diff options
author | Carl van Tonder <carl@supervacuo.com> | 2009-12-09 00:14:52 +0800 |
---|---|---|
committer | Xan Lopez <xan@gnome.org> | 2009-12-09 00:59:28 +0800 |
commit | ffe63b2868201600e3c0bf9f203de387c3616c40 (patch) | |
tree | de4ced06de2a2875d58fc2fef23cf52dc6260437 | |
parent | 1acaa540531f9ed3b33f87e10f0817b8c8ffd988 (diff) | |
download | gsoc2013-epiphany-ffe63b2868201600e3c0bf9f203de387c3616c40.tar.gz gsoc2013-epiphany-ffe63b2868201600e3c0bf9f203de387c3616c40.tar.zst gsoc2013-epiphany-ffe63b2868201600e3c0bf9f203de387c3616c40.zip |
Add gconf key to control the search engine used in auto-search
Defaults to Google, like it used to.
Bug #604087
Signed-off-by: Xan Lopez <xan@gnome.org>
-rw-r--r-- | data/epiphany.schemas.in | 11 | ||||
-rw-r--r-- | embed/ephy-web-view.c | 16 | ||||
-rw-r--r-- | lib/ephy-prefs.h | 1 |
3 files changed, 26 insertions, 2 deletions
diff --git a/data/epiphany.schemas.in b/data/epiphany.schemas.in index a847aa295..5faccc472 100644 --- a/data/epiphany.schemas.in +++ b/data/epiphany.schemas.in @@ -11,6 +11,17 @@ <long>Address of the user's home page.</long> </locale> </schema> + <schema> + <key>/schemas/apps/epiphany/general/url_search</key> + <applyto>/apps/epiphany/general/url_search</applyto> + <owner>epiphany</owner> + <type>string</type> + <default>http://www.google.com/search?q=%s&ie=UTF-8&oe=UTF-8</default> + <locale name="C"> + <short>URL Search</short> + <long>Search string for keywords entered in the URL bar.</long> + </locale> + </schema> <schema> <key>/schemas/apps/epiphany/dialogs/history_date_filter</key> <applyto>/apps/epiphany/dialogs/history_date_filter</applyto> diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 09172b423..a0a7c3a33 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -36,6 +36,7 @@ #include "ephy-embed-single.h" #include "ephy-embed-type-builtins.h" #include "ephy-embed-utils.h" +#include "ephy-prefs.h" #include "ephy-marshal.h" #include "ephy-permission-manager.h" #include "ephy-favicon-cache.h" @@ -1128,10 +1129,21 @@ normalize_or_autosearch_url (EphyWebView *view, const char *url) if (soup_uri == NULL && priv->non_search_regex && !g_regex_match (priv->non_search_regex, url, 0, NULL)) { - char *query_param = soup_form_encode ("q", url, NULL); + char *query_param, *url_search; + + url_search = eel_gconf_get_string (CONF_URL_SEARCH); + + if (url_search == NULL || url_search[0] == '\0') { + g_free (url_search); + + url_search = g_strdup (_("http://www.google.com/search?q=%s&ie=UTF-8&oe=UTF-8")); + } + + query_param = soup_form_encode ("q", url, NULL); /* + 2 here is getting rid of 'q=' */ - effective_url = g_strdup_printf (_("http://www.google.com/search?q=%s&ie=UTF-8&oe=UTF-8"), query_param + 2); + effective_url = g_strdup_printf (url_search, query_param + 2); g_free (query_param); + g_free (url_search); } else effective_url = ephy_embed_utils_normalize_address (url); diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h index 33d5388c9..b3fac06ec 100644 --- a/lib/ephy-prefs.h +++ b/lib/ephy-prefs.h @@ -31,6 +31,7 @@ G_BEGIN_DECLS /* General */ #define CONF_GENERAL_HOMEPAGE "/apps/epiphany/general/homepage" +#define CONF_URL_SEARCH "/apps/epiphany/general/url_search" #define CONF_ALWAYS_SHOW_TABS_BAR "/apps/epiphany/general/always_show_tabs_bar" #define CONF_WINDOWS_SHOW_TOOLBARS "/apps/epiphany/general/show_toolbars" #define CONF_WINDOWS_SHOW_BOOKMARKS_BAR "/apps/epiphany/general/show_bookmarks_bar" |