[gnome-music/wip/mschraal/core] albumwidget2: Hackish way of getting play working
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/core] albumwidget2: Hackish way of getting play working
- Date: Thu, 9 May 2019 23:19:54 +0000 (UTC)
commit cdf405510cb38baa7c57a6c86af5cb72f0de092b
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 | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
---
diff --git a/gnomemusic/widgets/albumwidget2.py b/gnomemusic/widgets/albumwidget2.py
index ef80347a..651322ab 100644
--- a/gnomemusic/widgets/albumwidget2.py
+++ b/gnomemusic/widgets/albumwidget2.py
@@ -63,6 +63,8 @@ class AlbumWidget2(Gtk.EventBox):
self.bind_property(
'selected-items-count', self._parent_view, 'selected-items-count')
+ self._listbox.connect("row-activated", self._on_row_activated)
+
@log
def update(self, album):
"""Update the album widget.
@@ -139,6 +141,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]