[file-roller] use the header-bar for options dialog



commit f96080c59ac2da792c4743f353540e75b95f6a1b
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Feb 15 16:27:00 2015 +0100

    use the header-bar for options dialog

 src/dlg-add.c         |   26 +++++++-
 src/ui/add-options.ui |  148 +++++++-----------------------------------------
 2 files changed, 44 insertions(+), 130 deletions(-)
---
diff --git a/src/dlg-add.c b/src/dlg-add.c
index 77213a3..9eeada4 100644
--- a/src/dlg-add.c
+++ b/src/dlg-add.c
@@ -734,6 +734,9 @@ aod_remove_cb (GtkWidget             *widget,
 }
 
 
+#define RESPONSE_DELETE_OPTIONS 10
+
+
 static void
 load_options_activate_cb (GtkMenuItem *menu_item,
                          DialogData  *data)
@@ -756,12 +759,27 @@ load_options_activate_cb (GtkMenuItem *menu_item,
 
        /* Get the widgets. */
 
-       aod_data->dialog = _gtk_builder_get_widget (aod_data->builder, "add_options_dialog");
+       aod_data->dialog = g_object_new (GTK_TYPE_DIALOG,
+                                        "title", _("Load Options"),
+                                        "modal", TRUE,
+                                        "use-header-bar", _gtk_settings_get_dialogs_use_header (),
+                                        NULL);
+       gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (aod_data->dialog))),
+                          _gtk_builder_get_widget (aod_data->builder, "add_options_dialog"));
+
+       gtk_dialog_add_buttons (GTK_DIALOG (aod_data->dialog),
+                               _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
+                               _("_Apply"), GTK_RESPONSE_OK,
+                               _("_Delete"), RESPONSE_DELETE_OPTIONS,
+                               NULL);
+
        aod_data->aod_treeview = _gtk_builder_get_widget (aod_data->builder, "aod_treeview");
 
-       ok_button = _gtk_builder_get_widget (aod_data->builder, "aod_okbutton");
-       cancel_button = _gtk_builder_get_widget (aod_data->builder, "aod_cancelbutton");
-       remove_button = _gtk_builder_get_widget (aod_data->builder, "aod_remove_button");
+       ok_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (aod_data->dialog), GTK_RESPONSE_OK);
+       gtk_style_context_add_class (gtk_widget_get_style_context (ok_button), 
GTK_STYLE_CLASS_SUGGESTED_ACTION);
+       cancel_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (aod_data->dialog), 
GTK_RESPONSE_CANCEL);
+       remove_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (aod_data->dialog), 
RESPONSE_DELETE_OPTIONS);
+       gtk_style_context_add_class (gtk_widget_get_style_context (remove_button), 
GTK_STYLE_CLASS_DESTRUCTIVE_ACTION);
 
        /* Set the signals handlers. */
 
diff --git a/src/ui/add-options.ui b/src/ui/add-options.ui
index 9dee200..5891fb9 100644
--- a/src/ui/add-options.ui
+++ b/src/ui/add-options.ui
@@ -1,139 +1,35 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkDialog" id="add_options_dialog">
+  <requires lib="gtk+" version="3.12"/>
+  <object class="GtkBox" id="add_options_dialog">
+    <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">Load Options</property>
-    <property name="window_position">center-on-parent</property>
-    <property name="type_hint">dialog</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox19">
+    <property name="border_width">10</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkScrolledWindow" id="scrolledwindow11">
+        <property name="width_request">350</property>
+        <property name="height_request">150</property>
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area19">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="aod_cancelbutton">
-                <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="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_action_appearance">False</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>
-            <child>
-              <object class="GtkButton" id="aod_okbutton">
-                <property name="label">gtk-apply</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="receives_default">False</property>
-                <property name="use_action_appearance">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</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>
+        <property name="can_focus">True</property>
+        <property name="shadow_type">in</property>
         <child>
-          <object class="GtkTable" id="table4">
+          <object class="GtkTreeView" id="aod_treeview">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="border_width">5</property>
-            <property name="n_columns">2</property>
-            <property name="column_spacing">6</property>
-            <property name="row_spacing">6</property>
-            <child>
-              <object class="GtkVBox" id="vbox18">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkButton" id="aod_remove_button">
-                    <property name="label">gtk-remove</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_action_appearance">False</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>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options">GTK_FILL</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkScrolledWindow" id="scrolledwindow11">
-                <property name="width_request">280</property>
-                <property name="height_request">150</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="shadow_type">in</property>
-                <child>
-                  <object class="GtkTreeView" id="aod_treeview">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="headers_visible">False</property>
-                    <child internal-child="selection">
-                      <object class="GtkTreeSelection" id="treeview-selection1"/>
-                    </child>
-                  </object>
-                </child>
-              </object>
+            <property name="can_focus">True</property>
+            <property name="headers_visible">False</property>
+            <child internal-child="selection">
+              <object class="GtkTreeSelection" id="treeview-selection"/>
             </child>
           </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">0</property>
+      </packing>
     </child>
-    <action-widgets>
-      <action-widget response="-7">aod_cancelbutton</action-widget>
-      <action-widget response="-10">aod_okbutton</action-widget>
-    </action-widgets>
   </object>
 </interface>


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