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.
This commit is contained in:
Matthias Clasen
2013-12-20 13:24:12 -05:00
parent f200eebfd6
commit 18d439ee40

View File

@ -356,7 +356,8 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
GtkWidget *image = NULL; GtkWidget *image = NULL;
AtkObject *accessible; 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 (); button = gtk_image_new ();
gtk_widget_set_valign (button, GTK_ALIGN_CENTER); gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
@ -371,7 +372,9 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
button = NULL; 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 (); button = gtk_menu_button_new ();
gtk_widget_set_valign (button, GTK_ALIGN_CENTER); 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; priv->titlebar_max_button = button;
} }
else if (strcmp (t[j], "close") == 0 && else if (strcmp (t[j], "close") == 0 &&
gtk_window_get_deletable (window) && gtk_window_get_deletable (window))
gtk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_NORMAL)
{ {
button = gtk_button_new (); button = gtk_button_new ();
gtk_widget_set_valign (button, GTK_ALIGN_CENTER); gtk_widget_set_valign (button, GTK_ALIGN_CENTER);