[epiphany/wip/exalm/esc: 1/2] window: Disable open/close tab view actions when already there
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/exalm/esc: 1/2] window: Disable open/close tab view actions when already there
- Date: Mon, 8 Mar 2021 20:19:56 +0000 (UTC)
commit 8c786d148fd116f5815061c1597cf0983ad44e7a
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Tue Mar 9 01:13:58 2021 +0500
window: Disable open/close tab view actions when already there
Unbreak the Esc key.
Fixes https://gitlab.gnome.org/GNOME/epiphany/-/issues/1463
src/ephy-window.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
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
@@ -3635,6 +3635,23 @@ download_completed_cb (EphyDownload *download,
g_application_quit (G_APPLICATION (shell));
}
+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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]