Top | Description | Object Hierarchy | Implemented Interfaces | Properties | ![]() |
![]() |
![]() |
![]() |
#include <gdata/services/documents/gdata-documents-entry.h> #define GDATA_DOCUMENTS_ACCESS_ROLE_OWNER #define GDATA_DOCUMENTS_ACCESS_ROLE_WRITER #define GDATA_DOCUMENTS_ACCESS_ROLE_READER GDataDocumentsEntry; GDataDocumentsEntryClass; gchar * gdata_documents_entry_get_path (GDataDocumentsEntry *self
); const gchar * gdata_documents_entry_get_resource_id (GDataDocumentsEntry *self
); const gchar * gdata_documents_entry_get_document_id (GDataDocumentsEntry *self
); gint64 gdata_documents_entry_get_edited (GDataDocumentsEntry *self
); GDataAuthor * gdata_documents_entry_get_last_modified_by (GDataDocumentsEntry *self
); gint64 gdata_documents_entry_get_last_viewed (GDataDocumentsEntry *self
); goffset gdata_documents_entry_get_quota_used (GDataDocumentsEntry *self
); gboolean gdata_documents_entry_writers_can_invite (GDataDocumentsEntry *self
); void gdata_documents_entry_set_writers_can_invite (GDataDocumentsEntry *self
,gboolean writers_can_invite
); gboolean gdata_documents_entry_is_deleted (GDataDocumentsEntry *self
);
GObject +----GDataParsable +----GDataEntry +----GDataDocumentsEntry +----GDataDocumentsDocument +----GDataDocumentsFolder
"document-id" gchar* : Read "edited" gint64 : Read "is-deleted" gboolean : Read / Write "last-modified-by" GDataAuthor* : Read "last-viewed" gint64 : Read "quota-used" gint64 : Read "resource-id" gchar* : Read "writers-can-invite" gboolean : Read / Write
GDataDocumentsEntry is a subclass of GDataEntry to represent a Google Documents entry, which is then further subclassed to give specific document types.
GDataDocumentsEntry implements GDataAccessHandler, meaning the access rules to it can be modified using that interface. As well as the
access roles defined for the base GDataAccessRule (e.g. GDATA_ACCESS_ROLE_NONE
), GDataDocumentsEntry has its own, such as
GDATA_DOCUMENTS_ACCESS_ROLE_OWNER
and GDATA_DOCUMENTS_ACCESS_ROLE_READER
.
Documents can (confusingly) be referenced by three different types of IDs: their entry ID, their resource ID and their document ID (untyped resource ID). Each is a substring of the previous ones (i.e. the entry ID contains the resource ID, which in turn contains the document ID). The resource ID and document ID should almost always be considered as internal, and thus entry IDs ("id") should normally be used to uniquely identify documents. For more information, see "resource-id".
For more details of Google Documents' GData API, see the online documentation.
Example 32. Moving an Entry Between Folders
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
GDataDocumentsService *service; GDataDocumentsEntry *entry, *intermediate_entry, *updated_entry; GDataDocumentsFolder *old_folder, *new_folder; GError *error = NULL; /* Create a service */ service = create_documents_service (); /* Get the entry, the folder it's being moved out of, and the folder it's being moved into. The entry can either be a document or * another folder, allowing hierarchies of folders to be constructed. */ entry = query_user_for_entry (service); old_folder = query_user_for_old_folder (service); new_folder = query_user_for_new_folder (service); /* Add the entry to the new folder */ intermediate_entry = gdata_documents_service_add_entry_to_folder (service, entry, new_folder, NULL, &error); g_object_unref (entry); g_object_unref (new_folder); if (error != NULL) { g_error ("Error adding entry to new folder: %s", error->message); g_error_free (error); g_object_unref (old_folder); g_object_unref (service); return; } /* Remove the entry from the old folder */ updated_entry = gdata_documents_service_remove_entry_from_folder (service, intermediate_entry, old_folder, NULL, &error); g_object_unref (intermediate_entry); g_object_unref (old_folder); g_object_unref (service); if (error != NULL) { /* Note that you might want to attempt to remove the intermediate_entry from the new_folder in this error case, so that * the operation is aborted cleanly. */ g_error ("Error removing entry from previous folder: %s", error->message); g_error_free (error); return; } /* Do something with the updated entry */ g_object_unref (updated_entry); |
#define GDATA_DOCUMENTS_ACCESS_ROLE_OWNER "owner"
The users specified by the GDataAccessRule have full owner access to the document. This allows them to modify the access rules and delete the document, amongst other things.
Since 0.7.0
#define GDATA_DOCUMENTS_ACCESS_ROLE_WRITER "writer"
The users specified by the GDataAccessRule have write access to the document. They cannot modify the access rules or delete the document.
Since 0.7.0
#define GDATA_DOCUMENTS_ACCESS_ROLE_READER "reader"
The users specified by the GDataAccessRule have read-only access to the document.
Since 0.7.0
typedef struct _GDataDocumentsEntry GDataDocumentsEntry;
All the fields in the GDataDocumentsEntry structure are private and should never be accessed directly.
Since 0.4.0
typedef struct { } GDataDocumentsEntryClass;
All the fields in the GDataDocumentsEntryClass structure are private and should never be accessed directly.
Since 0.4.0
gchar * gdata_documents_entry_get_path (GDataDocumentsEntry *self
);
Builds a path for the GDataDocumentsEntry, starting from a root node and traversing the folders containing the document, then ending with the document's ID.
An example path would be: /folder_id1/folder_id2/document_id
.
Note: the path is based on the entry/document IDs of the folders ("id") and document ("document-id"), and not the entries' human-readable names ("title").
|
a GDataDocumentsEntry |
Returns : |
the folder hierarchy path containing the document, or NULL ; free with g_free()
|
Since 0.4.0
const gchar * gdata_documents_entry_get_resource_id
(GDataDocumentsEntry *self
);
Gets the "resource-id" property.
|
a GDataDocumentsEntry |
Returns : |
the document's resource ID |
Since 0.11.0
const gchar * gdata_documents_entry_get_document_id
(GDataDocumentsEntry *self
);
gdata_documents_entry_get_document_id
is deprecated and should not be used in newly-written code. Use gdata_documents_entry_get_resource_id()
instead. See "document-id". (Since: 0.11.0.)
Gets the "document-id" property. The online GData Documentation refers to these as “untyped resource IDs”.
|
a GDataDocumentsEntry |
Returns : |
the document's document ID |
Since 0.4.0
gint64 gdata_documents_entry_get_edited (GDataDocumentsEntry *self
);
Gets the "edited" property. If the property is unset, -1
will be returned.
|
a GDataDocumentsEntry |
Returns : |
the UNIX timestamp for the time the document was last edited, or -1
|
Since 0.4.0
GDataAuthor * gdata_documents_entry_get_last_modified_by
(GDataDocumentsEntry *self
);
Gets the "last-modified-by" property.
|
a GDataDocumentsEntry |
Returns : |
the author who last modified the document. [transfer none] |
Since 0.4.0
gint64 gdata_documents_entry_get_last_viewed
(GDataDocumentsEntry *self
);
Gets the "last-viewed" property. If the property is unset, -1
will be returned.
|
a GDataDocumentsEntry |
Returns : |
the UNIX timestamp for the time the document was last viewed, or -1
|
Since 0.4.0
goffset gdata_documents_entry_get_quota_used
(GDataDocumentsEntry *self
);
Gets the "quota-used" property.
|
a GDataDocumentsEntry |
Returns : |
the number of quota bytes used by the document |
Since 0.13.0
gboolean gdata_documents_entry_writers_can_invite
(GDataDocumentsEntry *self
);
Gets the "writers-can-invite" property.
|
a GDataDocumentsEntry |
Returns : |
TRUE if writers can invite other people to edit the document, FALSE otherwise |
Since 0.4.0
void gdata_documents_entry_set_writers_can_invite (GDataDocumentsEntry *self
,gboolean writers_can_invite
);
Sets the "writers-can-invite" property to writers_can_invite
.
|
a GDataDocumentsEntry |
|
TRUE if writers can invite other people to edit the document, FALSE otherwise |
Since 0.4.0
gboolean gdata_documents_entry_is_deleted (GDataDocumentsEntry *self
);
Gets the "is-deleted" property.
|
a GDataDocumentsEntry |
Returns : |
TRUE if the document has been deleted, FALSE otherwise |
Since 0.5.0
"document-id"
property"document-id" gchar* : Read
GDataDocumentsEntry:document-id
is deprecated and should not be used in newly-written code. This a substring of the "resource-id", which is more general and should be used instead. (Since: 0.11.0.)
The document ID of the document, which is different from its entry ID (GDataEntry:id). The online GData Documentation refers to these as “untyped resource IDs”.
Default value: NULL
Since 0.4.0
"edited"
property"edited" gint64 : Read
The last time the document was edited. If the document has not been edited yet, the content indicates the time it was created.
For more information, see the Atom Publishing Protocol specification.
Allowed values: >= -1
Default value: -1
Since 0.4.0
"is-deleted"
property"is-deleted" gboolean : Read / Write
Indicates whether the document entry has been deleted (moved to the trash). Deleted documents will only
appear in query results if the "show-deleted" property is TRUE
.
Default value: FALSE
Since 0.5.0
"last-modified-by"
property"last-modified-by" GDataAuthor* : Read
Indicates the author of the last modification.
Since 0.4.0
"last-viewed"
property"last-viewed" gint64 : Read
The last time the document was viewed.
Allowed values: >= -1
Default value: -1
Since 0.4.0
"quota-used"
property"quota-used" gint64 : Read
The amount of user quota the document is occupying. Currently, only arbitrary files consume file space quota (whereas standard document formats, such as GDataDocumentsText, GDataDocumentsSpreadsheet and GDataDocumentsFolder don't). Measured in bytes.
This property will be 0
for documents which aren't consuming any quota.
Allowed values: >= 0
Default value: 0
Since 0.13.0
"resource-id"
property"resource-id" gchar* : Read
The resource ID of the document. This should not normally need to be used in client code, and is mostly for internal use. To uniquely identify a given document or folder, use its "id".
Resource IDs have the form:
; whereas
entry IDs have the form:
document|drawing|pdf|spreadsheet|presentation|folder
:untyped resource ID
https://docs.google.com/feeds/id/
in version 3 of the API.
resource ID
For more information, see the Google Documents API reference.
Default value: NULL
Since 0.11.0
"writers-can-invite"
property"writers-can-invite" gboolean : Read / Write
Indicates whether the document entry writers can invite others to edit the document.
Default value: FALSE
Since 0.4.0