summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDebarshi Ray <debarshir@gnome.org>2017-09-21 14:25:52 +0200
committerPhilip Withnall <withnall@endlessm.com>2018-02-14 15:14:18 +0000
commitd5134459ade51e53169cc9b76efad67e9e700814 (patch)
tree3d4d4de522451f9ff35a465dec6428f942e4585c
parentaade3a9b7ef55f1e64753e379f8e56fcc4bea8e5 (diff)
downloadlibgdata-d5134459ade51e53169cc9b76efad67e9e700814.tar.gz
documents: Expose _gdata_documents_entry_set_resource_id internally
This will be used by GDataDocumentsDocument and GDataDocumentsFolder to set their resource IDs right after parsing the JSON. https://bugzilla.gnome.org/show_bug.cgi?id=684920
-rw-r--r--Makefile.am4
-rw-r--r--gdata/services/documents/gdata-documents-entry-private.h33
-rw-r--r--gdata/services/documents/gdata-documents-entry.c16
3 files changed, 52 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 393195ce..8b17f051 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -300,7 +300,9 @@ gdata_documents_headers = \
gdata/services/documents/gdata-documents-spreadsheet.h \
gdata/services/documents/gdata-documents-upload-query.h \
gdata/services/documents/gdata-documents-access-rule.h
-private_headers += gdata/services/documents/gdata-documents-utils.h
+private_headers += \
+ gdata/services/documents/gdata-documents-entry-private.h \
+ gdata/services/documents/gdata-documents-utils.h
gdatadocumentsinclude_HEADERS = \
$(gdata_documents_headers) \
gdata/services/documents/gdata-documents-enums.h
diff --git a/gdata/services/documents/gdata-documents-entry-private.h b/gdata/services/documents/gdata-documents-entry-private.h
new file mode 100644
index 00000000..af92e737
--- /dev/null
+++ b/gdata/services/documents/gdata-documents-entry-private.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * GData Client
+ * Copyright (C) Red Hat, Inc. 2017
+ *
+ * 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_ENTRY_PRIVATE_H
+#define GDATA_DOCUMENTS_ENTRY_PRIVATE_H
+
+#include <glib.h>
+
+#include <gdata/services/documents/gdata-documents-entry.h>
+
+G_BEGIN_DECLS
+
+G_GNUC_INTERNAL void _gdata_documents_entry_set_resource_id (GDataDocumentsEntry *self, const gchar *resource_id);
+
+G_END_DECLS
+
+#endif /* !GDATA_DOCUMENTS_ENTRY_PRIVATE_H */
diff --git a/gdata/services/documents/gdata-documents-entry.c b/gdata/services/documents/gdata-documents-entry.c
index 5b109640..f5755c45 100644
--- a/gdata/services/documents/gdata-documents-entry.c
+++ b/gdata/services/documents/gdata-documents-entry.c
@@ -99,6 +99,7 @@
#include <glib/gi18n-lib.h>
#include "gdata-documents-entry.h"
+#include "gdata-documents-entry-private.h"
#include "gdata-parser.h"
#include "gdata-types.h"
#include "gdata-private.h"
@@ -1042,6 +1043,21 @@ gdata_documents_entry_get_resource_id (GDataDocumentsEntry *self)
return self->priv->resource_id;
}
+void
+_gdata_documents_entry_set_resource_id (GDataDocumentsEntry *self, const gchar *resource_id)
+{
+ g_return_if_fail (GDATA_IS_DOCUMENTS_ENTRY (self));
+ g_return_if_fail (resource_id != NULL && resource_id[0] != '\0');
+
+ if (g_strcmp0 (resource_id, self->priv->resource_id) == 0)
+ return;
+
+ g_free (self->priv->resource_id);
+ self->priv->resource_id = g_strdup (resource_id);
+
+ g_object_notify (G_OBJECT (self), "resource-id");
+}
+
/**
* gdata_documents_entry_set_writers_can_invite:
* @self: a #GDataDocumentsEntry