Use async creation of Source Registry in eds test backend. FOLKS_0_7_2
authorJeremy Whiting <jpwhiting@kde.org>
Thu, 28 Jun 2012 19:49:50 +0000 (13:49 -0600)
committerJeremy Whiting <jpwhiting@kde.org>
Thu, 28 Jun 2012 19:49:50 +0000 (13:49 -0600)
tests/lib/eds/backend.vala

index bda2984..16cb231 100644 (file)
@@ -120,14 +120,22 @@ public class EdsTest.Backend
 
   private void _prepare_source (bool is_default)
     {
-      try
-        {
-          this._source_registry = new SourceRegistry.sync (null);
-        }
-      catch (GLib.Error e)
+      var mainloop = new GLib.MainLoop (null, false);
+
+      create_source_registry.begin (null, (obj, async_res) =>
         {
-          GLib.critical (e.message);
-        }
+          try
+            {
+              this._source_registry = create_source_registry.end (async_res);
+            }
+          catch (GLib.Error e)
+            {
+              GLib.critical (e.message);
+            }
+          mainloop.quit();
+        });
+
+      mainloop.run();
 
       this._source = this._source_registry.ref_source (this._addressbook_name);
 
@@ -258,8 +266,6 @@ public class EdsTest.Backend
 
   public void tear_down ()
     {
-      var mainloop = new GLib.MainLoop (null, false);
-
       Environment.set_variable ("FOLKS_BACKEND_EDS_USE_ADDRESS_BOOKS",
                                 "", true);
 
@@ -281,10 +287,7 @@ public class EdsTest.Backend
               GLib.warning ("Unable to remove addressbook %s because: %s\n",
                   this._addressbook_name, e.message);
             }
-            mainloop.quit();
         });
-
-      mainloop.run();
     }
 
   private Gee.HashMap<string, string> _parse_addrs (string addr_s)