home · contact · privacy
In browser.py, fix sorting.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 12 Sep 2024 16:32:45 +0000 (18:32 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 12 Sep 2024 16:32:45 +0000 (18:32 +0200)
browser.py

index 1798fec0d8a5ef5ba452195b17b6d4ab6878e5b3..792fc4b2b789dc2559157ed7a6cfc0f9ecc614cf 100755 (executable)
@@ -238,7 +238,7 @@ class MainWindow(Gtk.Window):
                     self.gallery_store_filtered)
             self.include_dirs = False
             self.recurse_dirs = False
-            self.per_row = 3
+            self.per_row = 5
 
         def init_key_control():
             key_ctl = Gtk.EventControllerKey(
@@ -334,6 +334,7 @@ class MainWindow(Gtk.Window):
                 if isinstance(b, DirItem) and not isinstance(a, DirItem):
                     return +1
             # apply self.sort_order within DirItems and FileItems (separately)
+            ret = 0
             for key in self.sort_order:
                 a_cmp = None
                 b_cmp = None
@@ -344,14 +345,14 @@ class MainWindow(Gtk.Window):
                 if a_cmp is None and b_cmp is None:
                     continue
                 if a_cmp is None:
-                    return -1
-                if b_cmp is None:
-                    return +1
-                if a_cmp > b_cmp:
-                    return +1
-                if a_cmp < b_cmp:
-                    return -1
-            return 0
+                    ret = -1
+                elif b_cmp is None:
+                    ret = +1
+                elif a_cmp > b_cmp:
+                    ret = +1
+                elif a_cmp < b_cmp:
+                    ret = -1
+            return ret
 
         def init_gallery_slot(file_item):
             slot = Gtk.Box()