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



commit a0cba14eb222e47912bd3b804554ba2b9632dd16
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.

 src/ephy-action-bar-start.c | 28 ++++++++++++++++++++++++++--
 src/ephy-action-bar-start.h |  2 ++
 src/ephy-header-bar.c       |  1 +
 3 files changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/src/ephy-action-bar-start.c b/src/ephy-action-bar-start.c
index 54b6839ad..7428c81f1 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,18 @@ 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 +534,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 +590,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 +625,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]