[folks] Implemented linkable_property_to_links in Trf.Persona



commit 359b1ad903341396d7a5532a6918377ffcc7af42
Author: Raul Gutierrez Segales <raul gutierrez segales collabora co uk>
Date:   Mon Mar 28 11:51:43 2011 +0100

    Implemented linkable_property_to_links in Trf.Persona

 backends/tracker/lib/trf-persona.vala |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/backends/tracker/lib/trf-persona.vala b/backends/tracker/lib/trf-persona.vala
index 29effd8..84b2222 100644
--- a/backends/tracker/lib/trf-persona.vala
+++ b/backends/tracker/lib/trf-persona.vala
@@ -47,7 +47,7 @@ public class Trf.Persona : Folks.Persona,
   private string _alias;
   private bool _is_favourite;
   private const string[] _linkable_properties =
-      {"im-addresses", "email-addresses"};
+      {"im-addresses"};
   private GLib.List<FieldDetails> _phone_numbers;
   private GLib.List<FieldDetails> _email_addresses;
   private weak Sparql.Cursor _cursor;
@@ -366,6 +366,31 @@ public class Trf.Persona : Folks.Persona,
       return this._tracker_id;
     }
 
+  /**
+   * { inheritDoc}
+   */
+  public override void linkable_property_to_links (string prop_name,
+      Folks.Persona.LinkablePropertyCallback callback)
+    {
+      if (prop_name == "im-addresses")
+        {
+          this.im_addresses.foreach ((k, v) =>
+            {
+              unowned string protocol = (string) k;
+              unowned LinkedHashSet<string> im_addresses =
+                  (LinkedHashSet<string>) v;
+
+              foreach (string address in im_addresses)
+                  callback (protocol + ":" + address);
+            });
+        }
+      else
+        {
+          /* Chain up */
+          base.linkable_property_to_links (prop_name, callback);
+        }
+    }
+
   ~Persona ()
     {
       debug ("Destroying Trf.Persona '%s': %p", this.uid, this);



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