[folks] backends: Add [freeze|thaw]_notify() calls to [un]prepare() in backends



commit 3eb474fe0dc4925f56d75569df3fc29dfb56cffc
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Thu Nov 28 17:12:59 2013 +0000

    backends: Add [freeze|thaw]_notify() calls to [un]prepare() in backends
    
    Reduce signal duplication. Inspired by the dummy backend.

 backends/bluez/bluez-backend.vala     |    2 ++
 backends/eds/eds-backend.vala         |    4 ++++
 backends/key-file/kf-backend.vala     |    4 ++++
 backends/libsocialweb/sw-backend.vala |    5 +++++
 backends/ofono/ofono-backend.vala     |    8 ++++----
 backends/telepathy/tp-backend.vala    |    5 +++++
 backends/tracker/tr-backend.vala      |    4 ++++
 7 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/backends/bluez/bluez-backend.vala b/backends/bluez/bluez-backend.vala
index 1c89304..1966a68 100644
--- a/backends/bluez/bluez-backend.vala
+++ b/backends/bluez/bluez-backend.vala
@@ -466,6 +466,7 @@ public class Folks.Backends.BlueZ.Backend : Folks.Backend
       try
         {
           this._prepare_pending = true;
+          this.freeze_notify ();
 
           try
             {
@@ -569,6 +570,7 @@ public class Folks.Backends.BlueZ.Backend : Folks.Backend
         }
       finally
         {
+          this.thaw_notify ();
           this._prepare_pending = false;
         }
 
diff --git a/backends/eds/eds-backend.vala b/backends/eds/eds-backend.vala
index 4b8383e..90855f2 100644
--- a/backends/eds/eds-backend.vala
+++ b/backends/eds/eds-backend.vala
@@ -206,6 +206,7 @@ public class Folks.Backends.Eds.Backend : Folks.Backend
       try
         {
           this._prepare_pending = true;
+          this.freeze_notify ();
 
           this._create_avatars_cache_dir ();
 
@@ -226,6 +227,7 @@ public class Folks.Backends.Eds.Backend : Folks.Backend
         }
       finally
         {
+          this.thaw_notify ();
           this._prepare_pending = false;
         }
 
@@ -245,6 +247,7 @@ public class Folks.Backends.Eds.Backend : Folks.Backend
       try
         {
           this._prepare_pending = true;
+          this.freeze_notify ();
 
           var iter = this._persona_stores.values.iterator ();
 
@@ -263,6 +266,7 @@ public class Folks.Backends.Eds.Backend : Folks.Backend
         }
       finally
         {
+          this.thaw_notify ();
           this._prepare_pending = false;
         }
     }
diff --git a/backends/key-file/kf-backend.vala b/backends/key-file/kf-backend.vala
index e118ebd..67722b2 100644
--- a/backends/key-file/kf-backend.vala
+++ b/backends/key-file/kf-backend.vala
@@ -183,6 +183,7 @@ public class Folks.Backends.Kf.Backend : Folks.Backend
       try
         {
           this._prepare_pending = true;
+          this.freeze_notify ();
 
           File file;
           unowned string path = Environment.get_variable (
@@ -216,6 +217,7 @@ public class Folks.Backends.Kf.Backend : Folks.Backend
         }
       finally
         {
+          this.thaw_notify ();
           this._prepare_pending = false;
         }
 
@@ -270,6 +272,7 @@ public class Folks.Backends.Kf.Backend : Folks.Backend
       try
         {
           this._prepare_pending = true;
+          this.freeze_notify ();
 
           foreach (var persona_store in this._persona_stores.values)
             {
@@ -287,6 +290,7 @@ public class Folks.Backends.Kf.Backend : Folks.Backend
         }
       finally
         {
+          this.thaw_notify ();
           this._prepare_pending = false;
         }
     }
diff --git a/backends/libsocialweb/sw-backend.vala b/backends/libsocialweb/sw-backend.vala
index 5df08f1..ba41398 100644
--- a/backends/libsocialweb/sw-backend.vala
+++ b/backends/libsocialweb/sw-backend.vala
@@ -183,6 +183,8 @@ public class Folks.Backends.Sw.Backend : Folks.Backend
         {
           try
             {
+              this.freeze_notify ();
+
               foreach (var service_name in services)
                 this.add_service (service_name);
 
@@ -196,6 +198,7 @@ public class Folks.Backends.Sw.Backend : Folks.Backend
             }
           finally
             {
+              this.thaw_notify ();
               this._prepare_pending = false;
             }
         });
