aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/uzbl-core.c
diff options
context:
space:
mode:
authorGravatar Brendan Taylor <whateley@gmail.com>2011-04-12 22:35:42 -0600
committerGravatar Brendan Taylor <whateley@gmail.com>2011-04-12 22:35:42 -0600
commitbdfb2fb35c4d6fa407361dcc99aefb00ff185e6d (patch)
treee61dd35879dbf96de58e375e79546c9c6bbc3a76 /src/uzbl-core.c
parent1282b9cf99be29db65529eec3bfb14f6685b393b (diff)
allow a second argument to the 'download' command that specifies a destination path
Diffstat (limited to 'src/uzbl-core.c')
-rw-r--r--src/uzbl-core.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/uzbl-core.c b/src/uzbl-core.c
index 3a96482..204c89c 100644
--- a/src/uzbl-core.c
+++ b/src/uzbl-core.c
@@ -745,15 +745,21 @@ void
download(WebKitWebView *web_view, GArray *argv, GString *result) {
(void) result;
- const gchar *uri = NULL;
+ const gchar *uri = argv_idx(argv, 0);
+ const gchar *destination = NULL;
+ if(argv->len > 1)
+ destination = argv_idx(argv, 1);
- if(argv->len > 0)
- uri = argv_idx(argv, 0);
+ WebKitNetworkRequest *req = webkit_network_request_new(uri);
+ WebKitDownload *download = webkit_download_new(req);
+
+ download_cb(web_view, download, destination);
+
+ if(webkit_download_get_destination_uri(download))
+ webkit_download_start(download);
else
- uri = uzbl.state.uri;
+ g_object_unref(download);
- WebKitNetworkRequest *req = webkit_network_request_new(uri);
- webkit_web_view_request_download(web_view, req);
g_object_unref(req);
}