[epiphany] Always show new tab button in header bar on the left side



commit 2a903a40b76644c4d69c0cf3132362de6ffad7be
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Thu Dec 20 23:44:39 2018 +0100

    Always show new tab button in header bar on the left side
    
    Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/447
    Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/69

 src/ephy-action-bar-end.c             | 16 -------------
 src/ephy-action-bar-end.h             |  2 --
 src/ephy-action-bar-start.c           |  4 ++++
 src/ephy-action-bar.c                 |  2 --
 src/ephy-header-bar.c                 |  3 ---
 src/ephy-notebook.c                   |  8 -------
 src/ephy-window.c                     | 42 -----------------------------------
 src/resources/gtk/action-bar-end.ui   | 30 +------------------------
 src/resources/gtk/action-bar-start.ui | 19 ++++++++++++++++
 9 files changed, 24 insertions(+), 102 deletions(-)
---
diff --git a/src/ephy-action-bar-end.c b/src/ephy-action-bar-end.c
index 79d94725a..934fac09b 100644
--- a/src/ephy-action-bar-end.c
+++ b/src/ephy-action-bar-end.c
@@ -30,8 +30,6 @@ struct _EphyActionBarEnd {
   GtkBox parent_instance;
 
   GtkWidget *bookmarks_button;
-  GtkWidget *new_tab_revealer;
-  GtkWidget *new_tab_button;
   GtkWidget *downloads_revealer;
   GtkWidget *downloads_button;
   GtkWidget *downloads_popover;
@@ -107,12 +105,6 @@ ephy_action_bar_end_class_init (EphyActionBarEndClass *klass)
   gtk_widget_class_bind_template_child (widget_class,
                                         EphyActionBarEnd,
                                         bookmarks_button);
-  gtk_widget_class_bind_template_child (widget_class,
-                                        EphyActionBarEnd,
-                                        new_tab_revealer);
-  gtk_widget_class_bind_template_child (widget_class,
-                                        EphyActionBarEnd,
-                                        new_tab_button);
   gtk_widget_class_bind_template_child (widget_class,
                                         EphyActionBarEnd,
                                         downloads_revealer);
@@ -171,14 +163,6 @@ ephy_action_bar_end_set_show_bookmarks_button (EphyActionBarEnd *action_bar_end,
   gtk_widget_set_visible (action_bar_end->bookmarks_button, show);
 }
 
-void
-ephy_action_bar_end_set_show_new_tab_button (EphyActionBarEnd *action_bar_end,
-                                             gboolean          show)
-{
-  gtk_widget_set_visible (action_bar_end->new_tab_revealer, show);
-  gtk_revealer_set_reveal_child (GTK_REVEALER (action_bar_end->new_tab_revealer), show);
-}
-
 GtkWidget *
 ephy_action_bar_end_get_bookmarks_button (EphyActionBarEnd *action_bar_end)
 {
diff --git a/src/ephy-action-bar-end.h b/src/ephy-action-bar-end.h
index 56646c99a..801888168 100644
--- a/src/ephy-action-bar-end.h
+++ b/src/ephy-action-bar-end.h
@@ -32,7 +32,5 @@ G_DECLARE_FINAL_TYPE (EphyActionBarEnd, ephy_action_bar_end, EPHY, ACTION_BAR_EN
 EphyActionBarEnd *ephy_action_bar_end_new                       (void);
 void              ephy_action_bar_end_set_show_bookmarks_button (EphyActionBarEnd *action_bar_end,
                                                                  gboolean          show);
-void              ephy_action_bar_end_set_show_new_tab_button   (EphyActionBarEnd *action_bar_end,
-                                                                 gboolean          show);
 
 G_END_DECLS
diff --git a/src/ephy-action-bar-start.c b/src/ephy-action-bar-start.c
index 3e74fc3bf..1fe13119d 100644
--- a/src/ephy-action-bar-start.c
+++ b/src/ephy-action-bar-start.c
@@ -42,6 +42,7 @@ struct _EphyActionBarStart {
   GtkWidget *combined_stop_reload_button;
   GtkWidget *combined_stop_reload_image;
   GtkWidget *homepage_button;
+  GtkWidget *new_tab_button;
 
   guint navigation_buttons_menu_timeout;
 };
@@ -490,6 +491,9 @@ ephy_action_bar_start_class_init (EphyActionBarStartClass *klass)
   gtk_widget_class_bind_template_child (widget_class,
                                         EphyActionBarStart,
                                         homepage_button);
+  gtk_widget_class_bind_template_child (widget_class,
+                                        EphyActionBarStart,
+                                        new_tab_button);
 }
 
 static void
diff --git a/src/ephy-action-bar.c b/src/ephy-action-bar.c
index 9424ab962..41e3d6620 100644
--- a/src/ephy-action-bar.c
+++ b/src/ephy-action-bar.c
@@ -50,8 +50,6 @@ sync_chromes_visibility (EphyActionBar *action_bar)
                           chrome & EPHY_WINDOW_CHROME_HEADER_BAR);
   ephy_action_bar_end_set_show_bookmarks_button (action_bar->action_bar_end,
                                                  chrome & EPHY_WINDOW_CHROME_BOOKMARKS);
-  ephy_action_bar_end_set_show_new_tab_button (action_bar->action_bar_end,
-                                               chrome & EPHY_WINDOW_CHROME_TABSBAR);
 }
 
 static void
