[gnome-music/wip/mschraal/core: 29/118] albumwidget2: Hackish way of getting play working



commit 07cacddb521c5e71a476fc00120e62cc772ede3e
Author: Marinus Schraal <mschraal gnome org>
Date:   Thu May 9 23:13:51 2019 +0200

    albumwidget2: Hackish way of getting play working

 gnomemusic/widgets/albumwidget2.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
---
diff --git a/gnomemusic/widgets/albumwidget2.py b/gnomemusic/widgets/albumwidget2.py
index 1319a6fc..7b55244b 100644
--- a/gnomemusic/widgets/albumwidget2.py
+++ b/gnomemusic/widgets/albumwidget2.py
@@ -133,6 +133,33 @@ class AlbumWidget2(Gtk.EventBox):
         self._running_info_label.props.label = ngettext(
             "{} minute", "{} minutes", mins).format(mins)
 
+    @log
+    def _on_row_activated(self, klass, value):
+        old_model = Gtk.ListStore(
+            GObject.TYPE_STRING,  # title
+            GObject.TYPE_STRING,
+            GObject.TYPE_STRING,
+            GObject.TYPE_STRING,
+            GdkPixbuf.Pixbuf,    # icon
+            GObject.TYPE_OBJECT,  # song object
+            GObject.TYPE_BOOLEAN,  # item selected
+            GObject.TYPE_STRING,
+            GObject.TYPE_BOOLEAN,
+            GObject.TYPE_INT,  # icon shown
+            GObject.TYPE_BOOLEAN,
+            GObject.TYPE_INT
+        )
+
+        for song in self._model:
+            _iter = old_model.insert_with_valuesv(-1, [5], [song.props.media])
+            if song is self._model[value.get_index()]:
+                activated_iter = _iter
+
+        self._player.set_playlist(
+            PlayerPlaylist.Type.ALBUM, self._album_name, old_model,
+            activated_iter)
+        self._player.play()
+
     @log
     def _on_selection_changed(self, klass, value):
         n_items = 0


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