@@ -216,6 +219,7 @@ public class Folks.Backends.Sw.Backend : Folks.Backend
       try
         {
           this._prepare_pending = true;
+          this.freeze_notify ();
 
           foreach (var store in this._persona_stores.values)
             {
@@ -236,6 +240,7 @@ public class Folks.Backends.Sw.Backend : Folks.Backend
         }
       finally
         {
+          this.thaw_notify ();
           this._prepare_pending = false;
         }
     }
diff --git a/backends/ofono/ofono-backend.vala b/backends/ofono/ofono-backend.vala
index 1394e21..3ac68c0 100644
--- a/backends/ofono/ofono-backend.vala
+++ b/backends/ofono/ofono-backend.vala
@@ -174,6 +174,7 @@ public class Folks.Backends.Ofono.Backend : Folks.Backend
       try
         {
           this._prepare_pending = true;
+          this.freeze_notify ();
 
           /* New modem devices can be caught in notifications */
           Manager manager;
@@ -199,16 +200,15 @@ public class Folks.Backends.Ofono.Backend : Folks.Backend
               this._modem_added (modem.path, modem.properties);
             }
 
-          this.freeze_notify ();
           this._is_prepared = true;
           this.notify_property ("is-prepared");
 
           this._is_quiescent = true;
           this.notify_property ("is-quiescent");
-          this.thaw_notify ();
         }
       finally
         {
+          this.thaw_notify ();
           this._prepare_pending = false;
         }
 
@@ -228,13 +228,13 @@ public class Folks.Backends.Ofono.Backend : Folks.Backend
       try
         {
           this._prepare_pending = true;
+          this.freeze_notify ();
 
           foreach (var persona_store in this._persona_stores.values)
             {
               this.persona_store_removed (persona_store);
             }
 
-          this.freeze_notify ();
           this._persona_stores.clear ();
           this.notify_property ("persona-stores");
 
@@ -243,10 +243,10 @@ public class Folks.Backends.Ofono.Backend : Folks.Backend
 
           this._is_prepared = false;
           this.notify_property ("is-prepared");
-          this.thaw_notify ();
         }
       finally
         {
+          this.thaw_notify ();
           this._prepare_pending = false;
         }
     }
diff --git a/backends/telepathy/tp-backend.vala b/backends/telepathy/tp-backend.vala
index f593604..4c4cb95 100644
--- a/backends/telepathy/tp-backend.vala
+++ b/backends/telepathy/tp-backend.vala
@@ -166,6 +166,8 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
       try
         {
           this._prepare_pending = true;
+          this.freeze_notify ();
+
           this._account_manager = AccountManager.dup ();
           yield this._account_manager.prepare_async (null);
           this._account_manager.account_enabled.connect (
@@ -188,6 +190,7 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
         }
       finally
         {
+          this.thaw_notify ();
           this._prepare_pending = false;
         }
 
@@ -207,6 +210,7 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
       try
         {
           this._prepare_pending = true;
+          this.freeze_notify ();
 
           this._account_manager.account_enabled.disconnect (
               this._account_enabled_cb);
@@ -222,6 +226,7 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
         }
       finally
         {
+          this.thaw_notify ();
           this._prepare_pending = false;
         }
     }
diff --git a/backends/tracker/tr-backend.vala b/backends/tracker/tr-backend.vala
index f39ef43..bd23998 100644
--- a/backends/tracker/tr-backend.vala
+++ b/backends/tracker/tr-backend.vala
@@ -147,6 +147,7 @@ public class Folks.Backends.Tr.Backend : Folks.Backend
       try
         {
           this._prepare_pending = true;
+          this.freeze_notify ();
 
           this._add_default_persona_store ();
 
@@ -158,6 +159,7 @@ public class Folks.Backends.Tr.Backend : Folks.Backend
         }
       finally
         {
+          this.thaw_notify ();
           this._prepare_pending = false;
         }
 
@@ -177,6 +179,7 @@ public class Folks.Backends.Tr.Backend : Folks.Backend
       try
         {
           this._prepare_pending = true;
+          this.freeze_notify ();
 
           foreach (var persona_store in this._persona_stores.values)
             {
@@ -194,6 +197,7 @@ public class Folks.Backends.Tr.Backend : Folks.Backend
         }
       finally
         {
+          this.thaw_notify ();
           this._prepare_pending = false;
         }
     }


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