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



commit 27cd50ee7accb503d5b03b5a51988e0838f547fe
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          | 28 ++++++++++++++++++++++++++--
 src/ephy-action-bar-start.h          |  2 ++
 src/ephy-header-bar.c                |  1 +
 src/resources/themes/elementary.css  |  4 ++--
 src/resources/themes/elementary.scss |  7 ++-----
 5 files changed, 33 insertions(+), 9 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 44d31aa1e..14fb6de4a 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
diff --git a/src/resources/themes/elementary.css b/src/resources/themes/elementary.css
index 1eef494f8..badc331bb 100644
--- a/src/resources/themes/elementary.css
+++ b/src/resources/themes/elementary.css
@@ -92,6 +92,6 @@ dzlsuggestionpopover > revealer > box > elastic > scrolledwindow > viewport > li
 
 .floating-bar, .floating-bar label { color: #fff; text-shadow: 0 1px 2px alpha(#000,0.6); }
 
-.incognito-mode .titlebar { padding: 0; }
+.incognito-mode .titlebar:not(headerbar) { padding: 0; }
 
-.incognito-mode headerbar { padding: 8px 6px 6px; background-position: 100px; color: @text_shadow_color; }
+.incognito-mode headerbar { background-position: 100px; color: @text_shadow_color; }
diff --git a/src/resources/themes/elementary.scss b/src/resources/themes/elementary.scss
index cf0b06277..4638f8b77 100644
--- a/src/resources/themes/elementary.scss
+++ b/src/resources/themes/elementary.scss
@@ -102,15 +102,12 @@ dzlsuggestionpopover > revealer > box {
 }
 
 .incognito-mode {
-  // Override padding on the titlebar stack...
-  .titlebar {
+  // Override padding on the titlebar stack
+  .titlebar:not(headerbar) {
     padding: 0;
   }
 
   headerbar {
-    // ...and instead apply it on the headerbar inside
-    padding: 8px 6px 6px;
-
     background-position: 100px;
     color: themecolor(text_shadow_color);
   }


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