[gnome-music] Copy artwork async by using splice_async fixes #700021
- From: Seif Lotfy <seiflotfy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] Copy artwork async by using splice_async fixes #700021
- Date: Sun, 12 May 2013 20:26:10 +0000 (UTC)
commit 39e9bacffa6326e1c070af2b81fbcf1e0ffcde68
Author: Seif Lotfy <seif lotfy com>
Date: Sun May 12 22:25:05 2013 +0200
Copy artwork async by using splice_async
fixes #700021
src/albumArtCache.js | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/src/albumArtCache.js b/src/albumArtCache.js
index e9e8d45..f4e5c1d 100644
--- a/src/albumArtCache.js
+++ b/src/albumArtCache.js
@@ -123,16 +123,19 @@ const AlbumArtCache = new Lang.Class({
print("missing", album, artist);
- file.read_async(300, null, function(source, res, user_data) {
- var stream = file.read_finish(res),
- icon = GdkPixbuf.Pixbuf.new_from_stream_at_scale(stream, height, width, true, null),
+ file.read_async(300, null, Lang.bind(this, function(source, res, user_data) {
+ let stream = file.read_finish(res),
new_file = Gio.File.new_for_path(path);
-
- try{
- file.copy(new_file, Gio.FileCopyFlags.NONE, null, null);
- } catch(err) {};
- callback(icon);
- });
+ new_file.append_to_async(Gio.IOStreamSpliceFlags.NONE,
+ 300, null, Lang.bind(this, function (new_file, res, error) {
+ let outstream = new_file.append_to_finish(res);
+ outstream.splice_async(stream, Gio.IOStreamSpliceFlags.NONE, 300, null,
+ Lang.bind(this, function(outstream, res, error) {
+ if (outstream.splice_finish(res) > 0)
+ callback(GdkPixbuf.Pixbuf.new_from_file_at_scale(path, height, width, true));
+ }, null));
+ }));
+ }));
},
makeDefaultIcon: function(w, h) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]