[folks] Migrate PhoneDetails to using AbstractFieldDetails.id



commit 144583fd56fcbb9325e54ee6ded5d5005a3d3b62
Author: Travis Reitter <travis reitter collabora co uk>
Date:   Fri Oct 21 08:17:41 2011 -0700

    Migrate PhoneDetails to using AbstractFieldDetails.id
    
    Helps: bgo#662433 - AbstractFieldDetails.equal() is ambiguous about
    checking parameters.

 backends/tracker/lib/trf-persona.vala |    9 ++++-----
 folks/phone-details.vala              |   10 ++++++++++
 2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/backends/tracker/lib/trf-persona.vala b/backends/tracker/lib/trf-persona.vala
index b37b0af..636bbe3 100644
--- a/backends/tracker/lib/trf-persona.vala
+++ b/backends/tracker/lib/trf-persona.vala
@@ -1194,8 +1194,7 @@ public class Trf.Persona : Folks.Persona,
               string[] p_info = p.split ("\t");
               var phone_fd =
                 new PhoneFieldDetails (p_info[Trf.PhoneFields.PHONE]);
-              phone_fd.set_parameter ("tracker_id",
-                  p_info[Trf.PhoneFields.TRACKER_ID]);
+              phone_fd.id = p_info[Trf.PhoneFields.TRACKER_ID];
               phones.add (phone_fd);
             }
         }
@@ -1212,7 +1211,7 @@ public class Trf.Persona : Folks.Persona,
 
       foreach (var p in this._phone_numbers)
         {
-          if (p.get_parameter_values ("tracker_id").contains (tracker_id))
+          if (p.id == tracker_id)
             {
               found = true;
               break;
@@ -1222,7 +1221,7 @@ public class Trf.Persona : Folks.Persona,
       if (!found)
         {
           var phone_fd = new PhoneFieldDetails (phone);
-          phone_fd.set_parameter ("tracker_id", tracker_id);
+          phone_fd.id = tracker_id;
           this._phone_numbers.add (phone_fd);
           this.notify_property ("phone-numbers");
         }
@@ -1236,7 +1235,7 @@ public class Trf.Persona : Folks.Persona,
 
       foreach (var p in this._phone_numbers)
         {
-          if (p.get_parameter_values ("tracker_id").contains (tracker_id))
+          if (p.id == tracker_id)
             {
               this._phone_numbers.remove (p);
               found = true;
diff --git a/folks/phone-details.vala b/folks/phone-details.vala
index 8491822..384c05a 100644
--- a/folks/phone-details.vala
+++ b/folks/phone-details.vala
@@ -41,6 +41,16 @@ public class Folks.PhoneFieldDetails : AbstractFieldDetails<string>
   private const string[] _valid_digits = { "#", "*", "0", "1", "2", "3", "4",
       "5", "6", "7", "8", "9" };
 
+  private string _id;
+  /**
+   * { inheritDoc}
+   */
+  public override string id
+    {
+      get { return this._id; }
+      set { this._id = (value != null ? value : ""); }
+    }
+
   /**
    * Create a new PhoneFieldDetails.
    *



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