Bug 658331 — Ensure read-only PersonaStores have empty writeable-properties
authorPhilip Withnall <philip@tecnocode.co.uk>
Mon, 12 Sep 2011 22:31:06 +0000 (23:31 +0100)
committerPhilip Withnall <philip@tecnocode.co.uk>
Tue, 13 Sep 2011 16:50:42 +0000 (17:50 +0100)
Ensure that Edsf.PersonaStore.always-writeable-properties is empty for
EDS address books which are read-only. Similarly, ensure that
Edsf.Persona.writeable-properties is also empty for such address books (which
follows because it passes through the value of always-writeable-properties).

No other backends need modifying for this, since no others have a concept
of “read only” except libsocialweb, which already has empty
writeable-properties properties.

Closes: bgo#658331

NEWS
backends/eds/lib/edsf-persona-store.vala

diff --git a/NEWS b/NEWS
index 63502d8..3dd52c8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ Overview of changes from libfolks 0.6.2.1 to libfolks 0.6.3
 
 Bugs fixed:
 * Bug 658631 — crash at empathy startup
+* Bug 658331 — Ensure read-only PersonaStores have empty writeable-properties
 
 Overview of changes from libfolks 0.6.2 to libfolks 0.6.2.1
 ===========================================================
index 715ec24..90c160f 100644 (file)
@@ -145,6 +145,7 @@ public class Edsf.PersonaStore : Folks.PersonaStore
     }
 
   private string[] _always_writeable_properties = {};
+  private static string[] _always_writeable_properties_empty = {}; /* oh Vala */
 
   /**
    * {@inheritDoc}
@@ -153,7 +154,15 @@ public class Edsf.PersonaStore : Folks.PersonaStore
    */
   public override string[] always_writeable_properties
     {
-      get { return this._always_writeable_properties; }
+      get
+        {
+          if (this._addressbook.readonly == true)
+            {
+              return this._always_writeable_properties_empty;
+            }
+
+          return this._always_writeable_properties;
+        }
     }
 
   /*