[gnome-boxes] downloader: Also report progress for non-http(s)
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] downloader: Also report progress for non-http(s)
- Date: Sun, 16 Mar 2014 12:38:47 +0000 (UTC)
commit 5010a3b04715e032fe555eadb66eb81a4ce46a35
Author: Timm Bäder <mail baedert org>
Date: Thu Mar 13 16:16:42 2014 +0100
downloader: Also report progress for non-http(s)
Downloader.download just uses Boxes.copy_file if the given URL is a
non-http(s) URL, which did not report any progress even though
Downloader.download accepts an ActivityProgress argument.
https://bugzilla.gnome.org/show_bug.cgi?id=726254
src/downloader.vala | 2 +-
src/util-app.vala | 9 +++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/downloader.vala b/src/downloader.vala
index 6bd7359..fa8373d 100644
--- a/src/downloader.vala
+++ b/src/downloader.vala
@@ -93,7 +93,7 @@ private class Boxes.Downloader : GLib.Object {
if (remote_file.has_uri_scheme ("http") || remote_file.has_uri_scheme ("https"))
yield download_from_http (download);
else
- yield copy_file (remote_file, cached_file); // FIXME: No progress report in this case.
+ yield copy_file (remote_file, cached_file, progress);
} catch (GLib.Error error) {
download_failed (download, error);
diff --git a/src/util-app.vala b/src/util-app.vala
index 7a3627f..920bf45 100644
--- a/src/util-app.vala
+++ b/src/util-app.vala
@@ -364,10 +364,15 @@ namespace Boxes {
});
}
- public async void copy_file (File src_file, File dest_file, Cancellable? cancellable = null) throws
GLib.Error {
+ public async void copy_file (File src_file,
+ File dest_file,
+ ActivityProgress progress,
+ Cancellable? cancellable = null) throws GLib.Error {
try {
debug ("Copying '%s' to '%s'..", src_file.get_path (), dest_file.get_path ());
- yield src_file.copy_async (dest_file, 0, Priority.DEFAULT, cancellable);
+ yield src_file.copy_async (dest_file, 0, Priority.DEFAULT, cancellable, (current, total) => {
+ progress.progress = (double) current / total;
+ });
debug ("Copied '%s' to '%s'.", src_file.get_path (), dest_file.get_path ());
} catch (IOError.EXISTS error) {}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]