[libgdata] documents: Make GDataDocumentsDocument non-abstract
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] documents: Make GDataDocumentsDocument non-abstract
- Date: Fri, 13 Apr 2012 15:13:18 +0000 (UTC)
commit 1d0e74eeb0851d5be40b5d79d153682d52712180
Author: Philip Withnall <philip tecnocode co uk>
Date: Fri Apr 13 13:20:00 2012 +0100
documents: Make GDataDocumentsDocument non-abstract
It now represents arbitrary files, so that Google Documents can be used as
a kind of remote filesystem.
This shouldnât be an API break.
Helps: https://bugzilla.gnome.org/show_bug.cgi?id=656971
docs/reference/gdata-sections.txt | 1 +
gdata/gdata.symbols | 1 +
.../services/documents/gdata-documents-document.c | 34 +++++++++++++++++--
.../services/documents/gdata-documents-document.h | 2 +
4 files changed, 34 insertions(+), 4 deletions(-)
---
diff --git a/docs/reference/gdata-sections.txt b/docs/reference/gdata-sections.txt
index 787675c..c98edc0 100644
--- a/docs/reference/gdata-sections.txt
+++ b/docs/reference/gdata-sections.txt
@@ -1618,6 +1618,7 @@ GDataDocumentsFolderPrivate
<TITLE>GDataDocumentsDocument</TITLE>
GDataDocumentsDocument
GDataDocumentsDocumentClass
+gdata_documents_document_new
gdata_documents_document_download
gdata_documents_document_get_download_uri
<SUBSECTION Standard>
diff --git a/gdata/gdata.symbols b/gdata/gdata.symbols
index 3b8e9f1..bfe9e54 100644
--- a/gdata/gdata.symbols
+++ b/gdata/gdata.symbols
@@ -946,3 +946,4 @@ gdata_documents_upload_query_new
gdata_documents_upload_query_build_uri
gdata_documents_upload_query_get_folder
gdata_documents_upload_query_set_folder
+gdata_documents_document_new
diff --git a/gdata/services/documents/gdata-documents-document.c b/gdata/services/documents/gdata-documents-document.c
index 598ebc1..c9a75d5 100644
--- a/gdata/services/documents/gdata-documents-document.c
+++ b/gdata/services/documents/gdata-documents-document.c
@@ -23,8 +23,16 @@
* @stability: Unstable
* @include: gdata/services/documents/gdata-documents-document.h
*
- * #GDataDocumentsDocument is an abstract subclass of #GDataDocumentsEntry to represent a Google Documents document. It is subclassed by
- * #GDataDocumentsPresentation, #GDataDocumentsText and #GDataDocumentsSpreadsheet, which are instantiable.
+ * #GDataDocumentsDocument is a subclass of #GDataDocumentsEntry to represent an arbitrary Google Documents document (i.e. an arbitrary file which
+ * isn't a Google Documents presentation, text document or spreadsheet). It is subclassed by #GDataDocumentsPresentation, #GDataDocumentsText and
+ * #GDataDocumentsSpreadsheet, which represent those specific types of Google Document, respectively.
+ *
+ * #GDataDocumentsDocument used to be abstract, but was made instantiable in version 0.13.0 to allow for arbitrary file uploads. This can be achieved
+ * by setting #GDataDocumentsUploadQuery:convert to %FALSE when making an upload using gdata_documents_service_upload_document_resumable(). See the
+ * documentation for #GDataDocumentsUploadQuery for an example.
+ *
+ * It should be noted that #GDataDocumentsDocument should only be used to represent arbitrary files; its subclasses should be used any time a standard
+ * Google Document (spreadsheet, text document, presentation, etc.) is to be represented.
*
* For more details of Google Documents' GData API, see the
* <ulink type="http" url="https://developers.google.com/google-apps/documents-list/">online documentation</ulink>.
@@ -198,12 +206,14 @@
#include "gdata-private.h"
#include "gdata-service.h"
-G_DEFINE_ABSTRACT_TYPE (GDataDocumentsDocument, gdata_documents_document, GDATA_TYPE_DOCUMENTS_ENTRY)
+G_DEFINE_TYPE (GDataDocumentsDocument, gdata_documents_document, GDATA_TYPE_DOCUMENTS_ENTRY)
static void
gdata_documents_document_class_init (GDataDocumentsDocumentClass *klass)
{
- /* Nothing to see here. */
+ GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass);
+
+ entry_class->kind_term = "http://schemas.google.com/docs/2007#file";
}
static void
@@ -213,6 +223,22 @@ gdata_documents_document_init (GDataDocumentsDocument *self)
}
/**
+ * gdata_documents_document_new:
+ * @id: (allow-none): the entry's ID (not the document ID), or %NULL
+ *
+ * Creates a new #GDataDocumentsDocument with the given entry ID (#GDataEntry:id).
+ *
+ * Return value: (transfer full): a new #GDataDocumentsDocument, or %NULL; unref with g_object_unref()
+ *
+ * Since: 0.13.0
+ */
+GDataDocumentsDocument *
+gdata_documents_document_new (const gchar *id)
+{
+ return GDATA_DOCUMENTS_DOCUMENT (g_object_new (GDATA_TYPE_DOCUMENTS_DOCUMENT, "id", id, NULL));
+}
+
+/**
* gdata_documents_document_download:
* @self: a #GDataDocumentsDocument
* @service: a #GDataDocumentsService
diff --git a/gdata/services/documents/gdata-documents-document.h b/gdata/services/documents/gdata-documents-document.h
index 2385fd7..5b27cb2 100644
--- a/gdata/services/documents/gdata-documents-document.h
+++ b/gdata/services/documents/gdata-documents-document.h
@@ -63,6 +63,8 @@ typedef struct {
GType gdata_documents_document_get_type (void) G_GNUC_CONST;
+GDataDocumentsDocument *gdata_documents_document_new (const gchar *id) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
+
#include <gdata/services/documents/gdata-documents-service.h>
GDataDownloadStream *gdata_documents_document_download (GDataDocumentsDocument *self, GDataDocumentsService *service, const gchar *export_format,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]