[gnome-music/wip/mschraal/coreartist-sorter-fix: 5/5] coreartist: Use Gtk.Ordering for sorting
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/coreartist-sorter-fix: 5/5] coreartist: Use Gtk.Ordering for sorting
- Date: Sun, 20 Feb 2022 20:42:47 +0000 (UTC)
commit 766cbea93b2576065bbff6c75f793e631befbb3f
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]