]> spindle.queued.net Git - midori/commitdiff
Use first search engine if the default is not set
authorChristian Dywan <christian@twotoasts.de>
Sat, 30 Jan 2010 15:54:38 +0000 (16:54 +0100)
committerChristian Dywan <christian@twotoasts.de>
Sat, 30 Jan 2010 15:54:38 +0000 (16:54 +0100)
midori/main.c
midori/midori-websettings.c
midori/sokoke.c

index f2f5ecdd558b564b305b8ee633ed5e7911c6221d..57ced9f294b3bd824a89d8bc9aebfdfd0b9d60fc 100644 (file)
@@ -1860,6 +1860,17 @@ main (int    argc,
                 error->message);
         g_error_free (error);
     }
+
+    /* Pick first search engine as default if not set */
+    g_object_get (settings, "location-entry-search", &uri, NULL);
+    if (!(uri && *uri) && !katze_array_is_empty (search_engines))
+    {
+        item = katze_array_get_nth_item (search_engines, 0);
+        g_object_set (settings, "location-entry-search",
+                      katze_item_get_uri (item), NULL);
+    }
+    g_free (uri);
+
     bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
     #if HAVE_LIBXML
     katze_assign (config_file, build_config_filename (BOOKMARK_FILE));
index 10e40e890ec0dcafc29de6a29a6011bf456ff51e..0dd6494a61d04f0f5dac2c715a30ad8149649fde 100644 (file)
@@ -737,7 +737,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
                                      "location-entry-search",
                                      _("Location entry Search"),
                                      _("The search to perform inside the location entry"),
-                                     "http://www.google.com/search?q=%s",
+                                     NULL,
                                      flags));
 
     g_object_class_install_property (gobject_class,
index f0dceef068d691d3f163a70aa10e1a1d30c70a38..504dedf002dce22cc49de70b3bfee0f8312d7422 100644 (file)
@@ -556,9 +556,11 @@ gchar* sokoke_search_uri (const gchar* uri,
     gchar* escaped;
     gchar* search;
 
-    g_return_val_if_fail (uri != NULL, NULL);
     g_return_val_if_fail (keywords != NULL, NULL);
 
+    if (!uri)
+        return g_strdup (keywords);
+
     escaped = g_uri_escape_string (keywords, " :/", TRUE);
     if (strstr (uri, "%s"))
         search = g_strdup_printf (uri, escaped);