[libgdata] [documents] Re-query the document when removing it from a folder



commit e66e42f1637f5ed07efdde31aad5602aa30d2f89
Author: Philip Withnall <philip tecnocode co uk>
Date:   Thu Aug 6 23:07:20 2009 +0100

    [documents] Re-query the document when removing it from a folder
    
    This ensures we return the latest version of the document, rather than having
    to hack around with removing the old folder's links and categories ourselves.
    See: http://code.google.com/p/gdata-issues/issues/detail?id=1380

 gdata/gdata-upload-stream.c                        |    4 ++--
 gdata/services/documents/gdata-documents-service.c |    7 ++++---
 2 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gdata/gdata-upload-stream.c b/gdata/gdata-upload-stream.c
index e6abb5d..0f78649 100644
--- a/gdata/gdata-upload-stream.c
+++ b/gdata/gdata-upload-stream.c
@@ -548,8 +548,8 @@ create_network_thread (GDataUploadStream *self, GError **error)
  *
  * Creates a new #GDataUploadStream, allowing a file to be uploaded from a GData service using standard #GOutputStream API.
  *
- * The HTTP method to use should be specified in @method, and will typically be either %SOUP_METHOD_POST or %SOUP_METHOD_PUT, according to the server
- * and the @upload_uri.
+ * The HTTP method to use should be specified in @method, and will typically be either %SOUP_METHOD_POST (for insertions) or %SOUP_METHOD_PUT
+ * (for updates), according to the server and the @upload_uri.
  *
  * If @entry is specified, it will be attached to the upload as the entry to which the file being uploaded belongs. Otherwise, just the file
  * written to the stream will be uploaded, and given a default entry as determined by the server.
diff --git a/gdata/services/documents/gdata-documents-service.c b/gdata/services/documents/gdata-documents-service.c
index c670ce2..d633504 100644
--- a/gdata/services/documents/gdata-documents-service.c
+++ b/gdata/services/documents/gdata-documents-service.c
@@ -707,9 +707,10 @@ gdata_documents_service_remove_document_from_folder (GDataDocumentsService *self
 
 	g_object_unref (message);
 
-	/* Remove evidence of the folder from the entry and return it (since Google's servers don't return an updated entry for this query) */
-
-	return g_object_ref (document);
+	/* Google's servers don't return an updated copy of the entry, so we have to query for it again.
+	 * See: http://code.google.com/p/gdata-issues/issues/detail?id=1380 */
+	return gdata_documents_service_query_single_document (self, G_OBJECT_TYPE (document), gdata_documents_entry_get_document_id (document),
+							      cancellable, error);
 }
 
 GDataService *



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