[gnome-boxes/gnome-3-8] Asynchronously load VM sources



commit ffc85f8f74da629247f83d9eb76328f4ea0218e3
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Wed Jun 5 16:50:29 2013 +0200

    Asynchronously load VM sources
    
    The fix for bug #683489 changed the various VM sources to be loaded
    sequentially. As some sources can be slower than others (remote oVirt
    VS local libvirt connection), this means a slow source could block
    processing of a faster source, causing the UI to be empty for longer
    than it should.
    
    This commit follows one of Zeeshan's suggestion to make that processing
    asynchronous again.

 src/app.vala |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 4e9318e..f7b6c34 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -428,13 +428,16 @@ private class Boxes.App: Boxes.UI {
             return false;
         });
 
+        var i = 0;
         foreach (var source in new_sources)
-            yield add_collection_source (source);
-
-        if (default_connection == null) {
-            printerr ("Missing or failing default libvirt connection\n");
-            application.release (); // will end application
-        }
+            add_collection_source.begin (source, (obj, res) => {
+                    add_collection_source.end (res);
+                    i++;
+                    if ((i == new_sources.length ()) && (default_connection == null)) {
+                        printerr ("Missing or failing default libvirt connection\n");
+                        application.release (); // will end application
+                    }
+            });
     }
 
     private void save_window_geometry () {


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