[folks] Change EmailDetails.email_addresses to be a Set<FieldDetails>
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Change EmailDetails.email_addresses to be a Set<FieldDetails>
- Date: Sat, 23 Apr 2011 21:02:12 +0000 (UTC)
commit 1d035bd4d12e61b7809b5db251993306f6c170ae
Author: Philip Withnall <philip withnall collabora co uk>
Date: Tue Apr 19 21:55:06 2011 +0100
Change EmailDetails.email_addresses to be a Set<FieldDetails>
Helps: bgo#640092
NEWS | 1 +
backends/tracker/lib/trf-persona-store.vala | 96 +++++++++++++++++++++++----
backends/tracker/lib/trf-persona.vala | 23 ++-----
folks/email-details.vala | 5 +-
folks/individual.vala | 32 ++++-----
folks/potential-match.vala | 10 +--
tests/tracker/add-persona.vala | 13 ++--
tests/tracker/duplicated-emails.vala | 16 ++--
tests/tracker/emails-updates.vala | 6 +-
tests/tracker/match-email-addresses.vala | 16 ++--
tests/tracker/match-known-emails.vala | 16 ++--
tests/tracker/remove-persona.vala | 11 ++--
tests/tracker/set-duplicate-email.vala | 14 ++--
tests/tracker/set-emails.vala | 10 ++--
tools/inspect/utils.vala | 23 ++++++-
15 files changed, 185 insertions(+), 107 deletions(-)
---
diff --git a/NEWS b/NEWS
index 1dce30b..b29363c 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,7 @@ API changes:
* FieldDetails.get_parameter_values() now returns type Collection<string>
* FieldDetails.extend_parameters() now takes type MultiMap<string, string>
* PostalAddressDetails.postal_addresses is now of type Set<PostalAddress>
+* EmailDetails.email_addresses is now of type Set<FieldDetails>
Overview of changes from libfolks 0.4.0 to libfolks 0.5.0
=========================================================
diff --git a/backends/tracker/lib/trf-persona-store.vala b/backends/tracker/lib/trf-persona-store.vala
index ed024e6..9daa6c3 100644
--- a/backends/tracker/lib/trf-persona-store.vala
+++ b/backends/tracker/lib/trf-persona-store.vala
@@ -484,15 +484,9 @@ public class Trf.PersonaStore : Folks.PersonaStore
else if (k == Folks.PersonaStore.detail_key (
PersonaDetail.EMAIL_ADDRESSES))
{
- unowned GLib.List<FieldDetails> email_addresses =
- (GLib.List<FieldDetails>) v.get_pointer ();
- var email_addresses_l = email_addresses.copy ();
- foreach (var email_fd_obj in email_addresses_l)
- {
- email_fd_obj.ref ();
- }
- yield this._build_update_query (builder,
- (owned) email_addresses_l,
+ Set<FieldDetails> email_addresses =
+ (Set<FieldDetails>) v.get_object ();
+ yield this._build_update_query_set (builder, email_addresses,
"_:p", Trf.Attrib.EMAILS);
}
else if (k == Folks.PersonaStore.detail_key (
@@ -874,6 +868,57 @@ public class Trf.PersonaStore : Folks.PersonaStore
obj_var = "_:phone%d";
break;
case Trf.Attrib.EMAILS:
+ assert_not_reached ();
+ }
+
+ int cnt = 0;
+ foreach (var p in properties)
+ {
+ var affl = affl_var.printf (cnt);
+ var obj = yield this._urn_from_property (
+ related_attrib, related_prop, p.value);
+
+ if (obj == "")
+ {
+ obj = obj_var.printf (cnt);
+ builder.subject (obj);
+ builder.predicate ("a");
+ builder.object (related_attrib);
+ builder.predicate (related_prop);
+ builder.object_string (p.value);
+ }
+
+ builder.subject (affl);
+ builder.predicate ("a");
+ builder.object (Trf.OntologyDefs.NCO_AFFILIATION);
+ builder.predicate (related_connection);
+ builder.object (obj);
+
+ builder.subject (contact_var);
+ builder.predicate (Trf.OntologyDefs.NCO_HAS_AFFILIATION);
+ builder.object (affl);
+
+ cnt++;
+ }
+ }
+
+ private async void _build_update_query_set (
+ Tracker.Sparql.Builder builder,
+ Set<FieldDetails> properties,
+ string contact_var,
+ Trf.Attrib attrib)
+ {
+ string? affl_var = null;
+ string? obj_var = null;
+ unowned string? related_attrib = null;
+ unowned string? related_prop = null;
+ unowned string? related_connection = null;
+
+ switch (attrib)
+ {
+ case Trf.Attrib.PHONES:
+ assert_not_reached ();
+ case Trf.Attrib.EMAILS:
related_attrib = Trf.OntologyDefs.NCO_EMAIL;
related_prop = Trf.OntologyDefs.NCO_EMAIL_PROP;
related_connection = Trf.OntologyDefs.NCO_HAS_EMAIL;
@@ -1931,9 +1976,9 @@ public class Trf.PersonaStore : Folks.PersonaStore
}
internal async void _set_emails (Folks.Persona persona,
- owned GLib.List<FieldDetails> emails)
+ Set<FieldDetails> emails)
{
- yield this._set_unique_attrib (persona, (owned) emails,
+ yield this._set_unique_attrib_set (persona, emails,
Trf.Attrib.EMAILS);
}
@@ -1962,10 +2007,37 @@ public class Trf.PersonaStore : Folks.PersonaStore
"?contact", Trf.Attrib.PHONES);
break;
case Trf.Attrib.EMAILS:
+ assert_not_reached ();
+ }
+ builder.insert_close ();
+ builder.where_open ();
+ builder.subject ("?contact");
+ builder.predicate ("a");
+ builder.object (Trf.OntologyDefs.NCO_PERSON);
+ string filter = " FILTER(tracker:id(?contact) = %s) ".printf (p_id);
+ builder.append (filter);
+ builder.where_close ();
+
+ yield this._tracker_update (builder.result, query_name);
+ }
+
+ internal async void _set_unique_attrib_set (Folks.Persona persona,
+ Set<FieldDetails> properties, Trf.Attrib attrib)
+ {
+ string? query_name = null;
+ var p_id = ((Trf.Persona) persona).tracker_id ();
+ var builder = new Tracker.Sparql.Builder.update ();
+ builder.insert_open (null);
+
+ switch (attrib)
+ {
+ case Trf.Attrib.PHONES:
+ assert_not_reached ();
+ case Trf.Attrib.EMAILS:
query_name = "_set_emailss";
yield this._remove_attributes_from_persona (persona,
_REMOVE_EMAILS);
- yield this._build_update_query (builder, (owned) properties,
+ yield this._build_update_query_set (builder, properties,
"?contact", Trf.Attrib.EMAILS);
break;
}
diff --git a/backends/tracker/lib/trf-persona.vala b/backends/tracker/lib/trf-persona.vala
index eb738f3..3e69dba 100644
--- a/backends/tracker/lib/trf-persona.vala
+++ b/backends/tracker/lib/trf-persona.vala
@@ -51,7 +51,7 @@ public class Trf.Persona : Folks.Persona,
private const string[] _linkable_properties =
{"im-addresses", "local-ids", "web-service-addresses"};
private GLib.List<FieldDetails> _phone_numbers;
- private GLib.List<FieldDetails> _email_addresses;
+ private HashSet<FieldDetails> _email_addresses = new HashSet<FieldDetails> ();
private weak Sparql.Cursor _cursor;
private string _tracker_id;
@@ -97,20 +97,12 @@ public class Trf.Persona : Folks.Persona,
/**
* { inheritDoc}
*/
- public GLib.List<FieldDetails> email_addresses
+ public Set<FieldDetails> email_addresses
{
get { return this._email_addresses; }
public set
{
- var _temp = new GLib.List<FieldDetails> ();
- foreach (unowned FieldDetails e in value)
- {
- _temp.prepend (e);
- }
- _temp.reverse ();
-
- ((Trf.PersonaStore) this.store)._set_emails (this,
- (owned) _temp);
+ ((Trf.PersonaStore) this.store)._set_emails (this, value);
}
}
@@ -1009,7 +1001,7 @@ public class Trf.Persona : Folks.Persona,
{
var fd = new FieldDetails (addr);
fd.set_parameter ("tracker_id", tracker_id);
- this._email_addresses.prepend ((owned) fd);
+ this._email_addresses.add (fd);
this.notify_property ("email-addresses");
}
@@ -1047,7 +1039,7 @@ public class Trf.Persona : Folks.Persona,
return;
}
- var email_addresses = new GLib.List<FieldDetails> ();
+ var email_addresses = new HashSet<FieldDetails> ();
string[] emails_a = emails_field.split (",");
foreach (var e in emails_a)
@@ -1058,12 +1050,11 @@ public class Trf.Persona : Folks.Persona,
var fd = new FieldDetails (id_addr[Trf.EmailFields.EMAIL]);
fd.set_parameter ("tracker_id",
id_addr[Trf.EmailFields.TRACKER_ID]);
- email_addresses.prepend ((owned) fd);
+ email_addresses.add (fd);
}
}
- email_addresses.reverse ();
- this._email_addresses = (owned) email_addresses;
+ this._email_addresses = email_addresses;
}
private void _update_urls ()
diff --git a/folks/email-details.vala b/folks/email-details.vala
index 4434418..e160a63 100644
--- a/folks/email-details.vala
+++ b/folks/email-details.vala
@@ -19,6 +19,7 @@
*/
using GLib;
+using Gee;
/**
* Interface for classes that have email addresses, such as { link Persona}
@@ -31,7 +32,7 @@ public interface Folks.EmailDetails : Object
/**
* The email addresses of the contact.
*
- * @since 0.3.5
+ * @since UNRELEASED
*/
- public abstract List<FieldDetails> email_addresses { get; set; }
+ public abstract Set<FieldDetails> email_addresses { get; set; }
}
diff --git a/folks/individual.vala b/folks/individual.vala
index 08d9c47..0a2f7b3 100644
--- a/folks/individual.vala
+++ b/folks/individual.vala
@@ -288,19 +288,18 @@ public class Folks.Individual : Object,
}
}
- private GLib.List<FieldDetails> _email_addresses;
+ private HashSet<FieldDetails> _email_addresses;
/**
* { inheritDoc}
*/
- public GLib.List<FieldDetails> email_addresses
+ public Set<FieldDetails> email_addresses
{
get { return this._email_addresses; }
private set
{
- this._email_addresses = new GLib.List<FieldDetails> ();
- foreach (unowned FieldDetails fd in value)
- this._email_addresses.prepend (fd);
- this._email_addresses.reverse ();
+ this._email_addresses = new HashSet<FieldDetails> ();
+ foreach (var fd in value)
+ this._email_addresses.add (fd);
}
}
@@ -1215,37 +1214,36 @@ public class Folks.Individual : Object,
private void _update_email_addresses ()
{
/* Populate the email addresses as the union of our Personas' addresses.
- * If the same URL exist multiple times we merge the parameters. */
- var emails_set = new HashTable<unowned string, unowned FieldDetails> (
- str_hash, str_equal);
- var emails = new GLib.List<FieldDetails> ();
+ * If the same address exists multiple times we merge the parameters. */
+ var emails_set = new HashMap<unowned string, unowned FieldDetails> ();
+ var emails = new HashSet<FieldDetails> ();
foreach (var persona in this._persona_list)
{
var email_details = persona as EmailDetails;
if (email_details != null)
{
- foreach (unowned FieldDetails fd in email_details.email_addresses)
+ foreach (var fd in email_details.email_addresses)
{
if (fd.value == null)
continue;
- var existing = emails_set.lookup (fd.value);
+ var existing = emails_set.get (fd.value);
if (existing != null)
existing.extend_parameters (fd.parameters);
else
{
var new_fd = new FieldDetails (fd.value);
new_fd.extend_parameters (fd.parameters);
- emails_set.insert (fd.value, new_fd);
- emails.prepend ((owned) new_fd);
+ emails_set.set (fd.value, new_fd);
+ emails.add (new_fd);
}
}
}
}
- /* Set the private member directly to avoid iterating this list again */
- emails.reverse ();
- this._email_addresses = (owned) emails;
+
+ /* Set the private member directly to avoid iterating this set again */
+ this._email_addresses = emails;
this.notify_property ("email-addresses");
}
diff --git a/folks/potential-match.vala b/folks/potential-match.vala
index ad89b40..bceee13 100644
--- a/folks/potential-match.vala
+++ b/folks/potential-match.vala
@@ -240,14 +240,12 @@ public class Folks.PotentialMatch : Object
*/
private void _inspect_emails ()
{
- unowned GLib.List<FieldDetails> list_a =
- this._individual_a.email_addresses;
- unowned GLib.List<FieldDetails> list_b =
- this._individual_b.email_addresses;
+ var set_a = this._individual_a.email_addresses;
+ var set_b = this._individual_b.email_addresses;
- foreach (var fd_a in list_a)
+ foreach (var fd_a in set_a)
{
- foreach (var fd_b in list_b)
+ foreach (var fd_b in set_b)
{
string[] email_split_a = fd_a.value.split ("@");
string[] email_split_b = fd_b.value.split ("@");
diff --git a/tests/tracker/add-persona.vala b/tests/tracker/add-persona.vala
index aedd1a2..1b7c7d5 100644
--- a/tests/tracker/add-persona.vala
+++ b/tests/tracker/add-persona.vala
@@ -221,14 +221,13 @@ public class AddPersonaTests : Folks.TestCase
details.insert (Folks.PersonaStore.detail_key (PersonaDetail.GENDER),
(owned) v7);
- Value? v8 = Value (typeof (GLib.List<FieldDetails>));
- GLib.List<FieldDetails> emails =
- new GLib.List<FieldDetails> ();
+ Value? v8 = Value (typeof (Set<FieldDetails>));
+ var emails = new HashSet<FieldDetails> ();
var email_1 = new FieldDetails (this._email_1);
- emails.prepend ((owned) email_1);
+ emails.add (email_1);
var email_2 = new FieldDetails (this._email_2);
- emails.prepend ((owned) email_2);
- v8.set_pointer (emails);
+ emails.add (email_2);
+ v8.set_object (emails);
details.insert (
Folks.PersonaStore.detail_key (PersonaDetail.EMAIL_ADDRESSES),
(owned) v8);
@@ -413,7 +412,7 @@ public class AddPersonaTests : Folks.TestCase
if (i.gender == Gender.MALE)
this._properties_found.replace ("gender", true);
- foreach (unowned FieldDetails e in i.email_addresses)
+ foreach (var e in i.email_addresses)
{
if (e.value == this._email_1)
{
diff --git a/tests/tracker/duplicated-emails.vala b/tests/tracker/duplicated-emails.vala
index 1d8c774..6aa33f4 100644
--- a/tests/tracker/duplicated-emails.vala
+++ b/tests/tracker/duplicated-emails.vala
@@ -166,11 +166,11 @@ public class DuplicatedEmailsTests : Folks.TestCase
details1.insert (Folks.PersonaStore.detail_key (PersonaDetail.FULL_NAME),
(owned) val);
- val = Value (typeof (GLib.List<FieldDetails>));
- var emails1 = new GLib.List<FieldDetails> ();
+ val = Value (typeof (Set<FieldDetails>));
+ var emails1 = new HashSet<FieldDetails> ();
var email_1 = new FieldDetails (this._email_1);
- emails1.prepend ((owned) email_1);
- val.set_pointer (emails1);
+ emails1.add (email_1);
+ val.set_object (emails1);
details1.insert (
Folks.PersonaStore.detail_key (PersonaDetail.EMAIL_ADDRESSES),
(owned) val);
@@ -180,11 +180,11 @@ public class DuplicatedEmailsTests : Folks.TestCase
details2.insert (Folks.PersonaStore.detail_key (PersonaDetail.FULL_NAME),
(owned) val);
- val = Value (typeof (GLib.List<FieldDetails>));
- var emails2 = new GLib.List<FieldDetails> ();
+ val = Value (typeof (Set<FieldDetails>));
+ var emails2 = new HashSet<FieldDetails> ();
var email_2 = new FieldDetails (this._email_1);
- emails2.prepend ((owned) email_2);
- val.set_pointer (emails2);
+ emails2.add (email_2);
+ val.set_object (emails2);
details2.insert (
Folks.PersonaStore.detail_key (PersonaDetail.EMAIL_ADDRESSES),
(owned) val);
diff --git a/tests/tracker/emails-updates.vala b/tests/tracker/emails-updates.vala
index 683235c..8ff60c9 100644
--- a/tests/tracker/emails-updates.vala
+++ b/tests/tracker/emails-updates.vala
@@ -91,7 +91,7 @@ public class EmailsUpdatesTests : Folks.TestCase
var i = this._aggregator.individuals.lookup (this._individual_id);
if (i != null)
{
- foreach (unowned FieldDetails fd in i.email_addresses)
+ foreach (var fd in i.email_addresses)
{
var email = fd.value;
if (email == this._email_1)
@@ -138,7 +138,7 @@ public class EmailsUpdatesTests : Folks.TestCase
this._individual_id = i.id;
i.notify["email-addresses"].connect (this._notify_email_cb);
- foreach (unowned FieldDetails fd in i.email_addresses)
+ foreach (var fd in i.email_addresses)
{
var email = fd.value;
if (email == this._email_1)
@@ -182,7 +182,7 @@ public class EmailsUpdatesTests : Folks.TestCase
if (this._individual_id != individual.id)
return;
- foreach (unowned FieldDetails fd in individual.email_addresses)
+ foreach (var fd in individual.email_addresses)
{
var email = fd.value;
if (email == this._email_2)
diff --git a/tests/tracker/match-email-addresses.vala b/tests/tracker/match-email-addresses.vala
index 7f5f7ba..6b7727d 100644
--- a/tests/tracker/match-email-addresses.vala
+++ b/tests/tracker/match-email-addresses.vala
@@ -171,11 +171,11 @@ public class MatchEmailAddressesTests : Folks.TestCase
details1.insert (Folks.PersonaStore.detail_key (PersonaDetail.FULL_NAME),
(owned) val);
- val = Value (typeof (GLib.List<FieldDetails>));
- var emails1 = new GLib.List<FieldDetails> ();
+ val = Value (typeof (Set<FieldDetails>));
+ var emails1 = new HashSet<FieldDetails> ();
var email_1 = new FieldDetails (this._email_1);
- emails1.prepend ((owned) email_1);
- val.set_pointer (emails1);
+ emails1.add (email_1);
+ val.set_object (emails1);
details1.insert (
Folks.PersonaStore.detail_key (PersonaDetail.EMAIL_ADDRESSES),
(owned) val);
@@ -185,11 +185,11 @@ public class MatchEmailAddressesTests : Folks.TestCase
details2.insert (Folks.PersonaStore.detail_key (PersonaDetail.FULL_NAME),
(owned) val);
- val = Value (typeof (GLib.List<FieldDetails>));
- var emails2 = new GLib.List<FieldDetails> ();
+ val = Value (typeof (Set<FieldDetails>));
+ var emails2 = new HashSet<FieldDetails> ();
var email_2 = new FieldDetails (this._email_1);
- emails2.prepend ((owned) email_2);
- val.set_pointer (emails2);
+ emails2.add (email_2);
+ val.set_object (emails2);
details2.insert (
Folks.PersonaStore.detail_key (PersonaDetail.EMAIL_ADDRESSES),
(owned) val);
diff --git a/tests/tracker/match-known-emails.vala b/tests/tracker/match-known-emails.vala
index b901537..f0068f8 100644
--- a/tests/tracker/match-known-emails.vala
+++ b/tests/tracker/match-known-emails.vala
@@ -179,11 +179,11 @@ public class MatchKnownEmailsTests : Folks.TestCase
details1.insert (Folks.PersonaStore.detail_key (PersonaDetail.FULL_NAME),
(owned) val);
- val = Value (typeof (GLib.List<FieldDetails>));
- var emails1 = new GLib.List<FieldDetails> ();
+ val = Value (typeof (Set<FieldDetails>));
+ var emails1 = new HashSet<FieldDetails> ();
var email_1 = new FieldDetails (this._email_1);
- emails1.prepend ((owned) email_1);
- val.set_pointer (emails1);
+ emails1.add (email_1);
+ val.set_object (emails1);
details1.insert (
Folks.PersonaStore.detail_key (PersonaDetail.EMAIL_ADDRESSES),
(owned) val);
@@ -193,11 +193,11 @@ public class MatchKnownEmailsTests : Folks.TestCase
details2.insert (Folks.PersonaStore.detail_key (PersonaDetail.FULL_NAME),
(owned) val);
- val = Value (typeof (GLib.List<FieldDetails>));
- var emails2 = new GLib.List<FieldDetails> ();
+ val = Value (typeof (Set<FieldDetails>));
+ var emails2 = new HashSet<FieldDetails> ();
var email_2 = new FieldDetails (this._email_1);
- emails2.prepend ((owned) email_2);
- val.set_pointer (emails2);
+ emails2.add (email_2);
+ val.set_object (emails2);
details2.insert (
Folks.PersonaStore.detail_key (PersonaDetail.EMAIL_ADDRESSES),
(owned) val);
diff --git a/tests/tracker/remove-persona.vala b/tests/tracker/remove-persona.vala
index 5ea697c..2ca4484 100644
--- a/tests/tracker/remove-persona.vala
+++ b/tests/tracker/remove-persona.vala
@@ -131,14 +131,13 @@ public class RemovePersonaTests : Folks.TestCase
details.insert (Folks.PersonaStore.detail_key (PersonaDetail.FULL_NAME),
(owned) v1);
- Value? v2 = Value (typeof (GLib.List<FieldDetails>));
- GLib.List<FieldDetails> emails =
- new GLib.List<FieldDetails> ();
+ Value? v2 = Value (typeof (Set<FieldDetails>));
+ var emails = new HashSet<FieldDetails> ();
var email_1 = new FieldDetails ("test-1 example org");
- emails.prepend ((owned) email_1);
+ emails.add (email_1);
var email_2 = new FieldDetails ("test-2 example org");
- emails.prepend ((owned) email_2);
- v2.set_pointer (emails);
+ emails.add (email_2);
+ v2.set_object (emails);
details.insert (
Folks.PersonaStore.detail_key (PersonaDetail.EMAIL_ADDRESSES),
(owned) v2);
diff --git a/tests/tracker/set-duplicate-email.vala b/tests/tracker/set-duplicate-email.vala
index 0f5b3e8..7ff76a9 100644
--- a/tests/tracker/set-duplicate-email.vala
+++ b/tests/tracker/set-duplicate-email.vala
@@ -123,10 +123,10 @@ public class SetDuplicateEmailTests : Folks.TestCase
Trf.Persona p = (Trf.Persona) i.personas.nth_data (0);
if (this._has_email (p, this._email_1))
{
- var emails1 = new GLib.List<FieldDetails> ();
+ var emails1 = new HashSet<FieldDetails> ();
var email_1 = new FieldDetails (this._email_1);
- emails1.prepend ((owned) email_1);
- p.email_addresses = (emails1);
+ emails1.add (email_1);
+ p.email_addresses = emails1;
p.notify["email-addresses"].connect (this._email_addresses_cb);
}
}
@@ -191,11 +191,11 @@ public class SetDuplicateEmailTests : Folks.TestCase
details1.insert (Folks.PersonaStore.detail_key (PersonaDetail.FULL_NAME),
(owned) val);
- val = Value (typeof (GLib.List<FieldDetails>));
- var emails1 = new GLib.List<FieldDetails> ();
+ val = Value (typeof (Set<FieldDetails>));
+ var emails1 = new HashSet<FieldDetails> ();
var email_1 = new FieldDetails (this._email_1);
- emails1.prepend ((owned) email_1);
- val.set_pointer (emails1);
+ emails1.add (email_1);
+ val.set_object (emails1);
details1.insert (
Folks.PersonaStore.detail_key (PersonaDetail.EMAIL_ADDRESSES),
(owned) val);
diff --git a/tests/tracker/set-emails.vala b/tests/tracker/set-emails.vala
index 2275f38..faf6886 100644
--- a/tests/tracker/set-emails.vala
+++ b/tests/tracker/set-emails.vala
@@ -113,13 +113,13 @@ public class SetEmailsTests : Folks.TestCase
{
i.notify["email-addresses"].connect (this._notify_emails_cb);
- GLib.List<FieldDetails> emails = new GLib.List<FieldDetails> ();
+ var emails = new HashSet<FieldDetails> ();
var p1 = new FieldDetails (this._email_1);
- emails.prepend ((owned) p1);
+ emails.add (p1);
var p2 = new FieldDetails (this._email_2);
- emails.prepend ((owned) p2);
+ emails.add (p2);
Trf.Persona p = (Trf.Persona)i.personas.nth_data (0);
- p.email_addresses = (owned) emails;
+ p.email_addresses = emails;
}
}
@@ -131,7 +131,7 @@ public class SetEmailsTests : Folks.TestCase
Folks.Individual i = (Folks.Individual) individual_obj;
if (i.full_name == this._persona_fullname)
{
- foreach (unowned FieldDetails p in i.email_addresses)
+ foreach (var p in i.email_addresses)
{
if (p.value == this._email_1)
this._email_1_found = true;
diff --git a/tools/inspect/utils.vala b/tools/inspect/utils.vala
index a1ea495..fd20745 100644
--- a/tools/inspect/utils.vala
+++ b/tools/inspect/utils.vala
@@ -320,8 +320,27 @@ private class Folks.Inspect.Utils
output_string += " }";
return output_string;
}
- else if (prop_name == "email-addresses" ||
- prop_name == "urls" ||
+ else if (prop_name == "email-addresses")
+ {
+ output_string = "{ ";
+ bool first = true;
+ Set<FieldDetails> prop_list =
+ (Set<FieldDetails>) prop_value.get_object ();
+
+ foreach (var p in prop_list)
+ {
+ if (!first)
+ {
+ output_string += ", ";
+ }
+ output_string += p.value;
+ first = false;
+ }
+ output_string += " }";
+
+ return output_string;
+ }
+ else if (prop_name == "urls" ||
prop_name == "phone-numbers")
{
output_string = "{ ";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]