[easytag/wip/future-gtk: 27/31] Use GtkBuilder action-widgets for template dialogs



commit 7e93c5ce06148630c85eec9d2dce85943165b968
Author: David King <amigadave amigadave com>
Date:   Wed May 13 23:18:26 2015 +0700

    Use GtkBuilder action-widgets for template dialogs

 README                     |    2 +-
 configure.ac               |    4 ++--
 data/load_files_dialog.ui  |   22 ++++++++++++++++++++--
 data/playlist_dialog.ui    |   21 ++++++++++++++++++++-
 data/preferences_dialog.ui |   13 ++++++++++++-
 data/scan_dialog.ui        |   21 ++++++++++++++++++++-
 src/load_files_dialog.c    |    5 +----
 src/playlist_dialog.c      |    8 ++------
 src/preferences_dialog.c   |    3 ---
 src/scan_dialog.c          |   12 ------------
 10 files changed, 78 insertions(+), 33 deletions(-)
---
diff --git a/README b/README
index 4a2bcf0..4d29cfe 100644
--- a/README
+++ b/README
@@ -58,7 +58,7 @@ Installation
 ### Requirements
 
 * GLib version greater than 2.38.0 (http://www.gtk.org)
-* GTK+ version greater than 3.10.0 (http://www.gtk.org)
+* GTK+ version greater than 3.14.0 (http://www.gtk.org)
 * libid3tag (http://www.underbit.com/products/mad) (if not deactivated by './configure --disable-mp3')
 * id3lib version greater than 3.7.12 (http://id3lib.sourceforge.net) (Recommended: id3lib-3.8.3) (if not 
deactivated by './configure --disable-id3v23')
 * flac (http://flac.sourceforge.net) (if not deactivated by './configure --disable-flac')
diff --git a/configure.ac b/configure.ac
index 1dae65c..f925942 100644
--- a/configure.ac
+++ b/configure.ac
@@ -337,9 +337,9 @@ dnl Check the pkg-config dependencies
 GIO_DEPS="gio-2.0 >= 2.38.0"
 AC_SUBST([GLIB_DEPRECATION_FLAGS],
          ["-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_38 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_38"])
-GTK_DEPS="gtk+-3.0 >= 3.10.0"
+GTK_DEPS="gtk+-3.0 >= 3.14.0"
 AC_SUBST([GTK_DEPRECATION_FLAGS],
-         ["-DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_10 -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_10"])
+         ["-DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_14 -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_14"])
 PKG_CHECK_MODULES([EASYTAG], [$GIO_DEPS $GTK_DEPS $OPUS_DEPS $OGG_DEPS $SPEEX_DEPS $FLAC_DEPS $ID3TAG_DEPS 
$TAGLIB_DEPS $WAVPACK_DEPS])
 
 dnl Check for winsock
diff --git a/data/load_files_dialog.ui b/data/load_files_dialog.ui
index f10f1aa..0e0e44b 100644
--- a/data/load_files_dialog.ui
+++ b/data/load_files_dialog.ui
@@ -1,5 +1,5 @@
 <interface domain="easytag">
-    <requires lib="gtk+" version="3.10"/>
+    <requires lib="gtk+" version="3.14"/>
     <object class="GtkListStore" id="file_content_model">
         <columns>
             <column type="gchararray"/>
@@ -315,6 +315,24 @@
                 </child>
             </object>
         </child>
+        <child type="action">
+            <object class="GtkButton" id="close_button">
+                <property name="label" translatable="yes">_Close</property>
+                <property name="use-underline">True</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child type="action">
+            <object class="GtkButton" id="apply_button">
+                <property name="can-default">True</property>
+                <property name="label" translatable="yes">_Apply</property>
+                <property name="use-underline">True</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <action-widgets>
+            <action-widget response="-7">close_button</action-widget>
+            <action-widget response="-10">apply_button</action-widget>
+        </action-widgets>
     </template>
 </interface>
-
diff --git a/data/playlist_dialog.ui b/data/playlist_dialog.ui
index 8731ad6..4566391 100644
--- a/data/playlist_dialog.ui
+++ b/data/playlist_dialog.ui
@@ -1,5 +1,5 @@
 <interface domain="easytag">
-    <requires lib="gtk+" version="3.10"/>
+    <requires lib="gtk+" version="3.14"/>
     <template class="EtPlaylistDialog" parent="GtkDialog">
         <property name="destroy-with-parent">True</property>
         <property name="title" translatable="yes">Generate Playlist</property>
@@ -154,5 +154,24 @@
                 </child>
             </object>
         </child>
+        <child type="action">
+            <object class="GtkButton" id="close_button">
+                <property name="label" translatable="yes">_Close</property>
+                <property name="use-underline">True</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child type="action">
+            <object class="GtkButton" id="save_button">
+                <property name="can-default">True</property>
+                <property name="label" translatable="yes">_Save</property>
+                <property name="use-underline">True</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <action-widgets>
+            <action-widget response="-7">close_button</action-widget>
+            <action-widget response="-5">save_button</action-widget>
+        </action-widgets>
     </template>
 </interface>
diff --git a/data/preferences_dialog.ui b/data/preferences_dialog.ui
index 8f0b68a..10bc070 100644
--- a/data/preferences_dialog.ui
+++ b/data/preferences_dialog.ui
@@ -1,5 +1,5 @@
 <interface domain="easytag">
-    <requires lib="gtk+" version="3.10"/>
+    <requires lib="gtk+" version="3.14"/>
     <object class="GtkAdjustment" id="cddb_automatic_host1_adjustment">
         <property name="lower">0.0</property>
         <property name="step-increment">1.0</property>
@@ -1534,5 +1534,16 @@
                 </child>
             </object>
         </child>
+        <child type="action">
+            <object class="GtkButton" id="close_button">
+                <property name="can-default">True</property>
+                <property name="label" translatable="yes">_Close</property>
+                <property name="use-underline">True</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <action-widgets>
+            <action-widget response="-7">close_button</action-widget>
+        </action-widgets>
     </template>
 </interface>
diff --git a/data/scan_dialog.ui b/data/scan_dialog.ui
index 268092b..d609979 100644
--- a/data/scan_dialog.ui
+++ b/data/scan_dialog.ui
@@ -1,5 +1,5 @@
 <interface domain="easytag">
-    <requires lib="gtk+" version="3.10"/>
+    <requires lib="gtk+" version="3.14"/>
     <object class="GtkListStore" id="fill_masks_model">
         <columns>
             <column type="gchararray"/>
@@ -906,5 +906,24 @@ Use ‘/’ to make directories. If the first character is ‘/’, it is an abs
                 </child>
             </object>
         </child>
+        <child type="action">
+            <object class="GtkButton" id="close_button">
+                <property name="label" translatable="yes">_Close</property>
+                <property name="use-underline">True</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child type="action">
+            <object class="GtkButton" id="scan_button">
+                <property name="can-default">True</property>
+                <property name="label" translatable="yes">Scan Files</property>
+                <property name="tooltip-text" translatable="yes">Scan selected files</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <action-widgets>
+            <action-widget response="-7">close_button</action-widget>
+            <action-widget response="-10">scan_button</action-widget>
+        </action-widgets>
     </template>
 </interface>
diff --git a/src/load_files_dialog.c b/src/load_files_dialog.c
index 8686526..7d414c2 100644
--- a/src/load_files_dialog.c
+++ b/src/load_files_dialog.c
@@ -173,7 +173,7 @@ on_response (GtkDialog *dialog, gint response_id, gpointer user_data)
         case GTK_RESPONSE_APPLY:
             Load_Filename_Set_Filenames (ET_LOAD_FILES_DIALOG (dialog));
             break;
-        case GTK_RESPONSE_CANCEL:
+        case GTK_RESPONSE_CLOSE:
             gtk_widget_hide (GTK_WIDGET (dialog));
             break;
         case GTK_RESPONSE_DELETE_EVENT:
@@ -993,9 +993,6 @@ create_load_files_dialog (EtLoadFilesDialog *self)
 
     priv = et_load_files_dialog_get_instance_private (self);
 
-    gtk_dialog_add_buttons (GTK_DIALOG (self), _("_Close"),
-                            GTK_RESPONSE_CANCEL, _("_Apply"),
-                            GTK_RESPONSE_APPLY, NULL);
     gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_APPLY);
 
     /* Initial value. */
diff --git a/src/playlist_dialog.c b/src/playlist_dialog.c
index 95cc94e..1848b31 100644
--- a/src/playlist_dialog.c
+++ b/src/playlist_dialog.c
@@ -583,7 +583,7 @@ on_response (GtkDialog *dialog, gint response_id, gpointer user_data)
         case GTK_RESPONSE_OK:
             write_button_clicked (ET_PLAYLIST_DIALOG (dialog));
             break;
-        case GTK_RESPONSE_CANCEL:
+        case GTK_RESPONSE_CLOSE:
             gtk_widget_hide (GTK_WIDGET (dialog));
             break;
         case GTK_RESPONSE_DELETE_EVENT:
@@ -652,14 +652,10 @@ static void
 create_playlist_dialog (EtPlaylistDialog *self)
 {
     EtPlaylistDialogPrivate *priv;
-    GtkDialog *dialog;
 
     priv = et_playlist_dialog_get_instance_private (self);
-    dialog = GTK_DIALOG (self);
 
-    gtk_dialog_add_buttons (dialog, _("_Cancel"), GTK_RESPONSE_CANCEL,
-                            _("_Save"), GTK_RESPONSE_OK, NULL);
-    gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK);
+    gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
 
     /* Playlist name */
     g_settings_bind (MainSettings, "playlist-filename-mask",
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index 467f5af..df409d4 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -275,9 +275,6 @@ create_preferences_dialog (EtPreferencesDialog *self)
 
     priv = et_preferences_dialog_get_instance_private (self);
 
-    /* The window */
-    gtk_dialog_add_buttons (GTK_DIALOG (self), _("_Close"), GTK_RESPONSE_CLOSE,
-                            NULL);
     gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_CLOSE);
 
     /* Browser. */
diff --git a/src/scan_dialog.c b/src/scan_dialog.c
index 9ecfe7c..f48b592 100644
--- a/src/scan_dialog.c
+++ b/src/scan_dialog.c
@@ -2314,22 +2314,10 @@ static void
 create_scan_dialog (EtScanDialog *self)
 {
     EtScanDialogPrivate *priv;
-    GtkWidget *scan_button;
 
     priv = et_scan_dialog_get_instance_private (self);
 
-    /* The window */
-    gtk_dialog_add_buttons (GTK_DIALOG (self), _("_Close"),
-                            GTK_RESPONSE_CLOSE, NULL);
-
-    /* 'Scan selected files' button */
-    scan_button = gtk_button_new_with_label (_("Scan Files"));
-    gtk_widget_set_can_default (scan_button, TRUE);
-    gtk_dialog_add_action_widget (GTK_DIALOG (self), scan_button,
-                                  GTK_RESPONSE_APPLY);
     gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_APPLY);
-    gtk_widget_show (scan_button);
-    gtk_widget_set_tooltip_text (scan_button, _("Scan selected files"));
 
     g_settings_bind_with_mapping (MainSettings, "scan-mode", priv->notebook,
                                   "page", G_SETTINGS_BIND_DEFAULT,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]