=?utf-8?q?=5Bfolks=5D_Bug_658331_=E2=80=94_Ensure_read-only_PersonaStores?= =?utf-8?q?_have_empty_writeable-properties?=



commit 27a630efb78d0bc55d7fe5e60ba425a307f8efef
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Sep 12 23:31:06 2011 +0100

    Bug 658331 â Ensure read-only PersonaStores have empty writeable-properties
    
    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                                     |    1 +
 backends/eds/lib/edsf-persona-store.vala |   11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 63502d8..3dd52c8 100644
--- 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
 ===========================================================
diff --git a/backends/eds/lib/edsf-persona-store.vala b/backends/eds/lib/edsf-persona-store.vala
index 715ec24..90c160f 100644
--- a/backends/eds/lib/edsf-persona-store.vala
+++ b/backends/eds/lib/edsf-persona-store.vala
@@ -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;
+        }
     }
 
   /*



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]