commit 6ac054883fc83813c4dca756d42230836151e13b Author: Maia Kozheva <si...@ubuntu.com> Date: Sat Aug 28 01:34:06 2010 +0700
Port exporter plugin to GtkBuilder (by using newly added option_*_gb functions) libgtkpod/misc.c | 110 +++++++++++++++++++++++ libgtkpod/misc.h | 18 ++++ plugins/exporter/exporter.glade | 189 ++++++++++++++++++--------------------- plugins/exporter/file_export.c | 50 ++++++----- 4 files changed, 242 insertions(+), 125 deletions(-) --- diff --git a/libgtkpod/misc.c b/libgtkpod/misc.c index 5e0b167..306b94a 100644 --- a/libgtkpod/misc.c +++ b/libgtkpod/misc.c @@ -599,6 +599,31 @@ void option_set_radio_button(GladeXML *win_xml, const gchar *prefs_string, const gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (w), TRUE); } +void option_set_radio_button_gb(GtkBuilder *win_xml, const gchar *prefs_string, const gchar **widgets, gint dflt) { + gint wnum, num = 0; + GtkWidget *w; + + g_return_if_fail (win_xml && prefs_string && widgets); + + /* number of available widgets */ + num = 0; + while (widgets[num]) + ++num; + + if (!prefs_get_int_value(prefs_string, &wnum)) + wnum = dflt; + + if ((wnum >= num) || (wnum < 0)) { + fprintf(stderr, "Programming error: wnum > num (%d,%d,%s)\n", wnum, num, prefs_string); + /* set to reasonable default value */ + prefs_set_int(prefs_string, 0); + wnum = 0; + } + w = GTK_WIDGET(gtk_builder_get_object(win_xml, widgets[wnum])); + if (w) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (w), TRUE); +} + /* Retrieve which toggle button was activated and store the state in * the prefs */ gint option_get_radio_button(GladeXML *win_xml, const gchar *prefs_string, const gchar **widgets) { @@ -622,6 +647,27 @@ gint option_get_radio_button(GladeXML *win_xml, const gchar *prefs_string, const return i; } +gint option_get_radio_button_gb(GtkBuilder *win_xml, const gchar *prefs_string, const gchar **widgets) { + gint i; + + g_return_val_if_fail (win_xml && prefs_string && widgets, 0); + + for (i = 0; widgets[i]; ++i) { + GtkWidget *w = GTK_WIDGET(gtk_builder_get_object(win_xml, widgets[i])); + if (w) { + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (w))) + break; + } + } + if (!widgets[i]) { + fprintf(stderr, "Programming error: no active toggle button (%s)", prefs_string); + /* set reasonable default */ + i = 0; + } + prefs_set_int(prefs_string, i); + return i; +} + /* Set the current folder to what is stored in the prefs */ void option_set_folder(GtkFileChooser *fc, const gchar *prefs_string) { gchar *folder; @@ -703,6 +749,25 @@ void option_set_string(GladeXML *win_xml, const gchar *name, const gchar *dflt) g_free(string); } +void option_set_string_gb(GtkBuilder *win_xml, const gchar *name, const gchar *dflt) { + gchar *string; + GtkWidget *entry; + + g_return_if_fail (win_xml && name && dflt); + + prefs_get_string_value(name, &string); + + if (!string) + string = g_strdup(dflt); + + entry = GTK_WIDGET(gtk_builder_get_object(win_xml, name)); + + if (entry) + gtk_entry_set_text(GTK_ENTRY(entry), string); + + g_free(string); +} + /* Retrieve the current content of the string entry @name and write it * to the prefs (@name) */ /* If @value is != NULL, a copy of the string is placed into @@ -722,6 +787,21 @@ void option_get_string(GladeXML *win_xml, const gchar *name, gchar **value) { } } +void option_get_string_gb(GtkBuilder *win_xml, const gchar *name, gchar **value) { + GtkWidget *entry; + + g_return_if_fail (win_xml && name); + + entry = GTK_WIDGET(gtk_builder_get_object(win_xml, name)); + + if (entry) { + const gchar *str = gtk_entry_get_text(GTK_ENTRY (entry)); + prefs_set_string(name, str); + if (value) + *value = g_strdup(str); + } +} + /* Set the state of toggle button @name to the prefs value stored in @name or to @default if @name is not yet defined. */ void option_set_toggle_button(GladeXML *win_xml, const gchar *name, gboolean dflt) { @@ -739,6 +819,21 @@ void option_set_toggle_button(GladeXML *win_xml, const gchar *name, gboolean dfl gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active); } +void option_set_toggle_button_gb(GtkBuilder *win_xml, const gchar *name, gboolean dflt) { + gboolean active; + GtkWidget *button; + + g_return_if_fail (win_xml && name); + + if (!prefs_get_int_value(name, &active)) + active = dflt; + + button = GTK_WIDGET(gtk_builder_get_object(win_xml, name)); + + if (button) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active); +} + /* Retrieve the current state of the toggle button @name and write it * to the prefs (@name) */ /* Return value: the current state */ @@ -757,6 +852,21 @@ gboolean option_get_toggle_button(GladeXML *win_xml, const gchar *name) { return active; } +gboolean option_get_toggle_button_gb(GtkBuilder *win_xml, const gchar *name) { + gboolean active = FALSE; + GtkWidget *button; + + g_return_val_if_fail (win_xml && name, active); + + button = GTK_WIDGET(gtk_builder_get_object(win_xml, name)); + + if (button) { + active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); + prefs_set_int(name, active); + } + return active; +} + /*------------------------------------------------------------------*\ * * * Functions to create string/filename from a template * diff --git a/libgtkpod/misc.h b/libgtkpod/misc.h index 1ef83e8..f3852a7 100644 --- a/libgtkpod/misc.h +++ b/libgtkpod/misc.h @@ -160,6 +160,13 @@ void option_set_radio_button (GladeXML *win_xml, gint option_get_radio_button (GladeXML *win_xml, const gchar *prefs_string, const gchar **widgets); +void option_set_radio_button_gb (GtkBuilder *win_xml, + const gchar *prefs_string, + const gchar **widgets, + gint dflt); +gint option_get_radio_button_gb (GtkBuilder *win_xml, + const gchar *prefs_string, + const gchar **widgets); void option_set_folder (GtkFileChooser *fc, const gchar *prefs_string); void option_get_folder (GtkFileChooser *fc, @@ -176,11 +183,22 @@ void option_set_string (GladeXML *win_xml, void option_get_string (GladeXML *win_xml, const gchar *name, gchar **value); +void option_set_string_gb (GtkBuilder *win_xml, + const gchar *name, + const gchar *dflt); +void option_get_string_gb (GtkBuilder *win_xml, + const gchar *name, + gchar **value); void option_set_toggle_button (GladeXML *win_xml, const gchar *name, gboolean dflt); gboolean option_get_toggle_button (GladeXML *win_xml, const gchar *name); +void option_set_toggle_button_gb (GtkBuilder *win_xml, + const gchar *name, + gboolean dflt); +gboolean option_get_toggle_button_gb (GtkBuilder *win_xml, + const gchar *name); gchar *get_string_from_template (Track *track, const gchar *template, diff --git a/plugins/exporter/exporter.glade b/plugins/exporter/exporter.glade index 899ed53..458616d 100644 --- a/plugins/exporter/exporter.glade +++ b/plugins/exporter/exporter.glade @@ -1,71 +1,69 @@ <?xml version="1.0"?> -<glade-interface> +<interface> <!-- interface-requires gtk+ 2.16 --> <!-- interface-naming-policy toplevel-contextual --> - <widget class="GtkWindow" id="export_playlist_file_options"> + <object class="GtkWindow" id="export_playlist_file_options"> <property name="title" translatable="yes">window1</property> <child> - <widget class="GtkFrame" id="ep_options_frame"> + <object class="GtkFrame" id="ep_options_frame"> <property name="visible">True</property> <property name="label_xalign">0</property> <property name="shadow_type">GTK_SHADOW_NONE</property> <child> - <widget class="GtkAlignment" id="alignment4"> + <object class="GtkAlignment" id="alignment4"> <property name="visible">True</property> <property name="border_width">5</property> <property name="left_padding">12</property> <child> - <widget class="GtkTable" id="table29"> + <object class="GtkTable" id="table29"> <property name="visible">True</property> <property name="n_rows">3</property> <property name="n_columns">2</property> <property name="column_spacing">12</property> <property name="row_spacing">6</property> <child> - <widget class="GtkEntry" id="export_playlist_file_template"> + <object class="GtkEntry" id="export_playlist_file_template"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="tooltip" translatable="yes">Determines how the string for the info field should be constructed, e.g '%a/%A/%T - %t.mp3' or '%o'. You can separate several templates by semicolons -- gtkpod will determine which one to use by the filename extension given. Artist: %a, album: %A, composer: %c, title: %t, genre: %G, track nr: %T, CD nr: %C, year: %Y, original filename (requires extended information file): %o, the character '%': %%.</property> + <property name="tooltip-text" translatable="yes">Determines how the string for the info field should be constructed, e.g '%a/%A/%T - %t.mp3' or '%o'. You can separate several templates by semicolons -- gtkpod will determine which one to use by the filename extension given. Artist: %a, album: %A, composer: %c, title: %t, genre: %G, track nr: %T, CD nr: %C, year: %Y, original filename (requires extended information file): %o, the character '%': %%.</property> <property name="invisible_char">*</property> - </widget> + </object> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">2</property> <property name="bottom_attach">3</property> - <property name="y_options"></property> + <property name="y_options"/> </packing> </child> <child> - <widget class="GtkHBox" id="hbox60"> + <object class="GtkHBox" id="hbox60"> <property name="visible">True</property> <property name="spacing">10</property> <child> - <widget class="GtkRadioButton" id="source_prefer_local"> + <object class="GtkRadioButton" id="source_prefer_local"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="tooltip" translatable="yes">If available, the local copy of the track is referenced in the playlist. Otherwise the file on the iPod is used.</property> + <property name="tooltip-text" translatable="yes">If available, the local copy of the track is referenced in the playlist. Otherwise the file on the iPod is used.</property> <property name="label" translatable="yes">_Prefer Local</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> - </widget> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> - <widget class="GtkRadioButton" id="source_local"> + <object class="GtkRadioButton" id="source_local"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="tooltip" translatable="yes">The local copy of the track is referenced in the playlist. If the track is not available locally, an error message is displayed.</property> + <property name="tooltip-text" translatable="yes">The local copy of the track is referenced in the playlist. If the track is not available locally, an error message is displayed.</property> <property name="label" translatable="yes">_Local</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <property name="group">source_prefer_local</property> - </widget> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> @@ -73,16 +71,15 @@ </packing> </child> <child> - <widget class="GtkRadioButton" id="source_ipod"> + <object class="GtkRadioButton" id="source_ipod"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="tooltip" translatable="yes">The track on the iPod is referenced in the playlist file.</property> + <property name="tooltip-text" translatable="yes">The track on the iPod is referenced in the playlist file.</property> <property name="label" translatable="yes">_iPod</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <property name="group">source_prefer_local</property> - </widget> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> @@ -92,44 +89,42 @@ <child> <placeholder/> </child> - </widget> + </object> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> - <property name="x_options"></property> - <property name="y_options"></property> + <property name="x_options"/> + <property name="y_options"/> </packing> </child> <child> - <widget class="GtkHBox" id="hbox59"> + <object class="GtkHBox" id="hbox59"> <property name="visible">True</property> <property name="spacing">10</property> <child> - <widget class="GtkRadioButton" id="type_m3u"> + <object class="GtkRadioButton" id="type_m3u"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="label" translatable="yes">_M3U</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> - </widget> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> - <widget class="GtkRadioButton" id="type_pls"> + <object class="GtkRadioButton" id="type_pls"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="label" translatable="yes">_PLS</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <property name="group">type_m3u</property> - </widget> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> @@ -139,158 +134,154 @@ <child> <placeholder/> </child> - </widget> + </object> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="x_options"></property> - <property name="y_options"></property> + <property name="x_options"/> + <property name="y_options"/> </packing> </child> <child> - <widget class="GtkHBox" id="hbox58"> + <object class="GtkHBox" id="hbox58"> <property name="visible">True</property> <child> - <widget class="GtkLabel" id="label167"> + <object class="GtkLabel" id="label167"> <property name="visible">True</property> <property name="xalign">0</property> <property name="label" translatable="yes">Playlist type:</property> - </widget> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> - </widget> + </object> <packing> - <property name="x_options"></property> - <property name="y_options"></property> + <property name="x_options"/> + <property name="y_options"/> </packing> </child> <child> - <widget class="GtkHBox" id="hbox65"> + <object class="GtkHBox" id="hbox65"> <property name="visible">True</property> <child> - <widget class="GtkLabel" id="label168"> + <object class="GtkLabel" id="label168"> <property name="visible">True</property> <property name="xalign">0</property> <property name="label" translatable="yes">Source:</property> - </widget> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> - </widget> + </object> <packing> <property name="top_attach">1</property> <property name="bottom_attach">2</property> - <property name="x_options"></property> - <property name="y_options"></property> + <property name="x_options"/> + <property name="y_options"/> </packing> </child> <child> - <widget class="GtkHBox" id="hbox66"> + <object class="GtkHBox" id="hbox66"> <property name="visible">True</property> <child> - <widget class="GtkLabel" id="label165"> + <object class="GtkLabel" id="label165"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="xalign">0</property> <property name="label" translatable="yes">Info field template:</property> <property name="selectable">True</property> - </widget> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> - </widget> + </object> <packing> <property name="top_attach">2</property> <property name="bottom_attach">3</property> - <property name="x_options"></property> - <property name="y_options"></property> + <property name="x_options"/> + <property name="y_options"/> </packing> </child> - </widget> + </object> </child> - </widget> + </object> </child> - <child> - <widget class="GtkLabel" id="label166"> + <child type="label"> + <object class="GtkLabel" id="label166"> <property name="visible">True</property> <property name="label" translatable="yes"><b>gtkpod Options</b></property> <property name="use_markup">True</property> - </widget> - <packing> - <property name="type">label_item</property> - </packing> + </object> </child> - </widget> + </object> </child> - </widget> - <widget class="GtkWindow" id="export_files_options"> + </object> + <object class="GtkWindow" id="export_files_options"> <property name="title" translatable="yes">window1</property> <child> - <widget class="GtkFrame" id="ef_options_frame"> + <object class="GtkFrame" id="ef_options_frame"> <property name="visible">True</property> <property name="label_xalign">0</property> <property name="shadow_type">GTK_SHADOW_NONE</property> <child> - <widget class="GtkAlignment" id="alignment43"> + <object class="GtkAlignment" id="alignment43"> <property name="visible">True</property> <property name="top_padding">6</property> <property name="left_padding">12</property> <child> - <widget class="GtkVBox" id="vbox50"> + <object class="GtkVBox" id="vbox50"> <property name="visible">True</property> <child> - <widget class="GtkHBox" id="hbox51"> + <object class="GtkHBox" id="hbox51"> <property name="visible">True</property> <property name="spacing">12</property> <child> - <widget class="GtkLabel" id="label70"> + <object class="GtkLabel" id="label70"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="xalign">0</property> <property name="label" translatable="yes">Filename format: </property> <property name="selectable">True</property> - </widget> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> - <widget class="GtkEntry" id="export_files_template"> + <object class="GtkEntry" id="export_files_template"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="tooltip" translatable="yes">Determines the filename of tracks you copy from the iPod, e.g '%a/%A/%T - %t.mp3' or '%o'. You can separate several patterns by semicolons -- gtkpod will determine which one to use by the filename extension given. Artist: %a, album: %A, composer: %c, title: %t, genre: %G, track nr: %T, CD nr: %C, year: %Y, original filename (requires extended information file): %o, current playlist: %p, the character '%': %%.</property> + <property name="tooltip-text" translatable="yes">Determines the filename of tracks you copy from the iPod, e.g '%a/%A/%T - %t.mp3' or '%o'. You can separate several patterns by semicolons -- gtkpod will determine which one to use by the filename extension given. Artist: %a, album: %A, composer: %c, title: %t, genre: %G, track nr: %T, CD nr: %C, year: %Y, original filename (requires extended information file): %o, current playlist: %p, the character '%': %%.</property> <property name="invisible_char">*</property> <property name="text" translatable="yes"> </property> - </widget> + </object> <packing> <property name="position">1</property> </packing> </child> - </widget> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> - <widget class="GtkCheckButton" id="export_files_special_charset"> + <object class="GtkCheckButton" id="export_files_special_charset"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="tooltip" translatable="yes">Normally the charset specified when first importing the track will be used for the filename. If you set this option you can set a different charset with the charset selector (Preferences/'Adding/Updating/Syncing'). Note: the charset info is stored in the extended information file (see Preferences/'Writing of the iTunesDB'). Tracks imported before V0.51 will have no charset stored. Instead the charset specified will be used.</property> + <property name="tooltip-text" translatable="yes">Normally the charset specified when first importing the track will be used for the filename. If you set this option you can set a different charset with the charset selector (Preferences/'Adding/Updating/Syncing'). Note: the charset info is stored in the extended information file (see Preferences/'Writing of the iTunesDB'). Tracks imported before V0.51 will have no charset stored. Instead the charset specified will be used.</property> <property name="label" translatable="yes">Use selected charset (Preferences/'Adding/Updating/ Syncing') for this filename.</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> - </widget> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> @@ -298,15 +289,14 @@ for this filename.</property> </packing> </child> <child> - <widget class="GtkCheckButton" id="export_files_check_existing"> + <object class="GtkCheckButton" id="export_files_check_existing"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="tooltip" translatable="yes">When copying from iPod no check is performed on whether the destination file exists. Enabling this option will make gtkpod check whether the length of the destination file is the same as the file in the iPod. If so the file is skipped, allowing a quick sync of the iPod's contents.</property> + <property name="tooltip-text" translatable="yes">When copying from iPod no check is performed on whether the destination file exists. Enabling this option will make gtkpod check whether the length of the destination file is the same as the file in the iPod. If so the file is skipped, allowing a quick sync of the iPod's contents.</property> <property name="label" translatable="yes">Check for existing files when copying from iPod.</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> - </widget> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> @@ -314,19 +304,19 @@ for this filename.</property> </packing> </child> <child> - <widget class="GtkVBox" id="ef_message_box"> + <object class="GtkVBox" id="ef_message_box"> <property name="visible">True</property> <child> <placeholder/> </child> <child> - <widget class="GtkLabel" id="ef_message"> + <object class="GtkLabel" id="ef_message"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="yalign">0</property> <property name="wrap">True</property> <property name="selectable">True</property> - </widget> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> @@ -334,47 +324,44 @@ for this filename.</property> </packing> </child> <child> - <widget class="GtkScrolledWindow" id="scrolledwindow13"> + <object class="GtkScrolledWindow" id="scrolledwindow13"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="shadow_type">GTK_SHADOW_IN</property> <child> - <widget class="GtkTextView" id="ef_textview"> + <object class="GtkTextView" id="ef_textview"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="wrap_mode">GTK_WRAP_WORD</property> - </widget> + </object> </child> - </widget> + </object> <packing> <property name="position">2</property> </packing> </child> - </widget> + </object> <packing> <property name="padding">2</property> <property name="position">3</property> </packing> </child> - </widget> + </object> </child> - </widget> + </object> </child> - <child> - <widget class="GtkLabel" id="label72"> + <child type="label"> + <object class="GtkLabel" id="label72"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="label" translatable="yes"><b>gtkpod Options</b></property> <property name="use_markup">True</property> <property name="selectable">True</property> - </widget> - <packing> - <property name="type">label_item</property> - </packing> + </object> </child> - </widget> + </object> </child> - </widget> -</glade-interface> + </object> +</interface> diff --git a/plugins/exporter/file_export.c b/plugins/exporter/file_export.c index 60a2a2b..6164cad 100644 --- a/plugins/exporter/file_export.c +++ b/plugins/exporter/file_export.c @@ -53,7 +53,7 @@ struct fcd { GList *tracks; /* tracks to be written */ GtkWidget *fc; /* file chooser */ GList **filenames; /* pointer to GList to append the filenames used */ - GladeXML *win_xml; /* Glade xml reference */ + GtkBuilder *win_xml; /* Glade xml reference */ Track *track; /* current track to export */ }; @@ -482,9 +482,9 @@ static void export_files_write(struct fcd *fcd) { static void export_files_store_option_settings(struct fcd *fcd) { g_return_if_fail (fcd && fcd->win_xml && fcd->fc); - option_get_toggle_button(fcd->win_xml, EXPORT_FILES_SPECIAL_CHARSET); - option_get_toggle_button(fcd->win_xml, EXPORT_FILES_CHECK_EXISTING); - option_get_string(fcd->win_xml, EXPORT_FILES_TPL, NULL); + option_get_toggle_button_gb(fcd->win_xml, EXPORT_FILES_SPECIAL_CHARSET); + option_get_toggle_button_gb(fcd->win_xml, EXPORT_FILES_CHECK_EXISTING); + option_get_string_gb(fcd->win_xml, EXPORT_FILES_TPL, NULL); option_get_filename(GTK_FILE_CHOOSER (fcd->fc), EXPORT_FILES_PATH, NULL); } @@ -504,7 +504,7 @@ void export_tracks_as_files(GList *tracks, GList **filenames, gboolean display, GtkWidget *win, *options, *message_box; struct fcd *fcd; GtkWidget *fc; - GladeXML *export_files_xml; + GtkBuilder *export_files_xml; iTunesDB *itdb = NULL; if (tracks) { @@ -532,10 +532,11 @@ void export_tracks_as_files(GList *tracks, GList **filenames, gboolean display, = gtk_file_chooser_dialog_new(_("Select Export Destination Directory"), NULL, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL); gchar *glade_path = g_build_filename(get_glade_dir(), "exporter.glade", NULL); - export_files_xml = glade_xml_new(glade_path, "export_files_options", NULL); - win = gtkpod_xml_get_widget(export_files_xml, "export_files_options"); - options = gtkpod_xml_get_widget(export_files_xml, "ef_options_frame"); - message_box = gtkpod_xml_get_widget(export_files_xml, "ef_message_box"); + export_files_xml = gtk_builder_new(); + gtk_builder_add_from_file(export_files_xml, glade_path, NULL); + win = GTK_WIDGET(gtk_builder_get_object(export_files_xml, "export_files_options")); + options = GTK_WIDGET(gtk_builder_get_object(export_files_xml, "ef_options_frame")); + message_box = GTK_WIDGET(gtk_builder_get_object(export_files_xml, "ef_message_box")); g_free(glade_path); /* Information needed to clean up later */ @@ -557,8 +558,8 @@ void export_tracks_as_files(GList *tracks, GList **filenames, gboolean display, /* set message text */ if (display) { GList *gl; - GtkWidget *label = gtkpod_xml_get_widget(export_files_xml, "ef_message"); - GtkWidget *tv = gtkpod_xml_get_widget(export_files_xml, "ef_textview"); + GtkWidget *label = GTK_WIDGET(gtk_builder_get_object(export_files_xml, "ef_message")); + GtkWidget *tv = GTK_WIDGET(gtk_builder_get_object(export_files_xml, "ef_textview")); GtkTextBuffer *tb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tv)); if (message) gtk_label_set_text(GTK_LABEL (label), message); @@ -592,12 +593,12 @@ void export_tracks_as_files(GList *tracks, GList **filenames, gboolean display, /* set last folder */ option_set_folder(GTK_FILE_CHOOSER (fc), EXPORT_FILES_PATH); /* set toggle button "charset" */ - option_set_toggle_button(export_files_xml, EXPORT_FILES_SPECIAL_CHARSET, FALSE); + option_set_toggle_button_gb(export_files_xml, EXPORT_FILES_SPECIAL_CHARSET, FALSE); /* set toggle button "check for existing files" */ - option_set_toggle_button(export_files_xml, EXPORT_FILES_CHECK_EXISTING, TRUE); + option_set_toggle_button_gb(export_files_xml, EXPORT_FILES_CHECK_EXISTING, TRUE); /* set last template */ - option_set_string(export_files_xml, EXPORT_FILES_TPL, EXPORT_FILES_TPL_DFLT); + option_set_string_gb(export_files_xml, EXPORT_FILES_TPL, EXPORT_FILES_TPL_DFLT); response = gtk_dialog_run(GTK_DIALOG (fc)); @@ -793,9 +794,9 @@ static void export_playlist_file_cleanup(struct fcd *fcd) { static void export_playlist_file_retrieve_options(struct fcd *fcd) { g_return_if_fail (fcd && fcd->fc); - option_get_radio_button(fcd->win_xml, EXPORT_PLAYLIST_FILE_TYPE, ExportPlaylistFileTypeW); - option_get_radio_button(fcd->win_xml, EXPORT_PLAYLIST_FILE_SOURCE, ExportPlaylistFileSourceW); - option_get_string(fcd->win_xml, EXPORT_PLAYLIST_FILE_TPL, NULL); + option_get_radio_button_gb(fcd->win_xml, EXPORT_PLAYLIST_FILE_TYPE, ExportPlaylistFileTypeW); + option_get_radio_button_gb(fcd->win_xml, EXPORT_PLAYLIST_FILE_SOURCE, ExportPlaylistFileSourceW); + option_get_string_gb(fcd->win_xml, EXPORT_PLAYLIST_FILE_TPL, NULL); option_get_folder(GTK_FILE_CHOOSER (fcd->fc), EXPORT_PLAYLIST_FILE_PATH, NULL); } @@ -931,14 +932,15 @@ void export_tracks_to_playlist_file(GList *tracks) { GtkWidget *fc = gtk_file_chooser_dialog_new(_("Create Playlist File"), NULL, GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_APPLY, RESPONSE_APPLY, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL); - GladeXML *export_playlist_xml; + GtkBuilder *export_playlist_xml; gchar *glade_path = g_build_filename(get_glade_dir(), "exporter.glade", NULL); - export_playlist_xml = glade_xml_new(glade_path, "export_playlist_file_options", NULL); - win = gtkpod_xml_get_widget(export_playlist_xml, "export_playlist_file_options"); + export_playlist_xml = gtk_builder_new(); + gtk_builder_add_from_file(export_playlist_xml, glade_path, NULL); + win = GTK_WIDGET(gtk_builder_get_object(export_playlist_xml, "export_playlist_file_options")); g_free(glade_path); - options = gtkpod_xml_get_widget(export_playlist_xml, "ep_options_frame"); + options = GTK_WIDGET(gtk_builder_get_object(export_playlist_xml, "ep_options_frame")); fcd->win_xml = export_playlist_xml; @@ -958,11 +960,11 @@ void export_tracks_to_playlist_file(GList *tracks) { /* set last folder */ option_set_folder(GTK_FILE_CHOOSER (fc), EXPORT_PLAYLIST_FILE_PATH); /* set last type */ - option_set_radio_button(export_playlist_xml, EXPORT_PLAYLIST_FILE_TYPE, ExportPlaylistFileTypeW, 0); + option_set_radio_button_gb(export_playlist_xml, EXPORT_PLAYLIST_FILE_TYPE, ExportPlaylistFileTypeW, 0); /* set last source */ - option_set_radio_button(export_playlist_xml, EXPORT_PLAYLIST_FILE_SOURCE, ExportPlaylistFileSourceW, 0); + option_set_radio_button_gb(export_playlist_xml, EXPORT_PLAYLIST_FILE_SOURCE, ExportPlaylistFileSourceW, 0); /* set last template */ - option_set_string(export_playlist_xml, EXPORT_PLAYLIST_FILE_TPL, EXPORT_PLAYLIST_FILE_TPL_DFLT); + option_set_string_gb(export_playlist_xml, EXPORT_PLAYLIST_FILE_TPL, EXPORT_PLAYLIST_FILE_TPL_DFLT); /* catch response codes */ g_signal_connect (fc, "response", ------------------------------------------------------------------------------ Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d _______________________________________________ gtkpod-cvs2 mailing list gtkpod-cvs2@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2