[epiphany/gnome-3-32] Properly set sensitivity of reopen tab context menu item
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/gnome-3-32] Properly set sensitivity of reopen tab context menu item
- Date: Mon, 22 Apr 2019 19:15:23 +0000 (UTC)
commit a2f8fbdd711dbcd73db0791e3cd434eb441c8701
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Mon Apr 22 17:24:57 2019 +0000
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.
(cherry picked from commit 88104a58007ab10185d9fae093c2ee66d5d00c67)
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 5cb9bfa9b..5e3b61ba7 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -3359,6 +3359,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;
@@ -3437,8 +3438,10 @@ ephy_window_constructed (GObject *object)
window->notebook = setup_notebook (window);
+ 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)
@@ -3518,6 +3521,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]