[easytag/wip/application-window: 3/9] Move confirmation preferences page to GtkBuilder



commit 009b1aa09686da356f3b5a610819c59484830206
Author: David King <amigadave amigadave com>
Date:   Sat Aug 16 07:55:37 2014 +0100

    Move confirmation preferences page to GtkBuilder

 data/preferences_dialog.ui |  102 +++++++++++++++++++++++++++++++++++--------
 src/preferences_dialog.c   |   47 +++++++++-----------
 2 files changed, 105 insertions(+), 44 deletions(-)
---
diff --git a/data/preferences_dialog.ui b/data/preferences_dialog.ui
index 48940bd..f92b297 100644
--- a/data/preferences_dialog.ui
+++ b/data/preferences_dialog.ui
@@ -112,25 +112,6 @@
             </object>
         </child>
         <child>
-            <object class="GtkLabel" id="scanner_dialog_label">
-                <attributes>
-                    <attribute name="weight" value="bold"/>
-                </attributes>
-                <property name="halign">start</property>
-                <property name="label" translatable="yes">Scanner Dialog</property>
-                <property name="margin-top">12</property>
-                <property name="visible">True</property>
-            </object>
-        </child>
-        <child>
-            <object class="GtkCheckButton" id="scanner_dialog_startup_check">
-                <property name="label" translatable="yes">Show the scanner dialog on startup</property>
-                <property name="margin-left">12</property>
-                <property name="tooltip-text" translatable="yes">Whether to show the scanner window on 
application startup</property>
-                <property name="visible">True</property>
-            </object>
-        </child>
-        <child>
             <object class="GtkLabel" id="fields_label">
                 <attributes>
                     <attribute name="weight" value="bold"/>
@@ -177,4 +158,87 @@
             </object>
         </child>
     </object>
+    <object class="GtkGrid" id="application_grid">
+        <property name="border-width">12</property>
+        <property name="orientation">vertical</property>
+        <property name="row-spacing">6</property>
+        <property name="visible">True</property>
+        <child>
+            <object class="GtkLabel" id="confirmation_label">
+                <attributes>
+                    <attribute name="weight" value="bold"/>
+                </attributes>
+                <property name="halign">start</property>
+                <property name="label" translatable="yes">Confirmation</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkCheckButton" id="confirm_quit_check">
+                <property name="label" translatable="yes">Confirm before quitting the application</property>
+                <property name="margin-left">12</property>
+                <property name="tooltip-text" translatable="yes">Whether to ask for confirmation from the 
user before quitting the application</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkCheckButton" id="confirm_write_check">
+                <property name="label" translatable="yes">Confirm before writing tags</property>
+                <property name="margin-left">12</property>
+                <property name="tooltip-text" translatable="yes">Whether to ask for confirmation from the 
user before writing tags to audio files</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkCheckButton" id="confirm_rename_check">
+                <property name="label" translatable="yes">Confirm before renaming a file</property>
+                <property name="margin-left">12</property>
+                <property name="tooltip-text" translatable="yes">Whether to ask for confirmation from the 
user before renaming a file</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkCheckButton" id="confirm_delete_check">
+                <property name="label" translatable="yes">Confirm before deleting a file</property>
+                <property name="margin-left">12</property>
+                <property name="tooltip-text" translatable="yes">Whether to ask for confirmation from the 
user before deleting a file</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkCheckButton" id="confirm_write_playlist_check">
+                <property name="label" translatable="yes">Confirm before writing a playlist</property>
+                <property name="margin-left">12</property>
+                <property name="tooltip-text" translatable="yes">Whether to ask for confirmation from the 
user before writing a playlist</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkCheckButton" id="confirm_unsaved_files_check">
+                <property name="label" translatable="yes">Confirm before losing unsaved changes to 
files</property>
+                <property name="margin-left">12</property>
+                <property name="tooltip-text" translatable="yes">Whether to ask for confirmation from the 
user before performing an operation that would lose unsaved changes on files</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkLabel" id="scanner_dialog_label">
+                <attributes>
+                    <attribute name="weight" value="bold"/>
+                </attributes>
+                <property name="halign">start</property>
+                <property name="label" translatable="yes">Scanner Dialog</property>
+                <property name="margin-top">12</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+        <child>
+            <object class="GtkCheckButton" id="scanner_dialog_startup_check">
+                <property name="label" translatable="yes">Show the scanner dialog on startup</property>
+                <property name="margin-left">12</property>
+                <property name="tooltip-text" translatable="yes">Whether to show the scanner window on 
application startup</property>
+                <property name="visible">True</property>
+            </object>
+        </child>
+    </object>
 </interface>
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index 6305bce..09c6b3a 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -1226,12 +1226,6 @@ create_preferences_dialog (EtPreferencesDialog *self)
                      PFSDontUpperSomeWords, "active",
                      G_SETTINGS_BIND_DEFAULT);
 
