[libgdata/wip/rishi/drive: 9/11] documents: Expose _gdata_documents_entry_set_resource_id internally



commit 6e4903d079ca582b448560975d93d949d1f98650
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Sep 21 14:25:52 2017 +0200

    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

 Makefile.am                                        |    4 ++-
 .../documents/gdata-documents-entry-private.h      |   33 ++++++++++++++++++++
 gdata/services/documents/gdata-documents-entry.c   |   16 +++++++++
 3 files changed, 52 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 044193c..7f24f51 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 0000000..af92e73
--- /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 5b10964..f5755c4 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


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