summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Reitter <travis.reitter@collabora.co.uk>2011-10-20 17:23:51 (GMT)
committerTravis Reitter <travis.reitter@collabora.co.uk>2011-10-24 18:39:23 (GMT)
commit35e99dc1a1d2f1f5d60e14b321ba8ed10b829a1b (patch)
tree8e3465448bb4986ef3da5626bf1c792fd348384d
parent25a17b0ca731ce8f9140e2c09ff60003cc5f1b9e (diff)
downloadfolks-35e99dc1a1d2f1f5d60e14b321ba8ed10b829a1b.tar.gz
folks-35e99dc1a1d2f1f5d60e14b321ba8ed10b829a1b.tar.xz
Migrate NoteDetails to AbstractFieldDetails.id
Deprecate NoteFieldDetails.uid in favor of AbstractFieldDetails.id NoteFieldDetails.equal() now ignores NoteFieldDetails.uid Helps: bgo#662433 - AbstractFieldDetails.equal() is ambiguous about checking parameters.
-rw-r--r--NEWS2
-rw-r--r--folks/note-details.vala27
-rw-r--r--tests/tracker/note-details-interface.vala20
3 files changed, 39 insertions, 10 deletions
diff --git a/NEWS b/NEWS
index 24e5d8d..020a38a 100644
--- a/NEWS
+++ b/NEWS
@@ -6,9 +6,11 @@ Bugs fixed:
API changes:
* Add AbstractFieldDetails.id to identify instances of details
* Deprecate PostalAddress.uid in favor of AbstractFieldDetails.id
+* Deprecate NoteFieldDetails.uid in favor of AbstractFieldDetails.id
Behavior changes:
* PostalAddress.equal() now ignores PostalAddress.uid
+* NoteFieldDetails.equal() now ignores NoteFieldDetails.uid
Overview of changes from libfolks 0.6.4 to libfolks 0.6.4.1
=============================================================
diff --git a/folks/note-details.vala b/folks/note-details.vala
index 80c27d3..0c42389 100644
--- a/folks/note-details.vala
+++ b/folks/note-details.vala
@@ -33,15 +33,24 @@ using GLib;
*/
public class Folks.NoteFieldDetails : AbstractFieldDetails<string>
{
- /* FIXME: deprecate this */
- private string _uid;
+ private string _id;
+ /**
+ * {@inheritDoc}
+ */
+ public override string id
+ {
+ get { return this._id; }
+ set { this._id = (value != null ? value : ""); }
+ }
+
/**
* The UID of the note (if any).
*/
+ [Deprecated (since = "UNRELEASED", replacement = "AbstractFieldDetails.id")]
public string uid
{
- get { return _uid; }
- set { _uid = (value != null ? value : ""); }
+ get { return this.id; }
+ set { this.id = value; }
}
/**
@@ -63,7 +72,9 @@ public class Folks.NoteFieldDetails : AbstractFieldDetails<string>
this.value = value;
if (parameters != null)
this.parameters = parameters;
- this.uid = uid;
+
+ /* These are kept the same value now */
+ this.id = uid;
}
/**
@@ -80,7 +91,7 @@ public class Folks.NoteFieldDetails : AbstractFieldDetails<string>
if (that_nfd == null)
return false;
- return (this.uid == that_nfd.uid && this.value == that_nfd.value);
+ return (this.value == that_nfd.value);
}
/**
@@ -95,8 +106,8 @@ public class Folks.NoteFieldDetails : AbstractFieldDetails<string>
if (this.value != null)
retval += this.value.hash ();
- if (this.uid != null)
- retval += this.uid.hash ();
+ if (this.id != null)
+ retval += this.id.hash ();
return retval;
}
diff --git a/tests/tracker/note-details-interface.vala b/tests/tracker/note-details-interface.vala
index 3702cb4..20d227d 100644
--- a/tests/tracker/note-details-interface.vala
+++ b/tests/tracker/note-details-interface.vala
@@ -111,10 +111,26 @@ public class NoteDetailsInterfaceTests : Folks.TestCase
if (i.full_name == this._fullname)
{
i.notify["notes"].connect (this._notify_note_cb);
- foreach (var n in i.notes)
+ foreach (var note_fd in i.notes)
{
- if (n.equal (new NoteFieldDetails (this._note)))
+ var note_fd_expected = new NoteFieldDetails (this._note, null,
+ null);
+
+ /* We copy the tracker_id - we don't know it.
+ * We could get it from the 1st personas iid but there is no
+ * real need. */
+ note_fd_expected.id = note_fd.id;
+
+ if (note_fd.equal (note_fd_expected))
{
+ /* Ensure that setting the Note uid directly (which is
+ * deprecated) is equivalent to setting the id on a
+ * NoteFieldDetails directly */
+ var note_fd_2 = new NoteFieldDetails (
+ note_fd_expected.value, null, note_fd.id);
+ assert (note_fd.equal (note_fd_2));
+ assert (note_fd.id == note_fd_2.id);
+
this._found_note = true;
this._main_loop.quit ();
}