[gthumb] open location: otionally use the headerbar



commit ea5f41387e8cb23fa3158c629e78b70d261a1613
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Aug 13 10:14:42 2016 +0200

    open location: otionally use the headerbar

 data/ui/location.ui   |  113 +++++++++++++------------------------------------
 gthumb/dlg-location.c |   21 +++++++--
 2 files changed, 46 insertions(+), 88 deletions(-)
---
diff --git a/data/ui/location.ui b/data/ui/location.ui
index 335e0fd..a16d9d7 100644
--- a/data/ui/location.ui
+++ b/data/ui/location.ui
@@ -1,98 +1,42 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Fri Oct 18 21:34:45 2013 -->
+<!-- Generated with glade 3.20.0 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkDialog" id="location_dialog">
+  <requires lib="gtk+" version="3.14"/>
+  <object class="GtkBox" id="dialog_content">
+    <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">Open</property>
-    <property name="modal">True</property>
-    <property name="type_hint">dialog</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">2</property>
+    <child>
+      <object class="GtkBox" id="box1">
+        <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="border_width">5</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="spacing">6</property>
+        <child>
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="cancel_button">
-                <property name="label">gtk-cancel</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">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="ok_button">
-                <property name="label">gtk-open</property>
-                <property name="use_action_appearance">False</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
+            <property name="halign">start</property>
+            <property name="label" translatable="yes">_Location:</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">location_entry</property>
           </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">
+          <object class="GtkEntry" id="location_entry">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="border_width">5</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">6</property>
-            <child>
-              <object class="GtkLabel" id="label1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">_Location:</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">location_entry</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkEntry" id="location_entry">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="invisible_char">●</property>
-                <property name="activates_default">True</property>
-                <property name="width_chars">80</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
+            <property name="can_focus">True</property>
+            <property name="invisible_char">●</property>
+            <property name="activates_default">True</property>
+            <property name="width_chars">80</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -101,10 +45,11 @@
           </packing>
         </child>
       </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">cancel_button</action-widget>
-      <action-widget response="0">ok_button</action-widget>
-    </action-widgets>
   </object>
 </interface>
diff --git a/gthumb/dlg-location.c b/gthumb/dlg-location.c
index dad7e44..30ba1d4 100644
--- a/gthumb/dlg-location.c
+++ b/gthumb/dlg-location.c
@@ -403,7 +403,21 @@ dlg_location (GthBrowser *browser)
        data->ref_count = 1;
        data->browser = browser;
        data->builder = _gtk_builder_new_from_file ("location.ui", NULL);
-       data->dialog = GET_WIDGET ("location_dialog");
+
+       data->dialog = g_object_new (GTK_TYPE_DIALOG,
+                                    "title", _("Open"),
+                                    "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_CANCEL, GTK_RESPONSE_CANCEL,
+                               _("Open"), GTK_RESPONSE_OK,
+                               NULL);
+       _gtk_dialog_add_class_to_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK, 
GTK_STYLE_CLASS_SUGGESTED_ACTION);
 
        gth_browser_set_dialog (browser, "location", data->dialog);
 
@@ -437,11 +451,11 @@ dlg_location (GthBrowser *browser)
                          "destroy",
                          G_CALLBACK (destroy_cb),
                          data);
-       g_signal_connect (G_OBJECT (GET_WIDGET ("cancel_button")),
+       g_signal_connect (gtk_dialog_get_widget_for_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_CANCEL),
                          "clicked",
                          G_CALLBACK (cancel_button_clicked_cb),
                          data);
-       g_signal_connect (G_OBJECT (GET_WIDGET ("ok_button")),
+       g_signal_connect (gtk_dialog_get_widget_for_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK),
                          "clicked",
                          G_CALLBACK (ok_button_clicked_cb),
                          data);
@@ -453,6 +467,5 @@ dlg_location (GthBrowser *browser)
        /* run dialog. */
 
        update_completion_list (data);
-       gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (browser));
        gtk_widget_show (data->dialog);
 }


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