summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnno Boland (Gottox) <gottox@s01.de>2009-06-07 12:50:18 +0200
committerEnno Boland (Gottox) <gottox@s01.de>2009-06-07 12:50:18 +0200
commit8b6548c384366a3d3bb741b7f8d5e234866627e5 (patch)
tree7c25953cd835fbdb5f79ca23f004f943bac76081
parent08b45f411a39c07e5e0751c75abf5323c3c888d7 (diff)
downloadsurf-8b6548c384366a3d3bb741b7f8d5e234866627e5.tar.gz
surf-8b6548c384366a3d3bb741b7f8d5e234866627e5.tar.bz2
surf-8b6548c384366a3d3bb741b7f8d5e234866627e5.zip
wrap long lines. working on downloads.
-rw-r--r--surf.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/surf.c b/surf.c
index 1ccb1cc..f820249 100644
--- a/surf.c
+++ b/surf.c
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <webkit/webkit.h>
+#include <glib/gstdio.h>
#define LENGTH(x) (sizeof x / sizeof x[0])
@@ -22,6 +23,7 @@ Atom urlprop;
typedef struct Client {
GtkWidget *win, *scroll, *vbox, *urlbar, *searchbar;
WebKitWebView *view;
+ WebKitDownload * dl;
gchar *title;
gint progress;
struct Client *next;
@@ -112,8 +114,9 @@ download(WebKitWebView *view, WebKitDownload *o, gpointer d) {
gchar *uri, *filename;
home = g_get_home_dir();
- filename = g_build_filename(home, "Desktop",
+ filename = g_build_filename(home, ".surf", "dl",
webkit_download_get_suggested_filename(o), NULL);
+ g_mkdir(g_path_get_dirname(filename), 0755);
uri = g_strconcat("file://", filename, NULL);
webkit_download_set_destination_uri(o, uri);
g_free(filename);
@@ -243,11 +246,13 @@ loadfile(const Client *c, const gchar *f) {
if(strcmp(f, "-") == 0) {
chan = g_io_channel_unix_new(STDIN_FILENO);
if (chan) {
- while(g_io_channel_read_line(chan, &line, NULL, NULL, &e) == G_IO_STATUS_NORMAL) {
+ while(g_io_channel_read_line(chan, &line, NULL, NULL,
+ &e) == G_IO_STATUS_NORMAL) {
g_string_append(code, line);
g_free(line);
}
- webkit_web_view_load_html_string(c->view, code->str, NULL);
+ webkit_web_view_load_html_string(c->view, code->str,
+ "file://.");
g_io_channel_shutdown(chan, FALSE, NULL);
}
}
@@ -339,7 +344,6 @@ newclient(void) {
WebKitWebView *
newwindow(WebKitWebView *v, WebKitWebFrame *f, gpointer d) {
- /* TODO */
Client *c = newclient();
return c->view;
}