diff options
author | Claudio Saavedra <csaavedra@igalia.com> | 2012-05-10 00:06:18 +0800 |
---|---|---|
committer | Claudio Saavedra <csaavedra@igalia.com> | 2012-06-20 03:15:47 +0800 |
commit | 373899ffdddc869f3852b04e058ac82c9deac2ba (patch) | |
tree | 7e7ab2aeefffdacc70fb8e318e2b83e68d4425bd /src/ephy-window.c | |
parent | f676e68517dd300f6537ee15bd747665d6f05163 (diff) | |
download | gsoc2013-epiphany-373899ffdddc869f3852b04e058ac82c9deac2ba.tar gsoc2013-epiphany-373899ffdddc869f3852b04e058ac82c9deac2ba.tar.gz gsoc2013-epiphany-373899ffdddc869f3852b04e058ac82c9deac2ba.tar.bz2 gsoc2013-epiphany-373899ffdddc869f3852b04e058ac82c9deac2ba.tar.lz gsoc2013-epiphany-373899ffdddc869f3852b04e058ac82c9deac2ba.tar.xz gsoc2013-epiphany-373899ffdddc869f3852b04e058ac82c9deac2ba.tar.zst gsoc2013-epiphany-373899ffdddc869f3852b04e058ac82c9deac2ba.zip |
ephy-window: add a method to toggle visibility of default actions
Where default actions are the ones that should be disabled when we
display a blank page or anything that is not a webpage.
https://bugzilla.gnome.org/show_bug.cgi?id=678405
Diffstat (limited to 'src/ephy-window.c')
-rw-r--r-- | src/ephy-window.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c index c7c6728bc..d80ea26cb 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1571,14 +1571,13 @@ sync_tab_navigation (EphyWebView *view, } static void -sync_tab_is_blank (EphyWebView *view, - GParamSpec *pspec, - EphyWindow *window) +_ephy_window_set_default_actions_sensitive (EphyWindow *window, + guint flags, + gboolean set) { EphyWindowPrivate *priv = window->priv; GtkActionGroup *action_group; GtkAction *action; - gboolean is_blank = TRUE; int i; const char *action_group_actions[] = { "FileSaveAs", "FileSaveAsApplication", "FilePrint", "FileSendTo", "FileBookmarkPage", "EditFind", @@ -1586,9 +1585,6 @@ sync_tab_is_blank (EphyWebView *view, "ViewZoomIn", "ViewZoomOut", "ViewPageSource", NULL }; - if (window->priv->closing) return; - - is_blank = ephy_web_view_get_is_blank (view); action_group = priv->action_group; /* Page menu */ @@ -1597,25 +1593,37 @@ sync_tab_is_blank (EphyWebView *view, action = gtk_action_group_get_action (action_group, action_group_actions[i]); ephy_action_change_sensitivity_flags (action, - SENS_FLAG_IS_BLANK, is_blank); + flags, set); } /* Page context popup */ action = gtk_action_group_get_action (priv->popups_action_group, "ContextBookmarkPage"); ephy_action_change_sensitivity_flags (action, - SENS_FLAG_IS_BLANK, is_blank); + flags, set); action = gtk_action_group_get_action (priv->popups_action_group, "InspectElement"); ephy_action_change_sensitivity_flags (action, - SENS_FLAG_IS_BLANK, is_blank); + flags, set); /* Toolbar */ action = gtk_action_group_get_action (priv->toolbar_action_group, "ViewCombinedStopReload"); ephy_action_change_sensitivity_flags (action, - SENS_FLAG_IS_BLANK, is_blank); + flags, set); +} + +static void +sync_tab_is_blank (EphyWebView *view, + GParamSpec *pspec, + EphyWindow *window) +{ + if (window->priv->closing) return; + + _ephy_window_set_default_actions_sensitive (window, + SENS_FLAG_IS_BLANK, + ephy_web_view_get_is_blank (view)); } static void |