Commit a7634b8f authored by Jean Felder's avatar Jean Felder Committed by Jean Felder

albumwidget: Restore currently played album

Closes: #111
parent 555da3e7
......@@ -128,8 +128,6 @@ class AlbumWidget(Gtk.EventBox):
art = ArtImage(Art.Size.LARGE, item)
art.image = self._cover
GLib.idle_add(grilo.populate_album_songs, item, self.add_item)
self._album = utils.get_album_title(item)
self._artist_label.props.label = utils.get_artist_name(item)
self._title_label.props.label = self._album
......@@ -143,6 +141,17 @@ class AlbumWidget(Gtk.EventBox):
self._player.connect('song-changed', self._update_model)
# If an album is playing, restore it.
if self._player.playing_playlist(
PlayerPlaylist.Type.ALBUM, self._album):
length = len(self._player.get_songs())
for i, song in enumerate(self._player.get_songs()):
self.add_item(None, None, song[0], length - (i + 1))
self.add_item(None, None, None, 0)
GLib.idle_add(grilo.populate_album_songs, item, self.add_item)
def _set_composer_label(self, item):
composer = item.get_composer()
......@@ -228,7 +237,7 @@ class AlbumWidget(Gtk.EventBox):
def _update_model(self, player, position):
def _update_model(self, player, position=None):
"""Updates model when the song changes
:param Player player: The main player object
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