diff options
author | Brendan Taylor <whateley@gmail.com> | 2011-04-12 22:35:42 -0600 |
---|---|---|
committer | Brendan Taylor <whateley@gmail.com> | 2011-04-12 22:35:42 -0600 |
commit | bdfb2fb35c4d6fa407361dcc99aefb00ff185e6d (patch) | |
tree | e61dd35879dbf96de58e375e79546c9c6bbc3a76 /src/callbacks.c | |
parent | 1282b9cf99be29db65529eec3bfb14f6685b393b (diff) |
allow a second argument to the 'download' command that specifies a destination path
Diffstat (limited to 'src/callbacks.c')
-rw-r--r-- | src/callbacks.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/callbacks.c b/src/callbacks.c index 360b0c4..703107b 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -837,6 +837,11 @@ download_cb(WebKitWebView *web_view, WebKitDownload *download, gpointer user_dat /* get the URI being downloaded */ const gchar *uri = webkit_download_get_uri(download); + /* get the destination path, if specified. + * this is only intended to be set when this function is trigger by an + * explicit download using uzbl's 'download' action. */ + const gchar *destination = user_data; + if (uzbl.state.verbose) printf("Download requested -> %s\n", uri); @@ -883,6 +888,9 @@ download_cb(WebKitWebView *web_view, WebKitDownload *download, gpointer user_dat gchar *total_size_s = g_strdup_printf("%d", total_size); g_array_append_val(a, total_size_s); + if(destination) + g_array_append_val(a, destination); + GString *result = g_string_new (""); run_parsed_command(c, a, result); |