[gnome-music/wip/jfelder/new-artist-design: 25/26] artistalbumswidget: Use AlbumWidget instead of ArtistAlbumWidget




commit e6cd2219e2a7b2da2646fbfdf1ab1e9a0f04ecbb
Author: Jean Felder <jfelder src gnome org>
Date:   Fri Jul 30 18:48:41 2021 +0200

    artistalbumswidget: Use AlbumWidget instead of ArtistAlbumWidget
    
    With the latest mockups, the AlbumWidget and the ArtistAlbumWidget
    become very similar. The are mainly two differences:
    - the visibility of the artist label
    - the playlist that needs when a song is activated
    
    The change introduced in the previous commits allow to properly handle
    these differences.

 gnomemusic/widgets/artistalbumswidget.py | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)
---
diff --git a/gnomemusic/widgets/artistalbumswidget.py b/gnomemusic/widgets/artistalbumswidget.py
index 701ff9991..3c3e802a7 100644
--- a/gnomemusic/widgets/artistalbumswidget.py
+++ b/gnomemusic/widgets/artistalbumswidget.py
@@ -24,13 +24,13 @@
 
 from gi.repository import GObject, Gtk
 
-from gnomemusic.widgets.artistalbumwidget import ArtistAlbumWidget
+from gnomemusic.widgets.albumwidget import AlbumWidget
 
 
 class ArtistAlbumsWidget(Gtk.ListBox):
     """Widget containing all albums by an artist
 
-    A vertical list of ArtistAlbumWidget, containing all the albums
+    A vertical list of AlbumWidget, containing all the albums
     by one artist. Contains the model for all the song widgets of
     the album(s).
     """
@@ -62,26 +62,17 @@ class ArtistAlbumsWidget(Gtk.ListBox):
         self.get_style_context().add_class("artist-albums-widget")
         self.props.visible = True
 
-    def _song_activated(self, widget, song_widget):
-        if self.props.selection_mode:
-            return
-
-        coremodel = self._application.props.coremodel
-
-        def _on_playlist_loaded(klass, playlist_type):
-            self._player.play(song_widget.props.coresong)
-            coremodel.disconnect(signal_id)
-
-        signal_id = coremodel.connect("playlist-loaded", _on_playlist_loaded)
-        coremodel.props.active_core_object = self._artist
-
     def _add_album(self, corealbum):
         row = Gtk.ListBoxRow()
         row.props.selectable = False
         row.props.activatable = False
 
-        widget = ArtistAlbumWidget(
-            corealbum, self._songs_grid_size_group, self._cover_size_group)
+        widget = AlbumWidget(
+            self._application, self._songs_grid_size_group,
+            self._cover_size_group)
+        widget.props.corealbum = corealbum
+        widget.props.active_coreobject = self._artist
+        widget.props.show_artist_label = False
 
         self.bind_property(
             'selection-mode', widget, 'selection-mode',
@@ -89,7 +80,6 @@ class ArtistAlbumsWidget(Gtk.ListBox):
             | GObject.BindingFlags.SYNC_CREATE)
 
         row.add(widget)
-        widget.connect("song-activated", self._song_activated)
 
         return row
 


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