[folks] eds: Mark read-only address books as non-addable-to and non-removable-from
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] eds: Mark read-only address books as non-addable-to and non-removable-from
- Date: Wed, 13 Jul 2011 23:14:25 +0000 (UTC)
commit 6bf6d1391ef180e6129dbade8c781e7048c3e405
Author: Philip Withnall <philip tecnocode co uk>
Date: Wed Jul 13 23:04:45 2011 +0100
eds: Mark read-only address books as non-addable-to and non-removable-from
backends/eds/lib/edsf-persona-store.vala | 38 +++++++++++++++++++++++++++--
1 files changed, 35 insertions(+), 3 deletions(-)
---
diff --git a/backends/eds/lib/edsf-persona-store.vala b/backends/eds/lib/edsf-persona-store.vala
index a334e96..413cc1e 100644
--- a/backends/eds/lib/edsf-persona-store.vala
+++ b/backends/eds/lib/edsf-persona-store.vala
@@ -52,6 +52,13 @@ public class Edsf.PersonaStore : Folks.PersonaStore
*/
public override string type_id { get { return BACKEND_NAME; } }
+ private void _address_book_notify_read_only_cb (Object address_book,
+ ParamSpec pspec)
+ {
+ this.notify_property ("can-add-personas");
+ this.notify_property ("can-remove-personas");
+ }
+
/**
* Whether this PersonaStore can add { link Folks.Persona}s.
*
@@ -61,7 +68,15 @@ public class Edsf.PersonaStore : Folks.PersonaStore
*/
public override MaybeBool can_add_personas
{
- get { return MaybeBool.TRUE; }
+ get
+ {
+ if (this._addressbook == null)
+ {
+ return MaybeBool.FALSE;
+ }
+
+ return this._addressbook.readonly ? MaybeBool.FALSE : MaybeBool.TRUE;
+ }
}
/**
@@ -97,7 +112,15 @@ public class Edsf.PersonaStore : Folks.PersonaStore
*/
public override MaybeBool can_remove_personas
{
- get { return MaybeBool.TRUE; }
+ get
+ {
+ if (this._addressbook == null)
+ {
+ return MaybeBool.FALSE;
+ }
+
+ return this._addressbook.readonly ? MaybeBool.FALSE : MaybeBool.TRUE;
+ }
}
/**
@@ -161,7 +184,13 @@ public class Edsf.PersonaStore : Folks.PersonaStore
this._ebookview = null;
}
- this._addressbook = null;
+ if (this._addressbook != null)
+ {
+ this._addressbook.notify["readonly"].disconnect (
+ this._address_book_notify_read_only_cb);
+
+ this._addressbook = null;
+ }
}
catch (GLib.Error e)
{
@@ -362,6 +391,9 @@ public class Edsf.PersonaStore : Folks.PersonaStore
"Couldn't get BookClient: %s\n", e1.message);
}
+ this._addressbook.notify["readonly"].connect (
+ this._address_book_notify_read_only_cb);
+
try
{
yield this._addressbook.open (true, null);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]