[gnome-music/freeze-break: 11/107] Make Songs view filterable



commit 8460f65fb54249ac3f0ddac66bc1ce8e93719532
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Tue Aug 6 17:11:21 2013 +0200

    Make Songs view filterable

 gnomemusic/player.py |    2 +-
 gnomemusic/view.py   |   17 +++++++++--------
 2 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 4d6db37..633d4df 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -60,7 +60,7 @@ class Player(GObject.GObject):
 
     __gsignals__ = {
         'playing-changed': (GObject.SIGNAL_RUN_FIRST, None, ()),
-        'playlist-item-changed': (GObject.SIGNAL_RUN_FIRST, None, (Gtk.ListStore, Gtk.TreeIter)),
+        'playlist-item-changed': (GObject.SIGNAL_RUN_FIRST, None, (Gtk.TreeModelFilter, Gtk.TreeIter)),
         'current-changed': (GObject.SIGNAL_RUN_FIRST, None, ()),
         'playback-status-changed': (GObject.SIGNAL_RUN_FIRST, None, ()),
         'repeat-mode-changed': (GObject.SIGNAL_RUN_FIRST, None, ()),
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index dd948e2..d840c98 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -344,21 +344,22 @@ class Songs(ViewContainer):
         self.player.connect('playlist-item-changed', self.update_model)
 
     def _on_item_activated(self, widget, id, path):
-        child_path = self.filter.convert_path_to_child_path(path)
-        _iter = self._model.get_iter(child_path)
-        if self._model.get_value(_iter, 8) != self.errorIconName:
-            self.player.set_playlist('Songs', None, self._model, _iter, 5)
+        _iter = self.filter.get_iter(path)
+        child_iter = self.filter.convert_iter_to_child_iter(_iter)
+        if self._model.get_value(child_iter, 8) != self.errorIconName:
+            self.player.set_playlist('Songs', None, self.filter, _iter, 5)
             self.player.set_playing(True)
 
     def update_model(self, player, playlist, currentIter):
         if self.iter_to_clean:
             self._model.set_value(self.iter_to_clean, 10, False)
-        if playlist != self._model:
+        if playlist != self.filter:
             return False
 
-        self._model.set_value(currentIter, 10, True)
-        if self._model.get_value(currentIter, 8) != self.errorIconName:
-            self.iter_to_clean = currentIter.copy()
+        child_iter = self.filter.convert_iter_to_child_iter(currentIter)
+        self._model.set_value(child_iter, 10, True)
+        if self._model.get_value(child_iter, 8) != self.errorIconName:
+            self.iter_to_clean = child_iter.copy()
         return False
 
     def _add_item(self, source, param, item):


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