diff --git a/src/ephy-header-bar.c b/src/ephy-header-bar.c
index c7f3fcc9a..bda11d7c9 100644
--- a/src/ephy-header-bar.c
+++ b/src/ephy-header-bar.c
@@ -56,7 +56,6 @@ struct _EphyHeaderBar {
   GtkWidget *navigation_box;
   GtkWidget *reader_mode_revealer;
   GtkWidget *reader_mode_button;
-  GtkWidget *new_tab_revealer;
   GtkWidget *new_tab_button;
   GtkWidget *bookmarks_button;
   GtkWidget *page_menu_button;
@@ -112,8 +111,6 @@ sync_chromes_visibility (EphyHeaderBar *header_bar)
   ephy_action_bar_end_set_show_bookmarks_button (header_bar->action_bar_end,
                                                  chrome & EPHY_WINDOW_CHROME_BOOKMARKS);
   gtk_widget_set_visible (header_bar->page_menu_button, chrome & EPHY_WINDOW_CHROME_MENU);
-  ephy_action_bar_end_set_show_new_tab_button (header_bar->action_bar_end,
-                                               chrome & EPHY_WINDOW_CHROME_TABSBAR);
 }
 
 static void
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index b0c4b4d14..e06d6f9e8 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -482,14 +482,6 @@ ephy_notebook_constructed (GObject *object)
   gtk_notebook_set_action_widget (GTK_NOTEBOOK (notebook), hbox, GTK_PACK_END);
   gtk_widget_show (hbox);
 
-  button = gtk_button_new_from_icon_name ("tab-new-symbolic", GTK_ICON_SIZE_BUTTON);
-  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-  gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "win.new-tab");
-  /* Translators: tooltip for the new tab button */
-  gtk_widget_set_tooltip_text (button, _("Open a new tab"));
-  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-  gtk_widget_show (button);
-
   button = gtk_menu_button_new ();
   gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
   /* Translators: tooltip for the tab switcher menu button */
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 10bf1a499..6273c739d 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -3150,44 +3150,6 @@ sync_user_input_cb (EphyLocationController *action,
   window->updating_address = FALSE;
 }
 
