From 221a07a2af85385c1541239dd712068fbfb399c1 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Wed, 25 Mar 2009 12:03:34 +0000 Subject: 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 --- src/ephy-window.c | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'src') 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", -- cgit