[libgdata/wip/rishi/drive: 1/4] documents: Use JSON when editing ACLs



commit 0352d99feaeb1444bbd5318a00d88dc6a0cd26f0
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Jun 5 11:54:41 2015 +0200

    documents: Use JSON when editing ACLs
    
    New API added:
     • GDataDocumentsAccessRule
    
    This new class must be used in place of GDataAccessRule for making any
    changes to the ACLs of a Google Documents entry. This is essentially a
    soft API break, but it’s unavoidable.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684920

 Makefile.am                                        |    4 +-
 docs/reference/gdata-docs.xml                      |    1 +
 docs/reference/gdata-sections.txt                  |   18 ++++
 gdata/gdata.h                                      |    1 +
 gdata/gdata.symbols                                |    2 +
 .../documents/gdata-documents-access-rule.c        |   85 ++++++++++++++++++++
 .../documents/gdata-documents-access-rule.h        |   74 +++++++++++++++++
 7 files changed, 184 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 7b4982b..1944ddd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -292,7 +292,8 @@ gdata_documents_headers = \
        gdata/services/documents/gdata-documents-drawing.h      \
        gdata/services/documents/gdata-documents-pdf.h          \
        gdata/services/documents/gdata-documents-spreadsheet.h  \
-       gdata/services/documents/gdata-documents-upload-query.h
+       gdata/services/documents/gdata-documents-upload-query.h \
+       gdata/services/documents/gdata-documents-access-rule.h
 gdatadocumentsinclude_HEADERS = \
        $(gdata_documents_headers)                              \
        gdata/services/documents/gdata-documents-enums.h
@@ -431,6 +432,7 @@ gdata_sources = \
        gdata/services/documents/gdata-documents-pdf.c  \
        gdata/services/documents/gdata-documents-query.c        \
        gdata/services/documents/gdata-documents-upload-query.c \
+       gdata/services/documents/gdata-documents-access-rule.c  \
        \
        gdata/services/picasaweb/gdata-picasaweb-album.c        \
        gdata/services/picasaweb/gdata-picasaweb-query.c        \
diff --git a/docs/reference/gdata-docs.xml b/docs/reference/gdata-docs.xml
index 4f7ede0..3db99d3 100644
--- a/docs/reference/gdata-docs.xml
+++ b/docs/reference/gdata-docs.xml
@@ -166,6 +166,7 @@
                        <xi:include href="xml/gdata-documents-presentation.xml"/>
                        <xi:include href="xml/gdata-documents-spreadsheet.xml"/>
                        <xi:include href="xml/gdata-documents-text.xml"/>
+                       <xi:include href="xml/gdata-documents-access-rule.xml"/>
                </chapter>
 
                <chapter>
diff --git a/docs/reference/gdata-sections.txt b/docs/reference/gdata-sections.txt
index 92e68b2..d841848 100644
--- a/docs/reference/gdata-sections.txt
+++ b/docs/reference/gdata-sections.txt
@@ -2833,3 +2833,21 @@ GDATA_TYPE_CALENDAR_ACCESS_RULE
 <SUBSECTION Private>
 GDataCalendarAccessRulePrivate
 </SECTION>
+
+<SECTION>
+<FILE>gdata-documents-access-rule</FILE>
+<TITLE>GDataDocumentsAccessRule</TITLE>
+GDataDocumentsAccessRule
+GDataDocumentsAccessRuleClass
+gdata_documents_access_rule_new
+<SUBSECTION Standard>
+gdata_documents_access_rule_get_type
+GDATA_DOCUMENTS_ACCESS_RULE
+GDATA_DOCUMENTS_ACCESS_RULE_CLASS
+GDATA_DOCUMENTS_ACCESS_RULE_GET_CLASS
+GDATA_IS_DOCUMENTS_ACCESS_RULE
+GDATA_IS_DOCUMENTS_ACCESS_RULE_CLASS
+GDATA_TYPE_DOCUMENTS_ACCESS_RULE
+<SUBSECTION Private>
+GDataDocumentsAccessRulePrivate
+</SECTION>
diff --git a/gdata/gdata.h b/gdata/gdata.h
index f259b26..3231219 100644
--- a/gdata/gdata.h
+++ b/gdata/gdata.h
@@ -139,6 +139,7 @@
 #include <gdata/services/documents/gdata-documents-pdf.h>
 #include <gdata/services/documents/gdata-documents-enums.h>
 #include <gdata/services/documents/gdata-documents-upload-query.h>
+#include <gdata/services/documents/gdata-documents-access-rule.h>
 
 /* Google Tasks */
 #include <gdata/services/tasks/gdata-tasks-service.h>
diff --git a/gdata/gdata.symbols b/gdata/gdata.symbols
index 30c4a30..ae4cfb7 100644
--- a/gdata/gdata.symbols
+++ b/gdata/gdata.symbols
@@ -659,6 +659,8 @@ gdata_documents_query_add_reader
 gdata_documents_query_add_collaborator
 gdata_documents_service_error_get_type
 gdata_documents_service_error_quark
+gdata_documents_access_rule_get_type
+gdata_documents_access_rule_new
 gdata_download_stream_get_type
 gdata_download_stream_new
 gdata_download_stream_get_service
