[epiphany/mcatanzaro/reopen-closed-tab: 5/5] Properly set sensitivity of reopen tab context menu item
- From: Jan-Michael Brummer <jbrummer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mcatanzaro/reopen-closed-tab: 5/5] Properly set sensitivity of reopen tab context menu item
- Date: Mon, 22 Apr 2019 18:45:42 +0000 (UTC)
commit 88104a58007ab10185d9fae093c2ee66d5d00c67
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 d4394cc94..9e74dc0bf 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -3509,6 +3509,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;
@@ -3591,8 +3592,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)
@@ -3685,6 +3688,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]