Made the DBus functions aware of whether or not they are recieving futures

This commit is contained in:
Sumner Evans
2019-12-28 12:54:04 -07:00
parent f84f97732d
commit 2804bba34d
2 changed files with 40 additions and 20 deletions

View File

@@ -317,7 +317,14 @@ class SublimeMusicApp(Gtk.Application):
)
def get_playlists(index, max_count, order, reverse_order):
playlists = CacheManager.get_playlists().result()
playlists_result = CacheManager.get_playlists()
if playlists_result.is_future:
# We don't want to wait for the response in this case, so just
# return an empty array.
return GLib.Variant('(a(oss))', ([], ))
playlists = playlists_result.result()
sorters = {
'Alphabetical': lambda p: p.name,
'Created': lambda p: p.created,