[epiphany/mcatanzaro/reopen-closed-tab] Properly set sensitivity of reopen tab context menu item
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mcatanzaro/reopen-closed-tab] Properly set sensitivity of reopen tab context menu item
- Date: Mon, 22 Apr 2019 17:26:37 +0000 (UTC)
commit de7b1836eb70f9c50145298e7295ada0c39e4ceb
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Mon Apr 22 12:24:57 2019 -0500
Properly set sensitivity of reopen tab context menu item
The new Reopen Closed Tab context menu item in the tab bar is not
following the same sensitivity rules for the window menu item, resulting
in crashes when it's called when it should be insensitive.
src/ephy-window.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 4264559bd..a1444350a 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -3501,6 +3501,7 @@ ephy_window_constructed (GObject *object)
GActionGroup *action_group;
GSimpleActionGroup *simple_action_group;
guint i;
+ EphyShell *shell;
EphyEmbedShellMode mode;
EphyWindowChrome chrome = EPHY_WINDOW_CHROME_DEFAULT;
GApplication *app;
@@ -3583,8 +3584,10 @@ ephy_window_constructed (GObject *object)
ephy_pages_view_set_notebook (window->pages_view, EPHY_NOTEBOOK (window->notebook));
+ shell = ephy_shell_get_default ();
+ mode = ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (shell));
+
/* Setup incognito mode style */
- mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ());
if (mode == EPHY_EMBED_SHELL_MODE_INCOGNITO)
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (window)), "incognito-mode");
else if (mode == EPHY_EMBED_SHELL_MODE_AUTOMATION)
@@ -3677,6 +3680,18 @@ ephy_window_constructed (GObject *object)
g_object_set (window->location_controller, "editable", FALSE, NULL);
}
+ action_group = gtk_widget_get_action_group (GTK_WIDGET (window), "tab");
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "reopen");
+ if (mode == EPHY_EMBED_SHELL_MODE_INCOGNITO || mode == EPHY_EMBED_SHELL_MODE_AUTOMATION) {
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
+ } else {
+ g_object_bind_property (G_OBJECT (ephy_shell_get_session (shell)),
+ "can-undo-tab-closed",
+ action,
+ "enabled",
+ G_BINDING_SYNC_CREATE);
+ }
+
window->mouse_gesture_controller = ephy_mouse_gesture_controller_new (window);
ephy_window_set_chrome (window, chrome);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]