[folks] Hide setter for Backend.persona_stores



commit b7cb90a159008fd2cfa8dfcec7cf993c86a0816c
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Fri Sep 10 15:20:51 2010 +0100

    Hide setter for Backend.persona_stores

 backends/key-file/kf-backend.vala  |   23 ++++++++++++++++++-----
 backends/telepathy/tp-backend.vala |   25 +++++++++++++++++++------
 folks/backend.vala                 |   11 +----------
 3 files changed, 38 insertions(+), 21 deletions(-)
---
diff --git a/backends/key-file/kf-backend.vala b/backends/key-file/kf-backend.vala
index 305ff5e..1794d49 100644
--- a/backends/key-file/kf-backend.vala
+++ b/backends/key-file/kf-backend.vala
@@ -32,6 +32,7 @@ using Folks.Backends.Kf;
 public class Folks.Backends.Kf.Backend : Folks.Backend
 {
   private bool _is_prepared = false;
+  private HashTable<string, PersonaStore> _persona_stores;
 
   /**
    * Whether this Backend has been prepared.
@@ -55,7 +56,16 @@ public class Folks.Backends.Kf.Backend : Folks.Backend
    */
   public override HashTable<string, PersonaStore> persona_stores
     {
-      get; private set;
+      get { return this._persona_stores; }
+    }
+
+  /**
+   * { inheritDoc}
+   */
+  public Backend ()
+    {
+      this._persona_stores = new HashTable<string, PersonaStore> (str_hash,
+          str_equal);
     }
 
   /**
@@ -91,10 +101,11 @@ public class Folks.Backends.Kf.Backend : Folks.Backend
               /* Create the PersonaStore for the key file */
               PersonaStore store = new Kf.PersonaStore (file);
 
-              this.persona_stores.insert (store.id, store);
+              this._persona_stores.insert (store.id, store);
               store.removed.connect (this.store_removed_cb);
 
               this.persona_store_added (store);
+              this.notify_property ("persona-stores");
 
               this._is_prepared = true;
               this.notify_property ("is-prepared");
@@ -107,12 +118,13 @@ public class Folks.Backends.Kf.Backend : Folks.Backend
    */
   public override async void unprepare () throws GLib.Error
     {
-      this.persona_stores.foreach ((k, v) =>
+      this._persona_stores.foreach ((k, v) =>
         {
           this.persona_store_removed ((PersonaStore) v);
         });
 
-      this.persona_stores.remove_all ();
+      this._persona_stores.remove_all ();
+      this.notify_property ("persona-stores");
 
       this._is_prepared = false;
       this.notify_property ("is-prepared");
@@ -121,6 +133,7 @@ public class Folks.Backends.Kf.Backend : Folks.Backend
   private void store_removed_cb (Folks.PersonaStore store)
     {
       this.persona_store_removed (store);
-      this.persona_stores.remove (store.id);
+      this._persona_stores.remove (store.id);
+      this.notify_property ("persona-stores");
     }
 }
diff --git a/backends/telepathy/tp-backend.vala b/backends/telepathy/tp-backend.vala
index 81c6fd7..84eb686 100644
--- a/backends/telepathy/tp-backend.vala
+++ b/backends/telepathy/tp-backend.vala
@@ -31,6 +31,7 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
 {
   private AccountManager account_manager;
   private bool _is_prepared = false;
+  private HashTable<string, PersonaStore> _persona_stores;
 
   /**
    * { inheritDoc}
@@ -42,7 +43,16 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
    */
   public override HashTable<string, PersonaStore> persona_stores
     {
-      get; private set;
+      get { return this._persona_stores; }
+    }
+
+  /**
+   * { inheritDoc}
+   */
+  public Backend ()
+    {
+      this._persona_stores = new HashTable<string, PersonaStore> (str_hash,
+          str_equal);
     }
 
   /**
@@ -100,12 +110,13 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
           this.account_validity_changed_cb);
       this.account_manager = null;
 
-      this.persona_stores.foreach ((k, v) =>
+      this._persona_stores.foreach ((k, v) =>
         {
           this.persona_store_removed ((PersonaStore) v);
         });
 
-      this.persona_stores.remove_all ();
+      this._persona_stores.remove_all ();
+      this.notify_property ("persona-stores");
 
       this._is_prepared = false;
       this.notify_property ("is-prepared");
@@ -119,7 +130,7 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
 
   private void account_enabled_cb (Account account)
     {
-      PersonaStore store = this.persona_stores.lookup (
+      PersonaStore store = this._persona_stores.lookup (
           account.get_object_path ());
 
       if (store != null)
@@ -127,15 +138,17 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
 
       store = new Tpf.PersonaStore (account);
 
-      this.persona_stores.insert (store.id, store);
+      this._persona_stores.insert (store.id, store);
       store.removed.connect (this.store_removed_cb);
 
       this.persona_store_added (store);
+      this.notify_property ("persona-stores");
     }
 
   private void store_removed_cb (PersonaStore store)
     {
       this.persona_store_removed (store);
-      this.persona_stores.remove (store.id);
+      this._persona_stores.remove (store.id);
+      this.notify_property ("persona-stores");
     }
 }
diff --git a/folks/backend.vala b/folks/backend.vala
index 63310a9..39ad5a6 100644
--- a/folks/backend.vala
+++ b/folks/backend.vala
@@ -60,10 +60,7 @@ public abstract class Folks.Backend : Object
    * A backend may expose { link Persona}s from multiple servers or accounts
    * (for example), so may have a { link PersonaStore} for each.
    */
-  public abstract HashTable<string, PersonaStore> persona_stores
-    {
-      get; protected set;
-    }
+  public abstract HashTable<string, PersonaStore> persona_stores { get; }
 
   /**
    * Emitted when a { link PersonaStore} is added to the backend.
@@ -120,10 +117,4 @@ public abstract class Folks.Backend : Object
    * @since 0.3.2
    */
   public abstract async void unprepare () throws GLib.Error;
-
-  construct
-    {
-      this.persona_stores = new HashTable<string, PersonaStore> (str_hash,
-          str_equal);
-    }
 }



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