[gnome-music/wip/mschraal/asyncqueue-fixes: 6/6] Set most GLib async priorities to default
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/asyncqueue-fixes: 6/6] Set most GLib async priorities to default
- Date: Sun, 19 Sep 2021 11:05:08 +0000 (UTC)
commit 7e00a9494f9db2803c35955089ff7287ad75eb07
Author: Marinus Schraal <mschraal gnome org>
Date: Sun Sep 12 14:47:37 2021 +0200
Set most GLib async priorities to default
Try not to be too smart and set most GLib async priorities to default.
gnomemusic/artcache.py | 5 +++--
gnomemusic/embeddedart.py | 9 +++++----
gnomemusic/storeart.py | 9 +++++----
3 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/gnomemusic/artcache.py b/gnomemusic/artcache.py
index 6a53776f0..967ac2798 100644
--- a/gnomemusic/artcache.py
+++ b/gnomemusic/artcache.py
@@ -84,7 +84,7 @@ class ArtCache(GObject.GObject):
thumb_file = Gio.File.new_for_uri(thumbnail_uri)
if thumb_file:
thumb_file.read_async(
- GLib.PRIORITY_LOW, None, self._open_stream, None)
+ GLib.PRIORITY_DEFAULT, None, self._open_stream, None)
return
self.emit("finished", self._default_icon)
@@ -110,7 +110,8 @@ class ArtCache(GObject.GObject):
self.emit("finished", self._default_icon)
return
- stream.close_async(GLib.PRIORITY_LOW, None, self._close_stream, None)
+ stream.close_async(
+ GLib.PRIORITY_DEFAULT, None, self._close_stream, None)
surface = Gdk.cairo_surface_create_from_pixbuf(
pixbuf, self._scale, None)
diff --git a/gnomemusic/embeddedart.py b/gnomemusic/embeddedart.py
index dd4139536..567b11b1c 100644
--- a/gnomemusic/embeddedart.py
+++ b/gnomemusic/embeddedart.py
@@ -163,10 +163,11 @@ class EmbeddedArt(GObject.GObject):
self._lookup_cover_in_directory()
else:
self._file.create_async(
- Gio.FileCreateFlags.NONE, GLib.PRIORITY_LOW, None,
+ Gio.FileCreateFlags.NONE, GLib.PRIORITY_DEFAULT, None,
self._output_stream_created, pixbuf)
finally:
- stream.close_async(GLib.PRIORITY_LOW, None, self._stream_closed)
+ stream.close_async(
+ GLib.PRIORITY_DEFAULT, None, self._stream_closed)
def _output_stream_created(
self, stream: Gio.FileOutputStream, result: Gio.AsyncResult,
@@ -193,7 +194,7 @@ class EmbeddedArt(GObject.GObject):
self.emit("art-found", True)
finally:
output_stream.close_async(
- GLib.PRIORITY_LOW, None, self._stream_closed)
+ GLib.PRIORITY_DEFAULT, None, self._stream_closed)
def _stream_closed(
self, stream: Gio.OutputStream, result: Gio.AsyncResult) -> None:
@@ -207,7 +208,7 @@ class EmbeddedArt(GObject.GObject):
self._media_art.uri_async(
MediaArt.Type.ALBUM, MediaArt.ProcessFlags.NONE,
self._coreobject.props.url, self._artist, self._album,
- GLib.PRIORITY_LOW, None, self._uri_async_cb, None)
+ GLib.PRIORITY_DEFAULT, None, self._uri_async_cb, None)
def _uri_async_cb(self, src, result, data):
try:
diff --git a/gnomemusic/storeart.py b/gnomemusic/storeart.py
index a81a32fe3..0b09a5be8 100644
--- a/gnomemusic/storeart.py
+++ b/gnomemusic/storeart.py
@@ -85,7 +85,7 @@ class StoreArt(GObject.Object):
cache_dir_file = Gio.File.new_for_path(cache_dir)
cache_dir_file.query_info_async(
Gio.FILE_ATTRIBUTE_ACCESS_CAN_READ, Gio.FileQueryInfoFlags.NONE,
- GLib.PRIORITY_LOW, None, self._cache_dir_info_read, uri)
+ GLib.PRIORITY_DEFAULT, None, self._cache_dir_info_read, uri)
def _cache_dir_info_read(self, cache_dir_file, res, uri):
try:
@@ -126,10 +126,11 @@ class StoreArt(GObject.Object):
self.emit("finished")
else:
self._file.create_async(
- Gio.FileCreateFlags.NONE, GLib.PRIORITY_LOW, None,
+ Gio.FileCreateFlags.NONE, GLib.PRIORITY_DEFAULT, None,
self._output_stream_created, pixbuf)
finally:
- stream.close_async(GLib.PRIORITY_LOW, None, self._stream_closed)
+ stream.close_async(
+ GLib.PRIORITY_DEFAULT, None, self._stream_closed)
def _output_stream_created(
self, stream: Gio.FileOutputStream, result: Gio.AsyncResult,
@@ -156,7 +157,7 @@ class StoreArt(GObject.Object):
finally:
self.emit("finished")
output_stream.close_async(
- GLib.PRIORITY_LOW, None, self._stream_closed)
+ GLib.PRIORITY_DEFAULT, None, self._stream_closed)
def _stream_closed(
self, stream: Gio.OutputStream, result: Gio.AsyncResult) -> None:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]