[gnac/devel] Code refactoring
- From: BenoÃt Dupasquier <bdupasqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnac/devel] Code refactoring
- Date: Wed, 7 Dec 2011 17:33:31 +0000 (UTC)
commit 59803b25b8c75f937f3f9c9e6ed6757ac4a2d772
Author: BenoÃt Dupasquier <bdupasqu src gnome org>
Date: Wed Dec 7 10:00:53 2011 +0000
Code refactoring
data/profiles/flac.xml.in | 8 +-
data/profiles/speex.xml.in | 18 +-
data/profiles/ui/gnac-profiles-flac.xml | 2 +-
data/profiles/ui/gnac-profiles-lame.xml | 4 +
data/profiles/ui/gnac-profiles-manager.xml | 1 +
data/profiles/ui/gnac-profiles-properties.xml | 3 +
data/profiles/ui/gnac-profiles-speex.xml | 6 +-
data/profiles/ui/gnac-profiles-vorbis.xml | 2 +-
data/profiles/ui/gnac-profiles-wavpack.xml | 3 +
src/profiles/formats/gnac-profiles-aac.c | 6 +-
src/profiles/formats/gnac-profiles-flac.c | 8 +-
src/profiles/formats/gnac-profiles-lame.c | 12 +-
src/profiles/formats/gnac-profiles-speex.c | 22 +--
src/profiles/formats/gnac-profiles-unknown.c | 6 +-
src/profiles/formats/gnac-profiles-vorbis.c | 11 +-
src/profiles/formats/gnac-profiles-wav.c | 2 +-
src/profiles/formats/gnac-profiles-wavpack.c | 10 +-
src/profiles/gnac-profiles-default.c | 49 ++---
src/profiles/gnac-profiles-default.h | 2 +-
src/profiles/gnac-profiles-manager.c | 300 +++++++++++--------------
src/profiles/gnac-profiles-properties.c | 54 ++---
src/profiles/gnac-profiles-utils.c | 144 +++---------
src/profiles/gnac-profiles-utils.h | 17 +--
src/profiles/gnac-profiles-xml-engine.c | 34 +++
src/profiles/gnac-profiles-xml-engine.h | 12 +
src/profiles/gnac-profiles.c | 12 +-
26 files changed, 308 insertions(+), 440 deletions(-)
---
diff --git a/data/profiles/flac.xml.in b/data/profiles/flac.xml.in
index 89ac996..e036cae 100755
--- a/data/profiles/flac.xml.in
+++ b/data/profiles/flac.xml.in
@@ -14,10 +14,10 @@
<variable id="compression" type="slider">
<name>Compression</name>
<variable-name>quality</variable-name>
- <min-value>0.0</min-value>
- <max-value>8.0</max-value>
- <step-value>1.0</step-value>
- <default-value>5.0</default-value>
+ <min-value>0</min-value>
+ <max-value>9</max-value>
+ <step-value>1</step-value>
+ <default-value>5</default-value>
</variable>
</pipeline>
</profile>
diff --git a/data/profiles/speex.xml.in b/data/profiles/speex.xml.in
index b582d91..a839a28 100644
--- a/data/profiles/speex.xml.in
+++ b/data/profiles/speex.xml.in
@@ -35,24 +35,24 @@
<variable-name>quality</variable-name>
<min-value>0.0</min-value>
<max-value>10.0</max-value>
- <step-value>0.05</step-value>
+ <step-value>0.1</step-value>
<default-value>8.0</default-value>
</variable>
<variable id="bitrate" type="slider">
<name>Bitrate</name>
<variable-name>bitrate</variable-name>
- <min-value>0.0</min-value>
- <max-value>64.0</max-value>
- <step-value>1.0</step-value>
- <default-value>0.0</default-value>
+ <min-value>0</min-value>
+ <max-value>64</max-value>
+ <step-value>1</step-value>
+ <default-value>0</default-value>
</variable>
<variable id="abr" type="slider">
<name>Bitrate</name>
<variable-name>abr</variable-name>
- <min-value>0.0</min-value>
- <max-value>64.0</max-value>
- <step-value>1.0</step-value>
- <default-value>44.0</default-value>
+ <min-value>0</min-value>
+ <max-value>64</max-value>
+ <step-value>1</step-value>
+ <default-value>44</default-value>
</variable>
<variable id="vbr" type="check">
<name>Bitrate mode</name>
diff --git a/data/profiles/ui/gnac-profiles-flac.xml b/data/profiles/ui/gnac-profiles-flac.xml
index 2a94b76..be43f74 100755
--- a/data/profiles/ui/gnac-profiles-flac.xml
+++ b/data/profiles/ui/gnac-profiles-flac.xml
@@ -72,7 +72,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment1</property>
- <property name="digits">2</property>
+ <property name="digits">0</property>
<signal name="value-changed" handler="gnac_profiles_flac_generate_pipeline"/>
</object>
<packing>
diff --git a/data/profiles/ui/gnac-profiles-lame.xml b/data/profiles/ui/gnac-profiles-lame.xml
index 02356c9..415739a 100755
--- a/data/profiles/ui/gnac-profiles-lame.xml
+++ b/data/profiles/ui/gnac-profiles-lame.xml
@@ -130,6 +130,7 @@
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment1</property>
+ <property name="digits">0</property>
<signal name="value-changed" handler="gnac_profiles_lame_generate_pipeline"/>
</object>
<packing>
@@ -354,6 +355,7 @@
<property name="can_focus">True</property>
<property name="adjustment">adjustment2</property>
<property name="inverted">True</property>
+ <property name="digits">0</property>
<signal name="value-changed" handler="gnac_profiles_lame_generate_pipeline"/>
</object>
<packing>
@@ -402,6 +404,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment1</property>
+ <property name="digits">0</property>
<signal name="value-changed" handler="gnac_profiles_lame_generate_pipeline"/>
</object>
<packing>
@@ -429,6 +432,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment3</property>
+ <property name="digits">0</property>
<signal name="value-changed" handler="gnac_profiles_lame_generate_pipeline"/>
</object>
<packing>
diff --git a/data/profiles/ui/gnac-profiles-manager.xml b/data/profiles/ui/gnac-profiles-manager.xml
index 42b8606..9d7019c 100644
--- a/data/profiles/ui/gnac-profiles-manager.xml
+++ b/data/profiles/ui/gnac-profiles-manager.xml
@@ -19,6 +19,7 @@
<property name="default_width">400</property>
<property name="default_height">400</property>
<property name="modal">True</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<signal name="key_press_event" handler="gnac_profiles_mgr_on_key_pressed"/>
<signal name="delete_event" handler="gnac_profiles_mgr_on_delete_event"/>
diff --git a/data/profiles/ui/gnac-profiles-properties.xml b/data/profiles/ui/gnac-profiles-properties.xml
index 20738a6..d5185b7 100755
--- a/data/profiles/ui/gnac-profiles-properties.xml
+++ b/data/profiles/ui/gnac-profiles-properties.xml
@@ -4,6 +4,9 @@
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="window1">
<property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<signal name="key_press_event" handler="gnac_profiles_properties_on_window_key_pressed"/>
<signal name="delete-event" handler="gtk_widget_hide"/>
<child>
diff --git a/data/profiles/ui/gnac-profiles-speex.xml b/data/profiles/ui/gnac-profiles-speex.xml
index 9f8e46e..45d9b0a 100644
--- a/data/profiles/ui/gnac-profiles-speex.xml
+++ b/data/profiles/ui/gnac-profiles-speex.xml
@@ -59,6 +59,7 @@
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment1</property>
+ <property name="digits">0</property>
<signal name="value-changed" handler="gnac_profiles_speex_generate_pipeline"/>
</object>
<packing>
@@ -295,7 +296,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment3</property>
- <property name="digits">2</property>
+ <property name="digits">1</property>
<signal name="value-changed" handler="gnac_profiles_speex_generate_pipeline"/>
</object>
<packing>
@@ -363,7 +364,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment4</property>
- <property name="digits">2</property>
+ <property name="digits">1</property>
<signal name="value-changed" handler="gnac_profiles_speex_generate_pipeline"/>
</object>
<packing>
@@ -413,6 +414,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment2</property>
+ <property name="digits">0</property>
<signal name="value-changed" handler="gnac_profiles_speex_generate_pipeline"/>
</object>
<packing>
diff --git a/data/profiles/ui/gnac-profiles-vorbis.xml b/data/profiles/ui/gnac-profiles-vorbis.xml
index 3228e38..364225c 100755
--- a/data/profiles/ui/gnac-profiles-vorbis.xml
+++ b/data/profiles/ui/gnac-profiles-vorbis.xml
@@ -235,7 +235,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment1</property>
- <property name="digits">2</property>
+ <property name="digits">1</property>
<signal name="value-changed" handler="gnac_profiles_vorbis_generate_pipeline"/>
</object>
<packing>
diff --git a/data/profiles/ui/gnac-profiles-wavpack.xml b/data/profiles/ui/gnac-profiles-wavpack.xml
index 64ac53f..8fd6fc9 100644
--- a/data/profiles/ui/gnac-profiles-wavpack.xml
+++ b/data/profiles/ui/gnac-profiles-wavpack.xml
@@ -42,6 +42,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment1</property>
+ <property name="digits">0</property>
<signal name="value-changed" handler="gnac_profiles_wavpack_generate_pipeline"/>
</object>
<packing>
@@ -136,6 +137,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment3</property>
+ <property name="digits">0</property>
<signal name="value-changed" handler="gnac_profiles_wavpack_generate_pipeline"/>
</object>
<packing>
@@ -234,6 +236,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment2</property>
+ <property name="digits">0</property>
<signal name="value-changed" handler="gnac_profiles_wavpack_generate_pipeline"/>
</object>
<packing>
diff --git a/src/profiles/formats/gnac-profiles-aac.c b/src/profiles/formats/gnac-profiles-aac.c
index acab91d..76d9791 100755
--- a/src/profiles/formats/gnac-profiles-aac.c
+++ b/src/profiles/formats/gnac-profiles-aac.c
@@ -183,12 +183,8 @@ gnac_profiles_aac_generate_audio_profile(GError **error)
static GtkWidget *
-gnac_profiles_aac_get_widget(AudioProfileAAC *profile)
+gnac_profiles_aac_get_widget(void)
{
- if (profile) {
- gnac_profiles_aac_fullfill_fields(profile);
- }
-
return gnac_profiles_default_get_properties_alignment(&aac_bfi);
}
diff --git a/src/profiles/formats/gnac-profiles-flac.c b/src/profiles/formats/gnac-profiles-flac.c
index 3e33b4e..b7fae1e 100755
--- a/src/profiles/formats/gnac-profiles-flac.c
+++ b/src/profiles/formats/gnac-profiles-flac.c
@@ -76,7 +76,7 @@ gnac_profiles_flac_generate_pipeline(void)
{
gchar *pipeline = gnac_profiles_default_generate_pipeline(&flac_bfi);
pipeline = gnac_profiles_utils_add_properties_slider(pipeline, &flac_bfi,
- "slider-compression", NULL);
+ "%.0f", "slider-compression", NULL);
update_text_buffer_call_back(pipeline);
g_free(flac_bfi.pipeline);
@@ -134,12 +134,8 @@ gnac_profiles_flac_generate_audio_profile(GError **error)
static GtkWidget *
-gnac_profiles_flac_get_widget(AudioProfileFlac *profile)
+gnac_profiles_flac_get_widget(void)
{
- if (profile) {
- gnac_profiles_flac_fullfill_fields(profile);
- }
-
return gnac_profiles_default_get_properties_alignment(&flac_bfi);
}
diff --git a/src/profiles/formats/gnac-profiles-lame.c b/src/profiles/formats/gnac-profiles-lame.c
index 1ed4afa..17abe44 100755
--- a/src/profiles/formats/gnac-profiles-lame.c
+++ b/src/profiles/formats/gnac-profiles-lame.c
@@ -278,7 +278,7 @@ gnac_profiles_lame_generate_pipeline(void)
pipeline = gnac_profiles_utils_add_properties_combo(pipeline, &lame_bfi,
"combo-encoding-mode", NULL);
pipeline = gnac_profiles_utils_add_properties_slider(pipeline, &lame_bfi,
- "slider-mean-abr", NULL);
+ "%.0f", "slider-mean-abr", NULL);
pipeline = gnac_profiles_utils_add_properties_checked_combo(pipeline,
&lame_bfi,
"combo-min-vbr", "checkbutton-min-bitrate",
@@ -290,7 +290,7 @@ gnac_profiles_lame_generate_pipeline(void)
pipeline = gnac_profiles_utils_add_properties_combo(pipeline, &lame_bfi,
"combo-encoding-mode", NULL);
pipeline = gnac_profiles_utils_add_properties_slider(pipeline, &lame_bfi,
- "slider-vbr-quality", NULL);
+ "%.0f", "slider-vbr-quality", NULL);
pipeline = gnac_profiles_utils_add_properties_checked_slider(pipeline,
&lame_bfi, "slider-mean-vbr", "checkbutton-mean-bitrate", NULL);
pipeline = gnac_profiles_utils_add_properties_checked_combo(pipeline,
@@ -307,7 +307,7 @@ gnac_profiles_lame_generate_pipeline(void)
case COMPRESSION_RATIO:
pipeline = gnac_profiles_utils_add_properties_slider(pipeline, &lame_bfi,
- "slider-compression-ratio", NULL);
+ "%.0f", "slider-compression-ratio", NULL);
break;
default:
@@ -499,12 +499,8 @@ gnac_profiles_lame_generate_audio_profile(GError **error)
static GtkWidget *
-gnac_profiles_lame_get_widget(AudioProfileLame *profile)
+gnac_profiles_lame_get_widget(void)
{
- if (profile) {
- gnac_profiles_lame_fullfill_fields(profile);
- }
-
return gnac_profiles_default_get_properties_alignment(&lame_bfi);
}
diff --git a/src/profiles/formats/gnac-profiles-speex.c b/src/profiles/formats/gnac-profiles-speex.c
index d6cd013..79ae3a6 100644
--- a/src/profiles/formats/gnac-profiles-speex.c
+++ b/src/profiles/formats/gnac-profiles-speex.c
@@ -96,24 +96,14 @@ gnac_profiles_speex_init(UpdateTextBufferFunc call_back)
gnac_profiles_default_init(&speex_bfi);
- // Bitrate
gnac_profiles_utils_init_widget(&speex_bfi, "slider-bitrate-cbr",
"//variable[ id='bitrate']");
-
- // Bitrate-abr
gnac_profiles_utils_init_widget(&speex_bfi, "slider-bitrate-abr",
"//variable[ id='abr']");
-
- // Quality-cbr
gnac_profiles_utils_init_widget(&speex_bfi, "slider-quality-cbr",
"//variable[ id='quality-cbr']");
-
- // Quality-vbr
- widget = gnac_profiles_utils_init_widget(&speex_bfi, "slider-quality-vbr",
+ gnac_profiles_utils_init_widget(&speex_bfi, "slider-quality-vbr",
"//variable[ id='quality-vbr']");
- gtk_scale_set_digits(GTK_SCALE(widget), 2);
-
- // vbr
gnac_profiles_utils_init_widget(&speex_bfi, "checkbutton-vbr",
"//variable[ id='vbr']");
@@ -253,7 +243,7 @@ gnac_profiles_speex_generate_pipeline(void)
{
case CONSTANT_BITRATE:
pipeline = gnac_profiles_utils_add_properties_slider(pipeline,
- &speex_bfi, "slider-quality-cbr", NULL);
+ &speex_bfi, "%.0f", "slider-quality-cbr", NULL);
widget = gnac_profiles_utils_get_widget(&speex_bfi,
"checkbutton-bitrate-cbr");
@@ -283,7 +273,7 @@ gnac_profiles_speex_generate_pipeline(void)
break;
case VARIABLE_BITRATE:
- pipeline = gnac_profiles_utils_add_properties_slider_format(pipeline,
+ pipeline = gnac_profiles_utils_add_properties_slider(pipeline,
&speex_bfi, "%.2f", "slider-quality-vbr", NULL);
pipeline = gnac_profiles_utils_add_properties_check(pipeline, &speex_bfi,
"checkbutton-vbr", NULL);
@@ -477,12 +467,8 @@ gnac_profiles_speex_generate_audio_profile(GError **error)
static GtkWidget *
-gnac_profiles_speex_get_widget(AudioProfileSpeex *profile)
+gnac_profiles_speex_get_widget(void)
{
- if (profile) {
- gnac_profiles_speex_fullfill_fields(profile);
- }
-
return gnac_profiles_default_get_properties_alignment(&speex_bfi);
}
diff --git a/src/profiles/formats/gnac-profiles-unknown.c b/src/profiles/formats/gnac-profiles-unknown.c
index 2412109..ffcaee6 100644
--- a/src/profiles/formats/gnac-profiles-unknown.c
+++ b/src/profiles/formats/gnac-profiles-unknown.c
@@ -151,14 +151,10 @@ gnac_profiles_unknown_generate_audio_profile(GError **error)
static GtkWidget *
-gnac_profiles_unknown_get_widget(AudioProfileGeneric *profile)
+gnac_profiles_unknown_get_widget(void)
{
gtk_text_view_set_editable(pipeline_text_view, TRUE);
- if (profile) {
- gnac_profiles_unknown_fullfill_fields(profile);
- }
-
if (!g_signal_handler_is_connected(G_OBJECT(pipeline_text_view),
text_view_handler_id))
{
diff --git a/src/profiles/formats/gnac-profiles-vorbis.c b/src/profiles/formats/gnac-profiles-vorbis.c
index 423e3c0..9e5dcba 100755
--- a/src/profiles/formats/gnac-profiles-vorbis.c
+++ b/src/profiles/formats/gnac-profiles-vorbis.c
@@ -128,9 +128,8 @@ gnac_profiles_vorbis_init(UpdateTextBufferFunc call_back)
"//variable[ id='bitrate']");
// Quality
- widget = gnac_profiles_utils_init_widget(&vorbis_bfi, "slider-quality",
+ gnac_profiles_utils_init_widget(&vorbis_bfi, "slider-quality",
"//variable[ id='quality']");
- gtk_scale_set_digits(GTK_SCALE(widget), 1);
// Min bitrate
gnac_profiles_utils_init_widget(&vorbis_bfi, "combo-min-vbr",
@@ -175,7 +174,7 @@ gnac_profiles_vorbis_generate_pipeline(void)
pipeline = gnac_profiles_utils_add_properties_combo(pipeline,
&vorbis_bfi, "combo-bitrate", NULL);
} else if (encoding_mode == VARIABLE_BITRATE) {
- pipeline = gnac_profiles_utils_add_properties_slider_format(pipeline,
+ pipeline = gnac_profiles_utils_add_properties_slider(pipeline,
&vorbis_bfi, "%.1f", "slider-quality", NULL);
pipeline = gnac_profiles_utils_add_properties_checked_combo(pipeline,
&vorbis_bfi,
@@ -301,12 +300,8 @@ gnac_profiles_vorbis_generate_audio_profile(GError **error)
static GtkWidget *
-gnac_profiles_vorbis_get_widget(AudioProfileVorbis *profile)
+gnac_profiles_vorbis_get_widget(void)
{
- if (profile) {
- gnac_profiles_vorbis_fullfill_fields(profile);
- }
-
return gnac_profiles_default_get_properties_alignment(&vorbis_bfi);
}
diff --git a/src/profiles/formats/gnac-profiles-wav.c b/src/profiles/formats/gnac-profiles-wav.c
index b77ceca..8b551e3 100755
--- a/src/profiles/formats/gnac-profiles-wav.c
+++ b/src/profiles/formats/gnac-profiles-wav.c
@@ -102,7 +102,7 @@ gnac_profiles_wav_generate_audio_profile(GError **error)
static GtkWidget *
-gnac_profiles_wav_get_widget(AudioProfileGeneric *profile)
+gnac_profiles_wav_get_widget(void)
{
return gnac_profiles_default_get_properties_alignment(&wav_bfi);
}
diff --git a/src/profiles/formats/gnac-profiles-wavpack.c b/src/profiles/formats/gnac-profiles-wavpack.c
index 4a546c4..ca6381d 100644
--- a/src/profiles/formats/gnac-profiles-wavpack.c
+++ b/src/profiles/formats/gnac-profiles-wavpack.c
@@ -195,7 +195,7 @@ gnac_profiles_wavpack_generate_pipeline(void)
pipeline = gnac_profiles_utils_add_properties_combo(pipeline, &wavpack_bfi,
"combo-mode", NULL);
pipeline = gnac_profiles_utils_add_properties_slider(pipeline, &wavpack_bfi,
- "slider-extra-processing", NULL);
+ "%.0f", "slider-extra-processing", NULL);
pipeline = gnac_profiles_utils_add_properties_checked_combo(pipeline,
&wavpack_bfi,
"combo-joint-stereo-mode", "checkbutton-joint-stereo-mode",
@@ -214,7 +214,7 @@ gnac_profiles_wavpack_generate_pipeline(void)
"%.0f", 1000, widget);
} else {
pipeline = gnac_profiles_utils_add_properties_slider(pipeline,
- &wavpack_bfi, "slider-bits-per-sample", NULL);
+ &wavpack_bfi, "%.0f", "slider-bits-per-sample", NULL);
}
}
@@ -380,12 +380,8 @@ gnac_profiles_wavpack_generate_audio_profile(GError **error)
static GtkWidget *
-gnac_profiles_wavpack_get_widget(AudioProfileWavpack *profile)
+gnac_profiles_wavpack_get_widget(void)
{
- if (profile) {
- gnac_profiles_wavpack_fullfill_fields(profile);
- }
-
return gnac_profiles_default_get_properties_alignment(&wavpack_bfi);
}
diff --git a/src/profiles/gnac-profiles-default.c b/src/profiles/gnac-profiles-default.c
index c50315d..d0ab7fc 100755
--- a/src/profiles/gnac-profiles-default.c
+++ b/src/profiles/gnac-profiles-default.c
@@ -31,13 +31,12 @@
#include "libgnac-debug.h"
-void
-gnac_profiles_default_init(BasicFormatInfo *bfi)
+static void
+gnac_profiles_default_init_ui(BasicFormatInfo *bfi)
{
GError *error = NULL;
bfi->builder = gnac_ui_utils_create_gtk_builder(bfi->gtkbuilder_xml_file);
-
if (!gtk_builder_add_from_file(bfi->builder,
PKGDATADIR "/profiles/gnac-profiles-base-advanced.xml", &error))
{
@@ -48,39 +47,36 @@ gnac_profiles_default_init(BasicFormatInfo *bfi)
GtkWidget *profile_advanced_base_widget = gnac_profiles_utils_get_widget(bfi,
"table-advanced-base");
-
GtkWidget *widget = gnac_profiles_utils_get_widget(bfi,
"properties-table-advanced");
gtk_table_attach_defaults(GTK_TABLE(widget),
profile_advanced_base_widget, 0, 2, 0, 1);
-
- // Init values
- bfi->doc = gnac_profiles_xml_engine_load_doc_xpath(bfi->data_xml_file);
+}
+
+
+void
+gnac_profiles_default_init(BasicFormatInfo *bfi)
+{
+ gnac_profiles_default_init_ui(bfi);
+
XMLDoc *base_values_doc = gnac_profiles_xml_engine_load_doc_xpath(
PKGDATADIR "/profiles/base.xml");
- // format id
+ bfi->doc = gnac_profiles_xml_engine_load_doc_xpath(bfi->data_xml_file);
bfi->format_id = gnac_profiles_xml_engine_get_format_id(bfi->doc);
-
- // name and extension
- gnac_profiles_utils_init_name_extension(bfi->doc, bfi->format_id,
- &(bfi->format_name), &(bfi->file_extension));
-
- // description text
- bfi->description = gnac_profiles_utils_init_description(bfi->doc,
+ bfi->format_name = gnac_profiles_xml_engine_query_name(bfi->doc,
+ bfi->format_id);
+ bfi->file_extension = gnac_profiles_xml_engine_query_extension(bfi->doc,
+ bfi->format_id);
+ bfi->description = gnac_profiles_xml_engine_query_description(bfi->doc,
bfi->format_id);
-
- // format plugin name
bfi->format_plugin_name = gnac_profiles_xml_engine_get_text_node(bfi->doc,
"//gst-plugin-name");
// Advanced
- // channels
gnac_profiles_utils_init_base_widget(bfi->builder, base_values_doc,
"combo-channels", "//variable[ id='channels']");
-
- // sample rate
gnac_profiles_utils_init_base_widget(bfi->builder, base_values_doc,
"combo-sample-rate", "//variable[ id='sample-rate']");
@@ -88,11 +84,8 @@ gnac_profiles_default_init(BasicFormatInfo *bfi)
// pipeline
- // encoder
bfi->pipeline_encoder = gnac_profiles_xml_engine_get_text_node(bfi->doc,
"//process[ id='gstreamer-audio']");
-
- // multiplexers
bfi->pipeline_multiplexers = g_strconcat("", NULL);
GList *multiplexers_list = gnac_profiles_xml_engine_get_list_values(bfi->doc,
"//process[ id='multiplexer']/value");
@@ -166,18 +159,14 @@ gnac_profiles_default_fullfill_fields(AudioProfileGeneric *profile,
AudioProfileGeneric *
gnac_profiles_default_generate_audio_profile(BasicFormatInfo *bfi)
{
- AudioProfileGeneric *profile;
-
- profile = gnac_profiles_utils_audio_profile_generic_new();
+ AudioProfileGeneric *profile = gnac_profiles_utils_audio_profile_generic_new();
profile->extension = g_strdup(bfi->file_extension);
profile->format_id = g_strdup(bfi->format_id);
profile->format_name = g_strdup(bfi->format_name);
profile->pipeline = g_strdup(bfi->pipeline);
-
profile->channels = gnac_profiles_utils_get_value_combo(
gnac_profiles_utils_get_widget(bfi, "combo-channels"));
-
profile->rate = gnac_profiles_utils_get_value_combo(
gnac_profiles_utils_get_widget(bfi, "combo-sample-rate"));
@@ -218,9 +207,7 @@ gnac_profiles_default_load_generic_audio_profile(
return NULL;
}
- AudioProfileGeneric *profile;
-
- profile = gnac_profiles_utils_audio_profile_generic_new();
+ AudioProfileGeneric *profile = gnac_profiles_utils_audio_profile_generic_new();
*generic = profile;
gnac_profiles_utils_load_saved_profile(doc, "/audio-profile/base/",
"format-id", &profile->format_id,
diff --git a/src/profiles/gnac-profiles-default.h b/src/profiles/gnac-profiles-default.h
index b366719..d190e13 100755
--- a/src/profiles/gnac-profiles-default.h
+++ b/src/profiles/gnac-profiles-default.h
@@ -36,7 +36,7 @@ typedef gpointer (*FormatModuleGenerateAudioProfileFunc) (GError**);
typedef void (*FormatModuleFreeAudioProfileFunc) (gpointer);
typedef void (*FormatModuleFullfillFieldsFunc) (gpointer);
typedef gchar *(*FormatModuleGetComboFormatNameFunc) (void);
-typedef GtkWidget *(*FormatModuleGetWidgetFunc) (gpointer);
+typedef GtkWidget *(*FormatModuleGetWidgetFunc) (void);
typedef void (*FormatModuleSaveInFileFunc) (gpointer);
typedef gpointer (*FormatModuleLoadSpecificPropertiesFunc) (XMLDoc *doc, AudioProfileGeneric *generic);
typedef const gchar *(*FormatModuleGetPluginName) (void);
diff --git a/src/profiles/gnac-profiles-manager.c b/src/profiles/gnac-profiles-manager.c
index 2cb44b8..696b2d5 100644
--- a/src/profiles/gnac-profiles-manager.c
+++ b/src/profiles/gnac-profiles-manager.c
@@ -50,9 +50,9 @@ enum {
};
enum {
- TARGET_URI,
- TARGET_PLAIN,
-} DRAG_AND_DROP_TARGETS;
+ DND_TARGET_URI,
+ DND_TARGET_PLAIN
+};
typedef struct {
gchar **uris;
@@ -69,8 +69,8 @@ typedef struct {
GtkBuilder *profiles_mgr_builder = NULL;
static GtkTargetEntry target_list[] = {
- { "text/uri-list", 0, TARGET_URI },
- { "text/plain" , 0, TARGET_PLAIN }
+ { "text/uri-list", 0, DND_TARGET_URI },
+ { "text/plain" , 0, DND_TARGET_PLAIN }
};
static guint n_targets = G_N_ELEMENTS(target_list);
@@ -192,22 +192,18 @@ gnac_profiles_mgr_show_import_progressbar(gboolean show)
void
gnac_profiles_mgr_init(void)
{
- GtkTreeSelection *selection;
- GtkCellRenderer *renderer;
- GtkTreeView *view;
- GtkTreeModel *model;
-
profiles_mgr_builder = gnac_ui_utils_create_gtk_builder(
PKGDATADIR "/profiles/gnac-profiles-manager.xml");
- view = GTK_TREE_VIEW(gnac_profiles_mgr_get_widget("profile_treeview"));
- model = gtk_tree_view_get_model(view);
- selection = gtk_tree_view_get_selection(view);
+ GtkTreeView *view = GTK_TREE_VIEW(
+ gnac_profiles_mgr_get_widget("profile_treeview"));
+ GtkTreeModel *model = gtk_tree_view_get_model(view);
+ GtkTreeSelection *selection = gtk_tree_view_get_selection(view);
g_signal_connect(G_OBJECT(selection), "changed",
G_CALLBACK(gnac_profiles_mgr_on_treeselection_changed), NULL);
- renderer = gtk_cell_renderer_text_new();
+ GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
g_object_set(G_OBJECT(renderer), "ypad", 5, NULL);
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1,
@@ -219,7 +215,7 @@ gnac_profiles_mgr_init(void)
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1,
_("Extension"), renderer, "text", COL_EXTENSION, NULL);
- gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), 0,
+ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), COL_NAME,
GTK_SORT_ASCENDING);
gtk_drag_dest_set(GTK_WIDGET(view), GTK_DEST_DEFAULT_ALL, target_list,
@@ -243,7 +239,6 @@ gnac_profiles_mgr_set_parent(GtkWindow *parent)
GtkWindow *window = GTK_WINDOW(
gnac_profiles_mgr_get_widget("profile_manager_window"));
gtk_window_set_transient_for(window, parent);
- gtk_window_set_position(window, GTK_WIN_POS_CENTER_ON_PARENT);
gnac_profiles_properties_set_parent(window);
}
@@ -251,16 +246,15 @@ gnac_profiles_mgr_set_parent(GtkWindow *parent)
static GFile *
gnac_profiles_mgr_get_profiles_dir(void)
{
- GFile *dir;
- GError *error = NULL;
-
saved_profiles_dir = g_build_filename(g_get_user_data_dir(),
- "gnac", "profiles", NULL);
- dir = g_file_new_for_path(saved_profiles_dir);
+ PACKAGE, "profiles", NULL);
+ GFile *dir = g_file_new_for_path(saved_profiles_dir);
if (g_file_query_exists(dir, NULL)) {
return dir;
}
+ GError *error = NULL;
+
if (!g_file_make_directory_with_parents(dir, NULL, &error)) {
libgnac_warning("%s: %s",
_("Unable to create the profiles directory"), error->message);
@@ -268,8 +262,6 @@ gnac_profiles_mgr_get_profiles_dir(void)
return NULL;
}
- gnac_profiles_mgr_import_default_profiles();
-
return dir;
}
@@ -278,7 +270,6 @@ void
gnac_profiles_mgr_list_profiles(void)
{
GFile *dir = gnac_profiles_mgr_get_profiles_dir();
- if (!dir) return;
GError *error = NULL;
GFileEnumerator *files = g_file_enumerate_children(dir,
@@ -286,7 +277,7 @@ gnac_profiles_mgr_list_profiles(void)
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE, NULL, &error);
- if (!files) {
+ if (!files && error) {
g_clear_error(&error);
/* no profiles found, try to import the default ones */
gnac_profiles_mgr_import_default_profiles();
@@ -294,7 +285,7 @@ gnac_profiles_mgr_list_profiles(void)
G_FILE_ATTRIBUTE_STANDARD_NAME ","
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE, NULL, &error);
- if (!files) {
+ if (!files && error) {
g_printerr(_("No profiles available"));
libgnac_warning("%s", error->message);
g_clear_error(&error);
@@ -393,14 +384,11 @@ gnac_profiles_mgr_populate(void)
}
}
- /* TODO if the profiles directory exists, but does not
- * contain any profile, import the default ones */
-
GFileEnumerator *files = g_file_enumerate_children(dir,
G_FILE_ATTRIBUTE_STANDARD_NAME ","
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE, NULL, &error);
- if (!files) {
+ if (!files && error) {
const gchar *msg = N_("Unable to browse the profiles directory");
libgnac_warning("%s: %s", msg, error->message);
gnac_profiles_mgr_display_status_message(NULL, msg);
@@ -408,9 +396,18 @@ gnac_profiles_mgr_populate(void)
return;
}
- GFileInfo *file_info;
- while ((file_info = g_file_enumerator_next_file(files, NULL, NULL)))
- {
+ GFileInfo *file_info = g_file_enumerator_next_file(files, NULL, NULL);
+ if (!file_info) {
+ gnac_profiles_mgr_import_default_profiles();
+ g_file_enumerator_close(files, NULL, NULL);
+ files = g_file_enumerate_children(dir,
+ G_FILE_ATTRIBUTE_STANDARD_NAME ","
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ G_FILE_QUERY_INFO_NONE, NULL, &error);
+ file_info = g_file_enumerator_next_file(files, NULL, NULL);
+ }
+
+ while (file_info) {
if (g_file_info_get_file_type(file_info) == G_FILE_TYPE_REGULAR) {
GFile *profile_file = g_file_enumerator_get_container(files);
gchar *profile_file_path = g_file_get_path(profile_file);
@@ -432,6 +429,7 @@ gnac_profiles_mgr_populate(void)
}
g_object_unref(G_OBJECT(file_info));
+ file_info = g_file_enumerator_next_file(files, NULL, NULL);
}
gnac_profiles_mgr_display_status_message(NULL, NULL);
@@ -513,14 +511,12 @@ gnac_profiles_mgr_import_default_profiles(void)
GList *
gnac_profiles_mgr_get_profiles_list(void)
{
- gboolean has_next;
- GList *list = NULL;
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- model = GTK_TREE_MODEL(gnac_profiles_mgr_get_object("liststore"));
- has_next = gtk_tree_model_get_iter_first(model, &iter);
+ GtkTreeIter iter;
+ GtkTreeModel *model = GTK_TREE_MODEL(
+ gnac_profiles_mgr_get_object("liststore"));
+ gboolean has_next = gtk_tree_model_get_iter_first(model, &iter);
+ GList *list = NULL;
while (has_next) {
AudioProfileGeneric *profile;
gtk_tree_model_get(model, &iter, COL_PROFILE, &profile, -1);
@@ -574,12 +570,10 @@ gnac_profiles_mgr_show(void)
static void
gnac_profiles_mgr_clear(void)
{
- gboolean has_next;
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- model = GTK_TREE_MODEL(gnac_profiles_mgr_get_object("liststore"));
- has_next = gtk_tree_model_get_iter_first(model, &iter);
+ GtkTreeIter iter;
+ GtkTreeModel *model = GTK_TREE_MODEL(
+ gnac_profiles_mgr_get_object("liststore"));
+ gboolean has_next = gtk_tree_model_get_iter_first(model, &iter);
while (has_next) {
AudioProfileGeneric *profile;
@@ -595,16 +589,13 @@ gnac_profiles_mgr_clear(void)
static void
gnac_profiles_mgr_insert(gpointer profile)
{
- GtkListStore *model;
- GtkTreeIter iter;
- AudioProfileGeneric *generic;
- gchar *formatted_name;
-
- generic = AUDIO_PROFILE_GET_GENERIC(profile);
- model = GTK_LIST_STORE(gnac_profiles_mgr_get_object("liststore"));
-
- formatted_name = gnac_profiles_properties_filter_text_for_displaying(
+ GtkListStore *model = GTK_LIST_STORE(
+ gnac_profiles_mgr_get_object("liststore"));
+ AudioProfileGeneric *generic = AUDIO_PROFILE_GET_GENERIC(profile);
+ gchar *formatted_name = gnac_profiles_properties_filter_text_for_displaying(
generic->name, MAX_NAME_DISPLAY_SIZE);
+ GtkTreeIter iter;
+
gtk_list_store_append(model, &iter);
gtk_list_store_set(model, &iter,
COL_NAME, formatted_name,
@@ -622,11 +613,9 @@ gnac_profiles_mgr_remove(GtkTreeRowReference *ref)
{
g_return_if_fail(ref);
- GtkTreeModel *model;
- GtkTreePath *path;
-
- model = GTK_TREE_MODEL(gnac_profiles_mgr_get_object("liststore"));
- path = gtk_tree_row_reference_get_path(ref);
+ GtkTreeModel *model = GTK_TREE_MODEL(
+ gnac_profiles_mgr_get_object("liststore"));
+ GtkTreePath *path = gtk_tree_row_reference_get_path(ref);
if (!path) return;
GtkTreeIter iter;
@@ -649,11 +638,9 @@ gnac_profiles_mgr_get(GtkTreeRowReference *ref,
{
g_return_if_fail(ref);
- GtkTreeModel *model;
- GtkTreePath *path;
-
- model = GTK_TREE_MODEL(gnac_profiles_mgr_get_object("liststore"));
- path = gtk_tree_row_reference_get_path(ref);
+ GtkTreeModel *model = GTK_TREE_MODEL(
+ gnac_profiles_mgr_get_object("liststore"));
+ GtkTreePath *path = gtk_tree_row_reference_get_path(ref);
if (!path) return;
GtkTreeIter iter;
@@ -671,11 +658,9 @@ gnac_profiles_mgr_set(GtkTreeRowReference *ref, ...)
{
g_return_if_fail(ref);
- GtkListStore *list_store;
- GtkTreePath *path;
-
- list_store = GTK_LIST_STORE(gnac_profiles_mgr_get_object("liststore"));
- path = gtk_tree_row_reference_get_path(ref);
+ GtkListStore *list_store = GTK_LIST_STORE(
+ gnac_profiles_mgr_get_object("liststore"));
+ GtkTreePath *path = gtk_tree_row_reference_get_path(ref);
if (!path) return;
GtkTreeIter iter;
@@ -693,21 +678,16 @@ gnac_profiles_mgr_set(GtkTreeRowReference *ref, ...)
static GList *
gnac_profiles_mgr_get_selected_rows(void)
{
- GtkTreeView *view;
- GtkTreeModel *model;
- GtkTreeSelection *selection;
-
- GList *row_references = NULL;
- GList *next;
- GList *next_temp;
-
- model = GTK_TREE_MODEL(gnac_profiles_mgr_get_object("liststore"));
- view = GTK_TREE_VIEW(gnac_profiles_mgr_get_widget("profile_treeview"));
- selection = gtk_tree_view_get_selection(view);
+ GtkTreeModel *model = GTK_TREE_MODEL(
+ gnac_profiles_mgr_get_object("liststore"));
+ GtkTreeView *view = GTK_TREE_VIEW(
+ gnac_profiles_mgr_get_widget("profile_treeview"));
+ GtkTreeSelection *selection = gtk_tree_view_get_selection(view);
/* Convert path to GtkTreeRowReference */
- next = gtk_tree_selection_get_selected_rows(selection, &model);
- next_temp = next;
+ GList *next = gtk_tree_selection_get_selected_rows(selection, &model);
+ GList *next_temp = next;
+ GList *row_references = NULL;
while (next) {
row_references = g_list_prepend(row_references,
@@ -763,45 +743,41 @@ gnac_profiles_mgr_display_status_message(const gchar *success_message,
gtk_widget_show_all(frame_status);
- GtkWidget *label_status_ok;
- GtkWidget *image_status_ok;
- GtkWidget *label_status_error;
- GtkWidget *image_status_error;
-
- label_status_ok = gnac_profiles_mgr_get_widget("label-status-ok");
- image_status_ok = gnac_profiles_mgr_get_widget("image-status-ok");
- label_status_error = gnac_profiles_mgr_get_widget("label-status-error");
- image_status_error = gnac_profiles_mgr_get_widget("image-status-error");
+ GtkWidget *label_ok = gnac_profiles_mgr_get_widget("label-status-ok");
+ GtkWidget *image_ok = gnac_profiles_mgr_get_widget("image-status-ok");
if (success_message) {
- gtk_label_set_markup(GTK_LABEL(label_status_ok), success_message);
- gtk_widget_show(label_status_ok);
- gtk_widget_show(image_status_ok);
+ gtk_label_set_markup(GTK_LABEL(label_ok), success_message);
+ gtk_widget_show(label_ok);
+ gtk_widget_show(image_ok);
} else {
- gtk_widget_hide(label_status_ok);
- gtk_widget_hide(image_status_ok);
+ gtk_widget_hide(label_ok);
+ gtk_widget_hide(image_ok);
}
+ GtkWidget *label_error = gnac_profiles_mgr_get_widget("label-status-error");
+ GtkWidget *image_error = gnac_profiles_mgr_get_widget("image-status-error");
+
if (error_message) {
- gtk_label_set_markup(GTK_LABEL(label_status_error), error_message);
- gtk_widget_show(label_status_error);
- gtk_widget_show(image_status_error);
+ gtk_label_set_markup(GTK_LABEL(label_error), error_message);
+ gtk_widget_show(label_error);
+ gtk_widget_show(image_error);
} else {
- gtk_widget_hide(label_status_error);
- gtk_widget_hide(image_status_error);
+ gtk_widget_hide(label_error);
+ gtk_widget_hide(image_error);
}
}
void
-gnac_profiles_mgr_on_drag_data_received(GtkWidget *widget,
+gnac_profiles_mgr_on_drag_data_received(GtkWidget *widget G_GNUC_UNUSED,
GdkDragContext *context,
- gint x,
- gint y,
+ gint x G_GNUC_UNUSED,
+ gint y G_GNUC_UNUSED,
GtkSelectionData *selection_data,
guint info,
guint time,
- gpointer data)
+ gpointer data G_GNUC_UNUSED)
{
gchar **uris = g_uri_list_extract_uris((const gchar*) selection_data->data);
if (!uris) {
@@ -844,17 +820,17 @@ gnac_profiles_mgr_get_file_name(GFile *file,
return NULL;
}
- gchar *name;
+ gchar *name = NULL;
switch (target_type)
{
- case TARGET_URI:
+ case DND_TARGET_URI:
if (g_file_info_get_file_type(file_info) == G_FILE_TYPE_REGULAR) {
name = g_strdup(g_file_info_get_name(file_info));
}
break;
- case TARGET_PLAIN:
+ case DND_TARGET_PLAIN:
if (g_file_info_get_file_type(file_info) == G_FILE_TYPE_UNKNOWN) {
name = g_file_get_basename(file);
}
@@ -899,24 +875,16 @@ static gboolean
gnac_profiles_mgr_copy_file(GFile *src_file,
const gchar *dest_name)
{
- gboolean success;
- gchar *path;
- GError *error = NULL;
- GFile *dest_file;
- CopyData copy_data;
-
- path = g_build_filename(g_get_tmp_dir(), dest_name, NULL);
- dest_file = g_file_new_for_path(path);
- copy_data.path = path;
- copy_data.name = dest_name;
- copy_data.error = &error;
- copy_data.toggle = FALSE;
+ GError *error = NULL;
+ gchar *path = g_build_filename(g_get_tmp_dir(), dest_name, NULL);
+ GFile *dest_file = g_file_new_for_path(path);
+ CopyData copy_data = { path, dest_name, &error, FALSE };
gdk_threads_enter();
gnac_profiles_mgr_set_progress_bar_fraction(0.0);
gdk_threads_leave();
- success = g_file_copy(src_file, dest_file, G_FILE_COPY_NONE, NULL,
+ gboolean success = g_file_copy(src_file, dest_file, G_FILE_COPY_NONE, NULL,
(GFileProgressCallback) gnac_profiles_mgr_on_drag_profile_copied,
©_data, &error);
if (error) {
@@ -934,21 +902,20 @@ gnac_profiles_mgr_copy_file(GFile *src_file,
static void
gnac_profiles_mgr_copy_and_load_files(gpointer data)
{
- gchar *uri;
- guint profiles_ok = 0;
- guint profiles_error = 0;
- gint index = 0;
-
ThreadCopyData *tcopy_data = (ThreadCopyData *) data;
gchar **uris = tcopy_data->uris;
- uri = uris[index];
+ gint index = 0;
+ gchar *uri = uris[index];
gdk_threads_enter();
gnac_profiles_mgr_set_window_sensitive(FALSE);
gnac_profiles_mgr_show_import_progressbar(TRUE);
gdk_threads_leave();
+ guint profiles_ok = 0;
+ guint profiles_error = 0;
+
while (uri) {
GFile *file = g_file_new_for_uri(uri);
gchar *name = gnac_profiles_mgr_get_file_name(file, tcopy_data->info);
@@ -1003,9 +970,9 @@ gnac_profiles_mgr_on_drag_profile_copied(goffset current_num_bytes,
if (!copy_data->toggle) {
copy_data->toggle = TRUE;
} else {
- AudioProfileGeneric *profile;
- profile = gnac_profiles_properties_load_profile_from_file(
- copy_data->path, copy_data->name, copy_data->error);
+ AudioProfileGeneric *profile =
+ gnac_profiles_properties_load_profile_from_file(
+ copy_data->path, copy_data->name, copy_data->error);
if (profile && !(*(copy_data->error))) {
gdk_threads_enter();
@@ -1024,12 +991,12 @@ gnac_profiles_mgr_on_drag_profile_copied(goffset current_num_bytes,
void
-gnac_profiles_mgr_on_drag_data_get(GtkWidget *widget,
- GdkDragContext *drag_context,
+gnac_profiles_mgr_on_drag_data_get(GtkWidget *widget G_GNUC_UNUSED,
+ GdkDragContext *drag_context G_GNUC_UNUSED,
GtkSelectionData *data,
- guint info,
- guint time,
- gpointer user_data)
+ guint info G_GNUC_UNUSED,
+ guint time G_GNUC_UNUSED,
+ gpointer user_data G_GNUC_UNUSED)
{
gchar **uris = gnac_profiles_mgr_get_selected_uris();
gtk_selection_data_set_uris(data, uris);
@@ -1069,8 +1036,8 @@ gnac_profiles_mgr_get_selected_uris(void)
void
-gnac_profiles_mgr_on_add(GtkWidget *widget,
- gpointer data)
+gnac_profiles_mgr_on_add(GtkWidget *widget G_GNUC_UNUSED,
+ gpointer data G_GNUC_UNUSED)
{
gnac_profiles_properties_show(NULL, _("New Profile"),
G_CALLBACK(gnac_profiles_mgr_on_new_profile));
@@ -1078,7 +1045,7 @@ gnac_profiles_mgr_on_add(GtkWidget *widget,
static void
-gnac_profiles_mgr_on_new_profile(GtkWidget *widget,
+gnac_profiles_mgr_on_new_profile(GtkWidget *widget G_GNUC_UNUSED,
gpointer data)
{
gnac_profiles_mgr_insert(data);
@@ -1087,8 +1054,8 @@ gnac_profiles_mgr_on_new_profile(GtkWidget *widget,
void
-gnac_profiles_mgr_on_copy(GtkWidget *widget,
- gpointer data)
+gnac_profiles_mgr_on_copy(GtkWidget *widget G_GNUC_UNUSED,
+ gpointer data G_GNUC_UNUSED)
{
GList *selected = gnac_profiles_mgr_get_selected_rows();
if (!selected) return;
@@ -1114,7 +1081,7 @@ gnac_profiles_mgr_on_copy(GtkWidget *widget,
g_file_copy(src, dst, G_FILE_COPY_NONE, NULL, NULL, NULL, &error);
if (error)
{
- libgnac_debug("Failed to copy the profile %s: %s",
+ libgnac_debug("Failed to copy the profile %s: %s",
generic->name, error->message);
gnac_profiles_mgr_display_status_message(
NULL, _("Failed to copy the profile"));
@@ -1129,9 +1096,9 @@ gnac_profiles_mgr_on_copy(GtkWidget *widget,
return;
}
- AudioProfileGeneric *copy_profile;
- copy_profile = gnac_profiles_properties_load_profile_from_file(
- new_path, new_name, &error);
+ AudioProfileGeneric *copy_profile =
+ gnac_profiles_properties_load_profile_from_file(
+ new_path, new_name, &error);
if (copy_profile)
{
(copy_profile->generic)->name = g_strconcat(generic->name,
@@ -1141,7 +1108,7 @@ gnac_profiles_mgr_on_copy(GtkWidget *widget,
}
else if (error)
{
- libgnac_debug("Failed to load the profile %s: %s",
+ libgnac_debug("Failed to copy the profile %s: %s",
(copy_profile->generic)->name, error->message);
gnac_profiles_mgr_display_status_message(
NULL, _("Failed to copy the profile"));
@@ -1157,8 +1124,8 @@ gnac_profiles_mgr_on_copy(GtkWidget *widget,
void
-gnac_profiles_mgr_on_edit(GtkWidget *widget,
- gpointer data)
+gnac_profiles_mgr_on_edit(GtkWidget *widget G_GNUC_UNUSED,
+ gpointer data G_GNUC_UNUSED)
{
GList *selected = gnac_profiles_mgr_get_selected_rows();
if (!selected) return;
@@ -1176,7 +1143,7 @@ gnac_profiles_mgr_on_edit(GtkWidget *widget,
static void
-gnac_profiles_mgr_on_edit_profile(GtkWidget *widget,
+gnac_profiles_mgr_on_edit_profile(GtkWidget *widget G_GNUC_UNUSED,
gpointer data)
{
GList *selected = gnac_profiles_mgr_get_selected_rows();
@@ -1215,8 +1182,8 @@ gnac_profiles_mgr_on_edit_profile(GtkWidget *widget,
void
-gnac_profiles_mgr_on_remove(GtkWidget *widget,
- gpointer data)
+gnac_profiles_mgr_on_remove(GtkWidget *widget G_GNUC_UNUSED,
+ gpointer data G_GNUC_UNUSED)
{
GList *selected = gnac_profiles_mgr_get_selected_rows();
if (!selected) return;
@@ -1239,11 +1206,9 @@ gnac_profiles_mgr_on_remove(GtkWidget *widget,
|| (gtk_tree_path_prev(path) &&
gtk_tree_model_get_iter(model, &iter, path)))
{
- GtkTreeView *view;
- GtkTreeSelection *selection;
-
- view = GTK_TREE_VIEW(gnac_profiles_mgr_get_widget("profile_treeview"));
- selection = gtk_tree_view_get_selection(view);
+ GtkTreeView *view = GTK_TREE_VIEW(
+ gnac_profiles_mgr_get_widget("profile_treeview"));
+ GtkTreeSelection *selection = gtk_tree_view_get_selection(view);
gtk_tree_selection_select_iter(selection, &iter);
new_selected = TRUE;
}
@@ -1299,8 +1264,8 @@ gnac_profiles_mgr_on_treeselection_changed(void)
void
-gnac_profiles_mgr_on_close(GtkWidget *widget,
- gpointer data)
+gnac_profiles_mgr_on_close(GtkWidget *widget G_GNUC_UNUSED,
+ gpointer data G_GNUC_UNUSED)
{
GtkWidget *window = gnac_profiles_mgr_get_widget("profile_manager_window");
gtk_widget_hide(window);
@@ -1309,19 +1274,19 @@ gnac_profiles_mgr_on_close(GtkWidget *widget,
gboolean
-gnac_profiles_mgr_on_delete_event(GtkWidget *widget,
- GdkEvent *event,
- gpointer user_data)
+gnac_profiles_mgr_on_delete_event(GtkWidget *widget G_GNUC_UNUSED,
+ GdkEvent *event G_GNUC_UNUSED,
+ gpointer user_data G_GNUC_UNUSED)
{
- gnac_profiles_mgr_on_close(widget, user_data);
+ gnac_profiles_mgr_on_close(NULL, NULL);
return TRUE;
}
gboolean
-gnac_profiles_mgr_list_on_key_pressed(GtkWidget *widget,
+gnac_profiles_mgr_list_on_key_pressed(GtkWidget *widget G_GNUC_UNUSED,
GdkEventKey *event,
- gpointer data)
+ gpointer data G_GNUC_UNUSED)
{
if (gnac_ui_utils_event_is_delete_key(event)) {
gnac_profiles_mgr_on_remove(NULL, NULL);
@@ -1333,13 +1298,12 @@ gnac_profiles_mgr_list_on_key_pressed(GtkWidget *widget,
gboolean
-gnac_profiles_mgr_on_key_pressed(GtkWidget *widget,
+gnac_profiles_mgr_on_key_pressed(GtkWidget *widget G_GNUC_UNUSED,
GdkEventKey *event,
- gpointer data)
+ gpointer data G_GNUC_UNUSED)
{
if (gnac_ui_utils_event_is_escape_key(event)) {
- widget = gnac_profiles_mgr_get_widget("close_button");
- gtk_button_clicked(GTK_BUTTON(widget));
+ gnac_profiles_mgr_on_close(NULL, NULL);
return TRUE;
}
diff --git a/src/profiles/gnac-profiles-properties.c b/src/profiles/gnac-profiles-properties.c
index 30e16dc..9f86ebe 100644
--- a/src/profiles/gnac-profiles-properties.c
+++ b/src/profiles/gnac-profiles-properties.c
@@ -52,7 +52,7 @@
enum {
COL_NAME,
COL_MODULE,
- COL_ORDER,
+ COL_SORT,
NUM_COLS
};
@@ -128,10 +128,6 @@ gnac_profiles_properties_get_widget(const gchar *widget_name)
void
gnac_profiles_properties_init(void)
{
- GtkWidget *combo_format;
- GtkWindow *window;
- GtkCellRenderer *renderer_format;
-
profiles_properties_builder = gnac_ui_utils_create_gtk_builder(
PKGDATADIR "/profiles/gnac-profiles-properties.xml");
formats = g_hash_table_new(g_str_hash, g_str_equal);
@@ -139,22 +135,17 @@ gnac_profiles_properties_init(void)
saved_profiles_dir = g_build_filename(g_get_user_data_dir(),
"gnac", "profiles", NULL);
- combo_format = gnac_profiles_properties_get_widget("format_combo_box");
+ GtkWidget *combo_format = gnac_profiles_properties_get_widget(
+ "format_combo_box");
- renderer_format = gtk_cell_renderer_text_new();
+ GtkCellRenderer *renderer_format = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo_format),
renderer_format, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo_format),
renderer_format, "text", 0, NULL);
- window = GTK_WINDOW(gnac_profiles_properties_get_widget("window1"));
- gtk_window_set_type_hint(window, GDK_WINDOW_TYPE_HINT_DIALOG);
-
gnac_profiles_properties_init_format();
-
gnac_profiles_properties_display_status_message(NULL);
-
- gtk_window_set_modal(window, TRUE);
}
@@ -163,21 +154,18 @@ gnac_profiles_properties_set_parent(GtkWindow *parent)
{
GtkWindow *window = GTK_WINDOW(gnac_profiles_properties_get_widget("window1"));
gtk_window_set_transient_for(window, parent);
- gtk_window_set_position(window, GTK_WIN_POS_CENTER_ON_PARENT);
}
static void
gnac_profiles_properties_init_format(void)
{
- GtkWidget *hbox_properties =
- gnac_profiles_properties_get_widget("hbox_properties");
GtkWidget *format_combo_box =
gnac_profiles_properties_get_widget("format_combo_box");
GtkListStore *model = GTK_LIST_STORE(gtk_combo_box_get_model(
GTK_COMBO_BOX(format_combo_box)));
- gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), COL_ORDER,
+ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), COL_SORT,
GTK_SORT_ASCENDING);
guint i;
@@ -193,21 +181,15 @@ gnac_profiles_properties_init_format(void)
g_hash_table_insert(formats, (gpointer) format_id, format_module);
gtk_list_store_append(model, &iter);
- if (!gnac_utils_str_equal(format_id, "custom-format")) {
- gtk_list_store_set(model, &iter,
- COL_NAME, format_name,
- COL_MODULE, format_module,
- COL_ORDER, format_name,
- -1);
- } else {
- // XXX This is a big hack to be sure that Custom Format
- // will be at the end :-D
- gtk_list_store_set(model, &iter,
- COL_NAME, format_name,
- COL_MODULE, format_module,
- COL_ORDER, "ZZZZZZZZZZZZZZZZZZZ",
- -1);
- }
+ // XXX This is a big hack to be sure that Custom Format will be at the end
+ const gchar *sort_key = gnac_utils_str_equal(format_id, "custom-format") ?
+ "ZZZZZZZZZZZZZZZZZZZ" : format_name;
+
+ gtk_list_store_set(model, &iter,
+ COL_NAME, format_name,
+ COL_MODULE, format_module,
+ COL_SORT, sort_key,
+ -1);
g_free(format_name);
@@ -226,7 +208,9 @@ gnac_profiles_properties_init_format(void)
pipeline_box);
}
- GtkWidget *properties = format_module->funcs.get_widget(NULL);
+ GtkWidget *hbox_properties = gnac_profiles_properties_get_widget(
+ "hbox_properties");
+ GtkWidget *properties = format_module->funcs.get_widget();
gtk_box_pack_start(GTK_BOX(hbox_properties), properties, TRUE, TRUE, 0);
gtk_widget_hide(properties);
}
@@ -346,7 +330,7 @@ gnac_profiles_properties_combo_format_on_changed(GtkComboBox *widget,
GtkWidget *properties;
if (current_format_module && format_module != current_format_module) {
- properties = current_format_module->funcs.get_widget(NULL);
+ properties = current_format_module->funcs.get_widget();
gtk_widget_hide(properties);
}
@@ -362,7 +346,7 @@ gnac_profiles_properties_combo_format_on_changed(GtkComboBox *widget,
GtkLabel *label = GTK_LABEL(
gnac_profiles_properties_get_widget("format_decription_label"));
gtk_label_set_markup(label, format_module->funcs.get_description());
- properties = format_module->funcs.get_widget(NULL);
+ properties = format_module->funcs.get_widget();
gtk_widget_show(properties);
format_module->funcs.generate_pipeline();
current_format_module = format_module;
diff --git a/src/profiles/gnac-profiles-utils.c b/src/profiles/gnac-profiles-utils.c
index 42cfd68..a8c337b 100755
--- a/src/profiles/gnac-profiles-utils.c
+++ b/src/profiles/gnac-profiles-utils.c
@@ -32,53 +32,6 @@ static gchar *raw = NULL;
static gchar *audioconvert = NULL;
-static void
-gnac_profiles_utils_init_name(XMLDoc *doc,
- const gchar *format,
- gchar **name)
-{
- gchar *query = g_strconcat("//profile[ id='", format, "']/name", NULL);
- *name = gnac_profiles_xml_engine_get_text_node(doc, query);
- g_free(query);
-}
-
-
-static void
-gnac_profiles_utils_init_extension(XMLDoc *doc,
- const gchar *format,
- gchar **extension)
-{
- gchar *query = g_strconcat("//profile[ id='", format,
- "']/output-file-extension", NULL);
- *extension = gnac_profiles_xml_engine_get_text_node(doc, query);
- g_free(query);
-}
-
-
-void
-gnac_profiles_utils_init_name_extension(XMLDoc *doc,
- const gchar *format,
- gchar **name,
- gchar **extension)
-{
- gnac_profiles_utils_init_name(doc, format, name);
- gnac_profiles_utils_init_extension(doc, format, extension);
-}
-
-
-gchar *
-gnac_profiles_utils_init_description(XMLDoc *doc,
- const gchar *format)
-{
- gchar *query = g_strconcat("//profile[ id='", format, "']/description", NULL);
- gchar *description = gnac_profiles_xml_engine_get_text_node(doc, query);
-
- g_free(query);
-
- return description;
-}
-
-
gchar *
gnac_profiles_utils_get_combo_format_name(const gchar *name,
const gchar *extension)
@@ -89,25 +42,21 @@ gnac_profiles_utils_get_combo_format_name(const gchar *name,
static void
gnac_profiles_utils_add_values_combo(GtkWidget *combo,
- ComboValues *values)
+ ComboValues *combo_values)
{
gint index = 0;
+ GList *names = combo_values->names;
+ GList *values = combo_values->values;
- GList *list_names = values->names;
- GList *list_values = values->values;
+ while (names) {
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), names->data);
- while (list_names) {
- gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo),
- (const gchar *) list_names->data);
-
- if (gnac_utils_str_equal(values->default_value,
- (const gchar *) list_values->data))
- {
+ if (gnac_utils_str_equal(combo_values->default_value, values->data)) {
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), index);
}
- list_names = list_names->next;
- list_values = list_values->next;
+ names = names->next;
+ values = values->next;
++index;
}
}
@@ -118,16 +67,16 @@ gnac_profiles_utils_register_combo(GtkWidget *widget,
XMLDoc *doc,
const gchar *xpath_query)
{
- ComboValues *combo = gnac_profiles_xml_engine_get_combo_values(doc,
+ ComboValues *values = gnac_profiles_xml_engine_get_combo_values(doc,
xpath_query);
- if (!combo) {
+ if (!values) {
libgnac_warning("Impossible to register combo with xpath query %s",
xpath_query);
return;
}
- gnac_profiles_utils_add_values_combo(widget, combo);
- g_object_set_data(G_OBJECT(widget), "combo-values", combo);
+ gnac_profiles_utils_add_values_combo(widget, values);
+ g_object_set_data(G_OBJECT(widget), "combo-values", values);
}
@@ -135,7 +84,6 @@ static void
gnac_profiles_utils_add_values_slider(GtkWidget *slider,
SliderValues *values)
{
- gtk_scale_set_digits(GTK_SCALE(slider), 0);
gtk_range_set_range(GTK_RANGE(slider), values->min, values->max);
gtk_range_set_value(GTK_RANGE(slider), values->default_value);
gtk_range_set_increments(GTK_RANGE(slider), values->step, values->step);
@@ -147,16 +95,16 @@ gnac_profiles_utils_register_slider(GtkWidget *widget,
XMLDoc *doc,
const gchar *xpath_query)
{
- SliderValues *slider = gnac_profiles_xml_engine_get_slider_values(doc,
+ SliderValues *values = gnac_profiles_xml_engine_get_slider_values(doc,
xpath_query);
- if (!slider) {
+ if (!values) {
libgnac_warning("Impossible to register slider with xpath query %s",
xpath_query);
return;
}
- gnac_profiles_utils_add_values_slider(widget, slider);
- g_object_set_data(G_OBJECT(widget), "slider-values", slider);
+ gnac_profiles_utils_add_values_slider(widget, values);
+ g_object_set_data(G_OBJECT(widget), "slider-values", values);
}
@@ -165,15 +113,15 @@ gnac_profiles_utils_register_check(GtkWidget *widget,
XMLDoc *doc,
const gchar *xpath_query)
{
- CheckValues *check = gnac_profiles_xml_engine_get_check_values(doc,
+ CheckValues *values = gnac_profiles_xml_engine_get_check_values(doc,
xpath_query);
- if (!check) {
+ if (!values) {
libgnac_warning("Impossible to register check with xpath query %s",
xpath_query);
return;
}
- g_object_set_data(G_OBJECT(widget), "check-values", check);
+ g_object_set_data(G_OBJECT(widget), "check-values", values);
}
@@ -239,18 +187,18 @@ void
gnac_profiles_utils_set_value_combo(GtkWidget *combo,
const gchar *value)
{
- ComboValues *values = g_object_get_data(G_OBJECT(combo), "combo-values");
- GList *list_values = values->values;
+ ComboValues *combo_values = g_object_get_data(G_OBJECT(combo), "combo-values");
+ GList *values = combo_values->values;
- if (!value) value = values->default_value;
+ if (!value) value = combo_values->default_value;
gint index = 0;
- while (list_values) {
- if (gnac_utils_str_equal(value, (const gchar *) list_values->data)) {
+ while (values) {
+ if (gnac_utils_str_equal(value, values->data)) {
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), index);
}
- list_values = list_values->next;
+ values = values->next;
++index;
}
}
@@ -314,7 +262,6 @@ gnac_profiles_utils_get_value_combo(GtkWidget *combo)
{
gint index = gtk_combo_box_get_active(GTK_COMBO_BOX(combo));
ComboValues *values = g_object_get_data(G_OBJECT(combo), "combo-values");
-
return g_strconcat(g_list_nth_data(values->values, index), NULL);
}
@@ -757,38 +704,13 @@ gnac_profiles_utils_add_property_slider(gchar *pipeline,
gchar *
gnac_profiles_utils_add_properties_slider(gchar *pipeline,
BasicFormatInfo *bfi,
+ const gchar *format,
...)
{
GtkWidget *widget;
va_list ap;
const gchar *name;
- va_start(ap, bfi);
- name = va_arg(ap, const gchar *);
-
- while (name) {
- widget = gnac_profiles_utils_get_widget(bfi, name);
- pipeline = gnac_profiles_utils_add_property_slider(pipeline, "%.0f", 1,
- widget);
- name = va_arg(ap, const gchar *);
- }
-
- va_end(ap);
-
- return pipeline;
-}
-
-
-gchar *
-gnac_profiles_utils_add_properties_slider_format(gchar *pipeline,
- BasicFormatInfo *bfi,
- const gchar *format,
- ...)
-{
- GtkWidget *widget;
- va_list ap;
- const gchar *name;
-
va_start(ap, format);
name = va_arg(ap, const gchar *);
@@ -838,11 +760,13 @@ gnac_profiles_utils_add_properties_checked_slider(gchar *pipeline,
static gchar *
-gnac_profiles_utils_add_property_check(gchar *pipeline,
- GtkWidget *check)
+gnac_profiles_utils_add_property_check(BasicFormatInfo *bfi,
+ const gchar *widget_name,
+ gchar *pipeline)
{
- gboolean checked = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check));
- CheckValues *values = g_object_get_data(G_OBJECT(check), "check-values");
+ GtkWidget *widget = gnac_profiles_utils_get_widget(bfi, widget_name);
+ gboolean checked = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ CheckValues *values = g_object_get_data(G_OBJECT(widget), "check-values");
if (!values) return pipeline;
gchar *temp = g_strconcat(pipeline, " ",
@@ -859,7 +783,6 @@ gnac_profiles_utils_add_properties_check(gchar *pipeline,
BasicFormatInfo *bfi,
...)
{
- GtkWidget *widget;
va_list ap;
const gchar *name;
@@ -867,8 +790,7 @@ gnac_profiles_utils_add_properties_check(gchar *pipeline,
name = va_arg(ap, const gchar *);
while (name) {
- widget = gnac_profiles_utils_get_widget(bfi, name);
- pipeline = gnac_profiles_utils_add_property_check(pipeline, widget);
+ pipeline = gnac_profiles_utils_add_property_check(bfi, name, pipeline);
name = va_arg(ap, const gchar *);
}
diff --git a/src/profiles/gnac-profiles-utils.h b/src/profiles/gnac-profiles-utils.h
index e5f01ba..7b14722 100755
--- a/src/profiles/gnac-profiles-utils.h
+++ b/src/profiles/gnac-profiles-utils.h
@@ -73,20 +73,10 @@ BasicFormatInfo;
typedef void (*UpdateTextBufferFunc) (const gchar*);
typedef void (*StandardCallBack) (GtkWidget *widget, gpointer data);
-void
-gnac_profiles_utils_init_name_extension(XMLDoc *doc,
- const gchar *format,
- gchar **name,
- gchar **extension);
-
gchar *
gnac_profiles_utils_get_combo_format_name(const gchar *name,
const gchar *extension);
-gchar *
-gnac_profiles_utils_init_description(XMLDoc *doc,
- const gchar *format);
-
GtkWidget *
gnac_profiles_utils_init_base_widget(GtkBuilder *builder,
XMLDoc *doc,
@@ -183,15 +173,10 @@ gnac_profiles_utils_add_property_slider(gchar *pipeline,
gchar *
gnac_profiles_utils_add_properties_slider(gchar *pipeline,
BasicFormatInfo *bfi,
+ const gchar *format,
...);
gchar *
-gnac_profiles_utils_add_properties_slider_format(gchar *pipeline,
- BasicFormatInfo *bfi,
- const gchar *format,
- ...);
-
-gchar *
gnac_profiles_utils_add_properties_checked_slider(gchar *pipeline,
BasicFormatInfo *bfi,
...);
diff --git a/src/profiles/gnac-profiles-xml-engine.c b/src/profiles/gnac-profiles-xml-engine.c
index 059e758..91171da 100755
--- a/src/profiles/gnac-profiles-xml-engine.c
+++ b/src/profiles/gnac-profiles-xml-engine.c
@@ -132,6 +132,40 @@ gnac_profiles_xml_engine_get_text_node(XMLDoc *doc,
}
+gchar *
+gnac_profiles_xml_engine_query_name(XMLDoc *doc,
+ const gchar *format)
+{
+ gchar *query = g_strconcat("//profile[ id='", format, "']/name", NULL);
+ gchar *name = gnac_profiles_xml_engine_get_text_node(doc, query);
+ g_free(query);
+ return name;
+}
+
+
+gchar *
+gnac_profiles_xml_engine_query_extension(XMLDoc *doc,
+ const gchar *format)
+{
+ gchar *query = g_strconcat("//profile[ id='", format,
+ "']/output-file-extension", NULL);
+ gchar *extension = gnac_profiles_xml_engine_get_text_node(doc, query);
+ g_free(query);
+ return extension;
+}
+
+
+gchar *
+gnac_profiles_xml_engine_query_description(XMLDoc *doc,
+ const gchar *format)
+{
+ gchar *query = g_strconcat("//profile[ id='", format, "']/description", NULL);
+ gchar *description = gnac_profiles_xml_engine_get_text_node(doc, query);
+ g_free(query);
+ return description;
+}
+
+
static gboolean
gnac_profiles_xml_engine_str_equal(const xmlChar *str1,
const gchar *str2)
diff --git a/src/profiles/gnac-profiles-xml-engine.h b/src/profiles/gnac-profiles-xml-engine.h
index 73340c8..f6bf138 100755
--- a/src/profiles/gnac-profiles-xml-engine.h
+++ b/src/profiles/gnac-profiles-xml-engine.h
@@ -91,6 +91,18 @@ gchar *
gnac_profiles_xml_engine_get_text_node(XMLDoc *doc,
const gchar *expr);
+gchar *
+gnac_profiles_xml_engine_query_name(XMLDoc *doc,
+ const gchar *format);
+
+gchar *
+gnac_profiles_xml_engine_query_description(XMLDoc *doc,
+ const gchar *format);
+
+gchar *
+gnac_profiles_xml_engine_query_extension(XMLDoc *doc,
+ const gchar *format);
+
GList *
gnac_profiles_xml_engine_get_list_values(XMLDoc *doc,
const gchar *expr);
diff --git a/src/profiles/gnac-profiles.c b/src/profiles/gnac-profiles.c
index a33d3e9..d6a7848 100755
--- a/src/profiles/gnac-profiles.c
+++ b/src/profiles/gnac-profiles.c
@@ -34,6 +34,12 @@
#include "gnac-utils.h"
+enum {
+ COL_NAME,
+ COL_PROFILE,
+ NUM_COLS
+};
+
static void
gnac_profiles_on_combo_profile_changed(GtkWidget *widget,
gpointer data);
@@ -90,7 +96,7 @@ gnac_profiles_get_display_name(void)
if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combo_profile), &iter)) {
gchar *name;
- gtk_tree_model_get(model, &iter, 0, &name, -1);
+ gtk_tree_model_get(model, &iter, COL_NAME, &name, -1);
return name;
}
@@ -106,7 +112,7 @@ gnac_profiles_get_active_profile(void)
if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combo_profile), &iter)) {
AudioProfileGeneric *profile;
- gtk_tree_model_get(model, &iter, 1, &profile, -1);
+ gtk_tree_model_get(model, &iter, COL_PROFILE, &profile, -1);
return profile->generic;
}
@@ -155,7 +161,7 @@ gnac_profiles_set_current_profile(const gchar *name)
while (has_next && !found) {
AudioProfileGeneric *profile;
- gtk_tree_model_get(model, &iter, 1, &profile, -1);
+ gtk_tree_model_get(model, &iter, COL_PROFILE, &profile, -1);
if (gnac_utils_str_equal(profile->name, name)) {
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo_profile), &iter);
found = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]