diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2011-04-19 21:41:20 +0100 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2011-04-23 21:59:54 +0100 |
commit | f912d31414251e3a87616cdedb46d1d3015ccd53 (patch) | |
tree | c5e0a393dd29f48738e2651306a34bf8e12b40c0 /folks | |
parent | 56077a1d890d079e5d0fe6291706a037395db158 (diff) |
Change PostalAddressDetails.postal_addresses to be a Set<PostalAddress>
Helps: bgo#640092
Diffstat (limited to 'folks')
-rw-r--r-- | folks/individual.vala | 17 | ||||
-rw-r--r-- | folks/postal-address-details.vala | 13 |
2 files changed, 15 insertions, 15 deletions
diff --git a/folks/individual.vala b/folks/individual.vala index 5e67770..08d9c47 100644 --- a/folks/individual.vala +++ b/folks/individual.vala @@ -350,19 +350,18 @@ public class Folks.Individual : Object, } } - private GLib.List<PostalAddress> _postal_addresses; + private HashSet<PostalAddress> _postal_addresses; /** * {@inheritDoc} */ - public GLib.List<PostalAddress> postal_addresses + public Set<PostalAddress> postal_addresses { get { return this._postal_addresses; } private set { - this._postal_addresses = new GLib.List<PostalAddress> (); + this._postal_addresses = new HashSet<PostalAddress> (); foreach (PostalAddress pa in value) - this._postal_addresses.prepend (pa); - this._postal_addresses.reverse (); + this._postal_addresses.add (pa); } } @@ -1297,19 +1296,17 @@ public class Folks.Individual : Object, private void _update_postal_addresses () { - this._postal_addresses = new GLib.List<PostalAddress> (); + this._postal_addresses = new HashSet<PostalAddress> (); /* FIXME: Detect duplicates somehow? */ foreach (var persona in this._persona_list) { var address_details = persona as PostalAddressDetails; if (address_details != null) { - foreach (unowned PostalAddress pa in - address_details.postal_addresses) - this._postal_addresses.append (pa); + foreach (var pa in address_details.postal_addresses) + this._postal_addresses.add (pa); } } - this._postal_addresses.reverse (); this.notify_property ("postal-addresses"); } diff --git a/folks/postal-address-details.vala b/folks/postal-address-details.vala index dbe9f1f..86a35d6 100644 --- a/folks/postal-address-details.vala +++ b/folks/postal-address-details.vala @@ -20,6 +20,7 @@ */ using GLib; +using Gee; /** * Object representing a postal mail address. @@ -127,19 +128,19 @@ public class Folks.PostalAddress : Object construct set { _address_format = (value != null ? value : ""); } } - private List<string> _types; + private GLib.List<string> _types; /** * The types of the address. * * The types of address, for instance an address can be a home or work * address. */ - public List<string> types + public GLib.List<string> types { get { return this._types; } construct set { - this._types = new List<string> (); + this._types = new GLib.List<string> (); foreach (unowned string type in value) this._types.prepend (type); this._types.reverse (); @@ -171,7 +172,7 @@ public class Folks.PostalAddress : Object */ public PostalAddress (string? po_box, string? extension, string? street, string? locality, string? region, string? postal_code, string? country, - string? address_format, List<string> types, string? uid) + string? address_format, GLib.List<string> types, string? uid) { Object (po_box: po_box, extension: extension, @@ -231,6 +232,8 @@ public interface Folks.PostalAddressDetails : Object * The postal addresses of the contact. * * A list of postal addresses associated to the contact. + * + * @since UNRELEASED */ - public abstract List<PostalAddress> postal_addresses { get; set; } + public abstract Set<PostalAddress> postal_addresses { get; set; } } |