From da8629db97b325e24fe4a2e5cdf5cb2207a4890f Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 24 Aug 2010 01:34:27 +0100 Subject: [PATCH] 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 file changed, 7 insertions(+) diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py index 11df17a67..c083fad76 100644 --- a/deluge/ui/gtkui/listview.py +++ b/deluge/ui/gtkui/listview.py @@ -173,6 +173,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) @@ -599,3 +602,7 @@ class ListView: pixbuf=0, text=1) 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())