[folks] Bug 650422 — Add API for easily checking whether details are writeable
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Bug 650422 — Add API for easily checking whether details are writeable
- Date: Wed, 20 Jul 2011 21:32:37 +0000 (UTC)
commit 2483721d1e6f97c37c9fefb830d28e7187bcd7a5
Author: Philip Withnall <philip tecnocode co uk>
Date: Sun Jul 10 19:38:16 2011 +0100
Bug 650422 â Add API for easily checking whether details are writeable
Add Persona.writeable_properties, listing the properties of that Persona
for which updated values will be stored. It's intended that the property
value will be constant for a given Persona subclass, but this isn't
guaranteed; it's possible that Persona subclasses may vary the value of
writeable-properties at run time in future.
Closes: bgo#650422
NEWS | 3 +++
backends/eds/lib/edsf-persona.vala | 25 +++++++++++++++++++++++++
backends/key-file/kf-persona.vala | 16 ++++++++++++++++
backends/libsocialweb/lib/swf-persona.vala | 11 +++++++++++
backends/telepathy/lib/tpf-persona.vala | 16 ++++++++++++++++
backends/tracker/lib/trf-persona.vala | 28 ++++++++++++++++++++++++++++
folks/persona.vala | 15 +++++++++++++++
7 files changed, 114 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index fc737c8..7bcfe86 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ Bugs fixed:
* Bug 652048 â Make nickname writable
* Bug 652425 â Failure codes for removing personas needed in PersonaStoreError
* Bug 645549 â Add a way to get the individual from a persona
+* Bug 650422 â Add API for easily checking whether details are writeable
API changes:
* Swf.Persona retains and exposes its libsocialweb Contact
@@ -29,6 +30,8 @@ API changes:
* Change the error domain of PersonaStore.remove_persona() from GLib.Error to
Folks.PersonaStoreError
* Add a Persona.individual property
+* Add a Persona.writeable_properties property and implement it in all the
+ Persona subclasses
Overview of changes from libfolks 0.5.1 to libfolks 0.5.2
=========================================================
diff --git a/backends/eds/lib/edsf-persona.vala b/backends/eds/lib/edsf-persona.vala
index d06928c..4552cc6 100644
--- a/backends/eds/lib/edsf-persona.vala
+++ b/backends/eds/lib/edsf-persona.vala
@@ -61,6 +61,21 @@ public class Edsf.Persona : Folks.Persona,
private const string[] _linkable_properties = { "im-addresses",
"local-ids",
"web-service-addresses" };
+ private const string[] _writeable_properties =
+ {
+ "web-service-addresses",
+ "local-ids",
+ "postal-addresses",
+ "phone-numbers",
+ "email-addresses",
+ "notes",
+ "avatar",
+ "structured-name",
+ "full-name",
+ "nickname",
+ "im-addresses",
+ "groups"
+ };
private HashSet<FieldDetails> _phone_numbers;
private Set<FieldDetails> _phone_numbers_ro;
private HashSet<FieldDetails> _email_addresses;
@@ -186,6 +201,16 @@ public class Edsf.Persona : Folks.Persona,
get { return this._linkable_properties; }
}
+ /**
+ * { inheritDoc}
+ *
+ * @since UNRELEASED
+ */
+ public override string[] writeable_properties
+ {
+ get { return this._writeable_properties; }
+ }
+
private File _avatar;
/**
* An avatar for the Persona.
diff --git a/backends/key-file/kf-persona.vala b/backends/key-file/kf-persona.vala
index b5b9811..934ad3c 100644
--- a/backends/key-file/kf-persona.vala
+++ b/backends/key-file/kf-persona.vala
@@ -42,6 +42,12 @@ public class Folks.Backends.Kf.Persona : Folks.Persona,
"im-addresses",
"web-service-addresses"
};
+ private const string[] _writeable_properties =
+ {
+ "alias",
+ "im-addresses",
+ "web-service-addresses"
+ };
/**
* { inheritDoc}
@@ -54,6 +60,16 @@ public class Folks.Backends.Kf.Persona : Folks.Persona,
/**
* { inheritDoc}
*
+ * @since UNRELEASED
+ */
+ public override string[] writeable_properties
+ {
+ get { return this._writeable_properties; }
+ }
+
+ /**
+ * { inheritDoc}
+ *
* @since 0.1.15
*/
public string alias
diff --git a/backends/libsocialweb/lib/swf-persona.vala b/backends/libsocialweb/lib/swf-persona.vala
index 89d75aa..b8c6b52 100644
--- a/backends/libsocialweb/lib/swf-persona.vala
+++ b/backends/libsocialweb/lib/swf-persona.vala
@@ -40,6 +40,7 @@ public class Swf.Persona : Folks.Persona,
"im-addresses",
"web-service-addresses"
};
+ private const string[] _writeable_properties = {}; // No writeable properties
/**
* The names of the Persona's linkable properties.
@@ -52,6 +53,16 @@ public class Swf.Persona : Folks.Persona,
}
/**
+ * { inheritDoc}
+ *
+ * @since UNRELEASED
+ */
+ public override string[] writeable_properties
+ {
+ get { return this._writeable_properties; }
+ }
+
+ /**
* An avatar for the Persona.
*
* See { link Folks.HasAvatar.avatar}.
diff --git a/backends/telepathy/lib/tpf-persona.vala b/backends/telepathy/lib/tpf-persona.vala
index 4e6ef9c..f44ae7c 100644
--- a/backends/telepathy/lib/tpf-persona.vala
+++ b/backends/telepathy/lib/tpf-persona.vala
@@ -41,6 +41,12 @@ public class Tpf.Persona : Folks.Persona,
private string _alias;
private HashMultiMap<string, string> _im_addresses;
private const string[] _linkable_properties = { "im-addresses" };
+ private const string[] _writeable_properties =
+ {
+ "alias",
+ "is-favourite",
+ "groups"
+ };
/* Whether we've finished being constructed; this is used to prevent
* unnecessary trips to the Telepathy service to tell it about properties
@@ -101,6 +107,16 @@ public class Tpf.Persona : Folks.Persona,
}
/**
+ * { inheritDoc}
+ *
+ * @since UNRELEASED
+ */
+ public override string[] writeable_properties
+ {
+ get { return this._writeable_properties; }
+ }
+
+ /**
* An alias for the Persona.
*
* See { link Folks.AliasDetails.alias}.
diff --git a/backends/tracker/lib/trf-persona.vala b/backends/tracker/lib/trf-persona.vala
index 654c1e3..1fd58a4 100644
--- a/backends/tracker/lib/trf-persona.vala
+++ b/backends/tracker/lib/trf-persona.vala
@@ -55,6 +55,24 @@ public class Trf.Persona : Folks.Persona,
private Set<FieldDetails> _email_addresses_ro;
private weak Sparql.Cursor _cursor;
private string _tracker_id;
+ private const string[] _writeable_properties =
+ {
+ "alias",
+ "phone-numbers",
+ "email-addresses",
+ "avatar",
+ "structured-name",
+ "full-name",
+ "gender",
+ "birthday",
+ "roles",
+ "notes",
+ "urls",
+ "im-addresses",
+ "is-favourite",
+ "local-ids",
+ "web-service-addresses"
+ };
/**
* A nickname for the Persona.
@@ -107,6 +125,16 @@ public class Trf.Persona : Folks.Persona,
get { return this._linkable_properties; }
}
+ /**
+ * { inheritDoc}
+ *
+ * @since UNRELEASED
+ */
+ public override string[] writeable_properties
+ {
+ get { return this._writeable_properties; }
+ }
+
private File _avatar;
/**
* An avatar for the Persona.
diff --git a/folks/persona.vala b/folks/persona.vala
index a49805b..82784dc 100644
--- a/folks/persona.vala
+++ b/folks/persona.vala
@@ -153,6 +153,21 @@ public abstract class Folks.Persona : Object
public abstract string[] linkable_properties { get; }
/**
+ * The names of the properties of this Persona which are writeable.
+ *
+ * If a property name is in this list, setting the property should result in
+ * the updated value being stored in the backend's permanent storage (unless
+ * it gets rejected due to being invalid, or a different error occurs).
+ *
+ * It's intended that this property value will be constant for a given Persona
+ * subclass, but this isn't guaranteed; it's possible that Persona subclasses
+ * may vary the value of this property at run time.
+ *
+ * @since UNRELEASED
+ */
+ public abstract string[] writeable_properties { get; }
+
+ /**
* Callback into the aggregator to manipulate a link mapping.
*
* This is a callback provided by the { link IndividualAggregator} whenever
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]