[libgdata] documents: Split out the code to add a parent folder's link to an entry
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] documents: Split out the code to add a parent folder's link to an entry
- Date: Wed, 17 Jun 2015 10:37:09 +0000 (UTC)
commit 033b6c8e718c6698f0e4c808e919b3b60202368e
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Jun 16 18:22:13 2015 +0200
documents: Split out the code to add a parent folder's link to an entry
We will need this for creating folders and copying files.
https://bugzilla.gnome.org/show_bug.cgi?id=684920
gdata/services/documents/gdata-documents-service.c | 31 +++++++++++--------
1 files changed, 18 insertions(+), 13 deletions(-)
---
diff --git a/gdata/services/documents/gdata-documents-service.c
b/gdata/services/documents/gdata-documents-service.c
index dea3aad..48db18d 100644
--- a/gdata/services/documents/gdata-documents-service.c
+++ b/gdata/services/documents/gdata-documents-service.c
@@ -574,6 +574,22 @@ gdata_documents_service_query_documents_async (GDataDocumentsService *self, GDat
g_free (request_uri);
}
+static void
+add_folder_link_to_entry (GDataDocumentsEntry *entry, GDataDocumentsFolder *folder)
+{
+ GDataLink *_link;
+ const gchar *id;
+ gchar *uri;
+
+ /* HACK: Build the GDataLink:uri from the ID by adding the prefix. */
+ id = gdata_entry_get_id (GDATA_ENTRY (folder));
+ uri = g_strconcat (GDATA_DOCUMENTS_URI_PREFIX, id, NULL);
+ _link = gdata_link_new (uri, GDATA_LINK_PARENT);
+ gdata_entry_add_link (GDATA_ENTRY (entry), _link);
+ g_object_unref (_link);
+ g_free (uri);
+}
+
static GDataUploadStream *
upload_update_document (GDataDocumentsService *self, GDataDocumentsDocument *document, const gchar *slug,
const gchar *content_type,
GDataDocumentsFolder *folder, goffset content_length, const gchar *method, const
gchar *upload_uri,
@@ -587,19 +603,8 @@ upload_update_document (GDataDocumentsService *self, GDataDocumentsDocument *doc
if (strcmp (content_type, "application/vnd.oasis.opendocument.spreadsheet") == 0)
content_type = "application/x-vnd.oasis.opendocument.spreadsheet";
- if (folder != NULL) {
- GDataLink *_link;
- const gchar *id;
- gchar *uri;
-
- /* HACK: Build the GDataLink:uri from the ID by adding the prefix. */
- id = gdata_entry_get_id (GDATA_ENTRY (folder));
- uri = g_strconcat (GDATA_DOCUMENTS_URI_PREFIX, id, NULL);
- _link = gdata_link_new (uri, GDATA_LINK_PARENT);
- gdata_entry_add_link (GDATA_ENTRY (document), _link);
- g_object_unref (_link);
- g_free (uri);
- }
+ if (folder != NULL)
+ add_folder_link_to_entry (GDATA_DOCUMENTS_ENTRY (document), folder);
/* We need streaming file I/O: GDataUploadStream */
if (content_length == -1) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]