[folks] eds: support 'groups' when creating a contact



commit 6aaded38f044d6dc2bb28db020bcdaff32e09c76
Author: Patrick Ohly <patrick ohly intel com>
Date:   Thu Feb 7 15:28:08 2013 +0100

    eds: support 'groups' when creating a contact
    
    There's a minor twist with supporting the setting of groups from
    details: _set_contact_groups() needs to know whether the contact
    is a favorite, for special handling of Google contacts.
    
    If the PersonaDetail.IS_FAVOURITE is found first in the details, that
    boolean is passed to a later _set_contact_groups(). If
    _set_contact_groups() is done first, then _set_contact_is_favourite()
    applies the special Google workaround.

 backends/eds/lib/edsf-persona-store.vala |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/backends/eds/lib/edsf-persona-store.vala b/backends/eds/lib/edsf-persona-store.vala
index 27af5f5..1fb875b 100644
--- a/backends/eds/lib/edsf-persona-store.vala
+++ b/backends/eds/lib/edsf-persona-store.vala
@@ -389,6 +389,7 @@ public class Edsf.PersonaStore : Folks.PersonaStore
    * - PersonaStore.detail_key (PersonaDetail.WEB_SERVICE_ADDRESSES)
    * - PersonaStore.detail_key (PersonaDetail.NOTES)
    * - PersonaStore.detail_key (PersonaDetail.URLS)
+   * - PersonaStore.detail_key (PersonaDetail.GROUPS)
    *
    * See { link Folks.PersonaStore.add_persona_from_details}.
    *
@@ -414,6 +415,7 @@ public class Edsf.PersonaStore : Folks.PersonaStore
       var iter = HashTableIter<string, Value?> (details);
       unowned string k;
       unowned Value? _v;
+      bool is_fav = false; // Remember this for _set_contact_groups.
 
       while (iter.next (out k, out _v) == true)
         {
@@ -535,10 +537,16 @@ public class Edsf.PersonaStore : Folks.PersonaStore
                 (Set<RoleFieldDetails>) v.get_object ();
               this._set_contact_roles (contact, roles);
             }
+          else if (k == Folks.PersonaStore.detail_key (PersonaDetail.GROUPS))
+            {
+              Set<string> groups =
+                (Set<string>) v.get_object ();
+              this._set_contact_groups (contact, groups, is_fav);
+            }
           else if (k == Folks.PersonaStore.detail_key (
                   PersonaDetail.IS_FAVOURITE))
             {
-              bool is_fav = v.get_boolean ();
+              is_fav = v.get_boolean ();
               this._set_contact_is_favourite (contact, is_fav);
             }
         }


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