summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2012-10-01 10:42:58 +1300
committerRobert Ancell <robert.ancell@canonical.com>2012-10-01 10:42:58 +1300
commit344bdb99b8ef2be5361a4af18d6ab7ace9a07e44 (patch)
tree8eea4b3b6d53e5a8f2fa1dd06a66e68a1b0cdda6
parent9d3f6ae7c732a82ff1f6084b43425691cdde9d48 (diff)
downloaddconf-344bdb99b8ef2be5361a4af18d6ab7ace9a07e44.tar.gz
editor: Search key values and descriptions
https://bugzilla.gnome.org/show_bug.cgi?id=677652
-rw-r--r--editor/dconf-editor.vala24
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 */