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




commit 7d6bcaba3cebd5b26deba1c344a994f8e095847c
Author: Marinus Schraal <mschraal gnome org>
Date:   Tue Apr 5 00:17:53 2022 +0200

    player: Use Gtk.Ordering for shuffle sorter
    
    GTK- 4 porting regression.
    
    Fixes: #515

 gnomemusic/player.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 4b0bdf162..c0c2fa961 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -277,7 +277,12 @@ class PlayerPlaylist(GObject.GObject):
 
     def _on_repeat_mode_changed(self, klass, param):
         def _shuffle_sort(song_a, song_b, data=None):
-            return song_a.shuffle_pos < song_b.shuffle_pos
+            if song_a.props.shuffle_pos < song_b.props.shuffle_pos:
+                return Gtk.Ordering.SMALLER
+            elif song_a.props.shuffle_pos > song_b.props.shuffle_pos:
+                return Gtk.Ordering.LARGER
+            else:
+                return Gtk.Ordering.EQUAL
 
         if self.props.repeat_mode == RepeatMode.SHUFFLE:
             for idx, coresong in enumerate(self._model):


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