From: Enno Boland (Gottox) Date: Mon, 8 Jun 2009 07:27:40 +0000 (+0200) Subject: merge X-Git-Url: https://git.danieliu.xyz/?p=surf.git;a=commitdiff_plain;h=2d9716907da6c5ae1c494958b25b2b7969adf28a;hp=c5144c040f554f0320c744cb48a2d8dc1b646c4e merge --- diff --git a/surf.1 b/surf.1 new file mode 100644 index 0000000..9c2959b --- /dev/null +++ b/surf.1 @@ -0,0 +1,58 @@ +.TH SURF 1 surf\-VERSION +.SH NAME +surf \- simple webkit based browser +.SH SYNOPSIS +.B surf +.RB [ \-ehvx ] +.RB [ \-f " FILE"] +.RB [ \-u " URI"] +.SH DESCRIPTION +surf is a simple webbrowser which is based on webkit/gtk+. It is able +to display websites and follow links. It supports the Xembedded protocol +which makes it possible to embed it into another application. Furthermore +one can point surf to another URI by setting it's XProperties. +.SH OPTIONS +.TP +.B \-e +prints xid to standard output and waits until some application reparent the +window. +.TP +.B \-f FILE +Sets the browsers URI to FILE. Also it's possible to read from stdin. +.TP +.B \-h +prints usage information to standard output, then exits. +.TP +.B \-u URI +Sets the browsers URI. +.TP +.B \-v +prints version information to standard output, then exits. +.TP +.B \-x +prints xid to standard output. This can be used to script the browser by using +xprop +.SH USAGE +.TP +.B Ctrl\-Left +Walks back the history. +.TP +.B Ctrl\-Right +Walks forward the history. +.TP +.B Ctrl\-/ +Opens the search-bar. +.TP +.B Ctrl\-g +Opens the URL-bar. +.TP +.B Ctrl\-r +Reloads the website. +.TP +.B Ctrl\-Shift\-r +Reloads the website without using cache. +.SH SEE ALSO +.BR dmenu (1) +.BR xprop (1) +.SH BUGS +Please report them! diff --git a/surf.c b/surf.c index 74a2d55..3e912d5 100644 --- a/surf.c +++ b/surf.c @@ -14,14 +14,16 @@ #include #include #include +#include #define LENGTH(x) (sizeof x / sizeof x[0]) Display *dpy; Atom urlprop; typedef struct Client { - GtkWidget *win, *scroll, *vbox, *urlbar, *urllist, *searchbar; + GtkWidget *win, *scroll, *vbox, *urlbar, *searchbar; WebKitWebView *view; + WebKitDownload * dl; gchar *title; gint progress; struct Client *next; @@ -81,7 +83,6 @@ destroyclient(Client *c) { gtk_widget_destroy(GTK_WIDGET(webkit_web_view_new())); gtk_widget_destroy(c->scroll); gtk_widget_destroy(c->urlbar); - gtk_widget_destroy(c->urllist); gtk_widget_destroy(c->searchbar); gtk_widget_destroy(c->vbox); gtk_widget_destroy(c->win); @@ -114,8 +115,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); @@ -255,11 +257,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); } } @@ -351,7 +355,6 @@ newclient(void) { WebKitWebView * newwindow(WebKitWebView *v, WebKitWebFrame *f, gpointer d) { - /* TODO */ Client *c = newclient(); return c->view; }