[gnome-terminal] window: Add tab position setting



commit a17ac313f7b84895a152fa90a1082c350a3bb639
Author: Christian Persch <chpe gnome org>
Date:   Tue Feb 10 19:28:29 2015 +0100

    window: Add tab position setting
    
    Allow to position the tab bar at the top or bottom of the window.
    Supporting left or right position is not trivial, so not implemented.
    
    dconf only, no UI.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=75420#c25

 src/org.gnome.Terminal.gschema.xml |   13 +++++++++++++
 src/terminal-notebook.c            |    8 ++++++++
 src/terminal-schemas.h             |    1 +
 src/terminal-window.c              |    3 +++
 4 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/org.gnome.Terminal.gschema.xml b/src/org.gnome.Terminal.gschema.xml
index 9513c49..e480155 100644
--- a/src/org.gnome.Terminal.gschema.xml
+++ b/src/org.gnome.Terminal.gschema.xml
@@ -46,6 +46,14 @@
     <value nick='wide'   value='2'/>
   </enum>
 
+  <!-- From gtk+ -->
+  <enum id="org.gnome.Terminal.TabPosition">
+    <!-- <value nick="left"   value="0" /> -->
+    <!-- <value nick="right"  value="1" /> -->
+    <value nick="top"    value="2" />
+    <value nick="bottom" value="3" />
+  </enum>
+
   <!-- These really belong into some vte-built enums file, but
         using enums from other modules still has some
         problems. Just include a copy here for now.
@@ -643,6 +651,11 @@
       <summary>Whether to open new terminals as windows or tabs</summary>
     </key>
 
+    <key name="tab-position" enum="org.gnome.Terminal.TabPosition">
+      <default>'top'</default>
+      <summary>The position of the tab bar</summary>
+    </key>
+
    <!-- <child name="profiles" schema="org.gnome.Terminal.ProfilesList" /> -->
 
    <child name="keybindings" schema="org.gnome.Terminal.Legacy.Keybindings" />
diff --git a/src/terminal-notebook.c b/src/terminal-notebook.c
index 81005c5..d855a7b 100644
--- a/src/terminal-notebook.c
+++ b/src/terminal-notebook.c
@@ -24,10 +24,12 @@
 #include <gtk/gtk.h>
 
 #include "terminal-debug.h"
+#include "terminal-app.h"
 #include "terminal-intl.h"
 #include "terminal-mdi-container.h"
 #include "terminal-screen-container.h"
 #include "terminal-tab-label.h"
+#include "terminal-schemas.h"
 
 #define TERMINAL_NOTEBOOK_GET_PRIVATE(notebook)(G_TYPE_INSTANCE_GET_PRIVATE ((notebook), 
TERMINAL_TYPE_NOTEBOOK, TerminalNotebookPrivate))
 
@@ -420,6 +422,12 @@ terminal_notebook_constructed (GObject *object)
 
   G_OBJECT_CLASS (terminal_notebook_parent_class)->constructed (object);
 
+  g_settings_bind (terminal_app_get_global_settings (terminal_app_get ()),
+                   TERMINAL_SETTING_TAB_POSITION_KEY,
+                   object,
+                   "tab-pos",
+                   G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY);
+
   gtk_notebook_set_show_tabs (notebook, FALSE);
   gtk_notebook_set_scrollable (notebook, TRUE);
   gtk_notebook_set_show_border (notebook, FALSE);
diff --git a/src/terminal-schemas.h b/src/terminal-schemas.h
index 1a50d43..17ffdb2 100644
--- a/src/terminal-schemas.h
+++ b/src/terminal-schemas.h
@@ -73,6 +73,7 @@ G_BEGIN_DECLS
 #define TERMINAL_SETTING_NEW_TERMINAL_MODE_KEY          "new-terminal-mode"
 #define TERMINAL_SETTING_SCHEMA_VERSION                 "schema-version"
 #define TERMINAL_SETTING_SHELL_INTEGRATION_KEY          "shell-integration-enabled"
+#define TERMINAL_SETTING_TAB_POSITION_KEY               "tab-position"
 
 #define TERMINAL_SETTINGS_LIST_LIST_KEY                 "list"
 #define TERMINAL_SETTINGS_LIST_DEFAULT_KEY              "default"
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 1dacc93..d147ed8 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -2600,6 +2600,9 @@ terminal_window_init (TerminalWindow *window)
                          G_CALLBACK (terminal_window_update_tabs_menu_sensitivity),
                          window, NULL, G_CONNECT_SWAPPED | G_CONNECT_AFTER);
 
+  g_signal_connect_swapped (priv->mdi_container, "notify::tab-pos",
+                            G_CALLBACK (terminal_window_update_geometry), window);
+
   /* FIXME hack hack! */
   if (GTK_IS_NOTEBOOK (priv->mdi_container)) {
   g_signal_connect (priv->mdi_container, "button-press-event",


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