rind: Have the node view look for the child-inserted notification
The child-inserted notification is more specific than node-inserted, and carries the child's path with it as an argument. This saves some work on the UI side, and avoids potential deadlocks. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
a8cd9a84f3
commit
440f0901f4
|
@ -53,7 +53,7 @@ class TestNodeTreeView(unittest.TestCase):
|
|||
self.assertFalse(view.Entry.is_visible())
|
||||
self.assertFalse(view.Separator.is_visible())
|
||||
|
||||
def test_node_inserted(self):
|
||||
def test_child_inserted(self):
|
||||
path = os.path.abspath("./trier/Test Library/Test Artist 01")
|
||||
library = curds.playlist.lookup("Libraries")
|
||||
user = curds.playlist.lookup("Playlists")
|
||||
|
@ -70,6 +70,7 @@ class TestNodeTreeView(unittest.TestCase):
|
|||
|
||||
library.lookup(path)
|
||||
curds.playlist.library.join()
|
||||
gtk.main_loop()
|
||||
|
||||
for child in curds.playlist.Root.children:
|
||||
crow = Gtk.TreePath(child.get_path())
|
||||
|
|
|
@ -74,13 +74,12 @@ def visible_func(model, iter, data):
|
|||
Filter.set_visible_func(visible_func)
|
||||
|
||||
|
||||
def on_node_inserted(plist, index):
|
||||
if isinstance(plist, curds.playlist.Library):
|
||||
child = Gtk.TreePath(plist.get_path())
|
||||
path = Filter.convert_child_path_to_path(child)
|
||||
TreeView.expand_to_path(path)
|
||||
def on_child_inserted(child, path):
|
||||
if isinstance(child, curds.playlist.Library):
|
||||
fpath = Filter.convert_child_path_to_path(Gtk.TreePath(path))
|
||||
TreeView.expand_to_path(fpath)
|
||||
|
||||
curds.notify.register("node-inserted", on_node_inserted, idle=True)
|
||||
curds.notify.register("child-inserted", on_child_inserted, idle=True)
|
||||
|
||||
|
||||
def on_show_more(visible):
|
||||
|
@ -99,5 +98,5 @@ def reset():
|
|||
Filter.clear_cache()
|
||||
on_show_more(False)
|
||||
TreeView.set_model(Filter)
|
||||
curds.notify.register("show-more", on_show_more)
|
||||
curds.notify.register("node-inserted", on_node_inserted, idle=True)
|
||||
curds.notify.register("show-more", on_show_more)
|
||||
curds.notify.register("child-inserted", on_child_inserted, idle=True)
|
||||
|
|
Loading…
Reference in New Issue