[gnome-music/freeze-break: 77/107] view: Load cached playlist if selected again
- From: Arnel A. Borja <arnelborja src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/freeze-break: 77/107] view: Load cached playlist if selected again
- Date: Wed, 11 Sep 2013 13:20:50 +0000 (UTC)
commit 119c2a093f1e0c781fb88774669c130d2b6c2a56
Author: Arnel A. Borja <arnelborja src gnome org>
Date: Thu Sep 5 21:03:13 2013 +0800
view: Load cached playlist if selected again
gnomemusic/view.py | 42 ++++++++++++++++++++++++++----------------
1 files changed, 26 insertions(+), 16 deletions(-)
---
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index 0de549b..3cce40d 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -783,25 +783,35 @@ class Playlist(ViewContainer):
self._model.set(_iter, [8, 10], [self.errorIconName, True])
def _on_playlist_activated(self, widget, item_id, path):
- self._model = Gtk.ListStore(
- GObject.TYPE_STRING,
- GObject.TYPE_STRING,
- GObject.TYPE_STRING,
- GObject.TYPE_STRING,
- GdkPixbuf.Pixbuf,
- GObject.TYPE_OBJECT,
- GObject.TYPE_BOOLEAN,
- GObject.TYPE_INT,
- GObject.TYPE_STRING,
- GObject.TYPE_BOOLEAN,
- GObject.TYPE_BOOLEAN
- )
- self.view.set_model(self._model)
_iter = self.playlists_model.get_iter(path)
playlist = self.playlists_model.get_value(_iter, 2)
- playlists.parse_playlist(self.playlists_model.get_value(_iter, 2), self._add_song)
self.current_playlist = playlist
- playlists.parse_playlist(playlist, self._add_song)
+
+ # if the active queue has been set by this playlist,
+ # use it as model, otherwise build the liststore
+ cached_playlist = self.player.running_playlist('Playlist', playlist)
+ if cached_playlist:
+ self._model = cached_playlist
+ currentTrack = self.player.playlist.get_iter(self.player.currentTrack.get_path())
+ self.update_model(self.player, cached_playlist,
+ currentTrack)
+ self.view.set_model(self._model)
+ else:
+ self._model = Gtk.ListStore(
+ GObject.TYPE_STRING,
+ GObject.TYPE_STRING,
+ GObject.TYPE_STRING,
+ GObject.TYPE_STRING,
+ GdkPixbuf.Pixbuf,
+ GObject.TYPE_OBJECT,
+ GObject.TYPE_BOOLEAN,
+ GObject.TYPE_INT,
+ GObject.TYPE_STRING,
+ GObject.TYPE_BOOLEAN,
+ GObject.TYPE_BOOLEAN
+ )
+ self.view.set_model(self._model)
+ playlists.parse_playlist(playlist, self._add_song)
def _add_song(self, item):
if not item:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]