[gnome-boxes] wizard: Introduce media downloading feature



commit 4bbaa4dda448449d548406a6717257448ad1471c
Author: Lasse Schuirmann <lasse schuirmann gmail com>
Date:   Tue Jul 15 13:00:10 2014 +0200

    wizard: Introduce media downloading feature
    
    This adds the possibility to download installation/live media via the
    HTTP(S) protocol from the internet.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=729026

 src/wizard.vala |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/wizard.vala b/src/wizard.vala
index 53cd7ad..4ca36a7 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -350,8 +350,13 @@ private class Boxes.Wizard: Gtk.Stack, Boxes.UI {
             Downloader.fetch_os_logo.begin (installer_image, install_media.os, 128);
         }
 
-        progress.bind_property ("info", prep_status_label, "label");
-        yield install_media.prepare (progress, null);
+        ActivityProgress prepare_media_progress;
+        if (wizard_source.download_required)
+            prepare_media_progress = progress.add_child_activity (PREPARE_PROGRESS_SCALE);
+        else
+            prepare_media_progress = progress;
+        prepare_media_progress.bind_property ("info", prep_status_label, "label");
+        yield install_media.prepare (prepare_media_progress, prepare_cancellable);
 
         vm_creator = install_media.get_vm_creator ();
         prep_progress.fraction = 1.0;
@@ -359,6 +364,23 @@ private class Boxes.Wizard: Gtk.Stack, Boxes.UI {
     }
 
     private bool prepare (ActivityProgress progress) {
+        try {
+            // Validate URI
+            prepare_for_location (wizard_source.uri, true);
+        } catch (GLib.Error error) {
+            App.window.notificationbar.display_error (error.message);
+
+            return false;
+        }
+
+        prepare_cancellable = new Cancellable ();
+        if (wizard_source.download_required) {
+            continue_button.sensitive = false;
+            download_media.begin (wizard_source.uri, progress);
+
+            return true;
+        }
+
         installer_image.set_from_icon_name ("media-optical", 0); // Reset
 
         if (this.wizard_source.install_media != null) {


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