[folks] Hide setter for Persona.linkable_properties



commit 62d321e39dac00e13184200fada89ca982bbc065
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Fri Sep 10 15:45:30 2010 +0100

    Hide setter for Persona.linkable_properties

 NEWS                                    |    4 ++++
 backends/key-file/kf-persona.vala       |   11 +++++++++--
 backends/telepathy/lib/tpf-persona.vala |   14 +++++++++++---
 folks/persona.vala                      |    2 +-
 4 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/NEWS b/NEWS
index 79ab8bf..067732e 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,10 @@ API changes:
 * Add BackendStore.disable_backend().
 * Add BackendStore.unprepare().
 * Remove casting convenience methods on Individual (casting isn't hard)
+* Change the visibility of the setters of PersonaStore.type_id,
+  PersonaStore.display_name, PersonaStore.id, Backend.name,
+  Backend.persona_stores and Persona.linkable_properties. This removes the
+  corresponding C setter methods which should never have been exposed
 
 Bugs fixed:
 * Bug 629081 â?? Add API to allow specific backends to be disabled
diff --git a/backends/key-file/kf-persona.vala b/backends/key-file/kf-persona.vala
index 51a8883..2486519 100644
--- a/backends/key-file/kf-persona.vala
+++ b/backends/key-file/kf-persona.vala
@@ -38,6 +38,15 @@ public class Folks.Backends.Kf.Persona : Folks.Persona,
    * arrays aren't supported as generic types. */
   private HashTable<string, GenericArray<string>> _im_addresses;
   private string _alias;
+  private const string[] _linkable_properties = { "im-addresses" };
+
+  /**
+   * { inheritDoc}
+   */
+  public override string[] linkable_properties
+    {
+      get { return this._linkable_properties; }
+    }
 
   /**
    * { inheritDoc}
@@ -127,7 +136,6 @@ public class Folks.Backends.Kf.Persona : Folks.Persona,
    */
   public Persona (KeyFile key_file, string id, Folks.PersonaStore store)
     {
-      string[] linkable_properties = { "im-addresses" };
       string iid = store.id + ":" + id;
       string uid = this.build_uid ("key-file", store.id, id);
 
@@ -135,7 +143,6 @@ public class Folks.Backends.Kf.Persona : Folks.Persona,
               iid: iid,
               uid: uid,
               store: store,
-              linkable_properties: linkable_properties,
               is_user: false);
 
       debug ("Adding key-file Persona '%s' (IID '%s', group '%s')", uid, iid,
diff --git a/backends/telepathy/lib/tpf-persona.vala b/backends/telepathy/lib/tpf-persona.vala
index b0ea5e5..6b8498b 100644
--- a/backends/telepathy/lib/tpf-persona.vala
+++ b/backends/telepathy/lib/tpf-persona.vala
@@ -44,6 +44,7 @@ public class Tpf.Persona : Folks.Persona,
   private bool _is_favourite;
   private string _alias;
   private HashTable<string, GenericArray<string>> _im_addresses;
+  private const string[] _linkable_properties = { "im-addresses" };
 
   /* Whether we've finished being constructed; this is used to prevent
    * unnecessary trips to the Telepathy service to tell it about properties
@@ -73,6 +74,16 @@ public class Tpf.Persona : Folks.Persona,
   public string presence_message { get; private set; }
 
   /**
+   * The names of the Persona's linkable properties.
+   *
+   * See { link Folks.Persona.linkable_properties}.
+   */
+  public override string[] linkable_properties
+    {
+      get { return this._linkable_properties; }
+    }
+
+  /**
    * An alias for the Persona.
    *
    * See { link Folks.Aliasable.alias}.
@@ -203,8 +214,6 @@ public class Tpf.Persona : Folks.Persona,
    */
   public Persona (Contact contact, PersonaStore store) throws Tpf.PersonaError
     {
-      string[] linkable_properties = { "im-addresses" };
-
       /* FIXME: There is the possibility of a crash in the error condition below
        * due to bgo#604299, where the C self variable isn't initialised until we
        * chain up to the Object constructor, below. */
@@ -229,7 +238,6 @@ public class Tpf.Persona : Folks.Persona,
               iid: account.get_protocol () + ":" + id,
               uid: uid,
               store: store,
-              linkable_properties: linkable_properties,
               is_user: contact.handle == connection.self_handle);
 
       contact.notify["alias"].connect ((s, p) =>
diff --git a/folks/persona.vala b/folks/persona.vala
index 7733aa1..4c5ee2d 100644
--- a/folks/persona.vala
+++ b/folks/persona.vala
@@ -116,7 +116,7 @@ public abstract class Folks.Persona : Object
    *
    * @since 0.1.13
    */
-  public string[] linkable_properties { get; protected set; }
+  public abstract string[] linkable_properties { get; }
 
   /**
    * Callback into the aggregator to manipulate a link mapping.



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