[epiphany] Add setting to disable autosearch



commit 7e96228e7aa11e5d1ebce3d292e98d98fee802b6
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Wed Nov 1 13:15:37 2017 -0500

    Add setting to disable autosearch
    
    On some intranets, it's important to be able to load domains with no
    dot, e.g. example/something. But currently this triggers a web search if
    the protocol is not explicitly specified, e.g. http://example/something.
    Some users would rather disable autosearch rather than have to type out
    http:// all the time, so add a hidden setting to cater to them.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=789776

 data/org.gnome.epiphany.gschema.xml |    4 ++++
 embed/ephy-embed-utils.c            |    4 ++++
 lib/ephy-prefs.h                    |    7 ++++++-
 3 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index bb882eb..ad3d48e 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -230,6 +230,10 @@
                <key type="d" name="default-zoom-level">
                        <default>1.0</default>
                        <summary>Default zoom level for new pages</summary>
+               <key type="b" name="enable-autosearch">
+                       <default>true</default>
+                       <summary>Enable autosearch</summary>
+                       <description>Whether to automatically search the web when something that does not 
look like a URL is entered in the address bar. If this setting is disabled, everything will be loaded as a 
URL unless a search engine is explicitly selected from the dropdown menu.</description>
                </key>
        </schema>
        <schema id="org.gnome.Epiphany.state">
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
index ea2e0db..2399ef8 100644
--- a/embed/ephy-embed-utils.c
+++ b/embed/ephy-embed-utils.c
@@ -25,6 +25,7 @@
 #include "ephy-embed-utils.h"
 
 #include "ephy-about-handler.h"
+#include "ephy-prefs.h"
 #include "ephy-settings.h"
 #include "ephy-string.h"
 
@@ -276,6 +277,9 @@ ephy_embed_utils_autosearch_address (const char *search_key)
   EphyEmbedShell *shell;
   EphySearchEngineManager *search_engine_manager;
 
+  if (!g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_ENABLE_AUTOSEARCH))
+    return g_strdup (search_key);
+
   shell = ephy_embed_shell_get_default ();
   search_engine_manager = ephy_embed_shell_get_search_engine_manager (shell);
   address_search = ephy_search_engine_manager_get_default_search_address (search_engine_manager);
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 3f4ac1c..867e46f 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -101,7 +101,11 @@ static const char * const ephy_prefs_state_schema[] = {
 #define EPHY_PREFS_WEB_ENABLE_SITE_SPECIFIC_QUIRKS "enable-site-specific-quirks"
 #define EPHY_PREFS_WEB_ENABLE_SAFE_BROWSING        "enable-safe-browsing"
 #define EPHY_PREFS_WEB_GSB_API_KEY                 "gsb-api-key"
+<<<<<<< HEAD
 #define EPHY_PREFS_WEB_DEFAULT_ZOOM_LEVEL          "default-zoom-level"
+=======
+#define EPHY_PREFS_WEB_ENABLE_AUTOSEARCH           "enable-autosearch"
+>>>>>>> Add setting to disable autosearch
 
 static const char * const ephy_prefs_web_schema[] = {
   EPHY_PREFS_WEB_FONT_MIN_SIZE,
@@ -126,7 +130,8 @@ static const char * const ephy_prefs_web_schema[] = {
   EPHY_PREFS_WEB_ENABLE_SITE_SPECIFIC_QUIRKS,
   EPHY_PREFS_WEB_ENABLE_SAFE_BROWSING,
   EPHY_PREFS_WEB_GSB_API_KEY,
-  EPHY_PREFS_WEB_DEFAULT_ZOOM_LEVEL
+  EPHY_PREFS_WEB_DEFAULT_ZOOM_LEVEL,
+  EPHY_PREFS_WEB_ENABLE_AUTOSEARCH
 };
 
 #define EPHY_PREFS_SCHEMA                             "org.gnome.Epiphany"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]