Commit 2a903a40 authored by Jan-Michael Brummer's avatar Jan-Michael Brummer Committed by Michael Catanzaro

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

Fixes: #447
Fixes: #69
parent 6d7800f3
Pipeline #47478 passed with stage
in 13 minutes and 4 seconds
......@@ -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)
{
......
......@@ -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
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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 */
......
......@@ -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);
}
......
......@@ -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>
......@@ -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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment