[dconf] editor: Search key values and descriptions



commit 344bdb99b8ef2be5361a4af18d6ab7ace9a07e44
Author: Robert Ancell <robert ancell canonical com>
Date:   Mon Oct 1 10:42:58 2012 +1300

    editor: Search key values and descriptions
    
    https://bugzilla.gnome.org/show_bug.cgi?id=677652

 editor/dconf-editor.vala |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/editor/dconf-editor.vala b/editor/dconf-editor.vala
index 5a7cf8f..4721d25 100644
--- a/editor/dconf-editor.vala
+++ b/editor/dconf-editor.vala
@@ -322,7 +322,7 @@ class ConfigurationEditor : Gtk.Application
                 do
                 {
                     var key = dir.key_model.get_key(key_iter);
-                    if (key.name.index_of(search_entry.text) >= 0)
+                    if (key_matches(key, search_entry.text))
                     {
                         dir_tree_view.expand_to_path(model.get_path(iter));
                         dir_tree_view.get_selection().select_iter(iter);
@@ -339,6 +339,28 @@ class ConfigurationEditor : Gtk.Application
         search_label.set_text(_("Not found"));
     }
 
+    private bool key_matches (Key key, string text)
+    {
+        /* Check key name */
+        if (key.name.index_of(text) >= 0)
+            return true;
+
+        /* Check key schema (description) */
+        if (key.schema != null)
+        {
+            if (key.schema.summary != null && key.schema.summary.index_of(text) >= 0)
+                return true;
+            if (key.schema.description != null && key.schema.description.index_of(text) >= 0)
+                return true;
+        }
+
+        /* Check key value */
+        if (key.value.is_of_type(VariantType.STRING) && key.value.get_string().index_of(text) >= 0)
+            return true;
+
+        return false;
+    }
+
     private bool get_next_iter(ref Gtk.TreeIter iter)
     {
         /* Search children next */



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