[gtk+/dialogs: 18/25] page setup: Use headerbar



commit c82144d4ec7a5e7326f686f9ce4b9e9719659939
Author: William Jon McCann <william jon mccann gmail com>
Date:   Sun Dec 8 15:54:17 2013 +0100

    page setup: Use headerbar
    
    Make the page setup dialog use a headerbar when desired.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720059

 gtk/gtkpagesetupunixdialog.c    |   22 +++++++++++++----
 gtk/gtkpagesetupunixdialog.ui   |   49 +-------------------------------------
 gtk/gtkpagesetupunixdialog.ui.h |    3 +-
 3 files changed, 20 insertions(+), 54 deletions(-)
---
diff --git a/gtk/gtkpagesetupunixdialog.c b/gtk/gtkpagesetupunixdialog.c
index 00f74b3..9133206 100644
--- a/gtk/gtkpagesetupunixdialog.c
+++ b/gtk/gtkpagesetupunixdialog.c
@@ -190,6 +190,18 @@ gtk_page_setup_unix_dialog_init (GtkPageSetupUnixDialog *dialog)
   priv->print_backends = NULL;
 
   gtk_widget_init_template (GTK_WIDGET (dialog));
+  gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+                          _("_Cancel"), GTK_RESPONSE_CANCEL,
+                          _("_Apply"), GTK_RESPONSE_OK,
+                          NULL);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
+                                           GTK_RESPONSE_OK,
+                                           GTK_RESPONSE_CANCEL,
+                                           -1);
+G_GNUC_END_IGNORE_DEPRECATIONS
 
   /* Do this in code, we want the translatable strings without the markup */
   gtk_list_store_append (priv->printer_list, &iter);
@@ -213,11 +225,6 @@ gtk_page_setup_unix_dialog_init (GtkPageSetupUnixDialog *dialog)
   /* Load data */
   _gtk_print_load_custom_papers (priv->custom_paper_list);
   load_print_backends (dialog);
-
-  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
-                                           GTK_RESPONSE_OK,
-                                           GTK_RESPONSE_CANCEL,
-                                           -1);
 }
 
 static void
@@ -890,11 +897,16 @@ gtk_page_setup_unix_dialog_new (const gchar *title,
                                 GtkWindow   *parent)
 {
   GtkWidget *result;
+  gboolean use_header;
 
   if (title == NULL)
     title = _("Page Setup");
 
+  g_object_get (gtk_settings_get_default (),
+                "gtk-dialogs-use-header", &use_header,
+                NULL);
   result = g_object_new (GTK_TYPE_PAGE_SETUP_UNIX_DIALOG,
+                         "use-header-bar", use_header,
                          "title", title,
                          NULL);
 
diff --git a/gtk/gtkpagesetupunixdialog.ui b/gtk/gtkpagesetupunixdialog.ui
index a6059f6..46fe97b 100644
--- a/gtk/gtkpagesetupunixdialog.ui
+++ b/gtk/gtkpagesetupunixdialog.ui
@@ -28,53 +28,12 @@
     <property name="border_width">5</property>
     <property name="resizable">False</property>
     <property name="type_hint">dialog</property>
+    <property name="title" translatable="yes">Page Setup</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <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_area1">
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="cancel_button">
-                <property name="label" translatable="yes">_Cancel</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_underline">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="apply_button">
-                <property name="label" translatable="yes">_Apply</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_underline">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="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
         <child>
           <object class="GtkGrid" id="grid1">
             <property name="visible">True</property>
@@ -400,14 +359,10 @@
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">1</property>
+            <property name="position">0</property>
           </packing>
         </child>
       </object>
     </child>
-    <action-widgets>
-      <action-widget response="-6">cancel_button</action-widget>
-      <action-widget response="-5">apply_button</action-widget>
-    </action-widgets>
   </template>
 </interface>
diff --git a/gtk/gtkpagesetupunixdialog.ui.h b/gtk/gtkpagesetupunixdialog.ui.h
index ab92261..8ee6315 100644
--- a/gtk/gtkpagesetupunixdialog.ui.h
+++ b/gtk/gtkpagesetupunixdialog.ui.h
@@ -1,5 +1,4 @@
-N_("_Cancel");
-N_("_Apply");
+N_("Page Setup");
 N_("_Format for:");
 N_("_Paper size:");
 N_("_Orientation:");


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