[folks] telepathy: Only allow is-favourite to be writeable if the logger initialised
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] telepathy: Only allow is-favourite to be writeable if the logger initialised
- Date: Tue, 17 Apr 2012 11:17:43 +0000 (UTC)
commit 55c37843df726147bff087311f261fdf5f317b2e
Author: Philip Withnall <philip tecnocode co uk>
Date: Mon Apr 16 18:11:31 2012 +0100
telepathy: Only allow is-favourite to be writeable if the logger initialised
This prevents setting favourites falling into a black hole.
backends/telepathy/lib/tpf-persona-store.vala | 16 ++++++++++++++--
tests/telepathy/individual-properties.vala | 8 ++++++--
2 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index 80880f0..ded6a73 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -40,7 +40,7 @@ extern const string BACKEND_NAME;
*/
public class Tpf.PersonaStore : Folks.PersonaStore
{
- private string[] _always_writeable_properties = { "is-favourite" };
+ private string[] _always_writeable_properties = {};
/* Sets of Personas exposed by this store.
* This is the roster + self_contact */
@@ -490,6 +490,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
{
warning ("Failed to initialise favourite contacts: %s",
e.message);
+ this._logger = null;
}
});
@@ -552,6 +553,9 @@ public class Tpf.PersonaStore : Folks.PersonaStore
var contacts = yield this._logger.get_favourite_contacts ();
this._favourite_contacts_changed_cb (contacts, {});
+
+ this._always_writeable_properties += "is-favourite";
+ this.notify_property ("always-writeable-properties");
}
private Persona? _lookup_persona_by_id (string id)
@@ -844,7 +848,15 @@ public class Tpf.PersonaStore : Folks.PersonaStore
this._can_group_personas = MaybeBool.FALSE;
this._can_remove_personas = MaybeBool.FALSE;
- this._always_writeable_properties = { "is-favourite" };
+ if (this._logger != null)
+ {
+ this._always_writeable_properties = { "is-favourite" };
+ }
+ else
+ {
+ this._always_writeable_properties = {};
+ }
+
this.notify_property ("always-writeable-properties");
}
diff --git a/tests/telepathy/individual-properties.vala b/tests/telepathy/individual-properties.vala
index 12cd3ad..09fabb3 100644
--- a/tests/telepathy/individual-properties.vala
+++ b/tests/telepathy/individual-properties.vala
@@ -104,7 +104,9 @@ public class IndividualPropertiesTests : Folks.TestCase
}
assert (tpf_persona != null);
assert ("alias" in tpf_persona.writeable_properties);
- assert ("is-favourite" in tpf_persona.writeable_properties);
+ /* The logger isn't run in the test suite. */
+ assert (!("is-favourite"
+ in tpf_persona.writeable_properties));
assert ("groups" in tpf_persona.writeable_properties);
/* These are only writeable for the user contact */
assert (tpf_persona.is_user);
@@ -149,7 +151,9 @@ public class IndividualPropertiesTests : Folks.TestCase
}
assert (tpf_persona != null);
assert ("alias" in tpf_persona.writeable_properties);
- assert ("is-favourite" in tpf_persona.writeable_properties);
+ /* The logger isn't run in the test suite. */
+ assert (!("is-favourite"
+ in tpf_persona.writeable_properties));
assert ("groups" in tpf_persona.writeable_properties);
/* These are only writeable for the user contact */
assert (!tpf_persona.is_user);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]