-    /* Properties of the scanner window */
-    OpenScannerWindowOnStartup = GTK_WIDGET (gtk_builder_get_object (builder,
-                                                                     "scanner_dialog_startup_check"));
-    g_settings_bind (MainSettings, "scan-startup", OpenScannerWindowOnStartup,
-                     "active", G_SETTINGS_BIND_DEFAULT);
-
     /* Other options */
     OverwriteTagField = GTK_WIDGET (gtk_builder_get_object (builder,
                                                             "overwrite_fields_check"));
@@ -1256,8 +1250,6 @@ create_preferences_dialog (EtPreferencesDialog *self)
     g_settings_bind (MainSettings, "fill-crc32-comment", Crc32Comment,
                      "active", G_SETTINGS_BIND_DEFAULT);
 
-    g_object_unref (builder);
-
     /*
      * CDDB
      */
@@ -1474,43 +1466,48 @@ create_preferences_dialog (EtPreferencesDialog *self)
     /*
      * Confirmation
      */
-    Label = gtk_label_new (_("Confirmation"));
-    VBox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BOX_SPACING);
+    Label = gtk_label_new (_("Application"));
+    VBox = GTK_WIDGET (gtk_builder_get_object (builder, "application_grid"));
     gtk_notebook_append_page (GTK_NOTEBOOK(priv->options_notebook), VBox, Label);
-    gtk_container_set_border_width (GTK_CONTAINER (VBox), BOX_SPACING);
-
-    ConfirmBeforeExit = gtk_check_button_new_with_label (_("Confirm before quitting the application"));
-    gtk_box_pack_start(GTK_BOX(VBox),ConfirmBeforeExit,FALSE,FALSE,0);
+    ConfirmBeforeExit = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                            "confirm_quit_check"));
     g_settings_bind (MainSettings, "confirm-quit", ConfirmBeforeExit, "active",
                      G_SETTINGS_BIND_DEFAULT);
-    gtk_widget_set_tooltip_text (ConfirmBeforeExit,
-                                 _("Whether to ask for confirmation from the user before quitting the 
application"));
 
-    ConfirmWriteTag = gtk_check_button_new_with_label (_("Confirm before writing tags"));
-    gtk_box_pack_start(GTK_BOX(VBox),ConfirmWriteTag,FALSE,FALSE,0);
+    ConfirmWriteTag = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                          "confirm_write_check"));
     g_settings_bind (MainSettings, "confirm-write-tags", ConfirmWriteTag,
                      "active", G_SETTINGS_BIND_DEFAULT);
 
-    ConfirmRenameFile = gtk_check_button_new_with_label (_("Confirm before renaming a file"));
-    gtk_box_pack_start(GTK_BOX(VBox),ConfirmRenameFile,FALSE,FALSE,0);
+    ConfirmRenameFile = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                            "confirm_rename_check"));
     g_settings_bind (MainSettings, "confirm-rename-file", ConfirmRenameFile,
                      "active", G_SETTINGS_BIND_DEFAULT);
 
-    ConfirmDeleteFile = gtk_check_button_new_with_label (_("Confirm before deleting a file"));
+    ConfirmDeleteFile = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                            "confirm_delete_check"));
     g_settings_bind (MainSettings, "confirm-delete-file", ConfirmDeleteFile,
                      "active", G_SETTINGS_BIND_DEFAULT);
 
-    ConfirmWritePlayList = gtk_check_button_new_with_label (_("Confirm before writing a playlist"));
-    gtk_box_pack_start(GTK_BOX(VBox),ConfirmWritePlayList,FALSE,FALSE,0);
+    ConfirmWritePlayList = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                               "confirm_write_playlist_check"));
     g_settings_bind (MainSettings, "confirm-write-playlist",
                      ConfirmWritePlayList, "active", G_SETTINGS_BIND_DEFAULT);
 
-    ConfirmWhenUnsavedFiles = gtk_check_button_new_with_label (_("Confirm before losing unsaved changes to 
files"));
-    gtk_box_pack_start(GTK_BOX(VBox),ConfirmWhenUnsavedFiles,FALSE,FALSE,0);
+    ConfirmWhenUnsavedFiles = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                  "confirm_unsaved_files_check"));
     g_settings_bind (MainSettings, "confirm-when-unsaved-files",
                      ConfirmWhenUnsavedFiles, "active",
                      G_SETTINGS_BIND_DEFAULT);
 
+    /* Properties of the scanner window */
+    OpenScannerWindowOnStartup = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                                     "scanner_dialog_startup_check"));
+    g_settings_bind (MainSettings, "scan-startup", OpenScannerWindowOnStartup,
+                     "active", G_SETTINGS_BIND_DEFAULT);
+
+    g_object_unref (builder);
+
     /* Load the default page */
     g_settings_bind (MainSettings, "preferences-page", priv->options_notebook,
                      "page", G_SETTINGS_BIND_DEFAULT);


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