[gnome-boxes] downloader: Report progress of already running downloads



commit 48e2bb5a8d48886475d63d3b9423332f05cc08d7
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Mar 6 02:57:40 2013 +0200

    downloader: Report progress of already running downloads
    
    This is actually more like reporting progress of duplicate downloads.
    Duplicate downloads can currently happen for two reasons:
    
    1. We automatically download logo and drivers for known ISOs and
       devices as part of wizard's menu population. Now if user launches
       Boxes with path to one of these ISOs/devices as argument, we'll have
       two downloads launched for logo and driver files. Since automatic
       download will be launched first, user will see no progress of
       download reported at 'preparation' step of wizard (just a stuck
       progress bar).
    2. Multiple different OSs sharing logo and/or driver files and user
       having ISOs for at least two of them. This is currently not a problem
       since we don't allow multiple instances of wizard (or Boxes itself)
       running at the same time and progress of automatic downloads isn't
       reported to user. However, either of these could change in future.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695294

 src/downloader.vala |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/downloader.vala b/src/downloader.vala
index 5f1783f..486b3f7 100644
--- a/src/downloader.vala
+++ b/src/downloader.vala
@@ -61,7 +61,7 @@ private class Boxes.Downloader : GLib.Object {
         var download = downloads.get (uri);
         if (download != null)
             // Already being downloaded
-            return yield await_download (download, cached_path); // FIXME: No progress report in this case.
+            return yield await_download (download, cached_path, progress);
 
         var cached_file = File.new_for_path (cached_path);
         if (cached_file.query_exists ()) {
@@ -141,10 +141,13 @@ private class Boxes.Downloader : GLib.Object {
         }
     }
 
-    private async File? await_download (Download download, string cached_path) throws GLib.Error {
+    private async File? await_download (Download         download,
+                                        string           cached_path,
+                                        ActivityProgress progress) throws GLib.Error {
         File downloaded_file = null;
         GLib.Error download_error = null;
 
+        download.progress.bind_property ("progress", progress, "progress", BindingFlags.SYNC_CREATE);
         SourceFunc callback = await_download.callback;
         var downloaded_id = downloaded.connect ((downloader, downloaded) => {
             if (downloaded.uri != download.uri)


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