[evolution-data-server/libgdata-port] Lots of fixes to the contacts backend



commit c0d41063dc52788d6597554280a7b0142a880dbf
Author: Philip Withnall <philip tecnocode co uk>
Date:   Tue Jun 30 19:35:09 2009 +0100

    Lots of fixes to the contacts backend
    
    Updating and deleting contacts now works. The libgdata dependency has been
    necessarily bumped to 0.4.0.

 addressbook/backends/google/google-book.c          |   97 ++++++++-------
 addressbook/backends/google/util.c                 |  123 +++++++++++---------
 addressbook/backends/google/util.h                 |    3 +-
 .../backends/google/e-cal-backend-google-utils.c   |   23 ++--
 calendar/backends/google/e-cal-backend-google.c    |    4 +-
 configure.in                                       |    2 +-
 6 files changed, 138 insertions(+), 114 deletions(-)
---
diff --git a/addressbook/backends/google/google-book.c b/addressbook/backends/google/google-book.c
index 879a522..1dd5160 100644
--- a/addressbook/backends/google/google-book.c
+++ b/addressbook/backends/google/google-book.c
@@ -86,8 +86,6 @@ struct _GoogleBookPrivate
     EProxy *proxy;
     guint refresh_interval;
     char *base_uri;
-    /* FIXME - this one should not be needed */
-    char *add_base_uri;
 
     gboolean live_mode;
 
@@ -148,6 +146,7 @@ google_book_cache_add_contact (GoogleBook *book, GDataEntry *entry)
                              g_strdup (uid), g_object_ref (entry));
         return contact;
     case NO_CACHE:
+    default:
         break;
     }
     return NULL;
@@ -166,7 +165,8 @@ google_book_cache_remove_contact (GoogleBook *book, const char *uid)
         success = g_hash_table_remove (priv->cache.in_memory.contacts, uid);
         return success && g_hash_table_remove (priv->cache.in_memory.gdata_entries, uid);
     case NO_CACHE:
-    break;
+    default:
+        break;
     }
     return FALSE;
 }
@@ -182,9 +182,16 @@ google_book_cache_get_contact (GoogleBook *book, const char *uid, GDataEntry **e
         contact = e_book_backend_cache_get_contact (priv->cache.on_disk, uid);
         if (contact) {
             if (entry) {
-                const char *entry_xml;
-                entry_xml = _e_contact_get_gdata_entry_xml (contact);
-                *entry = GDATA_ENTRY (gdata_contacts_contact_new_from_xml (entry_xml, -1, NULL));
+                const char *entry_xml, *edit_link;
+
+                entry_xml = _e_contact_get_gdata_entry_xml (contact, &edit_link);
+                *entry = GDATA_ENTRY (gdata_parsable_new_from_xml (GDATA_TYPE_CONTACTS_CONTACT, entry_xml, -1, NULL));
+
+                if (*entry != NULL) {
+                    GDataLink *link = gdata_link_new (edit_link, GDATA_LINK_EDIT);
+                    gdata_entry_add_link (*entry, link);
+                    g_object_unref (link);
+                }
             }
             _e_contact_remove_gdata_entry_xml (contact);
         }
@@ -202,6 +209,7 @@ google_book_cache_get_contact (GoogleBook *book, const char *uid, GDataEntry **e
         }
         return contact;
     case NO_CACHE:
+    default:
         break;
     }
     return NULL;
@@ -241,6 +249,7 @@ google_book_cache_get_contacts (GoogleBook *book)
     case IN_MEMORY_CACHE:
         return _g_hash_table_to_list (priv->cache.in_memory.contacts);
     case NO_CACHE:
+    default:
         break;
     }
         return NULL;
@@ -280,6 +289,7 @@ google_book_cache_get_last_update (GoogleBook *book)
         }
         break;
     case NO_CACHE:
+    default:
         break;
     }
     return NULL;
@@ -302,6 +312,7 @@ google_book_cache_get_last_update_tv (GoogleBook *book, GTimeVal *tv)
         memcpy (tv, &priv->cache.in_memory.last_updated, sizeof (GTimeVal));
         return priv->cache.in_memory.contacts != NULL;
     case NO_CACHE:
+    default:
         break;
     }
     return FALSE;
