diff options
author | dusanx <ef_dva@yahoo.com> | 2009-04-28 02:35:24 +0200 |
---|---|---|
committer | dusanx <ef_dva@yahoo.com> | 2009-04-28 02:35:24 +0200 |
commit | 3e42283eb5eb296ecac9b9219cdc728e92b3c287 (patch) | |
tree | d72bed84814d82402a66fa908c8d15dd4bc7475c | |
parent | 5d0a67929ce39365c9b7a46250c88af511e43c2f (diff) |
Download and open in new window
-rw-r--r-- | CHECKLIST | 2 | ||||
-rw-r--r-- | uzbl.c | 24 |
2 files changed, 26 insertions, 0 deletions
@@ -15,6 +15,8 @@ Also testers and interested people can use this list to see what uzbl is about, all should be valid strings and contain things like the pid, fifo file, config file,.. (see README for details). * XDG_CONFIG_HOME and XDG_CONFIG_DIRS (+ default values) fully supported and working (looks for a config file called 'uzbl'). * --uri can be specified without http:// -- if missing will be prepended. +* Download completely finished +* Open in new window partially finished: target _new works, from popup meny does not work yet TODO: add stuff about internal/external keybinds, mod key, insert mode, status bar, behavior settings,.... @@ -115,6 +115,28 @@ run_command(const char *command, const char *args); /* --- CALLBACKS --- */ +static gboolean +new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data) { + (void) web_view; + (void) frame; + (void) navigation_action; + (void) policy_decision; + (void) user_data; + const gchar* uri = webkit_network_request_get_uri (request); + printf("New window requested -> %s \n", uri); + return (FALSE); +} + +static gboolean +download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data) { + (void) web_view; + (void) user_data; + const gchar* uri = webkit_download_get_uri ((WebKitDownload*)download); + printf("Download -> %s\n",uri); + run_command(download_handler, uri); + return (FALSE); +} + static void go_back_cb (WebKitWebView* page) { (void) page; @@ -419,6 +441,8 @@ create_browser () { g_signal_connect (G_OBJECT (web_view), "load-committed", G_CALLBACK (log_history_cb), web_view); g_signal_connect (G_OBJECT (web_view), "hovering-over-link", G_CALLBACK (link_hover_cb), web_view); g_signal_connect (G_OBJECT (web_view), "key-press-event", G_CALLBACK (key_press_cb), web_view); + g_signal_connect (G_OBJECT (web_view), "new-window-policy-decision-requested", G_CALLBACK (new_window_cb), web_view); + g_signal_connect (G_OBJECT (web_view), "download-requested", G_CALLBACK (download_cb), web_view); return scrolled_window; } |