rind: Listen for the "playlist-changed" notification
We ask for the notification to be placed on the queue so multiple changes to the same playlist will get batched together. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
b5c15598bc
commit
791e126ace
|
@ -8,7 +8,7 @@ from gi.repository import GObject, Gtk, GLib
|
|||
class ManagerModel(GObject.GObject, Gtk.TreeModel):
|
||||
def __init__(self, *args, **kwargs):
|
||||
GObject.GObject.__init__(self)
|
||||
curds.notify.register("add-track", self.on_add_track, queue=True)
|
||||
curds.notify.register("playlist-changed", self.on_playlist_changed, queue=True)
|
||||
curds.notify.register("new-playlist", self.on_new_playlist, queue=True)
|
||||
|
||||
def can_select_path(self, selection, model, path, current):
|
||||
|
@ -101,7 +101,7 @@ class ManagerModel(GObject.GObject, Gtk.TreeModel):
|
|||
valid = plist != None and plist != curds.PlaylistManager
|
||||
return (True, iter) if valid else (False, None)
|
||||
|
||||
def on_add_track(self, plist, track, index):
|
||||
def on_playlist_changed(self, plist):
|
||||
iter = self.playlist_iter(plist)
|
||||
if iter:
|
||||
self.row_changed(self.get_path(iter), iter)
|
||||
|
|
|
@ -15,7 +15,7 @@ test_album2 = os.path.abspath("./trier/Test Library/Test Artist 02/Test Album 2"
|
|||
class TestManager(unittest.TestCase):
|
||||
def setUp(self):
|
||||
curds.reset()
|
||||
curds.notify.register("add-track", manager.MgrModel.on_add_track, queue=True)
|
||||
curds.notify.register("playlist-changed", manager.MgrModel.on_playlist_changed, queue=True)
|
||||
curds.notify.register("new-playlist", manager.MgrModel.on_new_playlist, queue=True)
|
||||
|
||||
self.model = manager.ManagerModel()
|
||||
|
|
Loading…
Reference in New Issue