[Xfce4-commits] [apps/xfce4-terminal] 01/01: Add an option to open new tab to the right of the current tab

noreply at xfce.org noreply at xfce.org
Fri Aug 25 23:08:03 CEST 2017


This is an automated email from the git hooks/post-receive script.

f   2   4   0   4       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-terminal.

commit d6d035a88838601e786167dd480caf36313b2a49
Author: Igor <f2404 at yandex.ru>
Date:   Fri Aug 25 17:06:11 2017 -0400

    Add an option to open new tab to the right of the current tab
    
    Fixes bug #13821
---
 terminal/terminal-preferences-dialog.c |  2 +-
 terminal/terminal-preferences.c        | 11 +++++++++++
 terminal/terminal-preferences.glade    | 16 ++++++++++++++++
 terminal/terminal-window.c             | 12 +++++++++---
 4 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
index b7aae23..7fa4bbe 100644
--- a/terminal/terminal-preferences-dialog.c
+++ b/terminal/terminal-preferences-dialog.c
@@ -149,7 +149,7 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
                                        "misc-borders-default", "misc-tab-close-middle-click",
                                        "misc-mouse-autohide", "misc-rewrap-on-resize",
                                        "misc-copy-on-select", "misc-slim-tabs",
-                                       "shortcuts-no-helpkey",
+                                       "misc-new-tab-adjacent", "shortcuts-no-helpkey",
                                        "shortcuts-no-mnemonics", "shortcuts-no-menukey",
                                        "binding-backspace", "binding-delete",
                                        "binding-ambiguous-width", "background-mode",
diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index 89ef935..8a8fdb6 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -107,6 +107,7 @@ enum
   PROP_MISC_REWRAP_ON_RESIZE,
   PROP_MISC_USE_SHIFT_ARROWS_TO_SCROLL,
   PROP_MISC_SLIM_TABS,
+  PROP_MISC_NEW_TAB_ADJACENT,
   PROP_SCROLLING_BAR,
   PROP_SCROLLING_LINES,
   PROP_SCROLLING_ON_OUTPUT,
@@ -990,6 +991,16 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
                             G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
   /**
+   * TerminalPreferences:misc-new-tab-adjacent:
+   **/
+  preferences_props[PROP_MISC_NEW_TAB_ADJACENT] =
+      g_param_spec_boolean ("misc-new-tab-adjacent",
+                            NULL,
+                            "MiscNewTabAdjacent",
+                            FALSE,
+                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
    * TerminalPreferences:scrolling-bar:
    **/
   preferences_props[PROP_SCROLLING_BAR] =
diff --git a/terminal/terminal-preferences.glade b/terminal/terminal-preferences.glade
index 9ad2ecf..72aea9b 100644
--- a/terminal/terminal-preferences.glade
+++ b/terminal/terminal-preferences.glade
@@ -3327,6 +3327,22 @@ when double clicking:</property>
                                 <property name="position">4</property>
                               </packing>
                             </child>
+                            <child>
+                              <object class="GtkCheckButton" id="misc-new-tab-adjacent">
+                                <property name="label" translatable="yes">Open new tab to the _right of the active tab</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="halign">start</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">5</property>
+                              </packing>
+                            </child>
                           </object>
                         </child>
                       </object>
diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index a8f2450..72c15b8 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -2506,8 +2506,9 @@ void
 terminal_window_add (TerminalWindow *window,
                      TerminalScreen *screen)
 {
-  GtkWidget  *label;
-  gint        page;
+  GtkWidget *label;
+  gint       page, position = -1;
+  gboolean   adjacent;
 
   terminal_return_if_fail (TERMINAL_IS_WINDOW (window));
   terminal_return_if_fail (TERMINAL_IS_SCREEN (screen));
@@ -2515,7 +2516,12 @@ terminal_window_add (TerminalWindow *window,
   /* create the tab label */
   label = terminal_screen_get_tab_label (screen);
 
-  page = gtk_notebook_append_page (GTK_NOTEBOOK (window->priv->notebook), GTK_WIDGET (screen), label);
+  /* determine the tab position */
+  g_object_get (G_OBJECT (window->priv->preferences), "misc-new-tab-adjacent", &adjacent, NULL);
+  if (G_UNLIKELY (adjacent))
+    position = gtk_notebook_page_num (GTK_NOTEBOOK (window->priv->notebook), GTK_WIDGET (window->priv->active)) + 1;
+
+  page = gtk_notebook_insert_page (GTK_NOTEBOOK (window->priv->notebook), GTK_WIDGET (screen), label, position);
   gtk_container_child_set (GTK_CONTAINER (window->priv->notebook), GTK_WIDGET (screen), "tab-expand", TRUE, NULL);
   gtk_container_child_set (GTK_CONTAINER (window->priv->notebook), GTK_WIDGET (screen), "tab-fill", TRUE, NULL);
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list