#include <stdlib.h>
#include <stdio.h>
#include <webkit/webkit.h>
+#include <glib/gstdio.h>
#define LENGTH(x) (sizeof x / sizeof x[0])
typedef struct Client {
GtkWidget *win, *scroll, *vbox, *urlbar, *searchbar;
WebKitWebView *view;
+ WebKitDownload * dl;
gchar *title;
gint progress;
struct Client *next;
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);
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);
}
}
WebKitWebView *
newwindow(WebKitWebView *v, WebKitWebFrame *f, gpointer d) {
- /* TODO */
Client *c = newclient();
return c->view;
}