[folks] key-file: Allow empty Kf.Personas to be added to the persona store



commit 659d0c0b1dfb7123ee14c9cefe53696dd4dfb951
Author: Philip Withnall <philip tecnocode co uk>
Date:   Thu Aug 11 13:57:25 2011 +0200

    key-file: Allow empty Kf.Personas to be added to the persona store
    
    This is necessary for the tests for bgo#653777. It removes the error which
    would previously be thrown when trying to add a persona to Kf.PersonaStore
    with no properties.
    
    Helps: bgo#653777

 backends/key-file/kf-persona-store.vala |   18 ++----------------
 1 files changed, 2 insertions(+), 16 deletions(-)
---
diff --git a/backends/key-file/kf-persona-store.vala b/backends/key-file/kf-persona-store.vala
index 2c4698e..a6fb09e 100644
--- a/backends/key-file/kf-persona-store.vala
+++ b/backends/key-file/kf-persona-store.vala
@@ -333,20 +333,6 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
           = val2 != null
           ? (MultiMap<string, WebServiceFieldDetails>) val2.get_object ()
           : null;
-      uint im_addresses_size = (im_addresses == null)
-          ? 0 : im_addresses.size;
-      uint web_service_addresses_size = (web_service_addresses == null)
-          ? 0 : web_service_addresses.size;
-
-      if (im_addresses_size + web_service_addresses_size == 0)
-        {
-          throw new PersonaStoreError.INVALID_ARGUMENT (
-              /* Translators: the first two parameters are identifiers for the
-               * persona store. The third is a pointer address. Do not translate
-               * "im-addresses", as it's an object property name. */
-              _("Persona store (%s, %s) requires the following details:\n    im-addresses (provided: '%p')"),
-              this.type_id, this.id, im_addresses);
-        }
 
       debug ("Adding Persona from details.");
 
@@ -366,9 +352,9 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
        * key file */
       Persona persona = new Kf.Persona (this._key_file, persona_id, this);
       this._personas.set (persona.iid, persona);
-      if (im_addresses_size > 0)
+      if (im_addresses != null)
         persona.im_addresses = im_addresses;
-      if (web_service_addresses_size > 0)
+      if (web_service_addresses != null)
         persona.web_service_addresses = web_service_addresses;
 
       /* FIXME: GroupDetails.ChangeReason is not the right enum to use here */



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