[gnome-terminal/wip/fmuellner/headerbar: 3/6] window: Move new-tab button into headerbar



commit b928e9731f8fcdb3249a076223e1b162e2431a8d
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Nov 1 23:40:35 2018 +0100

    window: Move new-tab button into headerbar
    
    Opening a new tab is a very frequent action, which is currently
    exposed in the tab bar itself. However that means that it only
    becomes available when more than one tab is used. Moving the
    control to the headerbar instead makes the action always readily
    available and leaves a bit more space for tabs.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756798

 src/terminal-headerbar.ui | 21 +++++++++++++++++++++
 src/terminal-window.c     | 13 ++++++++-----
 2 files changed, 29 insertions(+), 5 deletions(-)
---
diff --git a/src/terminal-headerbar.ui b/src/terminal-headerbar.ui
index 3f8c5965..ae3ea5c3 100644
--- a/src/terminal-headerbar.ui
+++ b/src/terminal-headerbar.ui
@@ -20,5 +20,26 @@
     <property name="can-focus">False</property>
     <property name="visible">True</property>
     <property name="show-close-button">True</property>
+    <child>
+      <object class="GtkButton">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">True</property>
+        <property name="action-name">win.new-terminal</property>
+        <property name="action-target">('tab','current')</property>
+        <style>
+          <class name="image-button"/>
+        </style>
+        <child>
+          <object class="GtkImage">
+            <property name="visible">True</property>
+            <property name="icon_name">tab-new-symbolic</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="pack_type">end</property>
+      </packing>
+    </child>
   </template>
 </interface>
diff --git a/src/terminal-window.c b/src/terminal-window.c
index dc653fc0..7ed6b86f 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1882,11 +1882,14 @@ terminal_window_fill_notebook_action_box (TerminalWindow *window)
   box = terminal_notebook_get_action_box (TERMINAL_NOTEBOOK (priv->mdi_container), GTK_PACK_END);
 
   /* Create the NewTerminal button */
-  new_tab_button = terminal_icon_button_new ("tab-new-symbolic");
-  gtk_actionable_set_action_name (GTK_ACTIONABLE (new_tab_button), "win.new-terminal");
-  gtk_actionable_set_action_target (GTK_ACTIONABLE (new_tab_button), "(ss)", "tab", "current");
-  gtk_box_pack_start (GTK_BOX (box), new_tab_button, FALSE, FALSE, 0);
-  gtk_widget_show (new_tab_button);
+  if (!terminal_app_get_use_headerbar (terminal_app_get ()))
+    {
+      new_tab_button = terminal_icon_button_new ("tab-new-symbolic");
+      gtk_actionable_set_action_name (GTK_ACTIONABLE (new_tab_button), "win.new-terminal");
+      gtk_actionable_set_action_target (GTK_ACTIONABLE (new_tab_button), "(ss)", "tab", "current");
+      gtk_box_pack_start (GTK_BOX (box), new_tab_button, FALSE, FALSE, 0);
+      gtk_widget_show (new_tab_button);
+    }
 
   /* Create Tabs menu button */
   tabs_menu_button = terminal_menu_button_new ();


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