diff options
author | Michael Catanzaro <mcatanzaro@gnome.org> | 2016-09-17 16:01:12 -0500 |
---|---|---|
committer | Michael Catanzaro <mcatanzaro@gnome.org> | 2016-09-17 16:01:28 -0500 |
commit | 63821eade07fe0f7aaf5ff21d8718cb611dc9055 (patch) | |
tree | 24d45153f00269f431d424171bb2ac1168811cf7 | |
parent | 2c7965560ebcd2e76930087a429be6520b7e4fdd (diff) | |
download | epiphany-63821eade07fe0f7aaf5ff21d8718cb611dc9055.tar.gz |
lockdown: Fix criticals when starting in app mode
-rw-r--r-- | src/ephy-lockdown.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c index 171919b43..5b149da27 100644 --- a/src/ephy-lockdown.c +++ b/src/ephy-lockdown.c @@ -147,6 +147,7 @@ bind_settings_and_actions (GSettings *settings, action = g_action_map_lookup_action (G_ACTION_MAP (action_group), actions[i].action); + g_assert (action); /* We need a custom get_mapping for 'enabled' * properties, see usage of @@ -177,6 +178,7 @@ window_added_cb (GtkApplication *application, EphyLockdown *lockdown) { GActionGroup *action_group; + EphyEmbedShellMode mode; GAction *action; GSettings *settings; EphyLocationController *location_controller; @@ -197,10 +199,14 @@ window_added_cb (GtkApplication *application, arbitrary_url_cb (EPHY_SETTINGS_LOCKDOWN, EPHY_PREFS_LOCKDOWN_ARBITRARY_URL, EPHY_WINDOW (window)); - action_group = G_ACTION_GROUP (G_APPLICATION (gtk_window_get_application (GTK_WINDOW (window)))); - bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN, - action_group, app_actions, - G_N_ELEMENTS (app_actions)); + mode = ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (application)); + if (mode != EPHY_EMBED_SHELL_MODE_APPLICATION) { + /* These actions do not exist in application mode. */ + action_group = G_ACTION_GROUP (G_APPLICATION (application)); + bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN, + action_group, app_actions, + G_N_ELEMENTS (app_actions)); + } action_group = gtk_widget_get_action_group (GTK_WIDGET (window), "win"); @@ -235,7 +241,7 @@ window_added_cb (GtkApplication *application, g_settings_bind_writable (settings, "picture-filename", action, "enabled", FALSE); - if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_APPLICATION) { + if (mode != EPHY_EMBED_SHELL_MODE_APPLICATION) { location_controller = ephy_window_get_location_controller (EPHY_WINDOW (window)); bind_location_controller (EPHY_SETTINGS_LOCKDOWN, location_controller); } |