[gnome-music/wip/mschraal/core: 22/93] coresong: poc sort



commit fe7c5e4150b6da6f6abfed566cc7f7ed534514a3
Author: Marinus Schraal <mschraal gnome org>
Date:   Wed May 8 22:58:44 2019 +0200

    coresong: poc sort

 gnomemusic/coremodel.py | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index c25f6f7d..2e3234fa 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -25,9 +25,14 @@ class CoreModel(GObject.GObject):
         store = Gio.ListStore()
         album_id = media.get_id()
 
+        def _reverse_sort(song_a, song_b):
+            return song_b.props.track_number - song_a.props.track_number
+
         def _callback(source, dunno, media, something, something2):
             if media is None:
+                store.sort(_reverse_sort)
                 return
+
             print("media", media)
 
             song = self._hash[media.get_id()]


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