[libgdata/wip/rishi/drive] documents: Add support for updating content using Drive v2
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata/wip/rishi/drive] documents: Add support for updating content using Drive v2
- Date: Tue, 30 Jun 2015 13:08:41 +0000 (UTC)
commit a24d20f415f52ffa51548e4009e0cfb8b5d768d4
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Jun 30 15:02:52 2015 +0200
documents: Add support for updating content using Drive v2
There is a bug in the Drive web UI where the preview doesn't get
updated with the new content, but if you download or go through the
revisions then things are as they should be. I could reliably reproduce
it with plain/text content.
https://bugzilla.gnome.org/show_bug.cgi?id=684920
gdata/services/documents/gdata-documents-service.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/gdata/services/documents/gdata-documents-service.c
b/gdata/services/documents/gdata-documents-service.c
index 4807f20..ee7a891 100644
--- a/gdata/services/documents/gdata-documents-service.c
+++ b/gdata/services/documents/gdata-documents-service.c
@@ -819,7 +819,10 @@ GDataUploadStream *
gdata_documents_service_update_document (GDataDocumentsService *self, GDataDocumentsDocument *document,
const gchar *slug, const gchar *content_type,
GCancellable *cancellable, GError **error)
{
- GDataLink *update_link;
+ GDataUploadStream *update_stream;
+ const gchar *id;
+ gchar *update_uri;
+ gchar *update_uri_prefix;
g_return_val_if_fail (GDATA_IS_DOCUMENTS_SERVICE (self), NULL);
g_return_val_if_fail (GDATA_IS_DOCUMENTS_DOCUMENT (document), NULL);
@@ -832,11 +835,14 @@ gdata_documents_service_update_document (GDataDocumentsService *self, GDataDocum
return NULL;
}
- update_link = gdata_entry_look_up_link (GDATA_ENTRY (document), GDATA_LINK_EDIT_MEDIA);
- g_assert (update_link != NULL);
+ update_uri_prefix = gdata_documents_service_get_upload_uri (NULL);
+ id = gdata_entry_get_id (GDATA_ENTRY (document));
+ update_uri = g_strconcat (update_uri_prefix, "/", id, "?uploadType=multipart", NULL);
+ update_stream = upload_update_document (self, document, slug, content_type, NULL, -1,
SOUP_METHOD_PUT, update_uri, cancellable);
+ g_free (update_uri);
+ g_free (update_uri_prefix);
- return upload_update_document (self, document, slug, content_type, NULL, -1, SOUP_METHOD_PUT,
gdata_link_get_uri (update_link),
- cancellable);
+ return update_stream;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]