iAdd plumbing functionality. - surf - Surf web browser. Err gopher.r-36.net 70 i Err gopher.r-36.net 70 1Log /scm/surf//log.gph gopher.r-36.net 70 1Files /scm/surf//files.gph gopher.r-36.net 70 1Refs /scm/surf//refs.gph gopher.r-36.net 70 1README /scm/surf//file/README.gph gopher.r-36.net 70 1LICENSE /scm/surf//file/LICENSE.gph gopher.r-36.net 70 i--- Err gopher.r-36.net 70 1commit 9c3b5ad35389f1930834bf04341eb0c3514a850f /scm/surf//commit/9c3b5ad35389f1930834bf04341eb0c3514a850f.gph gopher.r-36.net 70 1parent 7c34d5061e372d44e20a27df375d785656614935 /scm/surf//commit/7c34d5061e372d44e20a27df375d785656614935.gph gopher.r-36.net 70 hAuthor: Christoph Lohmann <20h@r-36.net> URL:mailto:20h@r-36.net gopher.r-36.net 70 iDate: Mon, 19 Jan 2015 22:15:18 +0100 Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iAdd plumbing functionality. Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iDiffstat: Err gopher.r-36.net 70 i config.def.h | 7 +++++++ Err gopher.r-36.net 70 i surf.c | 23 +++++++++++++++++++++-- Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i2 files changed, 28 insertions(+), 2 deletions(-) Err gopher.r-36.net 70 i--- Err gopher.r-36.net 70 1diff --git a/config.def.h b/config.def.h /scm/surf//file/config.def.h.gph gopher.r-36.net 70 i@@ -53,6 +53,13 @@ static Bool allowgeolocation = TRUE; Err gopher.r-36.net 70 i } \ Err gopher.r-36.net 70 i } Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i+/* PLUMB(URI) */ Err gopher.r-36.net 70 i+#define PLUMB(u) {\ Err gopher.r-36.net 70 i+ .v = (char *[]){ "/bin/sh", "-c", \ Err gopher.r-36.net 70 i+ "xdg-open \"$0\"", u, NULL \ Err gopher.r-36.net 70 i+ } \ Err gopher.r-36.net 70 i+} Err gopher.r-36.net 70 i+ Err gopher.r-36.net 70 i /* styles */ Err gopher.r-36.net 70 i /* Err gopher.r-36.net 70 i * The iteration will stop at the first match, beginning at the beginning of Err gopher.r-36.net 70 1diff --git a/surf.c b/surf.c /scm/surf//file/surf.c.gph gopher.r-36.net 70 i@@ -95,7 +95,7 @@ static SoupCache *diskcache = NULL; Err gopher.r-36.net 70 i static void addaccelgroup(Client *c); Err gopher.r-36.net 70 i static void beforerequest(WebKitWebView *w, WebKitWebFrame *f, Err gopher.r-36.net 70 i WebKitWebResource *r, WebKitNetworkRequest *req, Err gopher.r-36.net 70 i- WebKitNetworkResponse *resp, gpointer d); Err gopher.r-36.net 70 i+ WebKitNetworkResponse *resp, Client *c); Err gopher.r-36.net 70 i static char *buildpath(const char *path); Err gopher.r-36.net 70 i static gboolean buttonrelease(WebKitWebView *web, GdkEventButton *e, Err gopher.r-36.net 70 i GList *gl); Err gopher.r-36.net 70 i@@ -138,6 +138,8 @@ static void getpagestat(Client *c); Err gopher.r-36.net 70 i static char *geturi(Client *c); Err gopher.r-36.net 70 i static gchar *getstyle(const char *uri); Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i+static void handleplumb(Client *c, WebKitWebView *w, const gchar *uri); Err gopher.r-36.net 70 i+ Err gopher.r-36.net 70 i static gboolean initdownload(WebKitWebView *v, WebKitDownload *o, Client *c); Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i static void inspector(Client *c, const Arg *arg); Err gopher.r-36.net 70 i@@ -209,11 +211,19 @@ addaccelgroup(Client *c) { Err gopher.r-36.net 70 i static void Err gopher.r-36.net 70 i beforerequest(WebKitWebView *w, WebKitWebFrame *f, WebKitWebResource *r, Err gopher.r-36.net 70 i WebKitNetworkRequest *req, WebKitNetworkResponse *resp, Err gopher.r-36.net 70 i- gpointer d) { Err gopher.r-36.net 70 i+ Client *c) { Err gopher.r-36.net 70 i const gchar *uri = webkit_network_request_get_uri(req); Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i if(g_str_has_suffix(uri, "/favicon.ico")) Err gopher.r-36.net 70 i webkit_network_request_set_uri(req, "about:blank"); Err gopher.r-36.net 70 i+ Err gopher.r-36.net 70 i+ if(!g_str_has_prefix(uri, "http://") \ Err gopher.r-36.net 70 i+ && !g_str_has_prefix(uri, "https://") \ Err gopher.r-36.net 70 i+ && !g_str_has_prefix(uri, "about:") \ Err gopher.r-36.net 70 i+ && strlen(uri) > 0) { Err gopher.r-36.net 70 i+ printf("Handle plumb: %s\n", uri); Err gopher.r-36.net 70 i+ handleplumb(c, w, uri); Err gopher.r-36.net 70 i+ } Err gopher.r-36.net 70 i } Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i static char * Err gopher.r-36.net 70 i@@ -561,6 +571,15 @@ getstyle(const char *uri) { Err gopher.r-36.net 70 i return g_strdup(""); Err gopher.r-36.net 70 i } Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i+static void Err gopher.r-36.net 70 i+handleplumb(Client *c, WebKitWebView *w, const gchar *uri) { Err gopher.r-36.net 70 i+ Arg arg; Err gopher.r-36.net 70 i+ Err gopher.r-36.net 70 i+ webkit_web_view_stop_loading(w); Err gopher.r-36.net 70 i+ arg = (Arg)PLUMB((char *)uri); Err gopher.r-36.net 70 i+ spawn(c, &arg); Err gopher.r-36.net 70 i+} Err gopher.r-36.net 70 i+ Err gopher.r-36.net 70 i static gboolean Err gopher.r-36.net 70 i initdownload(WebKitWebView *view, WebKitDownload *o, Client *c) { Err gopher.r-36.net 70 i Arg arg; Err gopher.r-36.net 70 .