[gnome-boxes/wip/inhibit: 11/13] wizard: Inhibit during media downloads



commit a7b7a93bba35dcd521448224f637fbac5d3d1ce9
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Apr 4 13:19:10 2018 +0200

    wizard: Inhibit during media downloads
    
    If the host system suspends during a download, the operation is
    going to fail.
    
    Fixes #193

 src/wizard.vala | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/wizard.vala b/src/wizard.vala
index ed452246..223a1476 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -642,6 +642,9 @@ private async void download_media (string uri, string? filename, ActivityProgres
         prep_status_label.label = _("Downloading media…");
 
         try {
+            var inhibit_reason = _("Downloading media");
+            App.app.inhibit (wizard_window, null, inhibit_reason);
+
             var cache_path = yield Downloader.fetch_media (uri, filename, download_progress, 
prepare_cancellable);
             prepare_downloaded_media (cache_path, progress);
         } catch (GLib.IOError.CANCELLED e) {
@@ -652,6 +655,8 @@ private async void download_media (string uri, string? filename, ActivityProgres
             window.notificationbar.display_error (_("Download failed."));
             page = WizardPage.SOURCE;
         }
+
+        App.app.uninhibit ();
     }
 
     private void prepare_downloaded_media (string cache_path, ActivityProgress progress) {


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