[gnome-music] view: Play songs in Search view when activated



commit 9b262321b6d00c555bff4ccfd17abe2b1d194c70
Author: Arnel Borja <arnelborja src gnome org>
Date:   Sun May 4 00:11:41 2014 +0800

    view: Play songs in Search view when activated

 gnomemusic/view.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index aff11f4..f4b2977 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -1170,12 +1170,19 @@ class Search(ViewContainer):
         self._add_list_renderers()
         self.player = player
         self.head_iters = [None, None, None, None]
+        self.songs_model = self._model
 
         self.view.get_generic_view().set_show_expanders(False)
 
     @log
     def _on_item_activated(self, widget, id, path):
-        pass
+        child_path = self.filter_model.convert_path_to_child_path(path)
+        _iter = self._model.get_iter(child_path)
+        if self._model[_iter][11] == 'song':
+            if self._model.get_value(_iter, 8) != self.errorIconName:
+                child_iter = self.songs_model.convert_child_iter_to_iter(_iter)[1]
+                self.player.set_playlist('Search Results', None, self.songs_model, child_iter, 5)
+                self.player.set_playing(True)
 
     def _add_item(self, source, param, item, remaining=0, data=None):
         if data is None:
@@ -1299,6 +1306,7 @@ class Search(ViewContainer):
         playlists_iter = self._model.insert_with_values(None, -1, [2], ['Playlists'])
 
         self.head_iters = [albums_iter, artists_iter, songs_iter, playlists_iter]
+        self.songs_model = self._model.filter_new(self._model.get_path(songs_iter))
 
         # Check that current source can do Query
         if grilo.search_source.supported_operations() & Grl.SupportedOps.QUERY:


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