@@ -311,19 +322,20 @@ static void
 google_book_cache_set_last_update (GoogleBook *book, GTimeVal *tv)
 {
     GoogleBookPrivate *priv = GET_PRIVATE (book);
-    char *time;
+    char *_time;
 
     switch (priv->cache_type) {
     case ON_DISK_CACHE:
-        time = g_time_val_to_iso8601 (tv);
+        _time = g_time_val_to_iso8601 (tv);
         /* Work around a bug in EBookBackendCache */
         e_file_cache_remove_object (E_FILE_CACHE (priv->cache.on_disk), "last_update_time");
-        e_book_backend_cache_set_time (priv->cache.on_disk, time);
-        g_free (time);
+        e_book_backend_cache_set_time (priv->cache.on_disk, _time);
+        g_free (_time);
         return;
     case IN_MEMORY_CACHE:
         memcpy (&priv->cache.in_memory.last_updated, tv, sizeof (GTimeVal));
     case NO_CACHE:
+    default:
         break;
     }
 }
@@ -443,6 +455,7 @@ google_book_cache_destroy (GoogleBook *book)
         g_hash_table_destroy (priv->cache.in_memory.gdata_entries);
         break;
     case NO_CACHE:
+    default:
         break;
     }
     priv->cache_type = NO_CACHE;
@@ -457,15 +470,9 @@ google_book_construct_base_uri (GoogleBook *book, gboolean use_ssl)
 
     __debug__ (G_STRFUNC);
     g_free (priv->base_uri);
-    g_free (priv->add_base_uri);
 
     esc_username = g_uri_escape_string (priv->username, NULL, FALSE);
     priv->base_uri = g_strdup_printf (format, use_ssl ? "https://"; : "http://";, esc_username);
-    /* FIXME - always use non ssl mode when adding entries. Somehow this does not
-     * work on SSL; i.e. get duplicate entries and SOUP returns error 7 - connection
-     * terminated unexpectedly
-     */
-    priv->add_base_uri = g_strdup_printf (format, "http://";, esc_username);
     g_free (esc_username);
 }
 
@@ -539,8 +546,8 @@ google_book_dispose (GObject *object)
         priv->service = NULL;
     }
     if (priv->proxy) {
-	g_object_unref (priv->proxy);
-	priv->proxy = NULL;
+        g_object_unref (priv->proxy);
+        priv->proxy = NULL;
     }
     google_book_cache_destroy (GOOGLE_BOOK (object));
 
@@ -554,7 +561,6 @@ google_book_finalize (GObject *object)
     GoogleBookPrivate *priv = GET_PRIVATE (object);
 
     g_free (priv->base_uri);
-    g_free (priv->add_base_uri);
     g_free (priv->username);
 
     if (G_OBJECT_CLASS (google_book_parent_class)->finalize)
@@ -738,17 +744,17 @@ google_book_new (const char *username, gboolean use_cache)
 static void
 proxy_settings_changed (EProxy *proxy, gpointer user_data)
 {
-	SoupURI *proxy_uri = NULL;
+    SoupURI *proxy_uri = NULL;
 
-	GoogleBookPrivate *priv = (GoogleBookPrivate*) user_data;
-	if (!priv || !priv->base_uri)
-		return;
+    GoogleBookPrivate *priv = (GoogleBookPrivate*) user_data;
+    if (!priv || !priv->base_uri)
+        return;
 
-	/* use proxy if necessary */
-	if (e_proxy_require_proxy_for_uri (proxy, priv->base_uri)) {
-		proxy_uri = e_proxy_peek_uri_for (proxy, priv->base_uri);
-	}
-	gdata_service_set_proxy_uri (GDATA_SERVICE (priv->service), proxy_uri);
+    /* use proxy if necessary */
+    if (e_proxy_require_proxy_for_uri (proxy, priv->base_uri)) {
+        proxy_uri = e_proxy_peek_uri_for (proxy, priv->base_uri);
+    }
+    gdata_service_set_proxy_uri (GDATA_SERVICE (priv->service), proxy_uri);
 }
 
 gboolean
@@ -782,9 +788,9 @@ google_book_connect_to_google (GoogleBook *book, const char *password, GError **
         google_book_error_from_soup_error (soup_error, error,
                                            "Connecting to Google failed");
         priv->service = NULL;
-	g_object_unref (service);
-	g_object_unref (priv->proxy);
-	priv->proxy = NULL;
+        g_object_unref (service);
+        g_object_unref (priv->proxy);
+        priv->proxy = NULL;
         return FALSE;
     }
 
