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



commit 0bb87edd10506e0dae9193e64563fa7236872ab0
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 | 19 +++++++++++++++++++
 src/terminal-window.c     | 13 ++++++++-----
 2 files changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/src/terminal-headerbar.ui b/src/terminal-headerbar.ui
index 3f8c5965..42ccdfba 100644
--- a/src/terminal-headerbar.ui
+++ b/src/terminal-headerbar.ui
@@ -20,5 +20,24 @@
     <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="focus_on_click">False</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>
+    </child>
   </template>
 </interface>
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 2f53e0fb..c5f5ee63 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1884,11 +1884,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]