about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarco Peereboom <marco@conformal.com>2010-02-26 03:38:08 +0000
committerMarco Peereboom <marco@conformal.com>2010-02-26 03:38:08 +0000
commit2af0c3b66b2b12e2cf15a377943c0713ebf4d01a (patch)
tree371d37e434c39387315435f7520ea7b0c4e767a7
parentbfd581c410cc48416bab5558e9a0917083c22436 (diff)
downloadxombrero-2af0c3b66b2b12e2cf15a377943c0713ebf4d01a.tar.gz
Simplify policy decission
-rw-r--r--xxxterm.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/xxxterm.c b/xxxterm.c
index 53b34e0..1dd0a47 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -940,20 +940,6 @@ notify_load_status_cb(WebKitWebView* wview, GParamSpec* pspec, struct tab *t)
 }
 
 int
-webview_nw_cb(WebKitWebView *wv, WebKitWebFrame *wf,
-    WebKitNetworkRequest *request, WebKitWebNavigationAction *na,
-    WebKitWebPolicyDecision *pd, struct tab *t)
-{
-	if (t == NULL)
-		errx(1, "webview_nw_cb");
-
-	DNPRINTF(XT_D_NAV, "webview_nw_cb: %s\n",
-	    webkit_network_request_get_uri(request));
-
-	return (FALSE); /* open in current tab */
-}
-
-int
 webview_npd_cb(WebKitWebView *wv, WebKitWebFrame *wf,
     WebKitNetworkRequest *request, WebKitWebNavigationAction *na,
     WebKitWebPolicyDecision *pd, struct tab *t)
@@ -966,16 +952,16 @@ webview_npd_cb(WebKitWebView *wv, WebKitWebFrame *wf,
 	DNPRINTF(XT_D_NAV, "webview_npd_cb: %s\n",
 	    webkit_network_request_get_uri(request));
 
+	uri = (char *)webkit_network_request_get_uri(request);
 	if (t->ctrl_click) {
-		uri = (char *)webkit_network_request_get_uri(request);
-		create_new_tab(uri, ctrl_click_focus);
 		t->ctrl_click = 0;
+		create_new_tab(uri, ctrl_click_focus);
 		webkit_web_policy_decision_ignore(pd);
-
 		return (TRUE); /* we made the decission */
 	}
 
-	return (FALSE);
+	webkit_web_policy_decision_use(pd);
+	return (TRUE); /* we made the decission */
 }
 
 int
@@ -1507,7 +1493,7 @@ create_new_tab(char *title, int focus)
 	    "signal::download-requested", (GCallback)webview_download_cb, t,
 	    "signal::mime-type-policy-decision-requested", (GCallback)webview_mimetype_cb, t,
 	    "signal::navigation-policy-decision-requested", (GCallback)webview_npd_cb, t,
-	    "signal::new-window-policy-decision-requested", (GCallback)webview_nw_cb, t,
+	    "signal::new-window-policy-decision-requested", (GCallback)webview_npd_cb, t,
 	    "signal::event", (GCallback)webview_event_cb, t,
 	    NULL);