[gnome-music/wip/mschraal/search-cleanups: 8/8] artistalbumswidget: Pass application around



commit e16d7764326ef3f613fe5a3e69e442bd84654ddc
Author: Marinus Schraal <mschraal gnome org>
Date:   Wed Jul 24 22:51:56 2019 +0200

    artistalbumswidget: Pass application around
    
    Cleanup some arguments by passing the application object instead.

 gnomemusic/views/artistsview.py          |  4 ++--
 gnomemusic/views/searchview.py           |  5 +++--
 gnomemusic/widgets/artistalbumswidget.py | 11 ++++++-----
 gnomemusic/widgets/artistalbumwidget.py  |  2 +-
 4 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/gnomemusic/views/artistsview.py b/gnomemusic/views/artistsview.py
index cf799d27..d79acc0e 100644
--- a/gnomemusic/views/artistsview.py
+++ b/gnomemusic/views/artistsview.py
@@ -58,7 +58,7 @@ class ArtistsView(BaseView):
         super().__init__(
             'artists', _("Artists"), application, sidebar_container)
 
-        self._player = player
+        self._application = application
         self._artists = {}
 
         self._window = application.props.window
@@ -152,7 +152,7 @@ class ArtistsView(BaseView):
             return
 
         self._artist_albums = ArtistAlbumsWidget(
-            coreartist, self._player, self._window, False)
+            coreartist, self._application, False)
         artist_albums_frame = Gtk.Frame(
             shadow_type=Gtk.ShadowType.NONE, hexpand=True)
         artist_albums_frame.add(self._artist_albums)
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index 1e0b5030..8fca353f 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -46,13 +46,14 @@ class SearchView(BaseView):
 
     @log
     def __init__(self, application, player):
+        self._application = application
         self._coremodel = application.props.coremodel
         self._model = self._coremodel.props.songs_search
         self._album_model = self._coremodel.props.albums_search
         self._artist_model = self._coremodel.props.artists_search
         super().__init__('search', None, application)
 
-        self._player = player
+        self._player = self._application.props.player
 
         self.previous_view = None
 
@@ -195,7 +196,7 @@ class SearchView(BaseView):
             # self.emit('song-activated', widget)
 
             self._artist_albums_widget = ArtistAlbumsWidget(
-                coreartist, self._player, self._window, False)
+                coreartist, self._application, False)
             self.add(self._artist_albums_widget)
             self._artist_albums_widget.show()
 
diff --git a/gnomemusic/widgets/artistalbumswidget.py b/gnomemusic/widgets/artistalbumswidget.py
index 5c48a8de..6dfead35 100644
--- a/gnomemusic/widgets/artistalbumswidget.py
+++ b/gnomemusic/widgets/artistalbumswidget.py
@@ -51,13 +51,14 @@ class ArtistAlbumsWidget(Gtk.ListBox):
 
     @log
     def __init__(
-            self, coreartist, player, window, selection_mode_allowed=False):
+            self, coreartist, application, selection_mode_allowed=False):
         super().__init__()
+
+        self._application = application
         self._artist = coreartist.props.artist
         self._model = coreartist.props.model
-        self._player = player
+        self._player = self._application.props.player
         self._selection_mode_allowed = selection_mode_allowed
-        self._window = window
 
         self._widgets = []
 
@@ -79,7 +80,7 @@ class ArtistAlbumsWidget(Gtk.ListBox):
         if self.props.selection_mode:
             return
 
-        coremodel = self._player._app.props.coremodel
+        coremodel = self._application.props.coremodel
 
         def _on_playlist_loaded(klass):
             self._player.play(song_widget.props.coresong)
@@ -91,7 +92,7 @@ class ArtistAlbumsWidget(Gtk.ListBox):
     def _add_album(self, corealbum):
         widget = ArtistAlbumWidget(
             corealbum, self._selection_mode_allowed,
-            self._songs_grid_size_group, self._cover_size_group, self._window)
+            self._songs_grid_size_group, self._cover_size_group)
 
         self.bind_property(
             'selection-mode', widget, 'selection-mode',
diff --git a/gnomemusic/widgets/artistalbumwidget.py b/gnomemusic/widgets/artistalbumwidget.py
index a42b381e..e2b9372e 100644
--- a/gnomemusic/widgets/artistalbumwidget.py
+++ b/gnomemusic/widgets/artistalbumwidget.py
@@ -53,7 +53,7 @@ class ArtistAlbumWidget(Gtk.Box):
 
     def __init__(
             self, corealbum, selection_mode_allowed, size_group=None,
-            cover_size_group=None, window=None):
+            cover_size_group=None):
         super().__init__(orientation=Gtk.Orientation.HORIZONTAL)
 
         self._size_group = size_group


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