summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Mikhaylenko <alexm@gnome.org>2021-03-09 01:13:58 +0500
committerAlexander Mikhaylenko <alexm@gnome.org>2021-03-09 01:13:58 +0500
commit8c786d148fd116f5815061c1597cf0983ad44e7a (patch)
treed9bd913f20c0f15b30dc1a3aa64048e4d60e6252
parent46dd424ff592ee5b42c73576e0be7eab23f2dffb (diff)
downloadepiphany-8c786d148fd116f5815061c1597cf0983ad44e7a.tar.gz
window: Disable open/close tab view actions when already there
Unbreak the Esc key. Fixes https://gitlab.gnome.org/GNOME/epiphany/-/issues/1463
-rw-r--r--src/ephy-window.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 6882bf143..0531adb15 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -3636,6 +3636,23 @@ download_completed_cb (EphyDownload *download,
}
static void
+notify_deck_child_cb (EphyWindow *window)
+{
+ GActionGroup *action_group;
+ GAction *action;
+ gboolean pages_open;
+
+ pages_open = hdy_deck_get_visible_child (HDY_DECK (window->main_deck)) == GTK_WIDGET (window->pages_view);
+ action_group = gtk_widget_get_action_group (GTK_WIDGET (window), "win");
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "content");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), pages_open);
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "tabs-view");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), !pages_open);
+}
+
+static void
ephy_window_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
@@ -3739,6 +3756,9 @@ ephy_window_constructed (GObject *object)
window->fullscreen_box = ephy_fullscreen_box_new ();
window->pages_view = ephy_pages_view_new ();
+ g_signal_connect_swapped (window->main_deck, "notify::visible-child",
+ G_CALLBACK (notify_deck_child_cb), window);
+
gtk_revealer_set_transition_type (window->tab_bar_revealer, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
hdy_tab_bar_set_view (window->tab_bar, ephy_tab_view_get_tab_view (window->tab_view));
ephy_pages_view_set_tab_view (window->pages_view, window->tab_view);