[libgdata: 1/7] documents: Added GDataDocumentsProperty to support Property Resource



commit a000213e15e08aef5c063e24ed28c98ca06f0a37
Author: Mayank Sharma <mayank8019 gmail com>
Date:   Thu Jul 25 16:09:57 2019 +0530

    documents: Added GDataDocumentsProperty to support Property Resource
    
    Google Drive API (v2) supports custom file properties on file/folder
    metadata and allows to store key-value pairs there. We add
    GDataDocumentsProperty which corresponds to a Property Resource, and
    provides functionality to create public/private custom property. The
    documentation has also been updated (a new section added for
    GDataDocumentsProperty).
    
    GDataDocumentsProperty class will later be used to add a list of
    "properties" on GDataDocumentsEntry, accessible through the
    file/folder metadata.

 docs/reference/gdata-docs.xml                      |   1 +
 docs/reference/gdata-sections.txt.in               |  26 ++
 gdata/gdata.h                                      |   1 +
 .../services/documents/gdata-documents-property.c  | 472 +++++++++++++++++++++
 .../services/documents/gdata-documents-property.h  | 106 +++++
 gdata/services/documents/meson.build               |   2 +
 gdata/symbol.map                                   |   8 +
 7 files changed, 616 insertions(+)
---
diff --git a/docs/reference/gdata-docs.xml b/docs/reference/gdata-docs.xml
index 9c1456ff..e164e2fd 100644
--- a/docs/reference/gdata-docs.xml
+++ b/docs/reference/gdata-docs.xml
@@ -156,6 +156,7 @@
                <chapter>
                        <title>Google Documents/Drive API</title>
                        <xi:include href="xml/gdata-documents-service.xml"/>
+                       <xi:include href="xml/gdata-documents-property.xml"/>
                        <xi:include href="xml/gdata-documents-feed.xml"/>
                        <xi:include href="xml/gdata-documents-query.xml"/>
                        <xi:include href="xml/gdata-documents-upload-query.xml"/>
diff --git a/docs/reference/gdata-sections.txt.in b/docs/reference/gdata-sections.txt.in
index b4569194..cf2fc4bf 100644
--- a/docs/reference/gdata-sections.txt.in
+++ b/docs/reference/gdata-sections.txt.in
@@ -1571,6 +1571,32 @@ GDATA_TYPE_DOCUMENTS_ENTRY
 GDataDocumentsEntryPrivate
 </SECTION>
 
+<SECTION>
+<FILE>gdata-documents-property</FILE>
+<TITLE>GDataDocumentsProperty</TITLE>
+GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PUBLIC
+GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PRIVATE
+GDataDocumentsProperty
+GDataDocumentsPropertyClass
+gdata_documents_property_new
+gdata_documents_property_get_key
+gdata_documents_property_get_etag
+gdata_documents_property_get_value
+gdata_documents_property_set_value
+gdata_documents_property_get_visibility
+gdata_documents_property_set_visibility
+<SUBSECTION Standard>
+gdata_documents_property_get_type
+GDATA_DOCUMENTS_PROPERTY
+GDATA_DOCUMENTS_PROPERTY_CLASS
+GDATA_DOCUMENTS_PROPERTY_GET_CLASS
+GDATA_IS_DOCUMENTS_PROPERTY
+GDATA_IS_DOCUMENTS_PROPERTY_CLASS
+GDATA_TYPE_DOCUMENTS_PROPERTY
+<SUBSECTION Private>
+GDataDocumentsPropertyPrivate
+</SECTION>
+
 <SECTION>
 <FILE>gdata-documents-feed</FILE>
 <TITLE>GDataDocumentsFeed</TITLE>
diff --git a/gdata/gdata.h b/gdata/gdata.h
index 405993e6..a1ff6ec4 100644
--- a/gdata/gdata.h
+++ b/gdata/gdata.h
@@ -128,6 +128,7 @@
 /* Google Documents*/
 #include <gdata/services/documents/gdata-documents-entry.h>
 #include <gdata/services/documents/gdata-documents-document.h>
