[gnome-music/wip/mschraal/player-shuffle-return-order] corealbum: Use Gtk.Ordering for sorter
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/player-shuffle-return-order] corealbum: Use Gtk.Ordering for sorter
- Date: Tue, 5 Apr 2022 08:57:31 +0000 (UTC)
commit 110dab14c186c7c1b5d7a5aa7cd4877b77af0692
Author: Marinus Schraal <mschraal gnome org>
Date: Tue Apr 5 10:52:16 2022 +0200
corealbum: Use Gtk.Ordering for sorter
gnomemusic/corealbum.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/corealbum.py b/gnomemusic/corealbum.py
index 27008184e..af3a1198c 100644
--- a/gnomemusic/corealbum.py
+++ b/gnomemusic/corealbum.py
@@ -80,7 +80,13 @@ class CoreAlbum(GObject.GObject):
disc_model_sort = Gtk.SortListModel.new(disc_model)
def _disc_order_sort(disc_a, disc_b, data=None):
- return disc_a.props.disc_nr - disc_b.props.disc_nr
+ order = disc_a.props.disc_nr - disc_b.props.disc_nr
+ if order < 0:
+ return Gtk.Ordering.SMALLER
+ elif order > 0:
+ return Gtk.Ordering.LARGER
+ else:
+ return Gtk.Ordering.EQUAL
disc_sorter = Gtk.CustomSorter()
disc_sorter.set_sort_func(_disc_order_sort)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]