Handle better webkit's navigation-policy-decision-requested signal to be able to manage external files, links and theme files. cpw.masca.webkit

Tue, 23 Aug 2011 06:21:27 +0000

author
Jorge Villaseñor <masca@cpw.pidgin.im>
date
Tue, 23 Aug 2011 06:21:27 +0000
branch
cpw.masca.webkit
changeset 32506
74d884939a2c
parent 32505
f9ecad1b9ebd
child 32507
5d345f996c80

Handle better webkit's navigation-policy-decision-requested signal to be able to manage external files, links and theme files.

pidgin/gtkwebview.c file | annotate | diff | comparison | revisions
--- a/pidgin/gtkwebview.c	Tue Aug 23 06:18:42 2011 +0000
+++ b/pidgin/gtkwebview.c	Tue Aug 23 06:21:27 2011 +0000
@@ -184,12 +184,19 @@
 		      WebKitWebPolicyDecision *policy_decision)
 {
 	const gchar *uri;
+	WebKitWebNavigationReason reason;
 
 	uri = webkit_network_request_get_uri (request);
+	reason = webkit_web_navigation_action_get_reason(navigation_action);
 
-	/* the gtk imhtml way was to create an idle cb, not sure
-	 * why, so right now just using purple_notify_uri directly */
-	purple_notify_uri (NULL, uri);
+	if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) {
+		/* the gtk imhtml way was to create an idle cb, not sure
+		 * why, so right now just using purple_notify_uri directly */
+		purple_notify_uri (NULL, uri);
+	}
+
+	webkit_web_policy_decision_use(policy_decision);
+
 	return TRUE;
 }
 

mercurial