[geary/wip/347-folks-loading-slow] Init Folks in the backgroud to prevent blocking the UI on startup



commit 8ee768fb0fcd9a276a2607947d3e299d71707a7c
Author: Michael Gratton <mike vee net>
Date:   Fri Mar 29 17:18:21 2019 +1100

    Init Folks in the backgroud to prevent blocking the UI on startup
    
    Fixes #347

 src/client/application/geary-controller.vala | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index c95534ca..0a12e4d5 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -263,11 +263,16 @@ public class GearyController : Geary.BaseObject {
         Folks.IndividualAggregator individuals =
             Folks.IndividualAggregator.dup();
         if (!individuals.is_prepared) {
-            try {
-                yield individuals.prepare();
-            } catch (GLib.Error err) {
-                error("Error preparing Folks: %s", err.message);
-            }
+            // Do this in the background since it can take a long time
+            // on some systems and the GUI shouldn't be blocked by it
+            individuals.prepare.begin((obj, res) => {
+                    try {
+                        individuals.prepare.end(res);
+                    } catch (GLib.Error err) {
+                        warning("Error preparing Folks: %s", err.message);
+                    }
+                });
+
         }
         this.avatar_store = new Application.AvatarStore(individuals);
 


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