@@ -806,14 +812,14 @@ google_book_set_offline_mode (GoogleBook *book, gboolean offline)
 
     priv->offline = offline;
     if (offline) {
-	if (priv->service) {
-		g_object_unref (priv->service);
-		priv->service = NULL;
-	}
-	if (priv->proxy) {
-		g_object_unref (priv->proxy);
-		priv->proxy = NULL;
-	}
+        if (priv->service) {
+            g_object_unref (priv->service);
+            priv->service = NULL;
+        }
+        if (priv->proxy) {
+            g_object_unref (priv->proxy);
+            priv->proxy = NULL;
+        }
     }
     if (offline == FALSE) {
         if (priv->service) {
@@ -845,12 +851,12 @@ google_book_add_contact (GoogleBook *book,
     g_return_val_if_fail (priv->service, FALSE);
 
     entry = _gdata_entry_new_from_e_contact (contact);
-    xml = gdata_entry_get_xml (entry);
+    xml = gdata_parsable_get_xml (GDATA_PARSABLE (entry));
     __debug__ ("new entry with xml: %s", xml);
     g_free (xml);
 
-    new_entry = gdata_service_insert_entry (GDATA_SERVICE (priv->service),
-                                            priv->add_base_uri, entry, NULL, &soup_error);
+    new_entry = GDATA_ENTRY (gdata_contacts_service_insert_contact (GDATA_CONTACTS_SERVICE (priv->service), GDATA_CONTACTS_CONTACT (entry),
+    								    NULL, &soup_error));
     g_object_unref (entry);
     if (soup_error) {
         google_book_error_from_soup_error (soup_error, error,
@@ -901,11 +907,12 @@ google_book_update_contact (GoogleBook *book,
     g_object_unref (cached_contact);
     _gdata_entry_update_from_e_contact (entry, contact);
 
-    xml = gdata_entry_get_xml (entry);
+    xml = gdata_parsable_get_xml (GDATA_PARSABLE (entry));
     __debug__ ("Before:\n%s", xml);
     g_free (xml);
 
-    new_entry = gdata_service_update_entry (GDATA_SERVICE (priv->service), entry, NULL, &soup_error);
+    new_entry = GDATA_ENTRY (gdata_contacts_service_update_contact (GDATA_CONTACTS_SERVICE (priv->service), GDATA_CONTACTS_CONTACT (entry),
+    								    NULL, &soup_error));
     g_object_unref (entry);
 
     if (soup_error) {
@@ -916,7 +923,7 @@ google_book_update_contact (GoogleBook *book,
 
     xml = NULL;
     if (new_entry)
-        xml = gdata_entry_get_xml (new_entry);
+        xml = gdata_parsable_get_xml (GDATA_PARSABLE (new_entry));
     __debug__ ("After:\n%s", xml);
     g_free (xml);
 
diff --git a/addressbook/backends/google/util.c b/addressbook/backends/google/util.c
index 4fed777..bddd440 100644
--- a/addressbook/backends/google/util.c
+++ b/addressbook/backends/google/util.c
@@ -22,7 +22,7 @@
 
 #include <string.h>
 #include <libsoup/soup.h>
-#include <gdata/gdata-gdata.h>
+#include <gdata/gdata.h>
 #include <gdata/services/contacts/gdata-contacts-contact.h>
 #include "util.h"
 
@@ -163,7 +163,7 @@ _gdata_entry_update_from_e_contact (GDataEntry *entry,
 
             /* Add the attribute as an extended property */
             value = e_vcard_attribute_get_value (attr);
-            gboolean gdata_contacts_contact_set_extended_property (GDATA_CONTACTS_CONTACT (entry), name, value);
+            gdata_contacts_contact_set_extended_property (GDATA_CONTACTS_CONTACT (entry), name, value);
             g_free (value);
         } else {
             GList *values;
@@ -231,7 +231,7 @@ _e_contact_new_from_gdata_entry (GDataEntry *entry)
     email_addresses = gdata_contacts_contact_get_email_addresses (GDATA_CONTACTS_CONTACT (entry));
     for (itr = email_addresses; itr; itr = itr->next) {
         email = itr->data;
-        if (TRUE == email->primary)
+        if (gdata_gd_email_address_is_primary (email) == TRUE)
             continue;
         attr = attribute_from_gdata_gd_email_address (email);
         if (attr) {
@@ -248,7 +248,7 @@ _e_contact_new_from_gdata_entry (GDataEntry *entry)
     im_addresses = gdata_contacts_contact_get_im_addresses (GDATA_CONTACTS_CONTACT (entry));
     for (itr = im_addresses; itr; itr = itr->next) {
         im = itr->data;
-        if (TRUE == im->primary)
+        if (gdata_gd_im_address_is_primary (im) == TRUE)
             continue;
         attr = attribute_from_gdata_gd_im_address (im);
         if (attr) {
@@ -265,7 +265,7 @@ _e_contact_new_from_gdata_entry (GDataEntry *entry)
     phone_numbers = gdata_contacts_contact_get_phone_numbers (GDATA_CONTACTS_CONTACT (entry));
     for (itr = phone_numbers; itr; itr = itr->next) {
         phone_number = itr->data;
-        if (TRUE == phone_number->primary)
+        if (gdata_gd_phone_number_is_primary (phone_number) == TRUE)
             continue;
         attr = attribute_from_gdata_gd_phone_number (phone_number);
         if (attr) {
@@ -282,7 +282,7 @@ _e_contact_new_from_gdata_entry (GDataEntry *entry)
     postal_addresses = gdata_contacts_contact_get_postal_addresses (GDATA_CONTACTS_CONTACT (entry));
     for (itr = postal_addresses; itr; itr = itr->next) {
         postal_address = itr->data;
-        if (TRUE == postal_address->primary)
+        if (gdata_gd_postal_address_is_primary (postal_address) == TRUE)
             continue;
         attr = attribute_from_gdata_gd_postal_address (postal_address);
         if (attr) {
@@ -298,35 +298,54 @@ _e_contact_new_from_gdata_entry (GDataEntry *entry)
 }
 
 #define GDATA_ENTRY_XML_ATTR "X-GDATA-ENTRY-XML"
+#define GDATA_ENTRY_LINK_ATTR "X-GDATA-ENTRY-LINK"
 
 void
 _e_contact_add_gdata_entry_xml (EContact *contact, GDataEntry *entry)
 {
     EVCardAttribute *attr;
     char *entry_xml;
+    GDataLink *link;
 
-    /* TODO: Why is this necessary? */
-    entry_xml = gdata_entry_get_xml (entry);
-
+    /* Cache the XML representing the entry */
+    entry_xml = gdata_parsable_get_xml (GDATA_PARSABLE (entry));
     attr = e_vcard_attribute_new ("", GDATA_ENTRY_XML_ATTR);
     e_vcard_attribute_add_value (attr, entry_xml);
     e_vcard_add_attribute (E_VCARD (contact), attr);
-
     g_free (entry_xml);
+
+    /* Also add the update URI for the entry, since that's not serialised by gdata_parsable_get_xml */
+    link = gdata_entry_look_up_link (entry, GDATA_LINK_EDIT);
+    if (link != NULL) {
+        attr = e_vcard_attribute_new ("", GDATA_ENTRY_LINK_ATTR);
+        e_vcard_attribute_add_value (attr, gdata_link_get_uri (link));
+        e_vcard_add_attribute (E_VCARD (contact), attr);
+    }
 }
 
 void
 _e_contact_remove_gdata_entry_xml (EContact *contact)
 {
     e_vcard_remove_attributes (E_VCARD (contact), NULL, GDATA_ENTRY_XML_ATTR);
+    e_vcard_remove_attributes (E_VCARD (contact), NULL, GDATA_ENTRY_LINK_ATTR);
 }
 
 const char*
-_e_contact_get_gdata_entry_xml (EContact *contact)
+_e_contact_get_gdata_entry_xml (EContact *contact, const gchar **edit_link)
 {
     EVCardAttribute *attr;
-    GList *values;
+    GList *values = NULL;
+
+    /* Return the edit link if asked */
+    if (edit_link != NULL) {
+        attr = e_vcard_get_attribute (E_VCARD (contact), GDATA_ENTRY_LINK_ATTR);
+        if (attr != NULL)
+            values = e_vcard_attribute_get_values (attr);
+        if (values != NULL)
+            *edit_link = values->data;
+    }
 
+    /* Return the entry's XML */
     attr = e_vcard_get_attribute (E_VCARD (contact), GDATA_ENTRY_XML_ATTR);
     values = e_vcard_attribute_get_values (attr);
 
@@ -562,16 +581,15 @@ attribute_from_gdata_gd_email_address (GDataGDEmailAddress *email)
     EVCardAttribute *attr;
     gboolean has_type;
 
-    if (NULL == email || NULL == email->address)
+    if (NULL == email || NULL == gdata_gd_email_address_get_address (email))
         return NULL;
 
     attr = e_vcard_attribute_new (NULL, EVC_EMAIL);
-    has_type = add_type_param_from_google_rel (attr, email->rel);
-    if (email->primary) {
+    has_type = add_type_param_from_google_rel (attr, gdata_gd_email_address_get_relation_type (email));
+    if (gdata_gd_email_address_is_primary (email) == TRUE)
         add_primary_param (attr, has_type);
-    }
-    add_label_param (attr, email->label);
-    e_vcard_attribute_add_value (attr, email->address);
+    add_label_param (attr, gdata_gd_email_address_get_label (email));
+    e_vcard_attribute_add_value (attr, gdata_gd_email_address_get_address (email));
     return attr;
 }
 
@@ -582,20 +600,19 @@ attribute_from_gdata_gd_im_address (GDataGDIMAddress *im)
     gboolean has_type;
     char *field_name;
 
-    if (NULL == im || NULL == im->address)
+    if (NULL == im || NULL == gdata_gd_im_address_get_address (im))
         return NULL;
 
-    field_name = field_name_from_google_im_protocol (im->protocol);
+    field_name = field_name_from_google_im_protocol (gdata_gd_im_address_get_protocol (im));
     if (NULL == field_name)
         return NULL;
 
     attr = e_vcard_attribute_new (NULL, field_name);
-    has_type = add_type_param_from_google_rel (attr, im->rel);
-    if (im->primary) {
+    has_type = add_type_param_from_google_rel (attr, gdata_gd_im_address_get_relation_type (im));
+    if (gdata_gd_im_address_is_primary (im))
         add_primary_param (attr, has_type);
-    }
-    add_label_param (attr, im->label);
-    e_vcard_attribute_add_value (attr, im->address);
+    add_label_param (attr, gdata_gd_im_address_get_label (im));
+    e_vcard_attribute_add_value (attr, gdata_gd_im_address_get_address (im));
     return attr;
 }
 
@@ -605,16 +622,15 @@ attribute_from_gdata_gd_phone_number (GDataGDPhoneNumber *number)
     EVCardAttribute *attr;
     gboolean has_type;
 
-    if (NULL == number || NULL == number->number)
+    if (NULL == number || NULL == gdata_gd_phone_number_get_number (number))
         return NULL;
 
     attr = e_vcard_attribute_new (NULL, EVC_TEL);
-    has_type = add_type_param_from_google_rel_phone (attr, number->rel);
-    if (number->primary) {
+    has_type = add_type_param_from_google_rel_phone (attr, gdata_gd_phone_number_get_relation_type (number));
+    if (gdata_gd_phone_number_is_primary (number))
         add_primary_param (attr, has_type);
-    }
-    add_label_param (attr, number->label);
-    e_vcard_attribute_add_value (attr, number->number);
+    add_label_param (attr, gdata_gd_phone_number_get_label (number));
+    e_vcard_attribute_add_value (attr, gdata_gd_phone_number_get_number (number));
     return attr;
 }
 
@@ -624,16 +640,15 @@ attribute_from_gdata_gd_postal_address (GDataGDPostalAddress *address)
     EVCardAttribute *attr;
     gboolean has_type;
 
-    if (NULL == address || NULL == address->address)
+    if (NULL == address || NULL == gdata_gd_postal_address_get_address (address))
         return NULL;
 
     attr = e_vcard_attribute_new (NULL, EVC_LABEL);
-    has_type = add_type_param_from_google_rel (attr, address->rel);
-    if (address->primary) {
+    has_type = add_type_param_from_google_rel (attr, gdata_gd_postal_address_get_relation_type (address));
+    if (gdata_gd_postal_address_is_primary (address))
         add_primary_param (attr, has_type);
-    }
-    add_label_param (attr, address->label);
-    e_vcard_attribute_add_value (attr, address->address);
+    add_label_param (attr, gdata_gd_postal_address_get_label (address));
+    e_vcard_attribute_add_value (attr, gdata_gd_postal_address_get_address (address));
     return attr;
 }
 
@@ -662,10 +677,10 @@ gdata_gd_email_address_from_attribute (EVCardAttribute *attr, gboolean *have_pri
         g_free (rel);
 
         __debug__ ("New %semail entry %s (%s/%s)",
-                    email->primary ? "primary " : "",
-                    email->address,
-                    email->rel,
-                    email->label);
+                    gdata_gd_email_address_is_primary (email) ? "primary " : "",
+                    gdata_gd_email_address_get_address (email),
+                    gdata_gd_email_address_get_relation_type (email),
+                    gdata_gd_email_address_get_label (email));
     }
 
     return email;
@@ -701,11 +716,11 @@ gdata_gd_im_address_from_attribute (EVCardAttribute *attr, gboolean *have_primar
         g_free (protocol);
 
         __debug__ ("New %s%s entry %s (%s/%s)",
-                    im->primary ? "primary " : "",
-                    im->protocol,
-                    im->address,
-                    im->rel,
-                    im->label);
+                    gdata_gd_im_address_is_primary (im) ? "primary " : "",
+                    gdata_gd_im_address_get_protocol (im),
+                    gdata_gd_im_address_get_address (im),
+                    gdata_gd_im_address_get_relation_type (im),
+                    gdata_gd_im_address_get_label (im));
     }
 
     return im;
@@ -736,10 +751,10 @@ gdata_gd_phone_number_from_attribute (EVCardAttribute *attr, gboolean *have_prim
         g_free (rel);
 
         __debug__ ("New %sphone-number entry %s (%s/%s)",
-                    number->primary ? "primary " : "",
-                    number->number,
-                    number->rel,
-                    number->label);
+                    gdata_gd_phone_number_is_primary (number) ? "primary " : "",
+                    gdata_gd_phone_number_get_number (number),
+                    gdata_gd_phone_number_get_relation_type (number),
+                    gdata_gd_phone_number_get_label (number));
     }
 
     return number;
@@ -770,10 +785,10 @@ gdata_gd_postal_address_from_attribute (EVCardAttribute *attr, gboolean *have_pr
         g_free (rel);
 
         __debug__ ("New %spostal address entry %s (%s/%s)",
-                    address->primary ? "primary " : "",
-                    address->address,
-                    address->rel,
-                    address->label);
+                    gdata_gd_postal_address_is_primary (address) ? "primary " : "",
+                    gdata_gd_postal_address_get_address (address),
+                    gdata_gd_postal_address_get_relation_type (address),
+                    gdata_gd_postal_address_get_label (address));
     }
 
     return address;
diff --git a/addressbook/backends/google/util.h b/addressbook/backends/google/util.h
index c952196..6babbf2 100644
--- a/addressbook/backends/google/util.h
+++ b/addressbook/backends/google/util.h
@@ -41,6 +41,7 @@ EContact*   _e_contact_new_from_gdata_entry    (GDataEntry *entry);
 void        _e_contact_add_gdata_entry_xml     (EContact   *contact,
                                                 GDataEntry *entry);
 void        _e_contact_remove_gdata_entry_xml  (EContact   *contact);
-const char* _e_contact_get_gdata_entry_xml     (EContact *contact);
+const char* _e_contact_get_gdata_entry_xml     (EContact *contact,
+						const gchar **edit_link);
 
 #endif
diff --git a/calendar/backends/google/e-cal-backend-google-utils.c b/calendar/backends/google/e-cal-backend-google-utils.c
index d049ed6..67fb910 100644
--- a/calendar/backends/google/e-cal-backend-google-utils.c
+++ b/calendar/backends/google/e-cal-backend-google-utils.c
@@ -468,24 +468,24 @@ e_gdata_event_to_cal_component (GDataCalendarEvent *event, ECalBackendGoogle *cb
 #if 0
 		_print_attendee ((Attendee *)l->data);
 #endif
-		attendee->value = g_strconcat ("MAILTO:", go_attendee->email, NULL);
-		attendee->cn = g_strdup (go_attendee->value_string);
+		attendee->value = g_strconcat ("MAILTO:", gdata_gd_who_get_email_address (go_attendee), NULL);
+		attendee->cn = g_strdup (gdata_gd_who_get_value_string (go_attendee));
 		/* TODO: This could be made less static once the GData API's in place */
 		attendee->role = ICAL_ROLE_OPTPARTICIPANT;
 		attendee->status = ICAL_PARTSTAT_NEEDSACTION;
 		attendee->cutype =  ICAL_CUTYPE_INDIVIDUAL;
 
 		/* Check for Organizer */
-		if (go_attendee->rel) {
+		if (gdata_gd_who_get_relation_type (go_attendee)) {
 			gchar *val;
-			val = strstr ((const gchar *)go_attendee->rel, (const gchar *)"organizer");
+			val = strstr (gdata_gd_who_get_relation_type (go_attendee), "organizer");
 			if (val != NULL && !strcmp ("organizer", val)) {
 				org = g_new0 (ECalComponentOrganizer, 1);
 
-				if (go_attendee->email)
-					org->value = g_strconcat ("MAILTO:", go_attendee->email, NULL);
-				if (go_attendee->value_string)
-					org->cn = g_strdup (go_attendee->value_string);
+				if (gdata_gd_who_get_email_address (go_attendee))
+					org->value = g_strconcat ("MAILTO:", gdata_gd_who_get_email_address (go_attendee), NULL);
+				if (gdata_gd_who_get_value_string (go_attendee))
+					org->cn = g_strdup (gdata_gd_who_get_value_string (go_attendee));
 			}	
 		}
 		
@@ -505,8 +505,9 @@ e_gdata_event_to_cal_component (GDataCalendarEvent *event, ECalBackendGoogle *cb
 
 		go_location = (GDataGDWhere *)l->data;
 
-		if (go_location->rel == NULL || strcmp (go_location->rel, "http://schemas.google.com/g/2005#event";) == 0)
-			location = go_location->value_string;
+		if (gdata_gd_where_get_relation_type (go_location) == NULL ||
+		    strcmp (gdata_gd_where_get_relation_type (go_location), "http://schemas.google.com/g/2005#event";) == 0)
+			location = gdata_gd_where_get_value_string (go_location);
 	}
 	e_cal_component_set_location (comp, location);
 
@@ -817,7 +818,7 @@ e_gdata_event_update_from_cal_component (ECalBackendGoogle *cbgo, GDataCalendarE
 	get_timeval (dt, &timeval2);
 
 	/* TODO: deal with pure dates */
-	when = gdata_gd_when_new (&timeval, &timeval2, FALSE, NULL, NULL);
+	when = gdata_gd_when_new (&timeval, &timeval2, FALSE);
 	gdata_calendar_event_add_time (event, when);
 
 	/* Content / Description */
diff --git a/calendar/backends/google/e-cal-backend-google.c b/calendar/backends/google/e-cal-backend-google.c
index 6019b1b..26e4c5e 100644
--- a/calendar/backends/google/e-cal-backend-google.c
+++ b/calendar/backends/google/e-cal-backend-google.c
@@ -522,8 +522,8 @@ fetch_attachments (ECalBackendGoogle *cbgo, ECalComponent *comp)
 	e_cal_component_set_attachment_list (comp, new_attach_list);
 }	
 
-ECalBackendSyncStatus 
-static receive_object (ECalBackendGoogle *cbgo, EDataCal *cal, icalcomponent *icalcomp)
+static ECalBackendSyncStatus 
+receive_object (ECalBackendGoogle *cbgo, EDataCal *cal, icalcomponent *icalcomp)
 {
 	ECalBackendGooglePrivate *priv;
 	GDataEntry *entry = NULL, *updated_entry = NULL;
diff --git a/configure.in b/configure.in
index 787d118..b37fb3d 100644
--- a/configure.in
+++ b/configure.in
@@ -30,7 +30,7 @@ m4_define([libglade_minimum_version], [2.0.0])          # XXX Just a Guess
 m4_define([libgnome_minimum_version], [2.0.0])          # XXX Just a Guess
 m4_define([libxml_minimum_version], [2.0.0])            # XXX Just a Guess
 m4_define([libsoup_minimum_version], [2.3.0])
-m4_define([libgdata_minimum_version], [0.2.0])
+m4_define([libgdata_minimum_version], [0.4.0])
 m4_define([gnome_keyring_minimum_version], [2.20.1])
 m4_define([sqlite_minimum_version], [3.5])
 m4_define([gweather_minimum_version], [2.25.4])



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