Goto current song on load

When a song has been loaded, we should scroll to it.
This commit is contained in:
Bryan Schumaker 2010-11-28 14:05:45 -05:00
parent b4f59b0547
commit 7ca735996e
1 changed files with 3 additions and 2 deletions

View File

@ -39,6 +39,7 @@ class ListView(gtk.TreeView):
def __init__(self, is_visible, right_click):
gtk.TreeView.__init__(self)
self.list = List()
event.invite("POSTLOAD", self.goto)
for index, label in enumerate(cols):
col = Column(index, label)
@ -89,13 +90,13 @@ class ListView(gtk.TreeView):
self.set_model(self.filter_model)
self.thaw_child_notify()
def goto(self):
def goto(self, *args):
id = sources.cur_lib_id
if id == -1:
return
for index, row in enumerate(self.filter_model):
if row[0] == id:
path = index - 10
path = index - 3
if path < 0:
path = 0
self.scroll_to_cell(path, None, True, 0, 0)