[folks] Take a PersonaStore in IndividualAggregator.add_persona_from_details
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Take a PersonaStore in IndividualAggregator.add_persona_from_details
- Date: Mon, 14 Feb 2011 21:53:46 +0000 (UTC)
commit 271ee14ed7a1c6373a8f1f5b4d91dc2410c5909d
Author: Philip Withnall <philip withnall collabora co uk>
Date: Sun Feb 6 12:05:23 2011 +0000
Take a PersonaStore in IndividualAggregator.add_persona_from_details
This gives the client more flexibility in choosing which persona store to
add the new persona to. Closes: bgo#629078
NEWS | 4 +++
folks/individual-aggregator.vala | 44 ++++++++++++-------------------------
2 files changed, 18 insertions(+), 30 deletions(-)
---
diff --git a/NEWS b/NEWS
index 88acd04..3e31188 100644
--- a/NEWS
+++ b/NEWS
@@ -4,11 +4,15 @@ Overview of changes from libfolks 0.3.4 to libfolks 0.3.5
API changes:
* Add Tpf.Persona.is_in_contact_list
* Rename the URLable interface to Urlable
+* Take a PersonaStore in IndividualAggregator.add_persona_from_details
+* Remove IndividualAggregatorError.STORE_NOT_FOUND
Bugs fixed:
* Bug 640901 â?? Allow it to be determined whether a user Tpf.Persona is in the
contact list
* Bug 641780 â?? Incorrect C function names for URLable interface
+* Bug 629078 â?? Folks needs a full API review to take advantage of our
+ compatibility break in 0.2.x
Overview of changes from libfolks 0.3.3 to libfolks 0.3.4
=========================================================
diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala
index a284e6f..33f2f2b 100644
--- a/folks/individual-aggregator.vala
+++ b/folks/individual-aggregator.vala
@@ -27,11 +27,6 @@ using GLib;
public errordomain Folks.IndividualAggregatorError
{
/**
- * A specified { link PersonaStore} could not be found.
- */
- STORE_NOT_FOUND,
-
- /**
* Adding a { link Persona} to a { link PersonaStore} failed.
*/
ADD_FAILED,
@@ -727,38 +722,24 @@ public class Folks.IndividualAggregator : Object
*
* @param parent an optional { link Individual} to add the new { link Persona}
* to. This persona will be appended to its ordered list of personas.
- * @param persona_store_type the { link PersonaStore.type_id} of the
- * { link PersonaStore} to use
- * @param persona_store_id the { link PersonaStore.id} of the
- * { link PersonaStore} to use
+ * @param persona_store the { link PersonaStore} to add the persona to
* @param details a key-value map of details to use in creating the new
* { link Persona}
* @return the new { link Persona} or `null` if the corresponding
* { link Persona} already existed. If non-`null`, the new { link Persona}
* will also be added to a new or existing { link Individual} as necessary.
+ *
+ * @since 0.3.UNRELEASED
*/
public async Persona? add_persona_from_details (Individual? parent,
- string persona_store_type,
- string persona_store_id,
+ PersonaStore persona_store,
HashTable<string, Value?> details) throws IndividualAggregatorError
{
- var full_id = this._get_store_full_id (persona_store_type,
- persona_store_id);
- var store = this._stores[full_id];
-
- if (store == null)
- {
- throw new IndividualAggregatorError.STORE_NOT_FOUND (
- /* Translators: the parameters are store identifiers. */
- _("No store known for type ID '%s' and ID '%s'."),
- persona_store_type, persona_store_id);
- }
-
Persona persona = null;
try
{
var details_copy = this._asv_copy (details);
- persona = yield store.add_persona_from_details (details_copy);
+ persona = yield persona_store.add_persona_from_details (details_copy);
}
catch (PersonaStoreError e)
{
@@ -768,11 +749,14 @@ public class Folks.IndividualAggregator : Object
}
else
{
+ var full_id = this._get_store_full_id (persona_store.type_id,
+ persona_store.id);
+
throw new IndividualAggregatorError.ADD_FAILED (
- /* Translators: the first two parameters are store identifiers
- * and the third parameter is an error message. */
- _("Failed to add contact for store type '%s', ID '%s': %s"),
- persona_store_type, persona_store_id, e.message);
+ /* Translators: the first parameter is a store identifier
+ * and the second parameter is an error message. */
+ _("Failed to add contact for persona store ID '%s': %s"),
+ full_id, e.message);
}
}
@@ -912,8 +896,8 @@ public class Folks.IndividualAggregator : Object
var details = new HashTable<string, Value?> (str_hash, str_equal);
details.insert ("im-addresses", addresses_value);
- yield this.add_persona_from_details (null, this._writeable_store.type_id,
- this._writeable_store.id, details);
+ yield this.add_persona_from_details (null, this._writeable_store,
+ details);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]