[gnome-tweak-tool] Improve search
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] Improve search
- Date: Sat, 20 Aug 2011 23:41:49 +0000 (UTC)
commit 66e9c1ca4fbd93e186ba9f789e629d38b775c832
Author: John Stowers <john stowers gmail com>
Date: Sun Aug 21 11:40:39 2011 +1200
Improve search
https://bugzilla.gnome.org/show_bug.cgi?id=656975
gtweak/tweakmodel.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gtweak/tweakmodel.py b/gtweak/tweakmodel.py
index f7d1dbe..d67ce5a 100644
--- a/gtweak/tweakmodel.py
+++ b/gtweak/tweakmodel.py
@@ -36,6 +36,8 @@ class Tweak:
self.description = description
self.group_name = options.get("group_name",_("Miscellaneous"))
+ self._search_cache = None
+
#FIXME: I would have rather done this as a GObject signal, but it
#would prohibit other tweaks from inheriting from GtkWidgets
self._notify_cb = None
@@ -49,7 +51,11 @@ class Tweak:
return None
def search_matches(self, txt):
- return txt in self.name or txt in self.description
+ if self._search_cache == None:
+ self._search_cache = set([i.strip(" .,\n'\"").lower() for j in (
+ self.name.split(' '),self.description.split(' ')) for i in j])
+
+ return txt.strip().lower() in self._search_cache
def set_notify_cb(self, func):
self._notify_cb = func
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]