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.
This commit is contained in:
Pedro Algarvio 2010-08-24 01:34:27 +01:00 committed by Calum Lind
parent 1e274cfb48
commit 69956ad1db
1 changed files with 7 additions and 0 deletions

View File

@ -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())