[gnome-terminal/wip/fmuellner/headerbar: 11/13] prefs: Move action widgets into titlebar when using headerbars



commit 4889ed40c19d6d42a5d662dbf87350684cc3fbd1
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Nov 5 23:24:50 2018 +0100

    prefs: Move action widgets into titlebar when using headerbars
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756798

 src/terminal-prefs.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
---
diff --git a/src/terminal-prefs.c b/src/terminal-prefs.c
index 8b66ceec..0f9c2f02 100644
--- a/src/terminal-prefs.c
+++ b/src/terminal-prefs.c
@@ -909,6 +909,29 @@ done:
     g_signal_emit_by_name (row, "activate");
   }
 
+  /* Move action widgets to titlebar when headerbar is used */
+  if (terminal_app_get_use_headerbar (app)) {
+    GtkWidget *headerbar;
+    GtkWidget *bbox;
+
+    headerbar = g_object_new (GTK_TYPE_HEADER_BAR,
+                              "show-close-button", TRUE,
+                              NULL);
+    bbox = gtk_widget_get_parent (help_button);
+
+    gtk_container_remove (GTK_CONTAINER (bbox), g_object_ref (help_button));
+    gtk_header_bar_pack_start (GTK_HEADER_BAR (headerbar), help_button);
+    g_object_unref (help_button);
+
+    gtk_style_context_add_class (gtk_widget_get_style_context (help_button),
+                                 "text-button");
+
+    gtk_widget_show (headerbar);
+    gtk_widget_hide (bbox);
+
+    gtk_window_set_titlebar (GTK_WINDOW (dialog), headerbar);
+  }
+
   terminal_util_dialog_focus_widget (the_pref_data->builder, widget_name);
 
   gtk_window_present (GTK_WINDOW (the_pref_data->dialog));


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