From 4fb2d11028bb659fe4b6f85cdfe5f79f702c8434 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Wed, 4 Jul 2012 12:30:42 +0200 Subject: ephy-window: Add update_link_actions_sensitivity() Helper function that will be shared with the WebKit2 implementation. --- src/ephy-window.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'src') 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 @@ -1043,6 +1043,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, @@ -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); -- cgit v1.2.3