[gnome-music/freeze-break: 81/107] view: Add method to get selected tracks in ViewContainer



commit 6de30da07b7c78a31d545951e9c54213e0b16fd3
Author: Arnel A. Borja <arnelborja src gnome org>
Date:   Fri Sep 6 23:17:18 2013 +0800

    view: Add method to get selected tracks in ViewContainer
    
    Currently, only implemented by Songs view

 gnomemusic/view.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index 3cce40d..9c79ccf 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -268,6 +268,9 @@ class ViewContainer(Stack):
     def _on_item_activated(self, widget, id, path):
         pass
 
+    def get_selected_track_uris(self):
+        return []
+
 
 #Class for the Empty View
 class Empty(Stack):
@@ -463,6 +466,10 @@ class Songs(ViewContainer):
         if grilo.tracker:
             GLib.idle_add(grilo.populate_songs, self._offset, self._add_item)
 
+    def get_selected_track_uris(self):
+        return [self._model.get_value(self._model.get_iter(path), 5).get_url()
+                for path in self.view.get_selection()]
+
 
 class Artists (ViewContainer):
     def __init__(self, header_bar, selection_toolbar, player):


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