mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-25 10:03:03 +01:00
5339c6bc31
Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
69 lines
2.4 KiB
Diff
69 lines
2.4 KiB
Diff
diff -Naur surf-0.6/config.def.h surf-0.6.patched/config.def.h
|
|
--- surf-0.6/config.def.h 2013-02-10 13:40:14.000000000 -0500
|
|
+++ surf-0.6.patched/config.def.h 2013-07-03 16:40:14.000000000 -0400
|
|
@@ -93,3 +93,10 @@
|
|
{ MODKEY|GDK_SHIFT_MASK,GDK_v, toggle, { .v = "enable-plugins" } },
|
|
};
|
|
|
|
+static SearchEngine searchengines[] = {
|
|
+ { "d", "https://duckduckgo.com/html/?q=%s" },
|
|
+ { "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" },
|
|
+};
|
|
diff -Naur surf-0.6/surf.c surf-0.6.patched/surf.c
|
|
--- surf-0.6/surf.c 2013-02-10 13:40:14.000000000 -0500
|
|
+++ surf-0.6.patched/surf.c 2013-07-03 15:25:44.000000000 -0400
|
|
@@ -76,6 +76,11 @@
|
|
|
|
G_DEFINE_TYPE(CookieJar, cookiejar, SOUP_TYPE_COOKIE_JAR_TEXT)
|
|
|
|
+typedef struct {
|
|
+ char *token;
|
|
+ char *uri;
|
|
+} SearchEngine;
|
|
+
|
|
static Display *dpy;
|
|
static Atom atoms[AtomLast];
|
|
static Client *clients = NULL;
|
|
@@ -139,6 +144,7 @@
|
|
static void navigate(Client *c, const Arg *arg);
|
|
static Client *newclient(void);
|
|
static void newwindow(Client *c, const Arg *arg, gboolean noembed);
|
|
+static gchar *parseuri(const gchar *uri);
|
|
static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d);
|
|
static void populatepopup(WebKitWebView *web, GtkMenu *menu, Client *c);
|
|
static void popupactivate(GtkMenuItem *menu, Client *);
|
|
@@ -627,8 +633,8 @@
|
|
u = g_strdup_printf("file://%s", rp);
|
|
free(rp);
|
|
} else {
|
|
- u = g_strrstr(uri, "://") ? g_strdup(uri)
|
|
- : g_strdup_printf("http://%s", uri);
|
|
+ u = parseuri(uri);
|
|
+
|
|
}
|
|
|
|
/* prevents endless loop */
|
|
@@ -893,6 +899,20 @@
|
|
}
|
|
}
|
|
|
|
+gchar *
|
|
+parseuri(const gchar *uri) {
|
|
+ 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);
|
|
+ }
|
|
+
|
|
+ return g_strrstr(uri, "://") ? g_strdup(uri) : g_strdup_printf("http://%s", uri);
|
|
+}
|
|
+
|
|
static void
|
|
pasteuri(GtkClipboard *clipboard, const char *text, gpointer d) {
|
|
Arg arg = {.v = text };
|