API changes:
* Add AbstractFieldDetails.id to identify instances of details
+* Deprecate PostalAddress.uid in favor of AbstractFieldDetails.id
+
+Behavior changes:
+* PostalAddress.equal() now ignores PostalAddress.uid
Overview of changes from libfolks 0.6.4 to libfolks 0.6.4.1
=============================================================
a_info[Trf.PostalAddressFields.POSTALCODE],
a_info[Trf.PostalAddressFields.COUNTRY],
null,
- a_info[Trf.PostalAddressFields.TRACKER_ID]);
+ null);
var pafd = new PostalAddressFieldDetails (pa);
+ pafd.id = a_info[Trf.PostalAddressFields.TRACKER_ID];
postal_addresses.add (pafd);
}
{
foreach (var pafd in this._postal_addresses)
{
- if (pafd.value.uid == tracker_id)
+ if (pafd.id == tracker_id)
{
this._postal_addresses.remove (pafd);
this.notify_property ("postal-addresses");
/**
* The UID of the Postal Address (if any).
*/
+ [Deprecated (since = "UNRELEASED", replacement = "AbstractFieldDetails.id")]
public string uid
{
get { return _uid; }
* components are equal (where `null` compares equal only with `null`) and
* they have the same set of types (or both have no types).
*
+ * This does not factor in the {@link PostalAddress.uid}.
+ *
* @param with another postal address to compare with
* @return `true` if the addresses are equal, `false` otherwise
*/
this.region != with.region ||
this.postal_code != with.postal_code ||
this.country != with.country ||
- this.address_format != with.address_format ||
- this.uid != with.uid)
+ this.address_format != with.address_format)
return false;
return true;
public class Folks.PostalAddressFieldDetails :
AbstractFieldDetails<PostalAddress>
{
+ private string _id;
+ /**
+ * {@inheritDoc}
+ */
+ public override string id
+ {
+ get { return this._id; }
+ set
+ {
+ this._id = (value != null ? value : "");
+
+ /* Keep the PostalAddress.uid sync'd from our id */
+ if (this._id != this.value.uid)
+ this.value.uid = this._id;
+ }
+ }
+
/**
* Create a new PostalAddressFieldDetails.
*
this.value = value;
if (parameters != null)
this.parameters = parameters;
+
+ /* We keep these sync'd both directions */
+ this.id = this.value.uid;
+
+ /* Keep the PostalAddress.uid sync'd to our id */
+ this.value.notify["uid"].connect ((s, p) =>
+ {
+ if (this.id != this.value.uid)
+ this.id = this.value.uid;
+ });
}
/**
foreach (var pa_fd in i.postal_addresses)
{
- this._address.value.uid = pa_fd.value.uid;
+ this._address.id = pa_fd.id;
if (pa_fd.equal (this._address))
this._properties_found.replace ("postal-address-1", true);
}
* Although we could get it from the 1st
* personas iid; there is no real need.
*/
- this._postal_address.value.uid = pa_fd.value.uid;
+ this._postal_address.id = pa_fd.id;
if (pa_fd.equal (this._postal_address))
{
Folks.Individual i = (Folks.Individual) individual_obj;
foreach (var pa_fd in i.postal_addresses)
{
- pa_fd.value.uid = this._pa_fd.value.uid;
+ pa_fd.id = this._pa_fd.id;
if (pa_fd.equal (this._pa_fd))
{
this._found_after_update = true;
assert (pa_fd is PostalAddressFieldDetails);
assert (pa_fd.value is PostalAddress);
- pa_fd.value.uid = this._pa_fd.value.uid;
+ pa_fd.id = this._pa_fd.id;
if (pa_fd.equal (this._pa_fd))
{
this._found_after_update = true;
foreach (var pafd in i.postal_addresses)
{
- this._postal_address_fd.value.uid = pafd.value.uid;
- if (pafd.value.equal (this._postal_address_fd.value))
+ this._postal_address_fd.id = pafd.id;
+ if (pafd.equal (this._postal_address_fd))
this._properties_found.replace ("postal-address-1", true);
}
* Although we could get it from the 1st
* personas iid; there is no real need.
*/
- this._postal_address_fd.value.uid = pafd.value.uid;
+ this._postal_address_fd.id = pafd.id;
if (pafd.value.equal (this._postal_address_fd.value))
{
+ /* Ensure that setting the postal address uid directly
+ * (which is deprecated) is equivalent to setting the id on
+ * a PostalAddressFieldDetails directly */
+ var pa_2 = new PostalAddress (
+ this._postal_address_fd.value.po_box,
+ this._postal_address_fd.value.extension,
+ this._postal_address_fd.value.street,
+ this._postal_address_fd.value.locality,
+ this._postal_address_fd.value.region,
+ this._postal_address_fd.value.postal_code,
+ this._postal_address_fd.value.country,
+ null,
+ pafd.id);
+ var pa_fd_2 = new PostalAddressFieldDetails (pa_2);
+ assert (pafd.equal (pa_fd_2));
+ assert (pafd.id == pa_fd_2.id);
+
this._found_postal_address = true;
this._main_loop.quit ();
}
foreach (var pafd in i.postal_addresses)
{
/* we don't care if UIDs differ for this test */
- this._postal_address_fd.value.uid = pafd.value.uid;
+ this._postal_address_fd.id = pafd.id;
if (pafd.value.equal (this._postal_address_fd.value))
{
this._postal_address_found = true;