[gnome-music/wip/jfelder/searchview-new-style: 11/21] albumcover: Limit timeout



commit 0cb6a67f5c8be55d2e5a0fb69fe0eca42c83d725
Author: Jean Felder <jfelder src gnome org>
Date:   Sat Aug 3 12:31:20 2019 +0200

    albumcover: Limit timeout

 gnomemusic/widgets/albumcover.py | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gnomemusic/widgets/albumcover.py b/gnomemusic/widgets/albumcover.py
index 5dc55a40..ae6b82f8 100644
--- a/gnomemusic/widgets/albumcover.py
+++ b/gnomemusic/widgets/albumcover.py
@@ -101,6 +101,8 @@ class AlbumCover(Gtk.FlowBoxChild):
         # quick first show with a placeholder cover and then a
         # reasonably responsive view while loading the actual
         # covers.
+        self._update_cover_id = self._cover_stack.connect(
+            "updated", self._on_cover_stack_updated)
         GLib.timeout_add(
             50 * self._nr_albums, self._cover_stack.update, self._corealbum,
             priority=GLib.PRIORITY_LOW)
@@ -131,3 +133,7 @@ class AlbumCover(Gtk.FlowBoxChild):
         tooltip.set_custom(self._tooltip)
 
         return True
+
+    def _on_cover_stack_updated(self, cover_stack):
+        AlbumCover._nr_albums -= 1
+        self._cover_stack.disconnect(self._update_cover_id)


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