[gnome-music/wip/mschraal/core] coremodel: Reuse CoreAlbums for	artist view
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gnome-music/wip/mschraal/core] coremodel: Reuse CoreAlbums for	artist view
- Date: Sun, 23 Jun 2019 23:57:53 +0000 (UTC)
commit d33fdea51dcf6fc05219ec277b62598fb5e04e18
Author: Marinus Schraal <mschraal gnome org>
Date:   Sun Jun 23 21:40:42 2019 +0200
    coremodel: Reuse CoreAlbums for artist view
 gnomemusic/coremodel.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index 9ca0374e..ff212506 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -127,7 +127,16 @@ class CoreModel(GObject.GObject):
         albums_model_sort = Gfm.SortListModel.new(albums_model)
 
         for album in albums:
-            artist_album = CoreAlbum(album, self)
+            artist_album = None
+            for corealbum in self._album_model:
+                if album.get_id() == corealbum.props.media.get_id():
+                    artist_album = corealbum
+                    break
+
+            if artist_album is None:
+                artist_album = CoreAlbum(album, self)
+                self._album_model.append(artist_album)
+
             albums_model.append(artist_album)
 
         return albums_model
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]