[gnome-contacts] eds: Use new folks API for Google address book system groups



commit 1cf1d966bacd6456087f684493da72648cf3c68c
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sun Jun 24 11:46:36 2012 +0100

    eds: Use new folks API for Google address book system groups
    
    This removes the gigantic hack based on matching translatable strings across
    gettext domains, and instead uses a new API from libfolks 0.7.2.
    
    This requires EDS 3.5.2 at runtime (as it depends on a new vCard property
    being exported by the Google Contacts backend), so its dependency has been
    bumped as well. If the vCard property is not present, all Google contacts
    will be considered _not_ in the âMy Contactsâ address book.
    
    Closes: https://bugzilla.gnome.org/show_bug.cgi?id=676383

 configure.ac              |    2 +-
 src/contacts-contact.vala |   14 +++++++-------
 src/contacts-esd-setup.c  |   24 ------------------------
 src/contacts-esd-setup.h  |    1 -
 vapi/custom.vapi          |    2 --
 5 files changed, 8 insertions(+), 35 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 31f358b..88ceac3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,7 +36,7 @@ AC_SUBST(GETTEXT_PACKAGE)
 pkg_modules="gtk+-3.0 >= 3.4.0
 	     glib-2.0 >= 2.31.10
 	     gnome-desktop-3.0
-	     folks >= 0.7.1
+	     folks >= 0.7.2
 	     folks-telepathy
 	     folks-eds
 	     libnotify
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index 9520f5d..1271f6b 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -1199,13 +1199,17 @@ public class Contacts.Contact : GLib.Object  {
     return false;
   }
 
+  /**
+   * Return true only for personas which are in a Google address book, but which
+   * are not in the user's "My Contacts" group in the address book.
+   */
   public static bool persona_is_google_other (Persona persona) {
     if (!persona_is_google (persona))
       return false;
 
-    var g = persona as GroupDetails;
-    if (g != null && !g.groups.contains (eds_personal_google_group_name ()))
-      return true;
+    var p = persona as Edsf.Persona;
+    if (p != null)
+      return !p.in_google_personal_group;
     return false;
   }
 
@@ -1287,10 +1291,6 @@ public class Contacts.Contact : GLib.Object  {
 
   public static async Persona? create_primary_persona_for_details (Folks.PersonaStore store, HashTable<string, Value?> details) throws GLib.Error {
     var p = yield store.add_persona_from_details (details);
-    if (p != null && persona_is_google (p)) {
-      var g = p as GroupDetails;
-      yield g.change_group (eds_personal_google_group_name (), true);
-    }
     return p;
   }
 
diff --git a/src/contacts-esd-setup.c b/src/contacts-esd-setup.c
index 8b2e919..1b0e5b1 100644
--- a/src/contacts-esd-setup.c
+++ b/src/contacts-esd-setup.c
@@ -71,30 +71,6 @@ gboolean contacts_has_goa_account (void)
   return has_goa_contacts;
 }
 
-/* This is an enourmous hack to find google eds contacts that are
-   in the "My Contacts" system group. */
-char *
-eds_personal_google_group_name (void)
-{
-  static char *name = NULL;
-  char *domain;
-
-  if (name == NULL) {
-    domain = g_strdup_printf ("evolution-data-server-%d.%d",
-			      EDS_MAJOR_VERSION,
-			      EDS_MINOR_VERSION + ((EDS_MINOR_VERSION) % 2));
-
-    /* Let's assume e-d-s is installed in the same prefix as gnome-contacts
-       (which works for system and jhbuild setups) */
-    bindtextdomain (domain, LOCALEDIR);
-
-    name = dgettext (domain, "Personal");
-    g_free (domain);
-  }
-
-  return name;
-}
-
 gboolean
 contacts_esource_uid_is_google (const char *uid)
 {
diff --git a/src/contacts-esd-setup.h b/src/contacts-esd-setup.h
index 1fbce1d..992accc 100644
--- a/src/contacts-esd-setup.h
+++ b/src/contacts-esd-setup.h
@@ -4,7 +4,6 @@ void contacts_ensure_eds_accounts (void);
 const char *contacts_lookup_esource_name_by_uid (const char *uid);
 const char *contacts_lookup_esource_name_by_uid_for_contact (const char *uid);
 gboolean contacts_esource_uid_is_google (const char *uid);
-char *eds_personal_google_group_name (void);
 gboolean contacts_has_goa_account (void);
 extern ESourceRegistry *eds_source_registry;
 extern gboolean contacts_avoid_goa_workaround;
diff --git a/vapi/custom.vapi b/vapi/custom.vapi
index 129c189..467284c 100644
--- a/vapi/custom.vapi
+++ b/vapi/custom.vapi
@@ -33,8 +33,6 @@ namespace Contacts {
 	public static unowned string? lookup_esource_name_by_uid_for_contact (string uid);
 	[CCode (cname = "contacts_esource_uid_is_google")]
 	public static bool esource_uid_is_google (string uid);
-	[CCode (cname = "eds_personal_google_group_name")]
-	public static unowned string? eds_personal_google_group_name ();
 	[CCode (cname = "contacts_has_goa_account")]
 	public static bool has_goa_account ();
 	[CCode (cname = "eds_source_registry")]



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