[gnome-terminal/wip/fmuellner/headerbar: 4/7] headerbar: Allow opening new windows by control-clicking new-tab button



commit d55cd0bcbd578ba04a04771182d7863c018a78b8
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Nov 6 00:19:33 2018 +0100

    headerbar: Allow opening new windows by control-clicking new-tab button
    
    New-terminal items open in a new tab or window, depending on the corre-
    sponding preference. Users can temporarily toggle that by pressing CTRL
    when activating the action. Extend that functionality to the new-tab
    button in the headerbar as suggested by Egmont, so users can quickly
    open new windows as well.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756798

 src/terminal-headerbar.ui | 2 +-
 src/terminal-window.c     | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/terminal-headerbar.ui b/src/terminal-headerbar.ui
index c54f1483..0eae12e6 100644
--- a/src/terminal-headerbar.ui
+++ b/src/terminal-headerbar.ui
@@ -72,7 +72,7 @@
             <property name="can_focus">True</property>
             <property name="receives_default">False</property>
             <property name="action-name">win.new-terminal</property>
-            <property name="action-target">('tab','current')</property>
+            <property name="action-target">('tab-default','current')</property>
             <style>
               <class name="image-button"/>
             </style>
diff --git a/src/terminal-window.c b/src/terminal-window.c
index d197afab..1d877a98 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -345,6 +345,7 @@ action_new_terminal_cb (GSimpleAction *action,
   TerminalSettingsList *profiles_list;
   gs_unref_object GSettings *profile = NULL;
   gs_free char *new_working_directory = NULL;
+  gboolean can_toggle = FALSE;
 
   g_assert (TERMINAL_IS_WINDOW (window));
 
@@ -358,10 +359,16 @@ action_new_terminal_cb (GSimpleAction *action,
     mode = TERMINAL_NEW_TERMINAL_MODE_TAB;
   else if (g_str_equal (mode_str, "window"))
     mode = TERMINAL_NEW_TERMINAL_MODE_WINDOW;
-  else {
+  else if (g_str_equal (mode_str, "tab-default")) {
+    mode = TERMINAL_NEW_TERMINAL_MODE_TAB;
+    can_toggle = TRUE;
+  } else {
     mode = g_settings_get_enum (terminal_app_get_global_settings (app),
                                 TERMINAL_SETTING_NEW_TERMINAL_MODE_KEY);
+    can_toggle = TRUE;
+  }
 
+  if (can_toggle) {
     GdkEvent *event = gtk_get_current_event ();
     if (event != NULL) {
       GdkModifierType modifiers;


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