[gnome-music/freeze-break: 16/107] Make sure we select the proper filtered path



commit 7ac87200ef5fbdca545cc9081852017b73c6655f
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Mon Sep 2 16:24:55 2013 +0200

    Make sure we select the proper filtered path

 gnomemusic/view.py    |    9 ++++++---
 gnomemusic/widgets.py |    3 ++-
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index d840c98..fa52230 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -306,7 +306,8 @@ class Albums(ViewContainer):
         self.set_visible_child(self._grid)
 
     def _on_item_activated(self, widget, id, path):
-        _iter = self._model.get_iter(path)
+        child_path = self.filter.convert_path_to_child_path(path)
+        _iter = self._model.get_iter(child_path)
         title = self._model.get_value(_iter, 2)
         artist = self._model.get_value(_iter, 3)
         item = self._model.get_value(_iter, 5)
@@ -344,7 +345,8 @@ class Songs(ViewContainer):
         self.player.connect('playlist-item-changed', self.update_model)
 
     def _on_item_activated(self, widget, id, path):
-        _iter = self.filter.get_iter(path)
+        child_path = self.filter.convert_path_to_child_path(path)
+        _iter = self._model.get_iter(child_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)
@@ -562,7 +564,8 @@ class Artists (ViewContainer):
         )
         child_name = "artists_%i" % self.artists_counter
         self.artistAlbumsStack.add_named(self.new_artistAlbumsWidget, child_name)
-        _iter = self._model.get_iter(path)
+        child_path = self.filter.convert_path_to_child_path(path)
+        _iter = self._model.get_iter(child_path)
         self._last_selection = _iter
         artist = self._model.get_value(_iter, 2)
         albums = self._artists[artist.lower()]['albums']
diff --git a/gnomemusic/widgets.py b/gnomemusic/widgets.py
index 450f522..37da4bf 100644
--- a/gnomemusic/widgets.py
+++ b/gnomemusic/widgets.py
@@ -142,7 +142,8 @@ class AlbumWidget(Gtk.EventBox):
         self.show_all()
 
     def _on_item_activated(self, widget, id, path):
-        _iter = self.model.get_iter(path)
+        child_path = self.filter.convert_path_to_child_path(path)
+        _iter = self._model.get_iter(child_path)
         if(self.model.get_value(_iter, 7) != ERROR_ICON_NAME):
             if (self.iterToClean and self.player.playlistId == self.album):
                 item = self.model.get_value(self.iterToClean, 5)


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