Module: deluge
Branch: 1.3-stable
Commit: 69956ad1db99d191a2afa37c52c7a2a972f9821b

Author: Pedro Algarvio <[email protected]>
Date:   Tue Aug 24 01:34:27 2010 +0100

Implemented search as you type capabilities to the treeview, ie, when the
treeview has focus and user starts typing, select the first matching
torrent name.

---

 deluge/ui/gtkui/listview.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py
index cc2b8be..bdf8d35 100644
--- a/deluge/ui/gtkui/listview.py
+++ b/deluge/ui/gtkui/listview.py
@@ -182,6 +182,9 @@ class ListView:
         else:
             self.treeview = gtk.TreeView()
 
+        self.treeview.set_enable_search(True)
+        self.treeview.set_search_equal_func(self.on_keypress_search_by_name)
+
         if state_file:
             self.load_state(state_file)
 
@@ -605,3 +608,7 @@ class ListView:
                         function=function, pixbuf=0, text=1, default=default)
 
         return True
+
+    def on_keypress_search_by_name(self, model, columnn, key, iter):
+        TORRENT_NAME_COL = 5
+        return not 
model[iter][TORRENT_NAME_COL].lower().startswith(key.lower())

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to