[gnome-music] player: Add new signal 'playlist-changed'
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] player: Add new signal 'playlist-changed'
- Date: Tue, 18 Nov 2014 11:39:12 +0000 (UTC)
commit 5c19436886bfafdecb60227732a059c8911ff22f
Author: Arnel Borja <arnelborja src gnome org>
Date: Sun Nov 16 00:39:59 2014 +0800
player: Add new signal 'playlist-changed'
https://bugzilla.gnome.org/show_bug.cgi?id=740211
gnomemusic/player.py | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 4ff2b1b..f7b2e29 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -65,6 +65,7 @@ class Player(GObject.GObject):
__gsignals__ = {
'playing-changed': (GObject.SIGNAL_RUN_FIRST, None, ()),
+ 'playlist-changed': (GObject.SIGNAL_RUN_FIRST, None, ()),
'playlist-item-changed': (GObject.SIGNAL_RUN_FIRST, None, (Gtk.TreeModel, Gtk.TreeIter)),
'current-changed': (GObject.SIGNAL_RUN_FIRST, None, ()),
'playback-status-changed': (GObject.SIGNAL_RUN_FIRST, None, ()),
@@ -510,20 +511,23 @@ class Player(GObject.GObject):
def set_playlist(self, type, id, model, iter, field):
self.stop()
- if self.playlist_insert_handler:
- self.playlist.disconnect(self.playlist_insert_handler)
- if self.playlist_delete_handler:
- self.playlist.disconnect(self.playlist_delete_handler)
+ old_playlist = self.playlist
+ if old_playlist != model:
+ self.playlist = model
+ if self.playlist_insert_handler:
+ old_playlist.disconnect(self.playlist_insert_handler)
+ if self.playlist_delete_handler:
+ old_playlist.disconnect(self.playlist_delete_handler)
- self.playlist = model
self.playlistType = type
self.playlistId = id
self.currentTrack = Gtk.TreeRowReference.new(model, model.get_path(iter))
self.playlistField = field
- self.playlist_insert_handler = model.connect('row-inserted', self._on_playlist_size_changed)
- self.playlist_delete_handler = model.connect('row-deleted', self._on_playlist_size_changed)
-
+ if old_playlist != model:
+ self.playlist_insert_handler = model.connect('row-inserted', self._on_playlist_size_changed)
+ self.playlist_delete_handler = model.connect('row-deleted', self._on_playlist_size_changed)
+ self.emit('playlist-changed')
self.emit('current-changed')
@log
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]