[gnome-terminal] prefs: Move action widgets into titlebar when using headerbars
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] prefs: Move action widgets into titlebar when using headerbars
- Date: Mon, 10 Dec 2018 21:02:01 +0000 (UTC)
commit 8a369d12f0e4f255cae3b00d21f4830220e0853d
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Dec 10 22:00:33 2018 +0100
prefs: Move action widgets into titlebar when using headerbars
https://bugzilla.gnome.org/show_bug.cgi?id=756798
src/terminal-prefs.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
---
diff --git a/src/terminal-prefs.c b/src/terminal-prefs.c
index 8b66ceec..12fa5049 100644
--- a/src/terminal-prefs.c
+++ b/src/terminal-prefs.c
@@ -751,6 +751,7 @@ terminal_prefs_show_preferences (GSettings *profile, const char *widget_name)
GtkWidget *theme_variant_label, *theme_variant_combo;
GtkWidget *new_terminal_mode_label, *new_terminal_mode_combo;
GtkWidget *close_button, *help_button;
+ GtkWidget *content_box;
GSettings *settings;
const GActionEntry action_entries[] = {
@@ -771,6 +772,7 @@ terminal_prefs_show_preferences (GSettings *profile, const char *widget_name)
data->builder = terminal_util_load_widgets_resource ("/org/gnome/terminal/ui/preferences.ui",
"preferences-dialog",
"preferences-dialog", &dialog,
+ "dialogue-content-box", &content_box,
"close-button", &close_button,
"help-button", &help_button,
"default-show-menubar-checkbutton", &show_menubar_button,
@@ -892,6 +894,32 @@ terminal_prefs_show_preferences (GSettings *profile, const char *widget_name)
profile_prefs_init ();
+ /* 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);
+
+ /* Remove extra spacing around the content */
+ g_object_set (G_OBJECT (content_box), "margin", 0, NULL);
+ }
+
/* misc */
g_signal_connect (close_button, "clicked", G_CALLBACK (prefs_dialog_close_button_clicked_cb), data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]