[gtk+] message dialog: Allow action area to extend to the edge



commit c42b39a9db500c4093c9d3a29f04d90adc128b66
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 17 12:36:53 2014 -0500

    message dialog: Allow action area to extend to the edge
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720059

 gtk/gtkmessagedialog.c  |   40 +++++++++++++++-------------------------
 gtk/gtkmessagedialog.ui |   36 ++++++++++++++----------------------
 2 files changed, 29 insertions(+), 47 deletions(-)
---
diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c
index 8bfa89b..3eda285 100644
--- a/gtk/gtkmessagedialog.c
+++ b/gtk/gtkmessagedialog.c
@@ -32,6 +32,7 @@
 #include "gtkbuildable.h"
 #include "gtklabel.h"
 #include "gtkbox.h"
+#include "gtkbbox.h"
 #include "gtkimage.h"
 #include "gtkintl.h"
 #include "gtkprivate.h"
@@ -305,6 +306,7 @@ static void
 gtk_message_dialog_init (GtkMessageDialog *dialog)
 {
   GtkMessageDialogPrivate *priv;
+  GtkWidget *action_area;
 
   dialog->priv = gtk_message_dialog_get_instance_private (dialog);
   priv = dialog->priv;
@@ -316,6 +318,10 @@ gtk_message_dialog_init (GtkMessageDialog *dialog)
 
   gtk_widget_init_template (GTK_WIDGET (dialog));
   gtk_message_dialog_style_updated (GTK_WIDGET (dialog));
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+  action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
+G_GNUC_END_IGNORE_DEPRECATIONS
+  gtk_button_box_set_layout (GTK_BUTTON_BOX (action_area), GTK_BUTTONBOX_EXPAND);
 }
 
 static void
@@ -869,6 +875,7 @@ gtk_message_dialog_add_buttons (GtkMessageDialog* message_dialog,
 {
   GtkDialog* dialog = GTK_DIALOG (message_dialog);
 
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   switch (buttons)
     {
     case GTK_BUTTONS_NONE:
@@ -876,57 +883,40 @@ gtk_message_dialog_add_buttons (GtkMessageDialog* message_dialog,
       break;
 
     case GTK_BUTTONS_OK:
-      gtk_dialog_add_button (dialog,
-                             _("_OK"),
-                             GTK_RESPONSE_OK);
+      gtk_dialog_add_button (dialog, _("_OK"), GTK_RESPONSE_OK);
       break;
 
     case GTK_BUTTONS_CLOSE:
-      gtk_dialog_add_button (dialog,
-                             _("_Close"),
-                             GTK_RESPONSE_CLOSE);
+      gtk_dialog_add_button (dialog, _("_Close"), GTK_RESPONSE_CLOSE);
       break;
 
     case GTK_BUTTONS_CANCEL:
-      gtk_dialog_add_button (dialog,
-                             _("_Cancel"),
-                             GTK_RESPONSE_CANCEL);
+      gtk_dialog_add_button (dialog, _("_Cancel"), GTK_RESPONSE_CANCEL);
       break;
 
     case GTK_BUTTONS_YES_NO:
-      gtk_dialog_add_button (dialog,
-                             _("_No"),
-                             GTK_RESPONSE_NO);
-      gtk_dialog_add_button (dialog,
-                             _("_Yes"),
-                             GTK_RESPONSE_YES);
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+      gtk_dialog_add_button (dialog, _("_No"), GTK_RESPONSE_NO);
+      gtk_dialog_add_button (dialog, _("_Yes"), GTK_RESPONSE_YES);
       gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
                                               GTK_RESPONSE_YES,
                                               GTK_RESPONSE_NO,
                                               -1);
-G_GNUC_END_IGNORE_DEPRECATIONS
       break;
 
     case GTK_BUTTONS_OK_CANCEL:
-      gtk_dialog_add_button (dialog,
-                             _("_Cancel"),
-                             GTK_RESPONSE_CANCEL);
-      gtk_dialog_add_button (dialog,
-                             _("_OK"),
-                             GTK_RESPONSE_OK);
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+      gtk_dialog_add_button (dialog, _("_Cancel"), GTK_RESPONSE_CANCEL);
+      gtk_dialog_add_button (dialog, _("_OK"), GTK_RESPONSE_OK);
       gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
                                               GTK_RESPONSE_OK,
                                               GTK_RESPONSE_CANCEL,
                                               -1);
-G_GNUC_END_IGNORE_DEPRECATIONS
       break;
       
     default:
       g_warning ("Unknown GtkButtonsType");
       break;
     } 
+G_GNUC_END_IGNORE_DEPRECATIONS
 
   g_object_notify (G_OBJECT (message_dialog), "buttons");
 }
diff --git a/gtk/gtkmessagedialog.ui b/gtk/gtkmessagedialog.ui
index aef68f4..e2a1022 100644
--- a/gtk/gtkmessagedialog.ui
+++ b/gtk/gtkmessagedialog.ui
@@ -3,38 +3,29 @@
   <!-- interface-requires gtk+ 3.10 -->
   <template class="GtkMessageDialog" parent="GtkDialog">
     <property name="can_focus">False</property>
-    <property name="border_width">5</property>
+    <property name="border_width">0</property>
     <property name="title"> </property>
     <property name="resizable">False</property>
     <property name="type_hint">dialog</property>
     <property name="skip_taskbar_hint">True</property>
+    <child internal-child="headerbar">
+      <object class="GtkHeaderBar" id="headerbar1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="show-close-button">False</property>
+      </object>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
+        <property name="border_width">0</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">14</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area1">
-            <property name="can_focus">False</property>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </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="spacing">20</property>
         <child>
           <object class="GtkBox" id="box">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="border_width">5</property>
+            <property name="border_width">0</property>
             <property name="spacing">12</property>
             <child>
               <object class="GtkImage" id="image">
@@ -45,7 +36,7 @@
                 <property name="stock">gtk-missing-image</property>
                 <property name="use_fallback">True</property>
                 <property name="icon_size">6</property>
-                <property name="xpad">6</property>
+                <property name="xpad">12</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -57,6 +48,7 @@
               <object class="GtkBox" id="message_area">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="margin_end">20</property>
                 <property name="orientation">vertical</property>
                 <property name="spacing">12</property>
                 <child>
@@ -106,7 +98,7 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">False</property>
-            <property name="position">1</property>
+            <property name="position">0</property>
           </packing>
         </child>
       </object>


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