diff --git a/gdata/services/documents/gdata-documents-access-rule.c 
b/gdata/services/documents/gdata-documents-access-rule.c
new file mode 100644
index 0000000..37e43e1
--- /dev/null
+++ b/gdata/services/documents/gdata-documents-access-rule.c
@@ -0,0 +1,85 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * GData Client
+ * Copyright (C) Red Hat, Inc. 2015
+ *
+ * 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-access-rule
+ * @short_description: GData Documents access rule object
+ * @stability: Stable
+ * @include: gdata/services/documents/gdata-documents-access-rule.h
+ *
+ * #GDataDocumentsAccessRule is a subclass of #GDataAccessRule to represent an
+ * access rule affecting users of a Google Documents entry.
+ *
+ * Since: UNRELEASED
+ */
+
+#include <config.h>
+#include <glib.h>
+
+#include "gdata-parser.h"
+#include "gdata-documents-access-rule.h"
+
+static const gchar *
+get_content_type (void);
+
+G_DEFINE_TYPE (GDataDocumentsAccessRule, gdata_documents_access_rule,
+               GDATA_TYPE_ACCESS_RULE)
+
+static void
+gdata_documents_access_rule_class_init (GDataDocumentsAccessRuleClass *klass)
+{
+       GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass);
+
+       parsable_class->get_content_type = get_content_type;
+}
+
+static void
+gdata_documents_access_rule_init (GDataDocumentsAccessRule *self)
+{
+       /* Nothing to do here. */
+}
+
+static const gchar *
+get_content_type (void)
+{
+       return "application/json";
+}
+
+/**
+ * gdata_documents_access_rule_new:
+ * @id: the access rule's ID, or %NULL
+ *
+ * Creates a new #GDataDocumentsAccessRule with the given ID and default
+ * properties.
+ *
+ * Return value: (transfer full): a new #GDataDocumentsAccessRule; unref with
+ *   g_object_unref()
+ *
+ * Since: UNRELEASED
+ */
+GDataDocumentsAccessRule *
+gdata_documents_access_rule_new (const gchar *id)
+{
+       GObject *retval = NULL;  /* owned */
+
+       retval = g_object_new (GDATA_TYPE_DOCUMENTS_ACCESS_RULE,
+                              "id", id,
+                              NULL);
+       return GDATA_DOCUMENTS_ACCESS_RULE (retval);
+}
diff --git a/gdata/services/documents/gdata-documents-access-rule.h 
b/gdata/services/documents/gdata-documents-access-rule.h
new file mode 100644
index 0000000..6d5b162
--- /dev/null
+++ b/gdata/services/documents/gdata-documents-access-rule.h
@@ -0,0 +1,74 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * GData Client
+ * Copyright (C) Red Hat, Inc. 2015
+ *
+ * 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_ACCESS_RULE_H
+#define GDATA_DOCUMENTS_ACCESS_RULE_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <gdata/gdata-access-rule.h>
+
+G_BEGIN_DECLS
+
+#define GDATA_TYPE_DOCUMENTS_ACCESS_RULE               (gdata_documents_access_rule_get_type ())
+#define GDATA_DOCUMENTS_ACCESS_RULE(o)                 (G_TYPE_CHECK_INSTANCE_CAST ((o), 
GDATA_TYPE_DOCUMENTS_ACCESS_RULE, GDataDocumentsAccessRule))
+#define GDATA_DOCUMENTS_ACCESS_RULE_CLASS(k)           (G_TYPE_CHECK_CLASS_CAST((k), 
GDATA_TYPE_DOCUMENTS_ACCESS_RULE, GDataDocumentsAccessRuleClass))
+#define GDATA_IS_DOCUMENTS_ACCESS_RULE(o)              (G_TYPE_CHECK_INSTANCE_TYPE ((o), 
GDATA_TYPE_DOCUMENTS_ACCESS_RULE))
+#define GDATA_IS_DOCUMENTS_ACCESS_RULE_CLASS(k)                (G_TYPE_CHECK_CLASS_TYPE ((k), 
GDATA_TYPE_DOCUMENTS_ACCESS_RULE))
+#define GDATA_DOCUMENTS_ACCESS_RULE_GET_CLASS(o)       (G_TYPE_INSTANCE_GET_CLASS ((o), 
GDATA_TYPE_DOCUMENTS_ACCESS_RULE, GDataDocumentsAccessRuleClass))
+
+/**
+ * GDataDocumentsAccessRule:
+ *
+ * All the fields in the #GDataDocumentsAccessRule structure are private and
+ * should never be accessed directly.
+ *
+ * Since: UNRELEASED
+ */
+typedef struct {
+       GDataAccessRule parent;
+} GDataDocumentsAccessRule;
+
+/**
+ * GDataDocumentsAccessRuleClass:
+ *
+ * All the fields in the #GDataDocumentsAccessRuleClass structure are private
+ * and should never be accessed directly.
+ *
+ * Since: UNRELEASED
+ */
+typedef struct {
+       /*< private >*/
+       GDataAccessRuleClass parent;
+
+       /*< private >*/
+       /* Padding for future expansion */
+       void (*_g_reserved0) (void);
+       void (*_g_reserved1) (void);
+} GDataDocumentsAccessRuleClass;
+
+GType gdata_documents_access_rule_get_type (void) G_GNUC_CONST;
+
+GDataDocumentsAccessRule *
+gdata_documents_access_rule_new (const gchar *id) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
+
+G_END_DECLS
+
+#endif /* !GDATA_DOCUMENTS_ACCESS_RULE_H */


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