[gnome-boxes] installer: Use the system cache for logos & drivers



commit d4bd651adb827f4a93ed6080048253620a6d1796
Author: Timm Bäder <mail baedert org>
Date:   Wed Mar 5 17:22:14 2014 +0100

    installer: Use the system cache for logos & drivers
    
    https://bugzilla.gnome.org/show_bug.cgi?id=698144

 src/downloader.vala           |    8 +++++++-
 src/unattended-installer.vala |   10 ++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/downloader.vala b/src/downloader.vala
index 353e8ad..6bd7359 100644
--- a/src/downloader.vala
+++ b/src/downloader.vala
@@ -147,9 +147,15 @@ private class Boxes.Downloader : GLib.Object {
         debug ("%s has logo '%s'.", os.name, logo_url);
 
         var remote_file = File.new_for_uri (logo_url);
+        var system_cached_path = get_system_logo_cache (remote_file.get_basename ());
         var cached_path = get_logo_cache (remote_file.get_basename ());
+
+        string[] cached_paths = { cached_path };
+        if (system_cached_path != null)
+            cached_paths += system_cached_path;
+
         try {
-            var cached_file = yield get_instance ().download (remote_file, {cached_path});
+            var cached_file = yield get_instance ().download (remote_file, cached_paths);
             var pixbuf = new Gdk.Pixbuf.from_file_at_size (cached_file.get_path (), size, size);
             image.set_from_pixbuf (pixbuf);
         } catch (GLib.Error error) {
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 633cd04..7fe6f09 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -498,10 +498,16 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
             var file_uri = location + "/" + filename;
             var file = File.new_for_uri (file_uri);
 
-            var cached_path = get_drivers_cache (location_checksum + "-" + file.get_basename ());
+            var driver_file_name = location_checksum + "-" + file.get_basename ();
+            var cached_path = get_drivers_cache (driver_file_name);
+            var system_cached_path = get_system_drivers_cache (driver_file_name);
+
+            string[] cached_paths = { cached_path };
+            if (system_cached_path != null)
+                cached_paths += system_cached_path;
 
             var file_progress = progress.add_child_activity (file_progress_scale);
-            file = yield downloader.download (file, {cached_path}, file_progress);
+            file = yield downloader.download (file, cached_paths, file_progress);
             file_progress.progress = 1.0; // Ensure progress reaches 100%
 
             driver_files.append (new UnattendedRawFile (this, cached_path, filename));


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