-static void
-update_new_tab_button_visibility (EphyWindow *window)
-{
-  EphyActionBarEnd *header_bar_end;
-  EphyActionBarEnd *action_bar_end;
-  gboolean visible;
-
-  if (!gtk_widget_get_mapped (GTK_WIDGET (window)))
-    return;
-
-  visible = !gtk_notebook_get_show_tabs (window->notebook);
-  header_bar_end = ephy_header_bar_get_action_bar_end (EPHY_HEADER_BAR (window->header_bar));
-  action_bar_end = ephy_action_bar_get_action_bar_end (EPHY_ACTION_BAR (window->action_bar));
-
-  if (visible) {
-    ephy_action_bar_end_set_show_new_tab_button (header_bar_end, TRUE);
-    ephy_action_bar_end_set_show_new_tab_button (action_bar_end, TRUE);
-  } else {
-    /* Note the animation here doesn't actually work, since we hide the revealer
-     * right away. That's not ideal, but not much we can do about it, since
-     * hiding the revealer results in the location entry expanding, and that
-     * needs to happen immediately or it looks pretty bad, so we can't wait
-     * until the animation completes. Using the revealer is still worthwhile
-     * because the new tab button reveal animation is more important.
-     */
-    ephy_action_bar_end_set_show_new_tab_button (header_bar_end, FALSE);
-    ephy_action_bar_end_set_show_new_tab_button (action_bar_end, FALSE);
-  }
-}
-
-static void
-notebook_show_tabs_changed_cb (GtkNotebook *notebook,
-                               GParamSpec  *pspec,
-                               EphyWindow  *window)
-{
-  update_new_tab_button_visibility (window);
-}
-
 static void
 title_widget_lock_clicked_cb (EphyTitleWidget *title_widget,
                               GdkRectangle    *lock_position,
@@ -3368,8 +3330,6 @@ ephy_window_constructed (GObject *object)
   setup_tab_accels (window);
 
   window->notebook = setup_notebook (window);
-  g_signal_connect_object (window->notebook, "notify::show-tabs",
-                           G_CALLBACK (notebook_show_tabs_changed_cb), window, 0);
 
   /* Setup incognito mode style */
   mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ());
@@ -3448,8 +3408,6 @@ ephy_window_constructed (GObject *object)
                                           SENS_FLAG_CHROME, TRUE);
   }
 
-  update_new_tab_button_visibility (window);
-
   ephy_window_set_chrome (window, chrome);
 }
 
diff --git a/src/resources/gtk/action-bar-end.ui b/src/resources/gtk/action-bar-end.ui
index bc0ba95c3..35f269a45 100644
--- a/src/resources/gtk/action-bar-end.ui
+++ b/src/resources/gtk/action-bar-end.ui
@@ -24,34 +24,6 @@
         <property name="pack-type">end</property>
       </packing>
     </child>
-    <child>
-      <object class="GtkRevealer" id="new_tab_revealer">
-        <property name="visible">False</property>
-        <property name="transition-type">crossfade</property>
-        <child>
-          <object class="GtkButton" id="new_tab_button">
-            <property name="visible">True</property>
-            <property name="action-name">win.new-tab</property>
-            <property name="valign">center</property>
-            <!-- Translators: tooltip for the new tab button -->
-            <property name="tooltip_text" translatable="yes">Open a new tab</property>
-            <style>
-              <class name="image-button"/>
-            </style>
-            <child>
-              <object class="GtkImage" id="new_tab_image">
-                <property name="visible">True</property>
-                <property name="icon-name">tab-new-symbolic</property>
-                <property name="icon-size">1</property>
-              </object>
-            </child>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="pack-type">end</property>
-      </packing>
-    </child>
     <child>
       <object class="GtkRevealer" id="downloads_revealer">
         <property name="visible">True</property>
@@ -82,4 +54,4 @@
   <object class="EphyBookmarksPopover" id="bookmarks_popover">
     <property name="visible">True</property>
   </object>
-</interface>
\ No newline at end of file
+</interface>
diff --git a/src/resources/gtk/action-bar-start.ui b/src/resources/gtk/action-bar-start.ui
index 29866afed..2c3e5742c 100644
--- a/src/resources/gtk/action-bar-start.ui
+++ b/src/resources/gtk/action-bar-start.ui
@@ -87,5 +87,24 @@
         </child>
       </object>
     </child>
+    <child>
+      <object class="GtkButton" id="new_tab_button">
+        <property name="visible">True</property>
+        <property name="action-name">win.new-tab</property>
+        <property name="valign">center</property>
+        <!-- Translators: tooltip for the new tab button -->
+        <property name="tooltip_text" translatable="yes">Open a new tab</property>
+        <style>
+          <class name="image-button"/>
+        </style>
+        <child>
+          <object class="GtkImage" id="new_tab_image">
+            <property name="visible">True</property>
+            <property name="icon-name">tab-new-symbolic</property>
+            <property name="icon-size">1</property>
+          </object>
+        </child>
+      </object>
+    </child>
   </template>
 </interface>


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