summarylogtreecommitdiffstats
path: root/appearance__message-dialogs.patch
blob: 030c939a814e7c4e136f2aa226449c7d710c5486 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
diff --color -U 5 -r -Z -B ./org/gtk/gtkdialog.c ./mod/gtk/gtkdialog.c
--- ./org/gtk/gtkdialog.c	2017-11-07 20:52:24.000000000 +0100
+++ ./mod/gtk/gtkdialog.c	2017-12-26 23:32:27.445080792 +0100
@@ -698,16 +698,16 @@
       _gtk_box_set_spacing_set (GTK_BOX (priv->vbox), FALSE);
     }
 
   /* don't set spacing when buttons are linked */
   if (gtk_button_box_get_layout (GTK_BUTTON_BOX (priv->action_area)) != GTK_BUTTONBOX_EXPAND)
-    gtk_box_set_spacing (GTK_BOX (priv->action_area), button_spacing);
+    gtk_box_set_spacing (GTK_BOX (priv->action_area), (button_spacing == 0) ? 6 : button_spacing);
 
   if (!_gtk_container_get_border_width_set (GTK_CONTAINER (priv->action_area)))
     {
       gtk_container_set_border_width (GTK_CONTAINER (priv->action_area),
-                                      action_area_border);
+                                      (action_area_border == 0) ? 5 : action_area_border);
       _gtk_container_set_border_width_set (GTK_CONTAINER (priv->action_area), FALSE);
     }
 }
 
 static void
diff --color -U 5 -r -Z -B ./org/gtk/gtkmessagedialog.c ./mod/gtk/gtkmessagedialog.c
--- ./org/gtk/gtkmessagedialog.c	2017-11-07 20:52:24.000000000 +0100
+++ ./mod/gtk/gtkmessagedialog.c	2017-12-27 01:50:31.895491270 +0100
@@ -35,10 +35,11 @@
 #include "gtkbbox.h"
 #include "gtkimage.h"
 #include "gtkintl.h"
 #include "gtkprivate.h"
 #include "gtktypebuiltins.h"
+#include "gtkcssprovider.h"
 
 /**
  * SECTION:gtkmessagedialog
  * @Short_description: A convenient message window
  * @Title: GtkMessageDialog
@@ -325,11 +326,21 @@
   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 gboolean style_added = FALSE;
+  if (!style_added)
+    {
+      style_added = TRUE;
+      GtkCssProvider *provider = gtk_css_provider_new ();
+      gtk_css_provider_load_from_data (provider,
+        "messagedialog > *, messagedialog buttonbox.dialog-action-area, messagedialog box.dialog-action-box { margin: 0; margin-top: 0; padding: 0; }",
+        -1, NULL);
+      gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (GTK_WIDGET (dialog)),
+        GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+    }
 
   settings = gtk_widget_get_settings (GTK_WIDGET (dialog));
   g_object_get (settings, "gtk-keynav-use-caret", &use_caret, NULL);
   gtk_label_set_selectable (GTK_LABEL (priv->label), use_caret);
   gtk_label_set_selectable (GTK_LABEL (priv->secondary_label), use_caret);
@@ -370,10 +381,11 @@
 setup_type (GtkMessageDialog *dialog,
 	    GtkMessageType    type)
 {
   GtkMessageDialogPrivate *priv = dialog->priv;
   const gchar *name = NULL;
+  const gchar *icon = NULL;
   AtkObject *atk_obj;
 
   if (priv->message_type == type)
     return;
 
@@ -381,32 +393,42 @@
 
   switch (type)
     {
     case GTK_MESSAGE_INFO:
       name = _("Information");
+      icon = "gtk-dialog-info";
       break;
 
     case GTK_MESSAGE_QUESTION:
       name = _("Question");
+      icon = "gtk-dialog-question";
       break;
 
     case GTK_MESSAGE_WARNING:
       name = _("Warning");
+      icon = "gtk-dialog-warning";
       break;
 
     case GTK_MESSAGE_ERROR:
       name = _("Error");
+      icon = "gtk-dialog-error";
       break;
 
     case GTK_MESSAGE_OTHER:
       break;
 
     default:
       g_warning ("Unknown GtkMessageType %u", type);
       break;
     }
 
+  if (icon)
+    {
+      GtkWidget *image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_DIALOG);
+      g_object_set (image, "visible", TRUE, NULL);
+      g_object_set (dialog, "image", image, NULL);
+    }
   atk_obj = gtk_widget_get_accessible (GTK_WIDGET (dialog));
   if (GTK_IS_ACCESSIBLE (atk_obj))
     {
       atk_object_set_role (atk_obj, ATK_ROLE_ALERT);
       if (name)
diff --color -U 5 -r -Z -B ./org/gtk/ui/gtkmessagedialog.ui ./mod/gtk/ui/gtkmessagedialog.ui
--- ./org/gtk/ui/gtkmessagedialog.ui	2017-11-07 20:52:24.000000000 +0100
+++ ./mod/gtk/ui/gtkmessagedialog.ui	2017-12-26 23:30:47.031742483 +0100
@@ -4,35 +4,38 @@
   <template class="GtkMessageDialog" parent="GtkDialog">
     <property name="title"></property>
     <property name="resizable">0</property>
     <property name="type-hint">dialog</property>
     <property name="skip-taskbar-hint">1</property>
+    <property name="border-width">5</property>
     <child internal-child="headerbar">
       <object class="GtkHeaderBar" id="headerbar1">
         <property name="visible">1</property>
       </object>
     </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="orientation">vertical</property>
-        <property name="spacing">20</property>
-        <property name="border-width">0</property>
+        <property name="spacing">8</property>
+        <property name="border-width">2</property>
         <child>
           <object class="GtkBox" id="box">
             <property name="visible">1</property>
-            <property name="margin-start">30</property>
-            <property name="margin-end">30</property>
-            <property name="spacing">30</property>
+            <property name="margin-start">2</property>
+            <property name="margin-end">2</property>
+            <property name="spacing">12</property>
+            <property name="border-width">5</property>
             <child>
               <object class="GtkBox" id="message_area">
                 <property name="visible">1</property>
                 <property name="orientation">vertical</property>
-                <property name="spacing">10</property>
+                <property name="spacing">12</property>
                 <child>
                   <object class="GtkLabel" id="label">
                     <property name="visible">1</property>
-                    <property name="halign">center</property>
+                    <property name="halign">start</property>
+                    <property name="xalign">0</property>
                     <property name="valign">start</property>
                     <property name="wrap">1</property>
                     <property name="max-width-chars">60</property>
                   </object>
                   <packing>
@@ -41,11 +44,12 @@
                 </child>
                 <child>
                   <object class="GtkLabel" id="secondary_label">
                     <property name="no-show-all">1</property>
                     <property name="margin-bottom">2</property>
-                    <property name="halign">center</property>
+                    <property name="halign">start</property>
+                    <property name="xalign">0</property>
                     <property name="valign">start</property>
                     <property name="wrap">1</property>
                     <property name="max-width-chars">60</property>
                   </object>
                   <packing>