[evolution-data-server] Add NOTE support to the Google Contacts backend



commit 8b3b96837f4590f75547640b7a9a9306a23cd4fa
Author: Philip Withnall <philip tecnocode co uk>
Date:   Wed Apr 21 16:34:54 2010 +0100

    Add NOTE support to the Google Contacts backend
    
    Closes: bgo#602244

 .../backends/google/e-book-backend-google.c        |    3 +-
 addressbook/backends/google/util.c                 |   21 ++++++++++++++++---
 2 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/addressbook/backends/google/e-book-backend-google.c b/addressbook/backends/google/e-book-backend-google.c
index fbbe86c..0eb853c 100644
--- a/addressbook/backends/google/e-book-backend-google.c
+++ b/addressbook/backends/google/e-book-backend-google.c
@@ -1175,7 +1175,8 @@ e_book_backend_google_get_supported_fields (EBookBackendSync *backend, EDataBook
 		E_CONTACT_ORG,
 		E_CONTACT_ORG_UNIT,
 		E_CONTACT_TITLE,
-		E_CONTACT_ROLE
+		E_CONTACT_ROLE,
+		E_CONTACT_NOTE
 	};
 
 	__debug__ (G_STRFUNC);
diff --git a/addressbook/backends/google/util.c b/addressbook/backends/google/util.c
index 33e6ea3..1a685cf 100644
--- a/addressbook/backends/google/util.c
+++ b/addressbook/backends/google/util.c
@@ -68,7 +68,7 @@ _gdata_entry_update_from_e_contact (GDataEntry *entry, EContact *contact)
 	gboolean have_phone_primary = FALSE;
 	gboolean have_postal_primary = FALSE;
 	gboolean have_org_primary = FALSE;
-	const gchar *title, *role;
+	const gchar *title, *role, *note;
 
 	attributes = e_vcard_get_attributes (E_VCARD (contact));
 
@@ -96,6 +96,13 @@ _gdata_entry_update_from_e_contact (GDataEntry *entry, EContact *contact)
 		g_object_unref (name);
 	}
 
+	/* NOTE */
+	note = e_contact_get (contact, E_CONTACT_NOTE);
+	if (note)
+		gdata_entry_set_content (entry, note);
+	else
+		gdata_entry_set_content (entry, NULL);
+
 	/* Clear out all the old attributes */
 	gdata_contacts_contact_remove_all_email_addresses (GDATA_CONTACTS_CONTACT (entry));
 	gdata_contacts_contact_remove_all_phone_numbers (GDATA_CONTACTS_CONTACT (entry));
@@ -120,8 +127,9 @@ _gdata_entry_update_from_e_contact (GDataEntry *entry, EContact *contact)
 		    0 == g_ascii_strcasecmp (name, EVC_VERSION) ||
 		    0 == g_ascii_strcasecmp (name, EVC_X_FILE_AS) ||
 		    0 == g_ascii_strcasecmp (name, EVC_TITLE) ||
-		    0 == g_ascii_strcasecmp (name, EVC_ROLE)) {
-			/* Ignore UID, VERSION, X-EVOLUTION-FILE-AS, N, FN, LABEL, TITLE, ROLE */
+		    0 == g_ascii_strcasecmp (name, EVC_ROLE) ||
+		    0 == g_ascii_strcasecmp (name, EVC_NOTE)) {
+			/* Ignore UID, VERSION, X-EVOLUTION-FILE-AS, N, FN, LABEL, TITLE, ROLE, NOTE */
 		} else if (0 == g_ascii_strcasecmp (name, EVC_EMAIL)) {
 			/* EMAIL */
 			GDataGDEmailAddress *email;
@@ -224,7 +232,7 @@ _e_contact_new_from_gdata_entry (GDataEntry *entry)
 	EVCard *vcard;
 	EVCardAttribute *attr;
 	GList *email_addresses, *im_addresses, *phone_numbers, *postal_addresses, *orgs;
-	const gchar *uid;
+	const gchar *uid, *note;
 	GList *itr;
 	GDataGDName *name;
 	GDataGDEmailAddress *email;
@@ -263,6 +271,11 @@ _e_contact_new_from_gdata_entry (GDataEntry *entry)
 		e_contact_set (E_CONTACT (vcard), E_CONTACT_NAME, &name_struct);
 	}
 
+	/* NOTE */
+	note = gdata_entry_get_content (entry);
+	if (note)
+		e_contact_set (E_CONTACT (vcard), E_CONTACT_NOTE, note);
+
 	/* EMAIL - primary first */
 	email = gdata_contacts_contact_get_primary_email_address (GDATA_CONTACTS_CONTACT (entry));
 	add_attribute_from_gdata_gd_email_address (vcard, email);



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