[gnome-music/wip/jfelder/simplify-player-model: 4/5] views: Rely on running_playlist to update_model
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/simplify-player-model: 4/5] views: Rely on running_playlist to update_model
- Date: Sun, 4 Mar 2018 23:19:25 +0000 (UTC)
commit abf05c631e4a04fbaeccb509de80998529d8729f
Author: Jean Felder <jfelder src gnome org>
Date: Sun Feb 25 16:27:46 2018 +0100
views: Rely on running_playlist to update_model
This avoids having to call private attributes and this should help prevent
internal problems in the future.
gnomemusic/views/artistsview.py | 5 +----
gnomemusic/views/playlistview.py | 3 ++-
gnomemusic/views/songsview.py | 2 +-
gnomemusic/widgets/albumwidget.py | 2 +-
4 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/gnomemusic/views/artistsview.py b/gnomemusic/views/artistsview.py
index 6c83bfb..f39bd74 100644
--- a/gnomemusic/views/artistsview.py
+++ b/gnomemusic/views/artistsview.py
@@ -130,11 +130,8 @@ class ArtistsView(BaseView):
widget = self._artists[artist.casefold()]['widget']
if widget:
- artist_widget_model = self.player.running_playlist(
- 'Artist', widget.artist)
artist_stack = self._artist_albums_stack
- # FIXME: calling to private model
- if widget._model == artist_widget_model:
+ if self.player.running_playlist('Artist', widget.artist):
self._artist_albums_widget = widget.get_parent()
GLib.idle_add(self._artist_albums_stack.set_visible_child,
self._artist_albums_widget)
diff --git a/gnomemusic/views/playlistview.py b/gnomemusic/views/playlistview.py
index 8c6e3b0..9866524 100644
--- a/gnomemusic/views/playlistview.py
+++ b/gnomemusic/views/playlistview.py
@@ -268,7 +268,8 @@ class PlaylistView(BaseView):
def _update_model(self, player, playlist, current_iter):
if self._iter_to_clean:
self._iter_to_clean_model[self._iter_to_clean][10] = False
- if playlist != self.model:
+ if not player.running_playlist(
+ 'Playlist', self._current_playlist.get_id()):
return False
self.model[current_iter][10] = True
diff --git a/gnomemusic/views/songsview.py b/gnomemusic/views/songsview.py
index a09109a..d844f6d 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -107,7 +107,7 @@ class SongsView(BaseView):
"""
if self._iter_to_clean:
self.model[self._iter_to_clean][10] = False
- if playlist != self.model:
+ if not player.running_playlist('Songs', None):
return False
self.model[current_iter][10] = True
diff --git a/gnomemusic/widgets/albumwidget.py b/gnomemusic/widgets/albumwidget.py
index 76717d6..427de77 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -290,7 +290,7 @@ class AlbumWidget(Gtk.EventBox):
:param playlist: The current playlist
:param current_iter: The current iter of the playlist model
"""
- if (playlist != self._model):
+ if not player.running_playlist('Album', self._album):
return True
current_song = playlist[current_iter][player.playlist_field]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]