diff options
author | Xan Lopez <xan@src.gnome.org> | 2009-03-25 20:03:34 +0800 |
---|---|---|
committer | Xan Lopez <xan@src.gnome.org> | 2009-03-25 20:03:34 +0800 |
commit | 221a07a2af85385c1541239dd712068fbfb399c1 (patch) | |
tree | c80a029b39cd19030ed02b27d43b4e79a77afe0d | |
parent | 31e3c172dd500a0f7faee64e3bb1b34538b6f106 (diff) | |
download | gsoc2013-epiphany-221a07a2af85385c1541239dd712068fbfb399c1.tar.gz gsoc2013-epiphany-221a07a2af85385c1541239dd712068fbfb399c1.tar.zst gsoc2013-epiphany-221a07a2af85385c1541239dd712068fbfb399c1.zip |
ephy-window: use new-window-policy-decision-requested signal.
Patch by Alejandro G. Castro.
Allows to open links with target=_blank in a new tab by clicking with
the middle button.
Requires WebKitGTK+ r41969.
Fixes #573357.
svn path=/trunk/; revision=8938
-rw-r--r-- | src/ephy-window.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c index 9b5ffd992..f70cbf067 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -2532,12 +2532,12 @@ create_web_view_cb (WebKitWebView *web_view, } static gboolean -navigation_policy_decision_required_cb (WebKitWebView *web_view, - WebKitWebFrame *web_frame, - WebKitNetworkRequest *request, - WebKitWebNavigationAction *action, - WebKitWebPolicyDecision *decision, - EphyWindow *window) +policy_decision_required_cb (WebKitWebView *web_view, + WebKitWebFrame *web_frame, + WebKitNetworkRequest *request, + WebKitWebNavigationAction *action, + WebKitWebPolicyDecision *decision, + EphyWindow *window) { WebKitWebNavigationReason reason; gint button; @@ -2681,6 +2681,7 @@ ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed) if (old_embed != NULL) { WebKitWebView *web_view; + guint sid; embed = old_embed; web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); @@ -2694,9 +2695,24 @@ ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed) g_signal_handlers_disconnect_by_func (web_view, G_CALLBACK (create_web_view_cb), window); - g_signal_handlers_disconnect_by_func (web_view, - G_CALLBACK (navigation_policy_decision_required_cb), - window); + sid = g_signal_lookup ("navigation-policy-decision-requested", + WEBKIT_TYPE_WEB_VIEW); + g_signal_handlers_disconnect_matched (web_view, + G_SIGNAL_MATCH_ID | + G_SIGNAL_MATCH_FUNC, + sid, + 0, NULL, + G_CALLBACK (policy_decision_required_cb), + NULL); + sid = g_signal_lookup ("new-window-policy-decision-requested", + WEBKIT_TYPE_WEB_VIEW); + g_signal_handlers_disconnect_matched (web_view, + G_SIGNAL_MATCH_ID | + G_SIGNAL_MATCH_FUNC, + sid, + 0, NULL, + G_CALLBACK (policy_decision_required_cb), + NULL); g_signal_handlers_disconnect_by_func (embed, G_CALLBACK (sync_tab_popup_windows), @@ -2785,7 +2801,10 @@ ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed) G_CALLBACK (create_web_view_cb), window, 0); g_signal_connect_object (web_view, "navigation-policy-decision-requested", - G_CALLBACK (navigation_policy_decision_required_cb), + G_CALLBACK (policy_decision_required_cb), + window, 0); + g_signal_connect_object (web_view, "new-window-policy-decision-requested", + G_CALLBACK (policy_decision_required_cb), window, 0); g_signal_connect_object (embed, "notify::hidden-popup-count", |