[gnome-music/wip/jfelder/playback-status-v3: 4/10] albumwidget: Use album_id to uniquify playlist name



commit f1d4b53b1cef5345ce172f6958b0329bbeb46ce8
Author: Jean Felder <jfelder src gnome org>
Date:   Thu Sep 13 08:43:27 2018 +0200

    albumwidget: Use album_id to uniquify playlist name
    
    This way, the album's id can be later used to retrieve information on
    it.

 gnomemusic/widgets/albumwidget.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/widgets/albumwidget.py b/gnomemusic/widgets/albumwidget.py
index ecdc2c93..55fe506c 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -79,7 +79,7 @@ class AlbumWidget(Gtk.EventBox):
         self._iter_to_clean = None
 
         self._create_model()
-        self._album_name = None
+        self._album_id = None
 
         self.bind_property(
             'selection-mode', self._disc_listbox, 'selection-mode',
@@ -127,11 +127,12 @@ class AlbumWidget(Gtk.EventBox):
 
         self._duration = 0
 
-        self._album_name = utils.get_album_title(album)
+        self._album_id = album.get_id()
+        album_name = utils.get_album_title(album)
         artist = utils.get_artist_name(album)
 
-        self._title_label.props.label = self._album_name
-        self._title_label.props.tooltip_text = self._album_name
+        self._title_label.props.label = album_name
+        self._title_label.props.tooltip_text = album_name
 
         self._artist_label.props.label = artist
         self._artist_label.props.tooltip_text = artist
@@ -193,7 +194,7 @@ class AlbumWidget(Gtk.EventBox):
             return
 
         self._player.set_playlist(
-            PlayerPlaylist.Type.ALBUM, self._album_name, song_widget.model,
+            PlayerPlaylist.Type.ALBUM, self._album_id, song_widget.model,
             song_widget.itr)
         self._player.play()
         return True
@@ -240,7 +241,7 @@ class AlbumWidget(Gtk.EventBox):
         :param int position: current song position
         """
         if not player.playing_playlist(
-                PlayerPlaylist.Type.ALBUM, self._album_name):
+                PlayerPlaylist.Type.ALBUM, self._album_id):
             return True
 
         current_song = player.props.current_song


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