[gtk+] Allow close buttons on dialogs



commit 18d439ee40d77cea07875b6dfff3cfe40b91e5a0
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Dec 20 13:24:12 2013 -0500

    Allow close buttons on dialogs
    
    It was a long-standing problem for some users of GtkDialog that
    there is no guaranted way to close it. So, lets show a close
    button.

 gtk/gtkheaderbar.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 3b49cb0..1d8dac6 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -356,7 +356,8 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
               GtkWidget *image = NULL;
               AtkObject *accessible;
 
-              if (strcmp (t[j], "icon") == 0)
+              if (strcmp (t[j], "icon") == 0 &&
+                  gtk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_NORMAL)
                 {
                   button = gtk_image_new ();
                   gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
@@ -371,7 +372,9 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
                       button = NULL;
                     }
                 }
-              else if (strcmp (t[j], "menu") == 0 && menu != NULL)
+              else if (strcmp (t[j], "menu") == 0 &&
+                       menu != NULL &&
+                       gtk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_NORMAL)
                 {
                   button = gtk_menu_button_new ();
                   gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
@@ -431,8 +434,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
                   priv->titlebar_max_button = button;
                 }
               else if (strcmp (t[j], "close") == 0 &&
-                       gtk_window_get_deletable (window) &&
-                       gtk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_NORMAL)
+                       gtk_window_get_deletable (window))
                 {
                   button = gtk_button_new ();
                   gtk_widget_set_valign (button, GTK_ALIGN_CENTER);


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