+#include <gdata/services/documents/gdata-documents-property.h>
 #include <gdata/services/documents/gdata-documents-text.h>
 #include <gdata/services/documents/gdata-documents-spreadsheet.h>
 #include <gdata/services/documents/gdata-documents-presentation.h>
diff --git a/gdata/services/documents/gdata-documents-property.c 
b/gdata/services/documents/gdata-documents-property.c
new file mode 100644
index 00000000..f57744a2
--- /dev/null
+++ b/gdata/services/documents/gdata-documents-property.c
@@ -0,0 +1,472 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * GData Client
+ * Copyright (C) Mayank Sharma <mayank8019 gmail com>
+ *
+ * GData Client is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * GData Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GData Client.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * SECTION:gdata-documents-property
+ * @short_description: GData Documents property object
+ * @stability: Unstable
+ * @include: gdata/gdata-property.h
+ *
+ * #GDataDocumentsProperty is a subclass of #GDataParsable and represents a Google Drive Property Resource 
on a file object.
+ *
+ * It allows applications to store additional metadata on a file, such as tags, IDs from other data stores, 
viewing preferences etc. Properties can be used to share metadata between applications, for example, in a 
workflow application.
+ *
+ * Each #GDataDocumentsProperty is characterized by a key-value pair (where value is optional, and takes 
empty string "" by default) and a visibility parameter. The visibility can take values "PUBLIC" for public 
properties and "PRIVATE" for private properties (default). Private properties are accessible only by the 
application which set them, but public properties can be read/written by other applications as well.
+ *
+ * Since: 0.18.0
+ */
+
+#include <glib.h>
+#include <gdata/gdata-parsable.h>
+#include <json-glib/json-glib.h>
+
+#include "gdata-documents-property.h"
+#include "gdata-parser.h"
+#include "gdata-comparable.h"
+
+static void gdata_documents_property_comparable_init (GDataComparableIface *iface);
+static void gdata_documents_property_finalize (GObject *object);
+static void gdata_documents_property_get_property (GObject *object, guint property_id, GValue *value, 
GParamSpec *pspec);
+static void gdata_documents_property_set_property (GObject *object, guint property_id, const GValue *value, 
GParamSpec *pspec);
+
+static void _gdata_documents_property_set_key (GDataDocumentsProperty *self, const gchar *key);
+static void _gdata_documents_property_set_etag (GDataDocumentsProperty *self, const gchar *etag);
+
+static gboolean parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GError **error);
+static void get_json (GDataParsable *parsable, JsonBuilder *builder);
+
+struct _GDataDocumentsPropertyPrivate {
+       gchar *key;
+       gchar *etag;
+       gchar *value;           /* default - empty string ("") */
+       gchar *visibility;      /* default - "PRIVATE" */
+};
+
+enum {
+       PROP_KEY = 1,
+       PROP_ETAG,
+       PROP_VALUE,
+       PROP_VISIBILITY
+};
+
+G_DEFINE_TYPE_WITH_CODE (GDataDocumentsProperty, gdata_documents_property, GDATA_TYPE_PARSABLE,
+                        G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, 
gdata_documents_property_comparable_init))
+
+static void
+gdata_documents_property_class_init (GDataDocumentsPropertyClass *klass)
+{
+       GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+       GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass);
+
+       g_type_class_add_private (klass, sizeof (GDataDocumentsPropertyPrivate));
+
+       gobject_class->set_property = gdata_documents_property_set_property;
+       gobject_class->get_property = gdata_documents_property_get_property;
+       gobject_class->finalize = gdata_documents_property_finalize;
+
+       parsable_class->parse_json = parse_json;
+       parsable_class->get_json = get_json;
+       parsable_class->element_name = "property";
+
+       /**
+        * GDataDocumentsProperty:key:
+        *
+        * The key of this property.
+        *
+        * For more information, see the <ulink type="http" 
url="https://developers.google.com/drive/api/v2/reference/properties";>Properties Resource</ulink>
+        *
+        * Since: 0.18.0
+        */
+       g_object_class_install_property (gobject_class, PROP_KEY,
+                                        g_param_spec_string ("key",
+                                                             "Key", "The key of this property.",
+                                                             NULL,
+                                                             G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+       /**
+        * GDataDocumentsProperty:etag:
+        *
+        * ETag of the property.
+        *
+        * For more information, see the <ulink type="http" 
url="https://developers.google.com/drive/api/v2/reference/properties";>Properties Resource</ulink>
+        *
+        * Since: 0.18.0
+        */
+       g_object_class_install_property (gobject_class, PROP_ETAG,
+                                        g_param_spec_string ("etag",
+                                                             "ETag", "ETag of the property.",
+                                                             NULL,
+                                                             G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | 
G_PARAM_STATIC_STRINGS));
+
+       /**
+        * GDataDocumentsProperty:value:
+        *
+        * The value of this property. By default, it takes the an empty string ("").
+        *
+        * For more information, see the <ulink type="http" 
url="https://developers.google.com/drive/api/v2/reference/properties";>Properties Resource</ulink>
+        *
+        * Since: 0.18.0
+        */
+       g_object_class_install_property (gobject_class, PROP_VALUE,
+                                        g_param_spec_string ("value",
+                                                             "Value", "The value of this property.",
+                                                             NULL,
+                                                             G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+       /**
+        * GDataDocumentsProperty:visibility:
+        *
+        * The visibility status of this property. The default value of
+        * visibility is PRIVATE on a Drive Properties Resource object,
+        * hence #GDataDocumentsProperty:visibility is %GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PRIVATE
+        * by default. A private property restricts its visibility to only the app which created it.
+        *
+        * For more information, see the <ulink type="http" 
url="https://developers.google.com/drive/api/v2/reference/properties";>Properties Resource</ulink>
+        *
+        * Since: 0.18.0
+        */
+       g_object_class_install_property (gobject_class, PROP_VISIBILITY,
+                                        g_param_spec_string ("visibility",
+                                                             "Visibility", "The visibility of this 
property.",
+                                                             NULL,
+                                                             G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+}
+
+static gint
+compare_with (GDataComparable *self, GDataComparable *other)
+{
+
+       GDataDocumentsPropertyPrivate *a = ((GDataDocumentsProperty*) self)->priv, *b = 
((GDataDocumentsProperty*) other)->priv;
+
+       if (g_strcmp0 (a->key, b->key) == 0 && g_strcmp0 (a->visibility, b->visibility) == 0)
+               return 0;
+       return 1;
+}
+
+static gboolean
+parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GError **error)
+{
+       gchar *output_val = NULL;
+       gboolean success = TRUE, is_key_parsed = FALSE;
+
+       if (gdata_parser_string_from_json_member (reader, "key", P_DEFAULT, &output_val, &success, error) == 
TRUE) {
+               if (success && output_val != NULL && output_val[0] != '\0') {
+                       _gdata_documents_property_set_key (GDATA_DOCUMENTS_PROPERTY (parsable), output_val);
+               }
+
+               is_key_parsed = TRUE;
+       } else if (gdata_parser_string_from_json_member (reader, "etag", P_DEFAULT, &output_val, &success, 
error) == TRUE) {
+               if (success && output_val != NULL && output_val[0] != '\0') {
+                       _gdata_documents_property_set_etag (GDATA_DOCUMENTS_PROPERTY (parsable), output_val);
+               }
+
+               is_key_parsed = TRUE;
+       } else if (gdata_parser_string_from_json_member (reader, "value", P_DEFAULT, &output_val, &success, 
error) == TRUE) {
+
+               /* A Property can have a value field to be an empty string, but
+                * never NULL */
+               if (success && output_val != NULL) {
+                       gdata_documents_property_set_value (GDATA_DOCUMENTS_PROPERTY (parsable), output_val);
+               }
+
+               is_key_parsed = TRUE;
+       } else if (gdata_parser_string_from_json_member (reader, "visibility", P_REQUIRED | P_NON_EMPTY, 
&output_val, &success, error) == TRUE) {
+               gdata_documents_property_set_visibility (GDATA_DOCUMENTS_PROPERTY (parsable), output_val);
+
+               is_key_parsed = TRUE;
+       }
+
+       if (is_key_parsed) {
+               g_free (output_val);
+               return success;
+       }
+
+       /* Chain up to the parent class */
+       return GDATA_PARSABLE_CLASS (gdata_documents_property_parent_class)->parse_json (parsable, reader, 
user_data, error);
+}
+
+static void
+get_json (GDataParsable *parsable, JsonBuilder *builder)
+{
+
+       GDataDocumentsPropertyPrivate *priv = GDATA_DOCUMENTS_PROPERTY (parsable)->priv;
+
+       /* Add all the Property specific JSON members */
+       g_assert (priv->key != NULL);
+       json_builder_set_member_name (builder, "key");
+       json_builder_add_string_value (builder, priv->key);
+
+       if (gdata_documents_property_get_etag (GDATA_DOCUMENTS_PROPERTY (parsable)) != NULL) {
+               json_builder_set_member_name (builder, "etag");
+               json_builder_add_string_value (builder, priv->etag);
+       }
+
+       /* Setting the "value" field of a Property Resource deletes that Property Resource */
+       json_builder_set_member_name (builder, "value");
+       json_builder_add_string_value (builder, priv->value);
+
+       json_builder_set_member_name (builder, "visibility");
+       json_builder_add_string_value (builder, priv->visibility);
+}
+
+static void
+gdata_documents_property_comparable_init (GDataComparableIface *iface)
+{
+       iface->compare_with = compare_with;
+}
+
+static void
+gdata_documents_property_init (GDataDocumentsProperty *self)
+{
+       self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_DOCUMENTS_PROPERTY, 
GDataDocumentsPropertyPrivate);
+
+       /* Google Drive sets the default value of a Property Resource to be an empty string (""),
+        * and visibility is %GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PRIVATE by default */
+       self->priv->value = g_strdup ("");
+       self->priv->visibility = g_strdup (GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PRIVATE);
+}
+
+static void
+gdata_documents_property_finalize (GObject *object)
+{
+       GDataDocumentsPropertyPrivate *priv = GDATA_DOCUMENTS_PROPERTY (object)->priv;
+
+       g_free (priv->key);
+       g_free (priv->etag);
+       g_free (priv->value);
+       g_free (priv->visibility);
+
+       /* Chain up to the parent class */
+       G_OBJECT_CLASS (gdata_documents_property_parent_class)->finalize (object);
+}
+
+static void
+gdata_documents_property_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+       GDataDocumentsPropertyPrivate *priv = GDATA_DOCUMENTS_PROPERTY (object)->priv;
+
+       switch (property_id) {
+               case PROP_KEY:
+                       g_value_set_string (value, priv->key);
+                       break;
+               case PROP_ETAG:
+                       g_value_set_string (value, priv->etag);
+                       break;
+               case PROP_VALUE:
+                       g_value_set_string (value, priv->value);
+                       break;
+               case PROP_VISIBILITY:
+                       g_value_set_string (value, priv->visibility);
+                       break;
+               default:
+                       /* We don't have any other property... */
+                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                       break;
+       }
+}
+
+static void
+gdata_documents_property_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec 
*pspec)
+{
+       GDataDocumentsProperty *self = GDATA_DOCUMENTS_PROPERTY (object);
+
+       switch (property_id) {
+               case PROP_KEY:
+                       _gdata_documents_property_set_key (self, g_value_get_string (value));
+                       break;
+               case PROP_ETAG:
+                       _gdata_documents_property_set_etag (self, g_value_get_string (value));
+                       break;
+               case PROP_VALUE:
+                       gdata_documents_property_set_value (self, g_value_get_string (value));
+                       break;
+               case PROP_VISIBILITY:
+                       gdata_documents_property_set_visibility (self, g_value_get_string (value));
+                       break;
+               default:
+                       /* We don't have any other property... */
+                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                       break;
+       }
+}
+
+/**
+ * gdata_documents_property_new:
+ * @key: the property's key
+ *
+ * Creates a new #GDataEntry with the given ID and default properties.
+ *
+ * Return value: (transfer full): a new #GDataDocumentsProperty; unref with g_object_unref()
+ *
+ * Since: 0.18.0
+ */
+GDataDocumentsProperty *
+gdata_documents_property_new (const gchar *key)
+{
+       /* GDataDocumentsProperty must have a non NULL key at initilization time,
+        * rest of the properties can be NULL or take their default values. */
+       g_return_val_if_fail (key != NULL && key[0] != '\0', NULL);
+
+       return GDATA_DOCUMENTS_PROPERTY (g_object_new (GDATA_TYPE_DOCUMENTS_PROPERTY, "key", key, NULL));
+}
+
+/**
+ * gdata_documents_property_get_key:
+ * @self: a #GDataDocumentsProperty
+ *
+ * Returns the key of the property. This will never be %NULL or an empty string ("").
+ *
+ * Return value: (transfer none): the property's key
+ *
+ * Since: 0.18.0
+ */
+const gchar *
+gdata_documents_property_get_key (GDataDocumentsProperty *self)
+{
+       g_return_val_if_fail (GDATA_IS_DOCUMENTS_PROPERTY (self), NULL);
+       return self->priv->key;
+}
+
+static void
+_gdata_documents_property_set_key (GDataDocumentsProperty *self, const gchar *key)
+{
+       /* This is a READ-ONLY PROPERTY */
+       g_return_if_fail (GDATA_IS_DOCUMENTS_PROPERTY (self));
+       g_return_if_fail (key != NULL && *key != '\0');
+
+       g_free (self->priv->key);
+       self->priv->key = g_strdup (key);
+
+       g_object_notify (G_OBJECT (self), "key");
+}
+
+/**
+ * gdata_documents_property_get_etag:
+ * @self: a #GDataDocumentsProperty
+ *
+ * Returns the ETag of the property.
+ *
+ * Return value: (transfer none): the property's ETag. The ETag will never be empty; it's either %NULL or a 
valid ETag.
+ *
+ * Since: 0.18.0
+ */
+const gchar *
+gdata_documents_property_get_etag (GDataDocumentsProperty *self)
+{
+       g_return_val_if_fail (GDATA_IS_DOCUMENTS_PROPERTY (self), NULL);
+       return self->priv->etag;
+}
+
+static void
+_gdata_documents_property_set_etag (GDataDocumentsProperty *self, const gchar *etag)
+{
+       g_return_if_fail (GDATA_IS_DOCUMENTS_PROPERTY (self));
+
+       if (g_strcmp0 (self->priv->etag, etag) != 0) {
+               g_free (self->priv->etag);
+               self->priv->etag = g_strdup (etag);
+               g_object_notify (G_OBJECT (self), "etag");
+       }
+}
+
+/**
+ * gdata_documents_property_get_value:
+ * @self: a #GDataDocumentsProperty
+ *
+ * Returns the value of the property.
+ *
+ * In the case that this value is %NULL, the Property Resource corresponding to @self will be deleted from 
the properties array on a file's metadata, whereas in the case that it's empty string (""), it will be set as 
it is.
+ *
+ * Return value: (nullable): the property's value. This can be %NULL or empty.
+ *
+ * Since: 0.18.0
+ */
+const gchar *
+gdata_documents_property_get_value (GDataDocumentsProperty *self)
+{
+       g_return_val_if_fail (GDATA_IS_DOCUMENTS_PROPERTY (self), NULL);
+       return self->priv->value;
+}
+
+/**
+ * gdata_documents_property_set_value:
+ * @self: a #GDataDocumentsProperty
+ * @value: (allow-none): the new value of the property
+ *
+ * Sets #GDataDocumentsProperty:value to @value, corresponding to the key.
+ *
+ * In the case that @value is %NULL, the Property Resource corresponding to @self will be deleted from the 
properties array on a file's metadata, whereas in the case that it's empty string (""), it will be set as it 
is.
+ *
+ * Since: 0.18.0
+ */
+void
+gdata_documents_property_set_value (GDataDocumentsProperty *self, const gchar *value)
+{
+       g_return_if_fail (GDATA_IS_DOCUMENTS_PROPERTY (self));
+
+       if (g_strcmp0 (self->priv->value, value) != 0) {
+               g_free (self->priv->value);
+               self->priv->value = g_strdup (value);
+               g_object_notify (G_OBJECT (self), "value");
+       }
+}
+
+/**
+ * gdata_documents_property_get_visibility:
+ * @self: a #GDataDocumentsProperty
+ *
+ * Returns the visibility status of the property.
+ *
+ * Return value: %GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PUBLIC if the #GDataDocumentsProperty is publicly 
visible to other
+ * apps, %GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PRIVATE if the #GDataDocumentsProperty is restricted to the 
application which
+ * created it.
+ *
+ * Since: 0.18.0
+ */
+const gchar *
+gdata_documents_property_get_visibility (GDataDocumentsProperty *self)
+{
+       g_return_val_if_fail (GDATA_IS_DOCUMENTS_PROPERTY (self), NULL);
+       return self->priv->visibility;
+}
+
+/**
+ * gdata_documents_property_set_visibility:
+ * @self: a #GDataDocumentsProperty
+ * @visibility: the new visibility status of the property
+ *
+ * Sets #GDataDocumentsProperty:visibility to %GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PUBLIC for
+ * public properties and %GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PRIVATE for
+ * private properties (default).
+ *
+ * Since: 0.18.0
+ */
+void
+gdata_documents_property_set_visibility (GDataDocumentsProperty *self, const gchar *visibility)
+{
+       g_return_if_fail (GDATA_IS_DOCUMENTS_PROPERTY (self));
+       g_return_if_fail (g_strcmp0 (visibility, GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PUBLIC) == 0 ||
+                         g_strcmp0 (visibility, GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PRIVATE) == 0);
+
+       if (g_strcmp0 (self->priv->visibility, visibility) != 0) {
+               g_free (self->priv->visibility);
+               self->priv->visibility = g_strdup (visibility);
+               g_object_notify (G_OBJECT (self), "visibility");
+       }
+}
diff --git a/gdata/services/documents/gdata-documents-property.h 
b/gdata/services/documents/gdata-documents-property.h
new file mode 100644
index 00000000..84f8d644
--- /dev/null
+++ b/gdata/services/documents/gdata-documents-property.h
@@ -0,0 +1,106 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * GData Client
+ * Copyright (C) Mayank Sharma <mayank8019 gmail com>
+ *
+ * GData Client is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * GData Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GData Client.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GDATA_DOCUMENTS_PROPERTY_H
+#define GDATA_DOCUMENTS_PROPERTY_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <gdata/gdata-parsable.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PUBLIC:
+ *
+ * The #GDataDocumentsProperty having the visibility set to TRUE corresponds to having the visibility 
property
+ * on a Drive Property Resource
+ * set to "PUBLIC". This makes the Property Resource visible to other apps.
+ *
+ * Since: 0.18.0
+ */
+#define GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PUBLIC "PUBLIC"
+
+/**
+ * GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PRIVATE:
+ *
+ * The #GDataDocumentsProperty having the visibility set to FALSE (default) corresponds to having the 
visibility property on a Drive Property Resource
+ * set to "PRIVATE". This makes the Property Resource accessible only by the app that created it.
+ *
+ * Since: 0.18.0
+ */
+#define GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PRIVATE "PRIVATE"
+
+#define GDATA_TYPE_DOCUMENTS_PROPERTY          (gdata_documents_property_get_type ())
+#define GDATA_DOCUMENTS_PROPERTY(o)            (G_TYPE_CHECK_INSTANCE_CAST ((o), 
GDATA_TYPE_DOCUMENTS_PROPERTY, GDataDocumentsProperty))
+#define GDATA_DOCUMENTS_PROPERTY_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_DOCUMENTS_PROPERTY, 
GDataDocumentsPropertyClass))
+#define GDATA_IS_DOCUMENTS_PROPERTY(o)         (G_TYPE_CHECK_INSTANCE_TYPE ((o), 
GDATA_TYPE_DOCUMENTS_PROPERTY))
+#define GDATA_IS_DOCUMENTS_PROPERTY_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), GDATA_TYPE_DOCUMENTS_PROPERTY))
+#define GDATA_DOCUMENTS_PROPERTY_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), 
GDATA_TYPE_DOCUMENTS_PROPERTY, GDataDocumentsPropertyClass))
+
+typedef struct _GDataDocumentsPropertyPrivate  GDataDocumentsPropertyPrivate;
+
+/**
+ * GDataDocumentsProperty:
+ *
+ * All the fields in the #GDataDocumentsProperty structure are private and should never be accessed directly.
+ *
+ * Since: 0.18.0
+ */
+typedef struct {
+       GDataParsable parent;
+       GDataDocumentsPropertyPrivate *priv;
+} GDataDocumentsProperty;
+
+/**
+ * GDataDocumentsPropertyClass:
+ *
+ * All the fields in the #GDataDocumentsPropertyClass structure are private and should never be accessed 
directly.
+ *
+ * Since: 0.18.0
+ */
+typedef struct {
+       /*< private >*/
+       GDataParsableClass parent;
+
+       /*< private >*/
+       /* Padding for future expansion */
+       void (*_g_reserved0) (void);
+       void (*_g_reserved1) (void);
+} GDataDocumentsPropertyClass;
+
+GType gdata_documents_property_get_type (void) G_GNUC_CONST;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GDataDocumentsProperty, g_object_unref)
+
+GDataDocumentsProperty *gdata_documents_property_new (const gchar *key) G_GNUC_WARN_UNUSED_RESULT 
G_GNUC_MALLOC;
+
+const gchar *gdata_documents_property_get_key (GDataDocumentsProperty *self) G_GNUC_PURE;
+
+const gchar *gdata_documents_property_get_etag (GDataDocumentsProperty *self) G_GNUC_PURE;
+
+const gchar *gdata_documents_property_get_value (GDataDocumentsProperty *self) G_GNUC_PURE;
+void gdata_documents_property_set_value (GDataDocumentsProperty *self, const gchar *value);
+
+const gchar *gdata_documents_property_get_visibility (GDataDocumentsProperty *self) G_GNUC_PURE;
+void gdata_documents_property_set_visibility (GDataDocumentsProperty *self, const gchar *visibility);
+
+G_END_DECLS
+
+#endif /* !GDATA_DOCUMENTS_PROPERTY_H */
diff --git a/gdata/services/documents/meson.build b/gdata/services/documents/meson.build
index 6ff2bec1..a0984839 100644
--- a/gdata/services/documents/meson.build
+++ b/gdata/services/documents/meson.build
@@ -12,6 +12,7 @@ headers = files(
   'gdata-documents-metadata.h',
   'gdata-documents-pdf.h',
   'gdata-documents-presentation.h',
+  'gdata-documents-property.h',
   'gdata-documents-query.h',
   'gdata-documents-service.h',
   'gdata-documents-spreadsheet.h',
@@ -36,6 +37,7 @@ sources += files(
   'gdata-documents-metadata.c',
   'gdata-documents-pdf.c',
   'gdata-documents-presentation.c',
+  'gdata-documents-property.c',
   'gdata-documents-query.c',
   'gdata-documents-service.c',
   'gdata-documents-spreadsheet.c',
diff --git a/gdata/symbol.map b/gdata/symbol.map
index e84d1d0a..b9893e3f 100644
--- a/gdata/symbol.map
+++ b/gdata/symbol.map
@@ -332,6 +332,14 @@ global:
        gdata_documents_pdf_new;
        gdata_documents_presentation_get_type;
        gdata_documents_presentation_new;
+       gdata_documents_property_get_etag;
+       gdata_documents_property_get_key;
+       gdata_documents_property_get_type;
+       gdata_documents_property_get_value;
+       gdata_documents_property_get_visibility;
+       gdata_documents_property_new;
+       gdata_documents_property_set_value;
+       gdata_documents_property_set_visibility;
        gdata_documents_query_add_collaborator;
        gdata_documents_query_add_reader;
        gdata_documents_query_get_collaborator_addresses;


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