[folks] telepathy: Add enable_persona_store and disable_persona_store to telepathy backend. telepathy: Add e



commit b4bff64ef78de9875bb426569d6024b2a6af82a0
Author: Jeremy Whiting <jpwhiting kde org>
Date:   Wed Sep 26 15:35:54 2012 -0600

    telepathy: Add enable_persona_store and disable_persona_store to telepathy backend.
    telepathy: Add empty set_persona_stores to telepathy backend.

 backends/telepathy/tp-backend.vala |   57 ++++++++++++++++++++++++++++++++----
 1 files changed, 51 insertions(+), 6 deletions(-)
---
diff --git a/backends/telepathy/tp-backend.vala b/backends/telepathy/tp-backend.vala
index 0734dbb..b8787d4 100644
--- a/backends/telepathy/tp-backend.vala
+++ b/backends/telepathy/tp-backend.vala
@@ -53,6 +53,35 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
   /**
    * { inheritDoc}
    */
+  public override void enable_persona_store (PersonaStore store)
+    {
+      if (this.persona_stores.has_key (store.id) == false)
+        {
+          this._add_store (store);
+        }
+    }
+    
+  /**
+   * { inheritDoc}
+   */
+  public override void disable_persona_store (PersonaStore store)
+    {
+      if (this.persona_stores.has_key (store.id))
+        {
+          this._remove_store (store);
+        }
+    }
+    
+  /**
+   * { inheritDoc}
+   */
+  public override void set_persona_stores (Set<string>? storeids)
+    {
+    }
+
+  /**
+   * { inheritDoc}
+   */
   public Backend ()
     {
       Object ();
@@ -171,17 +200,33 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
         }
 
       var store = Tpf.PersonaStore.dup_for_account (account);
-      store.removed.connect (this._store_removed_cb);
+      this._add_store (store);
+    }
 
-      this.notify_property ("persona-stores");
+  private void _add_store (PersonaStore store, bool notify = true)
+    {
+      store.removed.connect (this._store_removed_cb);
       this.persona_store_added (store);
-    }
 
-  private void _store_removed_cb (PersonaStore store)
+      if (notify)
+        {
+          this.notify_property ("persona-stores");
+        }
+    }
+  
+  private void _remove_store (PersonaStore store, bool notify = true)
     {
       store.removed.disconnect (this._store_removed_cb);
-
       this.persona_store_removed (store);
-      this.notify_property ("persona-stores");
+      
+      if (notify)
+      {
+        this.notify_property ("persona-stores");
+      }
+    }
+    
+  private void _store_removed_cb (PersonaStore store)
+    {
+      this._remove_store (store);
     }
 }



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