[folks] individual: Allow Individual.id to be an empty string with no personas
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] individual: Allow Individual.id to be an empty string with no personas
- Date: Thu, 28 Nov 2013 10:11:11 +0000 (UTC)
commit c3ace8c0f10964fd644dbaf17d54336167d1a97c
Author: Philip Withnall <philip withnall collabora co uk>
Date: Thu Nov 21 20:08:55 2013 +0000
individual: Allow Individual.id to be an empty string with no personas
If an Individual has no Personas (as can happen when it’s just been
constructed), document the ID as being the empty string. This is a
special case.
Previously, the ID defaulted to being null, which violated its specified
type.
https://bugzilla.gnome.org/show_bug.cgi?id=648811
folks/individual.vala | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/folks/individual.vala b/folks/individual.vala
index 67bdb10..5ff00b2 100644
--- a/folks/individual.vala
+++ b/folks/individual.vala
@@ -286,8 +286,11 @@ public class Folks.Individual : Object,
* instead. For example, if storing references to Individuals who are tagged
* in a photo, it may be safer to store the UID of the Persona whose backend
* provided the photo (e.g. Facebook).
+ *
+ * As a special case, the ID defaults to an empty string when the individual
+ * has no personas (i.e. if it’s just been constructed).
*/
- public string id { get; private set; }
+ public string id { get; private set; default = ""; }
/**
* Emitted when the last of the Individual's { link Persona}s has been
@@ -2899,6 +2902,11 @@ public class Folks.Individual : Object,
this.id = Checksum.compute_for_string (ChecksumType.SHA1,
((!) chosen_persona).uid);
}
+ else
+ {
+ /* Default if we have no personas. */
+ this.id = "";
+ }
/* Update our aggregated fields and notify the changes */
this._update_fields ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]