rind: Allow new-playlist notifications to run in other threads
We really need the UI to know about playlists as early as possible, so send that notification as soon as playlists are allocated to avoid potential ordering issues with the track scanning thread. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
0e6b788af1
commit
786ed226fe
|
@ -8,8 +8,8 @@ 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("new-playlist", self.on_new_playlist)
|
||||
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):
|
||||
plist = self.iter_playlist(self.get_iter(path))
|
||||
|
@ -107,13 +107,14 @@ class ManagerModel(GObject.GObject, Gtk.TreeModel):
|
|||
self.row_changed(self.get_path(iter), iter)
|
||||
|
||||
def on_new_playlist(self, plist, index, first):
|
||||
parent = self.playlist_iter(curds.PlaylistManager.parent(plist))
|
||||
child = self.iter_nth_child(parent, index)
|
||||
self.row_inserted(self.get_path(child), child)
|
||||
if parent != None and first == True:
|
||||
self.row_has_child_toggled(self.get_path(parent), parent)
|
||||
parent = curds.PlaylistManager.parent(plist)
|
||||
iter = self.playlist_iter(plist)
|
||||
self.row_inserted(self.get_path(iter), iter)
|
||||
if parent and first == True:
|
||||
piter = self.playlist_iter(parent)
|
||||
self.row_has_child_toggled(self.get_path(piter), piter)
|
||||
if isinstance(plist, curds.LibraryPlaylist):
|
||||
Treeview.expand_to_path(self.get_path(child))
|
||||
Treeview.expand_to_path(self.get_path(iter))
|
||||
|
||||
def on_selection_changed(self, selection):
|
||||
(model, rows) = selection.get_selected_rows()
|
||||
|
|
Loading…
Reference in New Issue