[gnome-music/wip/mschraal/assorted-cleanups: 10/12] coreartist: Pass Application to init



commit 813bf6efafb863ddd25d5f07d7caa58a2ffa9b9d
Author: Marinus Schraal <mschraal gnome org>
Date:   Thu Mar 26 13:21:46 2020 +0100

    coreartist: Pass Application to init

 gnomemusic/coreartist.py                      | 9 +++++++--
 gnomemusic/grilowrappers/grltrackerwrapper.py | 4 ++--
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/coreartist.py b/gnomemusic/coreartist.py
index 4a37d04f..b00a5e29 100644
--- a/gnomemusic/coreartist.py
+++ b/gnomemusic/coreartist.py
@@ -37,11 +37,16 @@ class CoreArtist(GObject.GObject):
     artist = GObject.Property(type=str)
     media = GObject.Property(type=Grl.Media)
 
-    def __init__(self, media, coremodel):
+    def __init__(self, application, media):
+        """Initiate the CoreArtist object
+
+        :param Application application: The application object
+        :param Grl.Media media: A media object
+        """
         super().__init__()
 
         self._cached_thumbnail_uri = None
-        self._coremodel = coremodel
+        self._coremodel = application.props.coremodel
         self._model = None
         self._selected = False
         self._thumbnail = None
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index a91c2b56..2ef0a390 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -281,7 +281,7 @@ class GrlTrackerWrapper(GObject.GObject):
             if media.get_id() in self._artist_ids.keys():
                 artist = self._artist_ids[media.get_id()]
             else:
-                artist = CoreArtist(media, self._coremodel)
+                artist = CoreArtist(self._application, media)
 
             artist_ids[media.get_id()] = artist
 
@@ -500,7 +500,7 @@ class GrlTrackerWrapper(GObject.GObject):
                 self._window.notifications_popup.pop_loading()
                 return
 
-            artist = CoreArtist(media, self._coremodel)
+            artist = CoreArtist(self._application, media)
             self._artist_ids[media.get_id()] = artist
             artists_added.append(artist)
             if len(artists_added) == self._SPLICE_SIZE:


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