[gnome-music/wip/mschraal/player-shuffle-return-order] coredisc: Use Gtk.Ordering for sorter



commit 9f73b9750b9834b3653e7cb6b4c7d575622ef94d
Author: Marinus Schraal <mschraal gnome org>
Date:   Tue Apr 5 10:55:12 2022 +0200

    coredisc: Use Gtk.Ordering for sorter

 gnomemusic/coredisc.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/coredisc.py b/gnomemusic/coredisc.py
index 09780018b..ece33ba2c 100644
--- a/gnomemusic/coredisc.py
+++ b/gnomemusic/coredisc.py
@@ -58,7 +58,13 @@ class CoreDisc(GObject.GObject):
     @GObject.Property(type=Gio.ListModel, default=None)
     def model(self):
         def _disc_sort(song_a, song_b, data=None):
-            return song_a.props.track_number - song_b.props.track_number
+            order = song_a.props.track_number - song_b.props.track_number
+            if order < 0:
+                return Gtk.Ordering.SMALLER
+            elif order > 0:
+                return Gtk.Ordering.LARGER
+            else:
+                return Gtk.Ordering.EQUAL
 
         if self._model is None:
             self._filter_model = Gtk.FilterListModel.new(


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