From c43d887747e3545fdccfbfc73bc9a1111696b555 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 30 Jan 2010 16:54:38 +0100 Subject: [PATCH] Use first search engine if the default is not set --- midori/main.c | 11 +++++++++++ midori/midori-websettings.c | 2 +- midori/sokoke.c | 4 +++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/midori/main.c b/midori/main.c index f2f5ecdd..57ced9f2 100644 --- a/midori/main.c +++ b/midori/main.c @@ -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)); diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c index 10e40e89..0dd6494a 100644 --- a/midori/midori-websettings.c +++ b/midori/midori-websettings.c @@ -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, diff --git a/midori/sokoke.c b/midori/sokoke.c index f0dceef0..504dedf0 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -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); -- 2.39.5