[gedit] close-confirmation-dialog: buttons at the bottom
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] close-confirmation-dialog: buttons at the bottom
- Date: Sun, 20 Jul 2014 13:00:25 +0000 (UTC)
commit 0a09c83a90de81f54bc6345376c5903eb1d73e75
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Jul 20 14:58:45 2014 +0200
close-confirmation-dialog: buttons at the bottom
As done in GtkMessageDialog we check the use-header-bar setting
to set an empty title as the header, but we force GtkDialog to
put the buttons at the bottom
gedit/gedit-close-confirmation-dialog.c | 32 +++++++++++++++++++++++++-----
1 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/gedit/gedit-close-confirmation-dialog.c b/gedit/gedit-close-confirmation-dialog.c
index f557003..5649da0 100644
--- a/gedit/gedit-close-confirmation-dialog.c
+++ b/gedit/gedit-close-confirmation-dialog.c
@@ -251,19 +251,39 @@ gedit_close_confirmation_dialog_new (GtkWindow *parent,
GList *unsaved_documents)
{
GtkWidget *dlg;
- gboolean use_header_bar;
+ gboolean use_header;
g_return_val_if_fail (unsaved_documents != NULL, NULL);
- g_object_get (gtk_settings_get_default (),
- "gtk-dialogs-use-header", &use_header_bar,
- NULL);
-
dlg = GTK_WIDGET (g_object_new (GEDIT_TYPE_CLOSE_CONFIRMATION_DIALOG,
- "use-header-bar", use_header_bar,
+ "use-header-bar", FALSE,
"unsaved_documents", unsaved_documents,
NULL));
+ /* As GtkMessageDialog we look at the setting to check
+ * whether to set a CSD header, but we actually force the
+ * buttons at the bottom
+ */
+ g_object_get (gtk_settings_get_default (),
+ "gtk-dialogs-use-header", &use_header,
+ NULL);
+
+ if (use_header)
+ {
+ GtkWidget *box;
+ GtkWidget *label;
+
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_widget_show (box);
+ gtk_widget_set_size_request (box, -1, 16);
+ label = gtk_label_new ("");
+ gtk_widget_set_margin_top (label, 6);
+ gtk_widget_set_margin_bottom (label, 6);
+ gtk_style_context_add_class (gtk_widget_get_style_context (label), "title");
+ gtk_box_set_center_widget (GTK_BOX (box), label);
+ gtk_window_set_titlebar (GTK_WINDOW (dlg), box);
+ }
+
if (parent != NULL)
{
gtk_window_group_add_window (gedit_window_get_group (GEDIT_WINDOW (parent)),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]