[libgdata] documents: Add a code example for adding a new folder
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] documents: Add a code example for adding a new folder
- Date: Thu, 30 Dec 2010 13:12:13 +0000 (UTC)
commit e081c7144e407bf107c2bebf0bf2ae57313f2ea1
Author: Philip Withnall <philip tecnocode co uk>
Date: Thu Dec 30 12:06:42 2010 +0000
documents: Add a code example for adding a new folder
Helps: bgo#579885
gdata/services/documents/gdata-documents-folder.c | 35 +++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/gdata/services/documents/gdata-documents-folder.c b/gdata/services/documents/gdata-documents-folder.c
index ce38c18..4c8b794 100644
--- a/gdata/services/documents/gdata-documents-folder.c
+++ b/gdata/services/documents/gdata-documents-folder.c
@@ -29,6 +29,41 @@
* For more details of Google Documents' GData API, see the
* <ulink type="http" url="http://code.google.com/apis/document/docs/2.0/developers_guide_protocol.html">online documentation</ulink>.
*
+ * <example>
+ * <title>Adding a Folder</title>
+ * <programlisting>
+ * GDataDocumentsService *service;
+ * GDataDocumentsFolder *folder, *new_folder;
+ * gchar *upload_uri;
+ * GError *error = NULL;
+ *
+ * /<!-- -->* Create a service *<!-- -->/
+ * service = create_documents_service ();
+ *
+ * /<!-- -->* Create the new folder *<!-- -->/
+ * folder = gdata_documents_folder_new (NULL);
+ * gdata_entry_set_title (GDATA_ENTRY (folder), "Folder Name");
+ *
+ * /<!-- -->* Insert the folder *<!-- -->/
+ * upload_uri = gdata_documents_service_get_upload_uri (NULL);
+ * new_folder = GDATA_DOCUMENTS_FOLDER (gdata_service_insert_entry (GDATA_SERVICE (service), upload_uri, GDATA_ENTRY (folder), NULL, &error));
+ * g_free (upload_uri);
+ *
+ * g_object_unref (folder);
+ * g_object_unref (service);
+ *
+ * if (error != NULL) {
+ * g_error ("Error inserting new folder: %s", error->message);
+ * g_error_free (error);
+ * return;
+ * }
+ *
+ * /<!-- -->* Do something with the new folder, such as store its ID for future use *<!-- -->/
+ *
+ * g_object_unref (new_folder);
+ * </programlisting>
+ * </example>
+ *
* Since: 0.4.0
**/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]