[gnome-music/wip/mschraal/assorted-cleanups: 1/18] grltrackerplaylist: Drop coremodel argument



commit 838e1dcfae882a0b8c6ef47482c07572d0d92341
Author: Marinus Schraal <mschraal gnome org>
Date:   Tue Dec 24 11:02:45 2019 +0100

    grltrackerplaylist: Drop coremodel argument
    
    CoreModel is provided through Application.

 gnomemusic/grilowrappers/grltrackerplaylists.py | 17 +++++------------
 gnomemusic/grilowrappers/grltrackerwrapper.py   |  2 +-
 2 files changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/gnomemusic/grilowrappers/grltrackerplaylists.py b/gnomemusic/grilowrappers/grltrackerplaylists.py
index 70150ec7..cec02289 100644
--- a/gnomemusic/grilowrappers/grltrackerplaylists.py
+++ b/gnomemusic/grilowrappers/grltrackerplaylists.py
@@ -54,13 +54,10 @@ class GrlTrackerPlaylists(GObject.GObject):
         Grl.METADATA_KEY_URL
     ]
 
-    def __init__(
-            self, source, coremodel, application, tracker_wrapper, songs_hash):
+    def __init__(self, source, application, tracker_wrapper, songs_hash):
         """Initialize GrlTrackerPlaylists.
 
         :param Grl.TrackerSource source: The Tracker source to wrap
-        :param CoreModel coremodel: CoreModel instance to use models
-                                    from
         :param Application application: Application instance
         :param TrackerWrapper tracker_wrapper: The TrackerWrapper
                                                instance
@@ -69,7 +66,7 @@ class GrlTrackerPlaylists(GObject.GObject):
         super().__init__()
 
         self._application = application
-        self._coremodel = coremodel
+        self._coremodel = application.props.coremodel
         self._log = application.props.log
         self._source = source
         self._model = self._coremodel.props.playlists
@@ -146,10 +143,8 @@ class GrlTrackerPlaylists(GObject.GObject):
             return
 
         playlist = Playlist(
-            media=media, source=self._source, coremodel=self._coremodel,
-            application=self._application,
+            media=media, source=self._source, application=self._application,
             tracker_wrapper=self._tracker_wrapper, songs_hash=self._songs_hash)
-
         self._model.append(playlist)
         callback = data
         if callback is not None:
@@ -304,8 +299,7 @@ class Playlist(GObject.GObject):
 
     def __init__(
             self, media=None, query=None, tag_text=None, source=None,
-            coremodel=None, application=None, tracker_wrapper=None,
-            songs_hash=None):
+            application=None, tracker_wrapper=None, songs_hash=None):
         super().__init__()
         """Initialize a playlist
 
@@ -314,7 +308,6 @@ class Playlist(GObject.GObject):
        :param string tag_text: The non translatable unique identifier
             of the playlist
        :param Grl.Source source: The Grilo Tracker source object
-       :param CoreModel coremodel: The CoreModel instance
        :param Application application: The Application instance
        :param TrackerWrapper tracker_wrapper: The TrackerWrapper instance
        :param dict songs_hash: The songs hash table
@@ -332,7 +325,7 @@ class Playlist(GObject.GObject):
         self._application = application
         self._model = None
         self._source = source
-        self._coremodel = coremodel
+        self._coremodel = application.props.coremodel
         self._coreselection = application.props.coreselection
         self._log = application.props.log
         self._songs_hash = songs_hash
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index 9822dc0f..7c22accf 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -385,7 +385,7 @@ class GrlTrackerWrapper(GObject.GObject):
                 # songs model fill, the playlists expect a filled songs
                 # hashtable.
                 self._tracker_playlists = GrlTrackerPlaylists(
-                    self.props.source, self._coremodel, self._application,
+                    self.props.source, self._application,
                     self._tracker_wrapper, self._hash)
 
                 return


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