From bdfb2fb35c4d6fa407361dcc99aefb00ff185e6d Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Tue, 12 Apr 2011 22:35:42 -0600 Subject: allow a second argument to the 'download' command that specifies a destination path --- src/callbacks.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/callbacks.c') 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); -- cgit v1.2.3