diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2012-07-04 18:30:42 +0800 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2012-08-14 15:10:21 +0800 |
commit | 4fb2d11028bb659fe4b6f85cdfe5f79f702c8434 (patch) | |
tree | 9119fc04b417b0ac43452bbaa61f8b029e66d1d7 | |
parent | 588a7e744ab54b907e9c22b0c0ee0a3151d20608 (diff) | |
download | gsoc2013-epiphany-4fb2d11028bb659fe4b6f85cdfe5f79f702c8434.tar gsoc2013-epiphany-4fb2d11028bb659fe4b6f85cdfe5f79f702c8434.tar.gz gsoc2013-epiphany-4fb2d11028bb659fe4b6f85cdfe5f79f702c8434.tar.bz2 gsoc2013-epiphany-4fb2d11028bb659fe4b6f85cdfe5f79f702c8434.tar.lz gsoc2013-epiphany-4fb2d11028bb659fe4b6f85cdfe5f79f702c8434.tar.xz gsoc2013-epiphany-4fb2d11028bb659fe4b6f85cdfe5f79f702c8434.tar.zst gsoc2013-epiphany-4fb2d11028bb659fe4b6f85cdfe5f79f702c8434.zip |
ephy-window: Add update_link_actions_sensitivity()
Helper function that will be shared with the WebKit2 implementation.
-rw-r--r-- | src/ephy-window.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c index c9113c2eb..0177e51bd 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1044,6 +1044,22 @@ ephy_window_delete_event (GtkWidget *widget, #define MAX_SPELL_CHECK_GUESSES 4 static void +update_link_actions_sensitivity (EphyWindow *window, + gboolean link_has_web_scheme) +{ + GtkAction *action; + GtkActionGroup *action_group; + + action_group = window->priv->popups_action_group; + + action = gtk_action_group_get_action (action_group, "OpenLinkInNewWindow"); + gtk_action_set_sensitive (action, link_has_web_scheme); + + action = gtk_action_group_get_action (action_group, "OpenLinkInNewTab"); + ephy_action_change_sensitivity_flags (action, SENS_FLAG_CONTEXT, !link_has_web_scheme); +} + +static void update_popup_actions_visibility (EphyWindow *window, WebKitWebView *view, guint context) @@ -1833,8 +1849,6 @@ show_embed_popup (EphyWindow *window, WebKitHitTestResult *hit_test_result) { EphyWindowPrivate *priv = window->priv; - GtkActionGroup *action_group; - GtkAction *action; guint context; const char *popup; gboolean can_open_in_new; @@ -1870,14 +1884,7 @@ show_embed_popup (EphyWindow *window, widget = gtk_ui_manager_get_widget (priv->manager, popup); g_return_if_fail (widget != NULL); - action_group = window->priv->popups_action_group; - - action = gtk_action_group_get_action (action_group, "OpenLinkInNewWindow"); - gtk_action_set_sensitive (action, can_open_in_new); - - action = gtk_action_group_get_action (action_group, "OpenLinkInNewTab"); - ephy_action_change_sensitivity_flags (action, SENS_FLAG_CONTEXT, !can_open_in_new); - + update_link_actions_sensitivity (window, can_open_in_new); update_popup_actions_visibility (window, view, context); |