Use first search engine if the default is not set

This commit is contained in:
Christian Dywan 2010-01-30 16:54:38 +01:00
parent 3d01b7b0c3
commit c43d887747
3 changed files with 15 additions and 2 deletions

View file

@ -1860,6 +1860,17 @@ main (int argc,
error->message); error->message);
g_error_free (error); 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); bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
#if HAVE_LIBXML #if HAVE_LIBXML
katze_assign (config_file, build_config_filename (BOOKMARK_FILE)); katze_assign (config_file, build_config_filename (BOOKMARK_FILE));

View file

@ -737,7 +737,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
"location-entry-search", "location-entry-search",
_("Location entry Search"), _("Location entry Search"),
_("The search to perform inside the location entry"), _("The search to perform inside the location entry"),
"http://www.google.com/search?q=%s", NULL,
flags)); flags));
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,

View file

@ -556,9 +556,11 @@ gchar* sokoke_search_uri (const gchar* uri,
gchar* escaped; gchar* escaped;
gchar* search; gchar* search;
g_return_val_if_fail (uri != NULL, NULL);
g_return_val_if_fail (keywords != NULL, NULL); g_return_val_if_fail (keywords != NULL, NULL);
if (!uri)
return g_strdup (keywords);
escaped = g_uri_escape_string (keywords, " :/", TRUE); escaped = g_uri_escape_string (keywords, " :/", TRUE);
if (strstr (uri, "%s")) if (strstr (uri, "%s"))
search = g_strdup_printf (uri, escaped); search = g_strdup_printf (uri, escaped);