[gnome-contacts] Work around changes in how folks marks its eds addressbooks



commit cc6422a1a39d936eadd98d734c289aa70d4f38bc
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Sep 26 14:48:06 2011 +0200

    Work around changes in how folks marks its eds addressbooks
    
    Folks used to uave the relative uri as the eds store id, but
    now switched to uid.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=660125

 src/contacts-contact.vala |    2 +-
 src/contacts-esd-setup.c  |    7 +++++++
 src/contacts-esd-setup.h  |    1 +
 vapi/custom.vapi          |    2 ++
 4 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index 45b6d82..9ab8290 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -934,7 +934,7 @@ public class Contacts.Contact : GLib.Object  {
 
   public static string format_persona_store_name (PersonaStore store) {
     if (store.type_id == "eds") {
-      if (store.id == "system") {
+      if (store.id == eds_local_store) {
 	return _("Local Contact");
       }
       if (store.id.has_suffix ("@gmail.com")) {
diff --git a/src/contacts-esd-setup.c b/src/contacts-esd-setup.c
index 3021ab1..bdb379d 100644
--- a/src/contacts-esd-setup.c
+++ b/src/contacts-esd-setup.c
@@ -25,6 +25,7 @@
 #include <libedataserver/e-source-group.h>
 #include <libedataserver/e-uid.h>
 
+char *contacts_eds_local_store = NULL;
 static gboolean created_local = FALSE;
 static GMainLoop *goa_loop;
 static GoaClient *goa_client;
@@ -153,6 +154,11 @@ ensure_local_addressbook (void)
   csd.uri_source = NULL;
   system_source = search_known_sources (source_list, check_system, &csd);
 
+  if (system_source != NULL)
+    contacts_eds_local_store = g_strdup (e_source_peek_uid (system_source));
+  else if (csd.uri_source != NULL)
+    contacts_eds_local_store = g_strdup (e_source_peek_uid (csd.uri_source));
+
   if (system_source)
     g_object_unref (system_source);
   if (csd.uri_source)
@@ -166,6 +172,7 @@ ensure_local_addressbook (void)
 
   client = e_book_client_new_system (NULL);
   if (client != NULL) {
+    contacts_eds_local_store = g_strdup (e_source_peek_uid (e_client_get_source (client)));
     g_object_unref (client);
     return TRUE;
   }
diff --git a/src/contacts-esd-setup.h b/src/contacts-esd-setup.h
index 898d7e1..71db7a5 100644
--- a/src/contacts-esd-setup.h
+++ b/src/contacts-esd-setup.h
@@ -1 +1,2 @@
 void contacts_ensure_eds_accounts (void);
+extern char *contacts_eds_local_store;
diff --git a/vapi/custom.vapi b/vapi/custom.vapi
index bbd5c9d..9354f14 100644
--- a/vapi/custom.vapi
+++ b/vapi/custom.vapi
@@ -27,4 +27,6 @@ namespace LocalGLib {
 namespace Contacts {
 	[CCode (cname = "contacts_ensure_eds_accounts")]
 	public static void ensure_eds_accounts ();
+	[CCode (cname = "contacts_eds_local_store")]
+	public static string? eds_local_store;
 }



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