summaryrefslogtreecommitdiff
path: root/src/view.c
diff options
context:
space:
mode:
authorportix <none@none>2012-09-24 21:44:12 +0200
committerportix <none@none>2012-09-24 21:44:12 +0200
commit8487e3d438a35e27374f1dfcd7b01c73ddc1fbef (patch)
tree91ae70ce08ca47b8273a7fab87f3eb58d03b7ab2 /src/view.c
parent3e6ba3478f1200df7d7cd5ccd57728e3f5122be9 (diff)
downloaddwb-8487e3d438a35e27374f1dfcd7b01c73ddc1fbef.zip
Create a new webview in view_create_web_view_cb if tabs are disabled, closing #216
Diffstat (limited to 'src/view.c')
-rw-r--r--src/view.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/view.c b/src/view.c
index 78e228bd..7d953e17 100644
--- a/src/view.c
+++ b/src/view.c
@@ -266,6 +266,16 @@ view_console_message_cb(WebKitWebView *web, char *message, int line, char *sourc
return true;
}/*}}}*/
+static gboolean
+new_window_cb(WebKitWebView *web, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *action,
+ WebKitWebPolicyDecision *policy, GList *gl) {
+ const char *uri = webkit_network_request_get_uri(request);
+ dwb_change_mode(NORMAL_MODE, true);
+ dwb_new_window(uri);
+ gtk_widget_destroy(GTK_WIDGET(web));
+ return true;
+}
+
/* view_create_web_view_cb(WebKitWebView *, WebKitWebFrame *, GList *) {{{*/
static WebKitWebView *
view_create_web_view_cb(WebKitWebView *web, WebKitWebFrame *frame, GList *gl) {
@@ -274,8 +284,9 @@ view_create_web_view_cb(WebKitWebView *web, WebKitWebFrame *frame, GList *gl) {
return WEBVIEW(gl);
}
else {
- dwb.state.nv = OPEN_NEW_WINDOW;
- return web;
+ GtkWidget *wv = webkit_web_view_new();
+ g_signal_connect(wv, "navigation-policy-decision-requested", G_CALLBACK(new_window_cb), gl);
+ return WEBKIT_WEB_VIEW(wv);
}
}/*}}}*/