summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2021-02-01 15:12:19 +0100
committerOndrej Holy <oholy@redhat.com>2021-02-11 18:03:53 +0100
commitb9f9e357884b1346b62a4d516b64fcae1eb38deb (patch)
treea3d768c0ca42d84771845a482fed72a34968dc75
parent19fbe4b4993ddc249769d4d6827c0939ca22b4af (diff)
downloadlibgdata-b9f9e357884b1346b62a4d516b64fcae1eb38deb.tar.gz
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
-rw-r--r--docs/reference/gdata-sections.txt.in1
-rw-r--r--gdata/gdata-core.symbols1
-rw-r--r--gdata/services/documents/gdata-documents-entry.c37
-rw-r--r--gdata/services/documents/gdata-documents-entry.h2
-rw-r--r--gdata/symbol.map1
5 files changed, 42 insertions, 0 deletions
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..62219bb5 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);
@@ -935,6 +953,8 @@ parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GEr
}
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;
}
return GDATA_PARSABLE_CLASS (gdata_documents_entry_parent_class)->parse_json (parsable, reader, user_data, error);
@@ -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;