]> spindle.queued.net Git - midori/commitdiff
Fold strings before matching to improve the comparabillity
authorChristian Dywan <christian@twotoasts.de>
Sat, 21 Nov 2009 06:17:45 +0000 (07:17 +0100)
committerChristian Dywan <christian@twotoasts.de>
Sat, 21 Nov 2009 06:17:45 +0000 (07:17 +0100)
midori/midori-locationaction.c

index 7d30ac69b95065c5758a3232f44e9cbf0251c196..a99d7eb72fa0943b38e4aca28f16ae04dc371493 100644 (file)
@@ -736,6 +736,7 @@ midori_location_entry_completion_match_cb (GtkEntryCompletion* completion,
     gchar* title;
     gboolean match;
     gchar* temp;
+    gchar* ftemp;
 
     model = gtk_entry_completion_get_model (completion);
     gtk_tree_model_get (model, iter, URI_COL, &uri, TITLE_COL, &title, -1);
@@ -744,18 +745,24 @@ midori_location_entry_completion_match_cb (GtkEntryCompletion* completion,
     if (G_LIKELY (uri))
     {
         gchar* ckey = g_utf8_collate_key (key, -1);
+        gchar* fkey = g_utf8_casefold (ckey, -1);
+        g_free (ckey);
         temp = g_utf8_collate_key (uri, -1);
-        match = (strstr (temp, ckey) != NULL);
+        ftemp = g_utf8_casefold (temp, -1);
         g_free (temp);
+        match = (strstr (ftemp, fkey) != NULL);
+        g_free (ftemp);
         g_free (uri);
 
         if (!match && G_LIKELY (title))
         {
             temp = g_utf8_collate_key (title, -1);
-            match = (strstr (temp, ckey) != NULL);
+            ftemp = g_utf8_casefold (temp, -1);
             g_free (temp);
+            match = (strstr (ftemp, fkey) != NULL);
+            g_free (ftemp);
         }
-        g_free (ckey);
+        g_free (fkey);
     }
 
     g_free (title);
@@ -1423,9 +1430,11 @@ midori_location_action_set_search_engines (MidoriLocationAction* location_action
         completion = gtk_entry_get_completion (GTK_ENTRY (child));
         i = 0;
         if (location_action->search_engines)
-        while ((item = katze_array_get_nth_item (location_action->search_engines, i++)))
-            gtk_entry_completion_delete_action (completion, 0);
-        midori_location_action_add_actions (completion, search_engines);
+        {
+            while ((item = katze_array_get_nth_item (location_action->search_engines, i++)))
+                gtk_entry_completion_delete_action (completion, 0);
+            midori_location_action_add_actions (completion, search_engines);
+        }
     }
 
     katze_object_assign (location_action->search_engines, search_engines);