[gnome-music/wip/mschraal/coreartist-sorter-fix] coreartist: Use Gtk.Ordering for sorting




commit 108eaf11a08954226ae0f828427ddf5dfa61dc4b
Author: Marinus Schraal <mschraal gnome org>
Date:   Sun Feb 20 21:02:25 2022 +0100

    coreartist: Use Gtk.Ordering for sorting
    
    Fixes: #506

 gnomemusic/coreartist.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/coreartist.py b/gnomemusic/coreartist.py
index 90a38d3d9..feb437de7 100644
--- a/gnomemusic/coreartist.py
+++ b/gnomemusic/coreartist.py
@@ -69,7 +69,12 @@ class CoreArtist(GObject.GObject):
             self.props.media, albums_model_filter)
 
         def _album_sort(album_a, album_b, data=None):
-            return album_a.props.year > album_b.props.year
+            if album_a.props.year > album_b.props.year:
+                return Gtk.Ordering.LARGER
+            elif album_a.props.year < album_b.props.year:
+                return Gtk.Ordering.SMALLER
+            else:
+                return Gtk.Ordering.EQUAL
 
         albums_sorter = Gtk.CustomSorter()
         albums_sorter.set_sort_func(_album_sort)


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