[dconf-editor] Ignore case in search.



commit b2b87405deb2da7322ba09f6640e0c44b22d7fc6
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Sep 21 15:08:39 2018 +0200

    Ignore case in search.
    
    Closes issue #5.

 editor/registry-search.vala | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/editor/registry-search.vala b/editor/registry-search.vala
index a173726..ee6ed08 100644
--- a/editor/registry-search.vala
+++ b/editor/registry-search.vala
@@ -265,7 +265,7 @@ private class RegistrySearch : RegistryList
             SimpleSettingObject? item = (SimpleSettingObject?) list_model.get_item (i);
             if (item == null)
                 assert_not_reached ();
-            if (!(term in ((!) item).name))
+            if (!(term.casefold () in ((!) item).casefolded_name))
             {
                 post_local--;
                 post_paths--;
@@ -310,8 +310,8 @@ private class RegistrySearch : RegistryList
             SimpleSettingObject? item = (SimpleSettingObject?) list_model.get_item (i);
             if (item == null)
                 assert_not_reached ();
-            string name = ((!) item).name;
-            if (!(term in name)
+            string name = ((!) item).casefolded_name;
+            if (!(term.casefold () in name)
              || (((!) item).is_search && term == name))
             {
                 post_bookmarks--;
@@ -326,13 +326,13 @@ private class RegistrySearch : RegistryList
         for (int i = (int) list_model.get_n_items () - 1; i >= post_folders; i--)
         {
             SimpleSettingObject item = (SimpleSettingObject) list_model.get_item (i);
-            if (!(term in item.name))
+            if (!(term.casefold () in item.casefolded_name))
                 list_model.remove (i);
         }
         for (int i = post_folders - 1; i >= post_bookmarks; i--)
         {
             SimpleSettingObject item = (SimpleSettingObject) list_model.get_item (i);
-            if (!(term in item.name))
+            if (!(term.casefold () in item.casefolded_name))
             {
                 post_folders--;
                 list_model.remove (i);
@@ -355,7 +355,7 @@ private class RegistrySearch : RegistryList
         string name;
         while (iter.next ("(qs)", out context_id, out name))
         {
-            if (term in name)
+            if (term.casefold () in name.casefold ())
             {
                 SimpleSettingObject sso = new SimpleSettingObject.from_base_path (context_id, name, 
current_path);
                 list_model.insert_sorted (sso, compare);
@@ -422,7 +422,7 @@ private class RegistrySearch : RegistryList
                 is_search = false;
             }
 
-            if (term in name)
+            if (term.casefold () in name.casefold ())
             {
                 SimpleSettingObject sso = new SimpleSettingObject.from_full_name (context_id, name, 
bookmark, is_search);
                 list_model.insert (post_bookmarks, sso);
@@ -484,7 +484,7 @@ private class RegistrySearch : RegistryList
             if (ModelUtils.is_folder_context_id (context_id))
             {
                 string full_name = ModelUtils.recreate_full_name (next, name, true);
-                if (!local_again && !(full_name in bookmarks) && term in name)
+                if (!local_again && !(full_name in bookmarks) && term.casefold () in name.casefold ())
                 {
                     SimpleSettingObject sso = new SimpleSettingObject.from_full_name (context_id, name, 
full_name);
                     list_model.insert (post_folders++, sso); // do not move the ++ outside
@@ -494,7 +494,7 @@ private class RegistrySearch : RegistryList
             else
             {
                 string full_name = ModelUtils.recreate_full_name (next, name, false);
-                if (!local_again && !(full_name in bookmarks) && term in name)
+                if (!local_again && !(full_name in bookmarks) && term.casefold () in name.casefold ())
                 {
                     SimpleSettingObject sso = new SimpleSettingObject.from_base_path (context_id, name, 
next);
                     list_model.append (sso);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]