Commit e16d7764 authored by Marinus Schraal's avatar Marinus Schraal Committed by Jean Felder

artistalbumswidget: Pass application around

Cleanup some arguments by passing the application object instead.
parent 90bba029
Pipeline #99452 passed with stages
in 7 minutes
...@@ -58,7 +58,7 @@ class ArtistsView(BaseView): ...@@ -58,7 +58,7 @@ class ArtistsView(BaseView):
super().__init__( super().__init__(
'artists', _("Artists"), application, sidebar_container) 'artists', _("Artists"), application, sidebar_container)
self._player = player self._application = application
self._artists = {} self._artists = {}
self._window = application.props.window self._window = application.props.window
...@@ -152,7 +152,7 @@ class ArtistsView(BaseView): ...@@ -152,7 +152,7 @@ class ArtistsView(BaseView):
return return
self._artist_albums = ArtistAlbumsWidget( self._artist_albums = ArtistAlbumsWidget(
coreartist, self._player, self._window, False) coreartist, self._application, False)
artist_albums_frame = Gtk.Frame( artist_albums_frame = Gtk.Frame(
shadow_type=Gtk.ShadowType.NONE, hexpand=True) shadow_type=Gtk.ShadowType.NONE, hexpand=True)
artist_albums_frame.add(self._artist_albums) artist_albums_frame.add(self._artist_albums)
......
...@@ -46,13 +46,14 @@ class SearchView(BaseView): ...@@ -46,13 +46,14 @@ class SearchView(BaseView):
@log @log
def __init__(self, application, player): def __init__(self, application, player):
self._application = application
self._coremodel = application.props.coremodel self._coremodel = application.props.coremodel
self._model = self._coremodel.props.songs_search self._model = self._coremodel.props.songs_search
self._album_model = self._coremodel.props.albums_search self._album_model = self._coremodel.props.albums_search
self._artist_model = self._coremodel.props.artists_search self._artist_model = self._coremodel.props.artists_search
super().__init__('search', None, application) super().__init__('search', None, application)
self._player = player self._player = self._application.props.player
self.previous_view = None self.previous_view = None
...@@ -195,7 +196,7 @@ class SearchView(BaseView): ...@@ -195,7 +196,7 @@ class SearchView(BaseView):
# self.emit('song-activated', widget) # self.emit('song-activated', widget)
self._artist_albums_widget = ArtistAlbumsWidget( self._artist_albums_widget = ArtistAlbumsWidget(
coreartist, self._player, self._window, False) coreartist, self._application, False)
self.add(self._artist_albums_widget) self.add(self._artist_albums_widget)
self._artist_albums_widget.show() self._artist_albums_widget.show()
......
...@@ -51,13 +51,14 @@ class ArtistAlbumsWidget(Gtk.ListBox): ...@@ -51,13 +51,14 @@ class ArtistAlbumsWidget(Gtk.ListBox):
@log @log
def __init__( def __init__(
self, coreartist, player, window, selection_mode_allowed=False): self, coreartist, application, selection_mode_allowed=False):
super().__init__() super().__init__()
self._application = application
self._artist = coreartist.props.artist self._artist = coreartist.props.artist
self._model = coreartist.props.model self._model = coreartist.props.model
self._player = player self._player = self._application.props.player
self._selection_mode_allowed = selection_mode_allowed self._selection_mode_allowed = selection_mode_allowed
self._window = window
self._widgets = [] self._widgets = []
...@@ -79,7 +80,7 @@ class ArtistAlbumsWidget(Gtk.ListBox): ...@@ -79,7 +80,7 @@ class ArtistAlbumsWidget(Gtk.ListBox):
if self.props.selection_mode: if self.props.selection_mode:
return return
coremodel = self._player._app.props.coremodel coremodel = self._application.props.coremodel
def _on_playlist_loaded(klass): def _on_playlist_loaded(klass):
self._player.play(song_widget.props.coresong) self._player.play(song_widget.props.coresong)
...@@ -91,7 +92,7 @@ class ArtistAlbumsWidget(Gtk.ListBox): ...@@ -91,7 +92,7 @@ class ArtistAlbumsWidget(Gtk.ListBox):
def _add_album(self, corealbum): def _add_album(self, corealbum):
widget = ArtistAlbumWidget( widget = ArtistAlbumWidget(
corealbum, self._selection_mode_allowed, 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( self.bind_property(
'selection-mode', widget, 'selection-mode', 'selection-mode', widget, 'selection-mode',
......
...@@ -53,7 +53,7 @@ class ArtistAlbumWidget(Gtk.Box): ...@@ -53,7 +53,7 @@ class ArtistAlbumWidget(Gtk.Box):
def __init__( def __init__(
self, corealbum, selection_mode_allowed, size_group=None, self, corealbum, selection_mode_allowed, size_group=None,
cover_size_group=None, window=None): cover_size_group=None):
super().__init__(orientation=Gtk.Orientation.HORIZONTAL) super().__init__(orientation=Gtk.Orientation.HORIZONTAL)
self._size_group = size_group self._size_group = size_group
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment