diff options
author | Xan Lopez <xlopez@igalia.com> | 2011-09-09 04:51:43 +0800 |
---|---|---|
committer | Xan Lopez <xlopez@igalia.com> | 2011-09-09 04:53:12 +0800 |
commit | 368e65ed6173f75b3c9ccf19e26b2846fc6fb3d0 (patch) | |
tree | 6af9b19428999bca58394f014793f1656524e8a4 /src | |
parent | c044acd19e68216221a157cfa884f90f5d3739a2 (diff) | |
download | gsoc2013-epiphany-368e65ed6173f75b3c9ccf19e26b2846fc6fb3d0.tar gsoc2013-epiphany-368e65ed6173f75b3c9ccf19e26b2846fc6fb3d0.tar.gz gsoc2013-epiphany-368e65ed6173f75b3c9ccf19e26b2846fc6fb3d0.tar.bz2 gsoc2013-epiphany-368e65ed6173f75b3c9ccf19e26b2846fc6fb3d0.tar.lz gsoc2013-epiphany-368e65ed6173f75b3c9ccf19e26b2846fc6fb3d0.tar.xz gsoc2013-epiphany-368e65ed6173f75b3c9ccf19e26b2846fc6fb3d0.tar.zst gsoc2013-epiphany-368e65ed6173f75b3c9ccf19e26b2846fc6fb3d0.zip |
ephy-window: disable unwanted actions in application mode
https://bugzilla.gnome.org/show_bug.cgi?id=657624
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-window.c | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c index 6e5190228..dc69089de 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -3750,6 +3750,14 @@ ephy_window_init (EphyWindow *window) window); } +static const char* disabled_actions_for_app_mode[] = { "FileOpen", + "FileSaveAs", + "FileSaveAsApplication", + "ViewMenuBar", + "ViewEncoding", + "FileBookmarkPage", + "GoBookmarks" }; + static GObject * ephy_window_constructor (GType type, guint n_construct_properties, @@ -3768,6 +3776,8 @@ ephy_window_constructor (GType type, guint settings_connection; GtkCssProvider *css_provider; GFile *css_file; + int i; + EphyEmbedShellMode mode; object = G_OBJECT_CLASS (ephy_window_parent_class)->constructor (type, n_construct_properties, construct_params); @@ -3927,14 +3937,37 @@ ephy_window_constructor (GType type, g_signal_connect (single, "notify::network-status", G_CALLBACK (sync_network_status), window); - /* Popup part */ + /* Disable actions not needed for popup mode. */ toolbar_action_group = ephy_toolbar_get_action_group (priv->toolbar); action = gtk_action_group_get_action (toolbar_action_group, "FileNewTab"); - ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, priv->is_popup); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, + priv->is_popup); action = gtk_action_group_get_action (priv->popups_action_group, "OpenLinkInNewTab"); - ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, priv->is_popup); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, + priv->is_popup); + /* Disabled actions not needed for application mode. */ + mode = ephy_embed_shell_get_mode (embed_shell); + if (mode == EPHY_EMBED_SHELL_MODE_APPLICATION) + { + /* FileNewTab and FileNewWindow are sort of special. */ + action = gtk_action_group_get_action (toolbar_action_group, "FileNewTab"); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, + TRUE); + + action = gtk_action_group_get_action (toolbar_action_group, "FileNewWindow"); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, + TRUE); + + for (i = 0; i < G_N_ELEMENTS (disabled_actions_for_app_mode); i++) + { + action = gtk_action_group_get_action (priv->action_group, + disabled_actions_for_app_mode[i]); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, TRUE); + } + } + /* Connect lock clicks */ action = gtk_action_group_get_action (priv->action_group, "ViewPageSecurityInfo"); g_signal_connect_swapped (priv->toolbar, "lock-clicked", |