[gnome-music/wip/gbsneto/contained-playlists: 26/35] playlists: Various fixups to playlist handling



commit db4c4a80d3db02bb93a5a74010eec0849d645441
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Dec 1 17:45:14 2016 -0200

    playlists: Various fixups to playlist handling
    
    Since we're wrapping the Grilo code in the Playlist code
    and making it transparent to the rest of the application,
    the entirety of the Playlists class should try as hard as
    it can to use that.
    
    This fixes some aborts and errors all around.

 gnomemusic/playlists.py |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/gnomemusic/playlists.py b/gnomemusic/playlists.py
index c9e9b4c..4949635 100644
--- a/gnomemusic/playlists.py
+++ b/gnomemusic/playlists.py
@@ -165,10 +165,10 @@ class Playlists(GObject.GObject):
         'playlist-deleted': (GObject.SignalFlags.RUN_FIRST, None, (Playlist,)),
         'playlist-updated': (GObject.SignalFlags.RUN_FIRST, None, (Playlist,)),
         'song-added-to-playlist': (
-            GObject.SignalFlags.RUN_FIRST, None, (Grl.Media, Grl.Media)
+            GObject.SignalFlags.RUN_FIRST, None, (Playlist, Grl.Media)
         ),
         'song-removed-from-playlist': (
-            GObject.SignalFlags.RUN_FIRST, None, (Grl.Media, Grl.Media)
+            GObject.SignalFlags.RUN_FIRST, None, (Playlist, Grl.Media)
         ),
     }
 
@@ -403,19 +403,15 @@ class Playlists(GObject.GObject):
                 new_playlist.grilo_item = item
 
                 self.playlists[new_playlist] = new_playlist
-                self.emit('playlist-added', playlist)
+                self.emit('playlist-added', new_playlist)
 
         def cursor_callback(cursor, res, data):
             try:
-                has_next = cursor.next_finish()
+                cursor.next_finish(res)
             except GLib.Error as err:
                 logger.warn("Error: %s, %s", err.__class__, err)
                 return
 
-            if has_next:
-                cursor.next_async(None, cursor_callback, data)
-                return
-
             playlist_id = cursor.get_integer(0)
             grilo.get_playlist_with_id(playlist_id, get_callback)
 
@@ -470,7 +466,7 @@ class Playlists(GObject.GObject):
                 return
             entry_id = cursor.get_integer(0)
             grilo.get_playlist_song_with_id(
-                playlist.get_id(), entry_id, get_callback
+                playlist.id, entry_id, get_callback
             )
 
         def update_callback(conn, res, data):
@@ -485,7 +481,7 @@ class Playlists(GObject.GObject):
             if not uri:
                 continue
             self.tracker.update_blank_async(
-                Query.add_song_to_playlist(playlist.get_id(), uri),
+                Query.add_song_to_playlist(playlist.id, uri),
                 GLib.PRIORITY_LOW,
                 None, update_callback, None
             )


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]