about summary refs log tree commit diff
path: root/surf.c
diff options
context:
space:
mode:
authorEnno Boland (Gottox) <gottox@s01.de>2009-06-06 21:12:39 +0200
committerEnno Boland (Gottox) <gottox@s01.de>2009-06-06 21:12:39 +0200
commitf2059fdb306f3d98e492a712bf73159fcbf32921 (patch)
tree46255e40b1d36b37be0a4cf4897be5df64709c20 /surf.c
parentsorted functions in alphabetic order. (diff)
downloadsurf-f2059fdb306f3d98e492a712bf73159fcbf32921.tar.gz
surf-f2059fdb306f3d98e492a712bf73159fcbf32921.tar.bz2
surf-f2059fdb306f3d98e492a712bf73159fcbf32921.zip
added spaceinvaders downloading support, thanks :)
Diffstat (limited to 'surf.c')
-rw-r--r--surf.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/surf.c b/surf.c
index 64f2a75..24b694a 100644
--- a/surf.c
+++ b/surf.c
@@ -40,7 +40,7 @@ static gboolean decidewindow(WebKitWebView *view, WebKitWebFrame *f,
 static void destroyclient(Client *c);
 static void destroywin(GtkWidget* w, gpointer d);
 static void die(char *str);
-static gboolean download(WebKitWebView *view, GObject *o, gpointer d);
+static gboolean download(WebKitWebView *view, WebKitDownload *o, gpointer d);
 static gchar *geturi(Client *c);
 static void hidesearch(Client *c);
 static void hideurl(Client *c);
@@ -107,9 +107,20 @@ void die(char *str) {
 }
 
 gboolean
-download(WebKitWebView *view, GObject *o, gpointer d) {
+download(WebKitWebView *view, WebKitDownload *o, gpointer d) {
 	/* TODO */
-	return FALSE;
+	const gchar *home;
+	gchar *uri, *filename;
+
+	home = g_get_home_dir();
+	filename = g_build_filename(home, "Desktop", 
+			webkit_download_get_suggested_filename(o), NULL);
+	uri = g_strconcat("file://", filename, NULL);
+	webkit_download_set_destination_uri(o, uri);
+	g_free(filename);
+	g_free(uri);
+	webkit_download_start(o);
+	return TRUE;
 }
 
 gchar *