[libgdata/wip/oholy/documents-shared-drives-support: 3/4] documents: Add gdata_documents_entry_get_shared_with_me_date




commit 8b1222a351aae7742495a49c38202cb5296acd0e
Author: Ondrej Holy <oholy redhat com>
Date:   Mon Feb 1 15:12:19 2021 +0100

    documents: Add gdata_documents_entry_get_shared_with_me_date
    
    Let's make available the SharedWithMeDate property to make implementation
    of the Shared with me folder for GVfsBackendGoogle easier.
    
    Relates: https://gitlab.gnome.org/GNOME/gvfs/-/issues/444
    Relates: https://gitlab.gnome.org/GNOME/gvfs/-/merge_requests/114

 docs/reference/gdata-sections.txt.in             |  1 +
 gdata/gdata-core.symbols                         |  1 +
 gdata/services/documents/gdata-documents-entry.c | 37 ++++++++++++++++++++++++
 gdata/services/documents/gdata-documents-entry.h |  2 ++
 gdata/symbol.map                                 |  1 +
 5 files changed, 42 insertions(+)
---
diff --git a/docs/reference/gdata-sections.txt.in b/docs/reference/gdata-sections.txt.in
index ca562bc8..2eaf94a2 100644
--- a/docs/reference/gdata-sections.txt.in
+++ b/docs/reference/gdata-sections.txt.in
@@ -1562,6 +1562,7 @@ gdata_documents_entry_is_deleted
 gdata_documents_entry_get_document_properties
 gdata_documents_entry_add_documents_property
 gdata_documents_entry_remove_documents_property
+gdata_documents_entry_get_shared_with_me_date
 <SUBSECTION Standard>
 gdata_documents_entry_get_type
 GDATA_DOCUMENTS_ENTRY
diff --git a/gdata/gdata-core.symbols b/gdata/gdata-core.symbols
index d742e535..fc6d8faa 100644
--- a/gdata/gdata-core.symbols
+++ b/gdata/gdata-core.symbols
@@ -651,6 +651,7 @@ gdata_documents_entry_set_writers_can_invite
 gdata_documents_entry_writers_can_invite
 gdata_documents_entry_get_last_modified_by
 gdata_documents_entry_is_deleted
+gdata_documents_entry_get_shared_with_me_date
 gdata_documents_query_get_type
 gdata_documents_query_new
 gdata_documents_query_new_with_limits
diff --git a/gdata/services/documents/gdata-documents-entry.c 
b/gdata/services/documents/gdata-documents-entry.c
index 07a86386..2aed45f2 100644
--- a/gdata/services/documents/gdata-documents-entry.c
+++ b/gdata/services/documents/gdata-documents-entry.c
@@ -135,6 +135,7 @@ struct _GDataDocumentsEntryPrivate {
        goffset quota_used; /* bytes */
        goffset file_size; /* bytes */
        GList *properties; /* GDataDocumentsProperty */
+       gint64 shared_with_me_date;
 };
 
 enum {
@@ -147,6 +148,7 @@ enum {
        PROP_RESOURCE_ID,
        PROP_QUOTA_USED,
        PROP_FILE_SIZE,
+       PROP_SHARED_WITH_ME_DATE,
 };
 
 G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GDataDocumentsEntry, gdata_documents_entry, GDATA_TYPE_ENTRY,
@@ -311,6 +313,19 @@ gdata_documents_entry_class_init (GDataDocumentsEntryClass *klass)
                                                             "File size", "The size of the document.",
                                                             0, G_MAXINT64, 0,
                                                             G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+       /**
+        * GDataDocumentsEntry:shared-with-me-date:
+        *
+        * The UNIX timestamp for the time at which this file was shared with the user.
+        *
+        * Since: 0.18.0
+        */
+       g_object_class_install_property (gobject_class, PROP_SHARED_WITH_ME_DATE,
+                                        g_param_spec_int64 ("shared-with-me-date",
+                                                            "Shared with me date", "The time at which this 
file was shared with the user.",
+                                                            -1, G_MAXINT64, -1,
+                                                            G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
 }
 
 static gboolean
@@ -437,6 +452,9 @@ gdata_documents_entry_get_property (GObject *object, guint property_id, GValue *
                case PROP_FILE_SIZE:
                        g_value_set_int64 (value, priv->file_size);
                        break;
+               case PROP_SHARED_WITH_ME_DATE:
+                       g_value_set_int64 (value, priv->shared_with_me_date);
+                       break;
                default:
                        /* We don't have any other property... */
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -934,6 +952,8 @@ parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GEr
                        json_reader_end_element (reader);
                }
 
+               return success;
+       } else if (gdata_parser_int64_time_from_json_member (reader, "sharedWithMeDate", P_DEFAULT, 
&(priv->shared_with_me_date), &success, error) == TRUE) {
                return success;
        }
 
@@ -1419,3 +1439,20 @@ gdata_documents_entry_remove_documents_property (GDataDocumentsEntry *self, GDat
 
        return TRUE;
 }
+
+/**
+ * gdata_documents_entry_get_shared_with_me_date:
+ * @self: a #GDataDocumentsEntry
+ *
+ * Gets the #GDataDocumentsEntry:shared-with-me-date property. If the property is unset, -1 will be returned.
+ *
+ * Return value: the UNIX timestamp for the time at which this file was shared with the user, or -1
+ *
+ * Since: 0.18.0
+ */
+gint64
+gdata_documents_entry_get_shared_with_me_date (GDataDocumentsEntry *self)
+{
+       g_return_val_if_fail (GDATA_IS_DOCUMENTS_ENTRY (self), -1);
+       return self->priv->shared_with_me_date;
+}
diff --git a/gdata/services/documents/gdata-documents-entry.h 
b/gdata/services/documents/gdata-documents-entry.h
index 558b91d2..a8ec8003 100644
--- a/gdata/services/documents/gdata-documents-entry.h
+++ b/gdata/services/documents/gdata-documents-entry.h
@@ -125,6 +125,8 @@ GList *gdata_documents_entry_get_document_properties (GDataDocumentsEntry *self)
 gboolean gdata_documents_entry_add_documents_property (GDataDocumentsEntry *self, GDataDocumentsProperty 
*property);
 gboolean gdata_documents_entry_remove_documents_property (GDataDocumentsEntry *self, GDataDocumentsProperty 
*property);
 
+gint64 gdata_documents_entry_get_shared_with_me_date (GDataDocumentsEntry *self);
+
 G_END_DECLS
 
 #endif /* !GDATA_DOCUMENTS_ENTRY_H */
diff --git a/gdata/symbol.map b/gdata/symbol.map
index 15e58a7b..b1cdfeff 100644
--- a/gdata/symbol.map
+++ b/gdata/symbol.map
@@ -329,6 +329,7 @@ global:
        gdata_documents_entry_remove_documents_property;
        gdata_documents_entry_set_writers_can_invite;
        gdata_documents_entry_writers_can_invite;
+       gdata_documents_entry_get_shared_with_me_date;
        gdata_documents_feed_get_type;
        gdata_documents_folder_get_type;
        gdata_documents_folder_new;


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