[gnome-music/wip/mschraal/file-exists-async: 6/12] artcache/storeart: Emit signal emission after I/O finish
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gnome-music/wip/mschraal/file-exists-async: 6/12] artcache/storeart: Emit signal emission after I/O finish
- Date: Sat,  4 Sep 2021 22:20:28 +0000 (UTC)
commit 80aa7cb5c2502d93f7cc2e796d8907b6ee87563e
Author: Marinus Schraal <mschraal gnome org>
Date:   Sun Aug 15 22:58:04 2021 +0200
    artcache/storeart: Emit signal emission after I/O finish
    
    The point of the AsyncQueue is to not do too much I/O simultanously.
    That involves all steps, including closing streams properly.
 gnomemusic/artcache.py | 5 ++++-
 gnomemusic/storeart.py | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/artcache.py b/gnomemusic/artcache.py
index 878eeed52..6a53776f0 100644
--- a/gnomemusic/artcache.py
+++ b/gnomemusic/artcache.py
@@ -55,6 +55,7 @@ class ArtCache(GObject.GObject):
 
         self._coreobject = None
         self._default_icon = None
+        self._surface = None
 
     def start(self, coreobject, size, scale):
         """Start the cache query
@@ -120,7 +121,7 @@ class ArtCache(GObject.GObject):
                 or isinstance(self._coreobject, CoreSong)):
             surface = make_icon_frame(surface, self._size, self._scale)
 
-        self.emit("finished", surface)
+        self._surface = surface
 
     def _close_stream(self, stream, result, data):
         try:
@@ -128,3 +129,5 @@ class ArtCache(GObject.GObject):
         except GLib.Error as error:
             self._log.warning(
                 "Error: {}, {}".format(error.domain, error.message))
+
+        self.emit("finished", self._surface)
diff --git a/gnomemusic/storeart.py b/gnomemusic/storeart.py
index 89f13c0ec..a1ff57664 100644
--- a/gnomemusic/storeart.py
+++ b/gnomemusic/storeart.py
@@ -166,8 +166,6 @@ class StoreArt(GObject.Object):
         self._coreobject.props.media.set_thumbnail(cache_file.get_uri())
         self._coreobject.props.thumbnail = cache_file.get_uri()
 
-        self.emit("finished")
-
         tmp_file.delete_async(
             GLib.PRIORITY_LOW, None, self._delete_callback, None)
 
@@ -177,3 +175,5 @@ class StoreArt(GObject.Object):
         except GLib.Error as error:
             self._log.warning(
                 "Error: {}, {}".format(error.domain, error.message))
+
+        self.emit("finished")
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]