]> spindle.queued.net Git - midori/commitdiff
Only set search in the browser if we have any search engines
authorChristian Dywan <christian@twotoasts.de>
Sat, 21 Nov 2009 05:36:35 +0000 (06:36 +0100)
committerChristian Dywan <christian@twotoasts.de>
Sat, 21 Nov 2009 05:36:35 +0000 (06:36 +0100)
This fixes the test case which broke when we made settings obligatory.

midori/midori-browser.c

index 2a8f96a123f34ff810ff65ff53ef99c49f942e34..be6925af7a6499f58111facbde7122fd7003aeff 100644 (file)
@@ -6446,19 +6446,22 @@ midori_browser_set_property (GObject*      object,
             _action_by_name (browser, "Search")), browser->search_engines);
         /* FIXME: Connect to updates */
 
-        g_object_get (browser->settings, "last-web-search", &last_web_search, NULL);
-        item = katze_array_get_nth_item (browser->search_engines, last_web_search);
-        midori_search_action_set_current_item (MIDORI_SEARCH_ACTION (
-            _action_by_name (browser, "Search")), item);
-
-        i = 0;
-        while ((item = katze_array_get_nth_item (browser->search_engines, i++)))
-            if (!g_strcmp0 (katze_item_get_uri (item), browser->location_entry_search))
-            {
-                midori_search_action_set_default_item (MIDORI_SEARCH_ACTION (
+        if (browser->search_engines)
+        {
+            g_object_get (browser->settings, "last-web-search", &last_web_search, NULL);
+            item = katze_array_get_nth_item (browser->search_engines, last_web_search);
+            midori_search_action_set_current_item (MIDORI_SEARCH_ACTION (
                 _action_by_name (browser, "Search")), item);
-                break;
-            }
+
+            i = 0;
+            while ((item = katze_array_get_nth_item (browser->search_engines, i++)))
+                if (!g_strcmp0 (katze_item_get_uri (item), browser->location_entry_search))
+                {
+                    midori_search_action_set_default_item (MIDORI_SEARCH_ACTION (
+                    _action_by_name (browser, "Search")), item);
+                    break;
+                }
+        }
         break;
     }
     case PROP_HISTORY: