[epiphany/wip/exalm/fullscreen: 8/8] action-bar-start: Hide new tab button in fullscreen



commit 993cf65f5452c151e0ed7cbd5b6d81e88cf3b6c5
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Sep 27 19:20:05 2019 +0500

    action-bar-start: Hide new tab button in fullscreen
    
    Ideally, there is a tab bar in fullscreen. However, since we don't have
    that, hide the button instead. This still leaves shortcuts though.
    
    Update the incognito style not to assume only the stack is .titlebar.

 src/ephy-action-bar-start.c | 29 +++++++++++++++++++++++++++--
 src/ephy-action-bar-start.h |  2 ++
 src/ephy-header-bar.c       |  1 +
 3 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/src/ephy-action-bar-start.c b/src/ephy-action-bar-start.c
index 54b6839ad..b7a7489aa 100644
--- a/src/ephy-action-bar-start.c
+++ b/src/ephy-action-bar-start.c
@@ -46,6 +46,7 @@ struct _EphyActionBarStart {
   GtkWidget *new_tab_button;
 
   guint navigation_buttons_menu_timeout;
+  gboolean is_fullscreen;
 };
 
 G_DEFINE_TYPE (EphyActionBarStart, ephy_action_bar_start, GTK_TYPE_BOX)
@@ -477,6 +478,19 @@ get_icon_size (void)
   return GTK_ICON_SIZE_BUTTON;
 }
 
+static void
+update_new_tab_button_visibility (EphyActionBarStart *action_bar_start)
+{
+  EphyEmbedShell *embed_shell;
+
+  embed_shell = ephy_embed_shell_get_default ();
+
+  gtk_widget_set_visible (action_bar_start->new_tab_button,
+                          (ephy_embed_shell_get_mode (embed_shell) != EPHY_EMBED_SHELL_MODE_APPLICATION) &&
+                          !is_desktop_pantheon () &&
+                          !action_bar_start->is_fullscreen);
+}
+
 static void
 ephy_action_bar_start_constructed (GObject *object)
 {
@@ -521,8 +535,7 @@ ephy_action_bar_start_constructed (GObject *object)
                     G_CALLBACK (homepage_button_release_event_cb), action_bar_start);
 
   /* New Tab Button */
-  if (ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_APPLICATION || is_desktop_pantheon ())
-    gtk_widget_set_visible (action_bar_start->new_tab_button, FALSE);
+  update_new_tab_button_visibility (action_bar_start);
 
   g_signal_connect (action_bar_start->new_tab_button, "button-release-event",
                     G_CALLBACK (new_tab_button_release_event_cb), action_bar_start);
@@ -578,6 +591,7 @@ ephy_action_bar_start_class_init (EphyActionBarStartClass *klass)
 static void
 ephy_action_bar_start_init (EphyActionBarStart *action_bar_start)
 {
+  action_bar_start->is_fullscreen = FALSE;
 }
 
 EphyActionBarStart *
@@ -612,3 +626,14 @@ ephy_action_bar_start_change_combined_stop_reload_state (EphyActionBarStart *act
                                  _(REFRESH_BUTTON_TOOLTIP));
   }
 }
+
+void
+ephy_action_bar_set_is_fullscreen (EphyActionBarStart *action_bar_start,
+                                   gboolean            fullscreen)
+{
+  if (action_bar_start->is_fullscreen == fullscreen)
+    return;
+
+  action_bar_start->is_fullscreen = fullscreen;
+  update_new_tab_button_visibility (action_bar_start);
+}
diff --git a/src/ephy-action-bar-start.h b/src/ephy-action-bar-start.h
index e64b8178a..b30ac44da 100644
--- a/src/ephy-action-bar-start.h
+++ b/src/ephy-action-bar-start.h
@@ -33,5 +33,7 @@ EphyActionBarStart *ephy_action_bar_start_new                               (voi
 GtkWidget          *ephy_action_bar_start_get_navigation_box                (EphyActionBarStart 
*action_bar_start);
 void                ephy_action_bar_start_change_combined_stop_reload_state (EphyActionBarStart 
*action_bar_start,
                                                                              gboolean            loading);
+void                ephy_action_bar_set_is_fullscreen                       (EphyActionBarStart 
*action_bar_start,
+                                                                             gboolean            fullscreen);
 
 G_END_DECLS
diff --git a/src/ephy-header-bar.c b/src/ephy-header-bar.c
index c01d61be6..324a5deca 100644
--- a/src/ephy-header-bar.c
+++ b/src/ephy-header-bar.c
@@ -124,6 +124,7 @@ fullscreen_changed_cb (EphyHeaderBar *header_bar)
 
   gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header_bar), !fullscreen);
   gtk_widget_set_visible (header_bar->restore_button, fullscreen);
+  ephy_action_bar_set_is_fullscreen (header_bar->action_bar_start, fullscreen);
 }
 
 static void


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