[gthumb] sort dialog: optionally use the headerbar



commit f93f8d1cf00006c23783c2f5706fc2251d5d7580
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Fri Aug 12 10:25:20 2016 +0200

    sort dialog: optionally use the headerbar

 data/ui/sort-order.ui   |  119 +++++++++++++---------------------------------
 gthumb/dlg-sort-order.c |   19 ++++++-
 2 files changed, 50 insertions(+), 88 deletions(-)
---
diff --git a/data/ui/sort-order.ui b/data/ui/sort-order.ui
index 9f7e255..3889aa6 100644
--- a/data/ui/sort-order.ui
+++ b/data/ui/sort-order.ui
@@ -1,97 +1,46 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Tue Nov 19 18:51:59 2013 -->
+<!-- Generated with glade 3.20.0 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkDialog" id="sort_order_dialog">
+  <requires lib="gtk+" version="3.14"/>
+  <object class="GtkBox" id="dialog_content">
+    <property name="width_request">300</property>
+    <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">Sort By</property>
-    <property name="type_hint">normal</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox1">
+    <property name="border_width">15</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">12</property>
+    <child>
+      <object class="GtkBox" id="sort_order_box">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="border_width">0</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="close_button">
-                <property name="label">gtk-close</property>
-                <property name="use_action_appearance">False</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
         <child>
-          <object class="GtkBox" id="box1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="border_width">6</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">6</property>
-            <child>
-              <object class="GtkBox" id="sort_order_box">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="border_width">0</property>
-                <property name="orientation">vertical</property>
-                <child>
-                  <placeholder/>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="inverse_checkbutton">
-                <property name="label" translatable="yes">_Inverse order</property>
-                <property name="use_action_appearance">False</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_underline">True</property>
-                <property name="xalign">0</property>
-                <property name="draw_indicator">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
+          <placeholder/>
         </child>
       </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="inverse_checkbutton">
+        <property name="label" translatable="yes">_Inverse order</property>
+        <property name="use_action_appearance">False</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="use_underline">True</property>
+        <property name="xalign">0</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
     </child>
-    <action-widgets>
-      <action-widget response="0">close_button</action-widget>
-    </action-widgets>
   </object>
 </interface>
diff --git a/gthumb/dlg-sort-order.c b/gthumb/dlg-sort-order.c
index 6bce8e8..8a130ec 100644
--- a/gthumb/dlg-sort-order.c
+++ b/gthumb/dlg-sort-order.c
@@ -109,13 +109,26 @@ dlg_sort_order (GthBrowser *browser)
 
        /* Get the widgets. */
 
-       data->dialog = _gtk_builder_get_widget (data->builder, "sort_order_dialog");
+       data->dialog = g_object_new (GTK_TYPE_DIALOG,
+                                    "title", _("Sort By"),
+                                    "transient-for", GTK_WINDOW (browser),
+                                    "modal", FALSE,
+                                    "destroy-with-parent", FALSE,
+                                    "use-header-bar", _gtk_settings_get_dialogs_use_header (),
+                                    NULL);
+       gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (data->dialog))),
+                          _gtk_builder_get_widget (data->builder, "dialog_content"));
+       gtk_dialog_add_buttons (GTK_DIALOG (data->dialog),
+                               _GTK_LABEL_OK, GTK_RESPONSE_CLOSE,
+                               NULL);
+       gtk_style_context_add_class (gtk_widget_get_style_context (gtk_dialog_get_widget_for_response 
(GTK_DIALOG (data->dialog), GTK_RESPONSE_CLOSE)),
+                                    GTK_STYLE_CLASS_SUGGESTED_ACTION);
+
        gth_browser_set_dialog (browser, "sort-order", data->dialog);
        g_object_set_data (G_OBJECT (data->dialog), "dialog_data", data);
 
        /* Set widgets data. */
 
-
        file_data = gth_browser_get_location_data (data->browser);
        if (file_data != NULL) {
                data->current_sort_type = gth_main_get_sort_type (g_file_info_get_attribute_string 
(file_data->info, "sort::type"));
@@ -159,7 +172,7 @@ dlg_sort_order (GthBrowser *browser)
                          "destroy",
                          G_CALLBACK (destroy_cb),
                          data);
-       g_signal_connect_swapped (GET_WIDGET ("close_button"),
+       g_signal_connect_swapped (gtk_dialog_get_widget_for_response (GTK_DIALOG (data->dialog), 
GTK_RESPONSE_CLOSE),
                                  "clicked",
                                  G_CALLBACK (gtk_widget_destroy),
                                  G_OBJECT (data->dialog));


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