[gnome-music/wip/mschraal/core: 101/190] coremodel: Sort albums by year



commit e0a5416d31cc7b17757bc044062bb30c9977a258
Author: Marinus Schraal <mschraal gnome org>
Date:   Sun Jun 23 22:05:55 2019 +0200

    coremodel: Sort albums by year

 gnomemusic/coremodel.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index ff212506..92a8e956 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -139,7 +139,13 @@ class CoreModel(GObject.GObject):
 
             albums_model.append(artist_album)
 
-        return albums_model
+        def _album_sort(album_a, album_b):
+            return album_a.props.year > album_b.props.year
+
+        albums_model_sort.set_sort_func(
+            self._wrap_list_store_sort_func(_album_sort))
+
+        return albums_model_sort
 
 
     def get_playlist_model(self):


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