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



commit 44d508d6969a6282a0e6901b0928900dc824cfc7
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-window.c  |  9 +--------
 src/terminal-window.ui | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 6820a409..b222ce5f 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1876,17 +1876,10 @@ static void
 terminal_window_fill_notebook_action_box (TerminalWindow *window)
 {
   TerminalWindowPrivate *priv = window->priv;
-  GtkWidget *box, *new_tab_button, *tabs_menu_button;
+  GtkWidget *box, *tabs_menu_button;
 
   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);
-
   /* Create Tabs menu button */
   tabs_menu_button = terminal_menu_button_new ();
   g_signal_connect (tabs_menu_button, "update-menu",
diff --git a/src/terminal-window.ui b/src/terminal-window.ui
index 7e1009be..1940919b 100644
--- a/src/terminal-window.ui
+++ b/src/terminal-window.ui
@@ -7,6 +7,27 @@
       <object class="GtkHeaderBar" id="headerbar">
         <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>
       </object>
     </child>
     <child>


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