diff options
Diffstat (limited to 'network/surf/patches/searchengines.diff')
-rw-r--r-- | network/surf/patches/searchengines.diff | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/network/surf/patches/searchengines.diff b/network/surf/patches/searchengines.diff index 77ad9deb80..e4577632e0 100644 --- a/network/surf/patches/searchengines.diff +++ b/network/surf/patches/searchengines.diff @@ -1,8 +1,8 @@ -diff -Naur surf-0.7/config.def.h surf-0.7.patched/config.def.h ---- surf-0.7/config.def.h 2015-12-19 09:59:30.000000000 -0500 -+++ surf-0.7.patched/config.def.h 2017-01-21 22:05:50.709360322 -0500 -@@ -129,6 +129,14 @@ - { MODKEY|GDK_SHIFT_MASK,GDK_g, togglegeolocation, { 0 } }, +diff -Naur surf-2.0/config.def.h surf-2.0.patched/config.def.h +--- surf-2.0/config.def.h 2017-03-28 12:17:45.000000000 -0400 ++++ surf-2.0.patched/config.def.h 2017-06-25 02:20:53.529174137 -0400 +@@ -153,6 +153,13 @@ + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } }, }; +static SearchEngine searchengines[] = { @@ -10,63 +10,61 @@ diff -Naur surf-0.7/config.def.h surf-0.7.patched/config.def.h + { "g", "https://www.google.com/search?q=%s" }, + { "dict", "http://www.thefreedictionary.com/%s" }, + { "sb", "http://slackbuilds.org/result/?search=%s&sv=@SLACKVER@" }, -+ { "sw", "http://search.slackware.eu/cgi-bin/search.cgi?rm=search&needle=%s&haystack=2&sver=@SVER@&button-search=Search" }, +}; + /* button definitions */ - /* click can be ClkDoc, ClkLink, ClkImg, ClkMedia, ClkSel, ClkEdit, ClkAny */ + /* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */ static Button buttons[] = { -diff -Naur surf-0.7/surf.c surf-0.7.patched/surf.c ---- surf-0.7/surf.c 2015-12-19 09:59:30.000000000 -0500 -+++ surf-0.7.patched/surf.c 2017-01-21 22:05:12.304360777 -0500 -@@ -91,6 +91,12 @@ - G_DEFINE_TYPE(CookieJar, cookiejar, SOUP_TYPE_COOKIE_JAR_TEXT) +diff -Naur surf-2.0/surf.c surf-2.0.patched/surf.c +--- surf-2.0/surf.c 2017-03-28 12:17:45.000000000 -0400 ++++ surf-2.0.patched/surf.c 2017-06-25 02:04:32.517172473 -0400 +@@ -129,6 +129,11 @@ + } Button; typedef struct { -+ char *token; -+ char *uri; ++ char *token; ++ char *uri; +} SearchEngine; + -+ +typedef struct { - char *regex; - char *style; + const char *uri; + Parameter config[ParameterLast]; regex_t re; -@@ -178,6 +184,7 @@ - static void navigate(Client *c, const Arg *arg); - static Client *newclient(void); - static void newwindow(Client *c, const Arg *arg, gboolean noembed); +@@ -202,6 +207,7 @@ + static void download(Client *c, WebKitURIResponse *r); + static void closeview(WebKitWebView *v, Client *c); + static void destroywin(GtkWidget* w, Client *c); +static gchar *parseuri(const gchar *uri); + + /* Hotkeys */ static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d); - static gboolean contextmenu(WebKitWebView *view, GtkWidget *menu, - WebKitHitTestResult *target, gboolean keyboard, -@@ -838,8 +845,7 @@ - u = g_strdup_printf("file://%s", rp); - free(rp); +@@ -477,7 +483,7 @@ + url = g_strdup_printf("file://%s", path); + free(path); } else { -- u = g_strrstr(uri, "://") ? g_strdup(uri) -- : g_strdup_printf("http://%s", uri); -+ u = parseuri(uri); +- url = g_strdup_printf("http://%s", uri); ++ url = parseuri(uri); } - setatom(c, AtomUri, uri); -@@ -1172,6 +1178,21 @@ - } + setatom(c, AtomUri, url); +@@ -1461,6 +1467,22 @@ + gtk_main_quit(); } -+static gchar * ++gchar * +parseuri(const gchar *uri) { -+ guint i; ++ guint i; + -+ for (i = 0; i < LENGTH(searchengines); i++) { -+ if (searchengines[i].token == NULL || searchengines[i].uri == NULL || \ -+ *(uri + strlen(searchengines[i].token)) != ' ') -+ continue; -+ if (g_str_has_prefix(uri, searchengines[i].token)) -+ return g_strdup_printf(searchengines[i].uri, uri + strlen(searchengines[i].token) + 1); -+ } ++ for (i = 0; i < LENGTH(searchengines); i++) { ++ if (searchengines[i].token == NULL || searchengines[i].uri == NULL || ++ *(uri + strlen(searchengines[i].token)) != ' ') ++ continue; ++ if (g_str_has_prefix(uri, searchengines[i].token)) ++ return g_strdup_printf(searchengines[i].uri, ++ uri + strlen(searchengines[i].token) + 1); ++ } + -+ return g_strrstr(uri, "://") ? g_strdup(uri) : g_strdup_printf("http://%s", uri); ++ return g_strdup_printf("http://%s", uri); +} + void |