GDataDocumentsEntry

GDataDocumentsEntry — GData document object abstract class

Stability Level

Unstable, unless otherwise indicated

Synopsis

#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_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);
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);

Object Hierarchy

  GObject
   +----GDataParsable
         +----GDataEntry
               +----GDataDocumentsEntry
                     +----GDataDocumentsDocument
                     +----GDataDocumentsFolder

Implemented Interfaces

GDataDocumentsEntry implements GDataAccessHandler.

Properties

  "document-id"              gchar*                : Read
  "edited"                   gint64                : Read
  "is-deleted"               gboolean              : Read / Write
  "last-modified-by"         GDataAuthor*          : Read
  "last-viewed"              gint64                : Read
  "writers-can-invite"       gboolean              : Read / Write

Description

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.

For more details of Google Documents' GData API, see the online documentation.

Example 24. 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);


Details

GDATA_DOCUMENTS_ACCESS_ROLE_OWNER

#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


GDATA_DOCUMENTS_ACCESS_ROLE_WRITER

#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


GDATA_DOCUMENTS_ACCESS_ROLE_READER

#define GDATA_DOCUMENTS_ACCESS_ROLE_READER "reader"

The users specified by the GDataAccessRule have read-only access to the document.

Since 0.7.0


GDataDocumentsEntry

typedef struct _GDataDocumentsEntry GDataDocumentsEntry;

All the fields in the GDataDocumentsEntry structure are private and should never be accessed directly.

Since 0.4.0


GDataDocumentsEntryClass

typedef struct {
} GDataDocumentsEntryClass;

All the fields in the GDataDocumentsEntryClass structure are private and should never be accessed directly.

Since 0.4.0


gdata_documents_entry_get_path ()

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").

self :

a GDataDocumentsEntry

Returns :

the folder hierarchy path containing the document, or NULL; free with g_free()

Since 0.4.0


gdata_documents_entry_get_document_id ()

const gchar *       gdata_documents_entry_get_document_id
                                                        (GDataDocumentsEntry *self);

Gets the "document-id" property.

self :

a GDataDocumentsEntry

Returns :

the document's document ID

Since 0.4.0


gdata_documents_entry_get_edited ()

gint64              gdata_documents_entry_get_edited    (GDataDocumentsEntry *self);

Gets the "edited" property. If the property is unset, -1 will be returned.

self :

a GDataDocumentsEntry

Returns :

the UNIX timestamp for the time the document was last edited, or -1

Since 0.4.0


gdata_documents_entry_get_last_modified_by ()

GDataAuthor *       gdata_documents_entry_get_last_modified_by
                                                        (GDataDocumentsEntry *self);

Gets the "last-modified-by" property.

self :

a GDataDocumentsEntry

Returns :

the author who last modified the document. [transfer none]

Since 0.4.0


gdata_documents_entry_get_last_viewed ()

gint64              gdata_documents_entry_get_last_viewed
                                                        (GDataDocumentsEntry *self);

Gets the "last-viewed" property. If the property is unset, -1 will be returned.

self :

a GDataDocumentsEntry

Returns :

the UNIX timestamp for the time the document was last viewed, or -1

Since 0.4.0


gdata_documents_entry_writers_can_invite ()

gboolean            gdata_documents_entry_writers_can_invite
                                                        (GDataDocumentsEntry *self);

Gets the "writers-can-invite" property.

self :

a GDataDocumentsEntry

Returns :

TRUE if writers can invite other people to edit the document, FALSE otherwise

Since 0.4.0


gdata_documents_entry_set_writers_can_invite ()

void                gdata_documents_entry_set_writers_can_invite
                                                        (GDataDocumentsEntry *self,
                                                         gboolean writers_can_invite);

Sets the "writers-can-invite" property to writers_can_invite.

self :

a GDataDocumentsEntry

writers_can_invite :

TRUE if writers can invite other people to edit the document, FALSE otherwise

Since 0.4.0


gdata_documents_entry_is_deleted ()

gboolean            gdata_documents_entry_is_deleted    (GDataDocumentsEntry *self);

Gets the "is-deleted" property.

self :

a GDataDocumentsEntry

Returns :

TRUE if the document has been deleted, FALSE otherwise

Since 0.5.0

Property Details

The "document-id" property

  "document-id"              gchar*                : Read

The document ID of the document, which is different from its entry ID (GDataEntry:id).

Default value: NULL

Since 0.4.0


The "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


The "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


The "last-modified-by" property

  "last-modified-by"         GDataAuthor*          : Read

Indicates the author of the last modification.

Since 0.4.0


The "last-viewed" property

  "last-viewed"              gint64                : Read

The last time the document was viewed.

Allowed values: >= -1

Default value: -1

Since 0.4.0


The "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