[gnome-music/wip/mschraal/core] artistalbumwidget: Cleanup



commit 87dcbd9eb2804a39406d801b892b3ed48a9d2187
Author: Marinus Schraal <mschraal gnome org>
Date:   Sun Jun 23 22:54:28 2019 +0200

    artistalbumwidget: Cleanup

 gnomemusic/widgets/artistalbumswidget.py | 15 +++------------
 gnomemusic/widgets/artistalbumwidget.py  | 22 +++++++---------------
 2 files changed, 10 insertions(+), 27 deletions(-)
---
diff --git a/gnomemusic/widgets/artistalbumswidget.py b/gnomemusic/widgets/artistalbumswidget.py
index 803238d6..761ecad5 100644
--- a/gnomemusic/widgets/artistalbumswidget.py
+++ b/gnomemusic/widgets/artistalbumswidget.py
@@ -131,18 +131,10 @@ class ArtistAlbumsWidget(Gtk.Box):
         )
 
     @log
-    def _on_album_displayed(self, data=None):
-        self._albums_to_load -= 1
-        if self._albums_to_load == 0:
-            self._window.notifications_popup.pop_loading()
-            self.show_all()
-
-    @log
-    def _add_album(self, album):
+    def _add_album(self, corealbum):
         widget = ArtistAlbumWidget(
-            album.props.media, self._player, album.props.model,
-            self._selection_mode_allowed, self._songs_grid_size_group,
-            self._cover_size_group, self._window)
+            corealbum, self._selection_mode_allowed,
+            self._songs_grid_size_group, self._cover_size_group, self._window)
 
         self.bind_property(
             'selection-mode', widget, 'selection-mode',
@@ -152,7 +144,6 @@ class ArtistAlbumsWidget(Gtk.Box):
         self._album_box.pack_start(widget, False, False, 0)
         self._widgets.append(widget)
 
-        widget.connect('songs-loaded', self._on_album_displayed)
         widget.connect("song-activated", self._song_activated)
 
     @log
diff --git a/gnomemusic/widgets/artistalbumwidget.py b/gnomemusic/widgets/artistalbumwidget.py
index d2207f96..3c9cad52 100644
--- a/gnomemusic/widgets/artistalbumwidget.py
+++ b/gnomemusic/widgets/artistalbumwidget.py
@@ -27,7 +27,6 @@ from gi.repository import GObject, Gtk
 from gnomemusic import log
 from gnomemusic.albumartcache import Art
 from gnomemusic.grilo import grilo
-from gnomemusic.player import PlayerPlaylist
 from gnomemusic.widgets.disclistboxwidget import DiscBox
 from gnomemusic.widgets.songwidget import SongWidget
 import gnomemusic.utils as utils
@@ -48,29 +47,24 @@ class ArtistAlbumWidget(Gtk.Box):
 
     __gsignals__ = {
         "song-activated": (GObject.SignalFlags.RUN_FIRST, None, (SongWidget, )),
-        'songs-loaded': (GObject.SignalFlags.RUN_FIRST, None, ()),
     }
 
     def __repr__(self):
         return '<ArtistAlbumWidget>'
 
-    @log
     def __init__(
-            self, media, player, model, selection_mode_allowed,
-            size_group=None, cover_size_group=None, window=None):
+            self, corealbum, selection_mode_allowed, size_group=None,
+            cover_size_group=None, window=None):
         super().__init__(orientation=Gtk.Orientation.HORIZONTAL)
 
         self._size_group = size_group
         self._cover_size_group = cover_size_group
 
-        self._media = media
-        self._album_title = utils.get_album_title(self._media)
-        self._model = model
         self._selection_mode = False
         self._selection_mode_allowed = selection_mode_allowed
 
         self._cover_stack.props.size = Art.Size.MEDIUM
-        self._cover_stack.update(self._media)
+        self._cover_stack.update(corealbum.props.media)
 
         allowed = self._selection_mode_allowed
         self._disc_list_box.props.selection_mode_allowed = allowed
@@ -80,9 +74,8 @@ class ArtistAlbumWidget(Gtk.Box):
             GObject.BindingFlags.BIDIRECTIONAL
             | GObject.BindingFlags.SYNC_CREATE)
 
-        self._title.props.label = self._album_title
-        year = utils.get_media_year(self._media)
-
+        self._title.props.label = corealbum.props.title
+        year = corealbum.props.year
         if year:
             self._year.props.label = year
 
@@ -92,7 +85,8 @@ class ArtistAlbumWidget(Gtk.Box):
         if self._cover_size_group:
             self._cover_size_group.add_widget(self._cover_stack)
 
-        self._disc_list_box.bind_model(self._model, self._create_widget)
+        self._disc_list_box.bind_model(
+            corealbum.props.model, self._create_widget)
 
         def non_selectable(child):
             child.props.selectable = False
@@ -104,7 +98,6 @@ class ArtistAlbumWidget(Gtk.Box):
 
         return disc_box
 
-    @log
     def _create_disc_box(self, disc_nr, album_model):
         disc_box = DiscBox(None, album_model)
         disc_box.set_disc_number(disc_nr)
@@ -115,7 +108,6 @@ class ArtistAlbumWidget(Gtk.Box):
 
         return disc_box
 
-    @log
     def _song_activated(self, widget, song_widget):
         if self.props.selection_mode:
             return


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