home · contact · privacy
browser.py: Minor fix and optimization in .update_gallery.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 9 Sep 2024 14:46:27 +0000 (16:46 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 9 Sep 2024 14:46:27 +0000 (16:46 +0200)
browser.py

index b1bcc3aadc3e9e8e57f376512f8a92f4eb4af16d..33791a6338548ffe8f04d07347d2200dc64133f6 100755 (executable)
@@ -262,6 +262,8 @@ class MainWindow(Gtk.Window):
                     return True
                 if a_cmp is None:
                     return False
+                elif b_cmp is None:
+                    return True
                 return a_cmp > b_cmp
 
         def init_gallery_slot(file_item):
@@ -276,9 +278,10 @@ class MainWindow(Gtk.Window):
             slot.append(slot.content)
             return slot
 
-        self.gallery.bind_model(self.gallery_selection, init_gallery_slot)
+        self.gallery.bind_model(None, lambda _: Gtk.Box())
         if sort:
             self.gallery_store.sort(sorter)
+        self.gallery.bind_model(self.gallery_selection, init_gallery_slot)
         to_select = self.gallery.get_child_at_index(0)
         if suggested_selection:
             i = 0