## GDataCalendarEvent

GDataCalendarEvent — GData Calendar event object

## Stability Level

Stable, unless otherwise indicated

## Functions

GDataCalendarEvent * | gdata_calendar_event_new ()
GList * | gdata_calendar_event_get_people ()
void | gdata_calendar_event_add_person ()
GList * | gdata_calendar_event_get_places ()
void | gdata_calendar_event_add_place ()
GList * | gdata_calendar_event_get_times ()
gboolean | gdata_calendar_event_get_primary_time ()
void | gdata_calendar_event_add_time ()
const gchar * | gdata_calendar_event_get_recurrence ()
void | gdata_calendar_event_set_recurrence ()
void | gdata_calendar_event_get_original_event_details ()
gboolean | gdata_calendar_event_is_exception ()
gboolean | gdata_calendar_event_get_anyone_can_add_self ()
void | gdata_calendar_event_set_anyone_can_add_self ()
gboolean | gdata_calendar_event_get_guests_can_invite_others ()
void | gdata_calendar_event_set_guests_can_invite_others ()
gboolean | gdata_calendar_event_get_guests_can_modify ()
void | gdata_calendar_event_set_guests_can_modify ()
gboolean | gdata_calendar_event_get_guests_can_see_guests ()
void | gdata_calendar_event_set_guests_can_see_guests ()
guint | gdata_calendar_event_get_sequence ()
void | gdata_calendar_event_set_sequence ()
const gchar * | gdata_calendar_event_get_status ()
void | gdata_calendar_event_set_status ()
const gchar * | gdata_calendar_event_get_transparency ()
void | gdata_calendar_event_set_transparency ()
const gchar * | gdata_calendar_event_get_uid ()
void | gdata_calendar_event_set_uid ()
const gchar * | gdata_calendar_event_get_visibility ()
void | gdata_calendar_event_set_visibility ()
gint64 | gdata_calendar_event_get_edited ()

## Properties

gboolean | anyone-can-add-self | Read / Write
gint64 | edited | Read
gboolean | guests-can-invite-others | Read / Write
gboolean | guests-can-modify | Read / Write
gboolean | guests-can-see-guests | Read / Write
char * | original-event-id | Read
char * | original-event-uri | Read
char * | recurrence | Read / Write
guint | sequence | Read / Write
char * | status | Read / Write
char * | transparency | Read / Write
char * | uid | Read / Write
char * | visibility | Read / Write

## Types and Values

| GDataCalendarEvent
| GDataCalendarEventClass

## Object Hierarchy

        GObject
        ╰── GDataParsable
            ╰── GDataEntry
                ╰── GDataCalendarEvent

## Includes

    #include <gdata/services/calendar/gdata-calendar-event.h>

## Description

GDataCalendarEvent is a subclass of GDataEntry to represent an event on a calendar from Google Calendar.

For more details of Google Calendar's GData API, see the

online documentation.

Example 19. Adding a New Event to the Default Calendar

    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

    GDataCalendarService *service;
    GDataCalendarEvent *event, *new_event;
    GDataGDWhere *where;
    GDataGDWho *who;
    GDataGDWhen *when;
    gint64 current_time;
    GError *error = NULL;

    /* Create a service */
    service = create_calendar_service ();

    /* Create the new event */
    event = gdata_calendar_event_new (NULL);

    gdata_entry_set_title (GDATA_ENTRY (event), "Event Title");
    gdata_entry_set_content (GDATA_ENTRY (event), "Event description. This should be a few sentences long.");
    gdata_calendar_event_set_status (event, GDATA_GD_EVENT_STATUS_CONFIRMED);

    where = gdata_gd_where_new (NULL, "Description of the location", NULL);
    gdata_calendar_event_add_place (event, where);
    g_object_unref (where);

    who = gdata_gd_who_new (GDATA_GD_WHO_EVENT_ORGANIZER, "John Smith", "john.smith@gmail.com");
    gdata_calendar_event_add_person (event, who);
    g_object_unref (who);

    current_time = g_get_real_time () / G_USEC_PER_SEC;
    when = gdata_gd_when_new (current_time, current_time + 3600, FALSE);
    gdata_calendar_event_add_time (event, when);
    g_object_unref (when);

    /* Insert the event in the calendar */
    new_event = gdata_calendar_service_insert_event (service, event, NULL, &error);

    g_object_unref (event);
    g_object_unref (service);

    if (error != NULL) {
    	g_error ("Error inserting event: %s", error->message);
    	g_error_free (error);
    	return NULL;
    }

    /* Do something with the new_event here, such as return it to the user or store its ID for later usage */

    g_object_unref (new_event);

## Functions

### gdata_calendar_event_new ()

    GDataCalendarEvent *
    gdata_calendar_event_new (const gchar *id);

Creates a new GDataCalendarEvent with the given ID and default properties.

#### Parameters

id | the event's ID, or `NULL`. | [allow-none]

#### Returns

a new GDataCalendarEvent; unref with `g_object_unref()`

### gdata_calendar_event_get_people ()

    GList *
    gdata_calendar_event_get_people (GDataCalendarEvent *self);

Gets a list of the people attending the event.

#### Parameters

self | a GDataCalendarEvent |

#### Returns

a GList of GDataGDWhos, or `NULL`.

[element-type GData.GDWho][transfer none]

Since: 0.2.0

### gdata_calendar_event_add_person ()

    void
    gdata_calendar_event_add_person (GDataCalendarEvent *self,
                                     GDataGDWho *who);

Adds the person `who` to the event as a guest (attendee, organiser, performer, etc.), and increments its reference count.

Duplicate people will not be added to the list.

#### Parameters

self | a GDataCalendarEvent |
who | a GDataGDWho to add |

### gdata_calendar_event_get_places ()

    GList *
    gdata_calendar_event_get_places (GDataCalendarEvent *self);

Gets a list of the locations associated with the event.

#### Parameters

self | a GDataCalendarEvent |

#### Returns

a GList of GDataGDWheres, or `NULL`.

[element-type GData.GDWhere][transfer none]

Since: 0.2.0

### gdata_calendar_event_add_place ()

    void
    gdata_calendar_event_add_place (GDataCalendarEvent *self,
                                    GDataGDWhere *where);

Adds the place `where` to the event as a location and increments its reference count.

Duplicate places will not be added to the list.

#### Parameters

self | a GDataCalendarEvent |
where | a GDataGDWhere to add |

### gdata_calendar_event_get_times ()

    GList *
    gdata_calendar_event_get_times (GDataCalendarEvent *self);

Gets a list of the time periods associated with the event.

#### Parameters

self | a GDataCalendarEvent |

#### Returns

a GList of GDataGDWhens, or `NULL`.

[element-type GData.GDWhen][transfer none]

Since: 0.2.0

### gdata_calendar_event_get_primary_time ()

    gboolean
    gdata_calendar_event_get_primary_time (GDataCalendarEvent *self,
                                           gint64 *start_time,
                                           gint64 *end_time,
                                           GDataGDWhen **when);

Gets the first time period associated with the event, conveniently returning just its start and end times if required.

If there are no time periods, or more than one time period, associated with the event, `FALSE` will be returned, and the parameters will remain unmodified.

#### Parameters

self | a GDataCalendarEvent |
start_time | a gint64 for the start time, or `NULL`. | [out caller-allocates]
end_time | a gint64 for the end time, or `NULL`. | [out caller-allocates]
when | a GDataGDWhen for the primary time structure, or `NULL`. | [out callee-allocates][transfer none]

#### Returns

`TRUE` if there is only one time period associated with the event, `FALSE` otherwise

Since: 0.2.0

### gdata_calendar_event_add_time ()

    void
    gdata_calendar_event_add_time (GDataCalendarEvent *self,
                                   GDataGDWhen *when);

Adds `when` to the event as a time period when the event happens, and increments its reference count.

Duplicate times will not be added to the list.

Note: `gdata_calendar_event_add_time()` and `gdata_calendar_event_set_recurrence()` are mutually exclusive, as the server doesn't support positive exceptions to recurrence rules. If recurrences are required, use `gdata_calendar_event_set_recurrence()`. Note that this means reminders cannot be set for the event, as they are only supported by GDataGDWhen. No checks are performed for these forbidden conditions, as to do so would break libgdata's API; if both a recurrence is set and a specific time is added, the server will return an error when the GDataCalendarEvent is inserted using `gdata_service_insert_entry()`.

#### Parameters

self | a GDataCalendarEvent |
when | a GDataGDWhen to add |

Since: 0.2.0

### gdata_calendar_event_get_recurrence ()

    const gchar *
    gdata_calendar_event_get_recurrence (GDataCalendarEvent *self);

Gets the “recurrence” property.

#### Parameters

self | a GDataCalendarEvent |

#### Returns

the event recurrence patterns, or `NULL`

Since: 0.3.0

### gdata_calendar_event_set_recurrence ()

    void
    gdata_calendar_event_set_recurrence (GDataCalendarEvent *self,
                                         const gchar *recurrence);

Sets the “recurrence” property to the new recurrence, `recurrence` .

Set `recurrence` to `NULL` to unset the property in the event.

Note: `gdata_calendar_event_add_time()` and `gdata_calendar_event_set_recurrence()` are mutually exclusive. See the documentation for `gdata_calendar_event_add_time()` for details.

#### Parameters

self | a GDataCalendarEvent |
recurrence | a new event recurrence, or `NULL`. | [allow-none]

Since: 0.3.0

### gdata_calendar_event_get_original_event_details ()

    void
    gdata_calendar_event_get_original_event_details
                                   (GDataCalendarEvent *self,
                                    gchar **event_id,
                                    gchar **event_uri);

Gets details of the original event, if this event is an exception to a recurring event. The original event's ID and the URI of the event's XML are returned in `event_id` and `event_uri` , respectively.

If this event is not an exception to a recurring event, `event_id` and `event_uri` will be set to `NULL`. See `gdata_calendar_event_is_exception()` to determine more simply whether an event is an exception to a recurring event.

If both `event_id` and `event_uri` are `NULL`, this function is a no-op. Otherwise, they should both be freed with `g_free()`.

#### Parameters

self | a GDataCalendarEvent |
event_id | return location for the original event's ID, or `NULL`. | [out callee-allocates][transfer full]
event_uri | return location for the original event's URI, or `NULL`. | [out callee-allocates][transfer full]

Since: 0.3.0

### gdata_calendar_event_is_exception ()

    gboolean
    gdata_calendar_event_is_exception (GDataCalendarEvent *self);

Determines whether the event is an exception to a recurring event. If it is, details of the original event can be retrieved using `gdata_calendar_event_get_original_event_details()`.

#### Parameters

self | a GDataCalendarEvent |

#### Returns

`TRUE` if the event is an exception, `FALSE` otherwise

Since: 0.3.0

### gdata_calendar_event_get_anyone_can_add_self ()

    gboolean
    gdata_calendar_event_get_anyone_can_add_self
                                   (GDataCalendarEvent *self);

Gets the “anyone-can-add-self” property.

#### Parameters

self | a GDataCalendarEvent |

#### Returns

`TRUE` if anyone can add themselves as an attendee to the event, `FALSE` otherwise

### gdata_calendar_event_set_anyone_can_add_self ()

    void
    gdata_calendar_event_set_anyone_can_add_self
                                   (GDataCalendarEvent *self,
                                    gboolean anyone_can_add_self);

Sets the “anyone-can-add-self” property to `anyone_can_add_self` .

#### Parameters

self | a GDataCalendarEvent |
anyone_can_add_self | `TRUE` if anyone can add themselves as an attendee to the event, `FALSE` otherwise |

### gdata_calendar_event_get_guests_can_invite_others ()

    gboolean
    gdata_calendar_event_get_guests_can_invite_others
                                   (GDataCalendarEvent *self);

Gets the “guests-can-invite-others” property.

#### Parameters

self | a GDataCalendarEvent |

#### Returns

`TRUE` if attendees can invite others to the event, `FALSE` otherwise

### gdata_calendar_event_set_guests_can_invite_others ()

    void
    gdata_calendar_event_set_guests_can_invite_others
                                   (GDataCalendarEvent *self,
                                    gboolean guests_can_invite_others);

Sets the “guests-can-invite-others” property to `guests_can_invite_others` .

#### Parameters

self | a GDataCalendarEvent |
guests_can_invite_others | `TRUE` if attendees can invite others to the event, `FALSE` otherwise |

### gdata_calendar_event_get_guests_can_modify ()

    gboolean
    gdata_calendar_event_get_guests_can_modify
                                   (GDataCalendarEvent *self);

Gets the “guests-can-modify” property.

#### Parameters

self | a GDataCalendarEvent |

#### Returns

`TRUE` if attendees can modify the original event, `FALSE` otherwise

### gdata_calendar_event_set_guests_can_modify ()

    void
    gdata_calendar_event_set_guests_can_modify
                                   (GDataCalendarEvent *self,
                                    gboolean guests_can_modify);

Sets the “guests-can-modify” property to `guests_can_modify` .

#### Parameters

self | a GDataCalendarEvent |
guests_can_modify | `TRUE` if attendees can modify the original event, `FALSE` otherwise |

### gdata_calendar_event_get_guests_can_see_guests ()

    gboolean
    gdata_calendar_event_get_guests_can_see_guests
                                   (GDataCalendarEvent *self);

Gets the “guests-can-see-guests” property.

#### Parameters

self | a GDataCalendarEvent |

#### Returns

`TRUE` if attendees can see who's attending the event, `FALSE` otherwise

### gdata_calendar_event_set_guests_can_see_guests ()

    void
    gdata_calendar_event_set_guests_can_see_guests
                                   (GDataCalendarEvent *self,
                                    gboolean guests_can_see_guests);

Sets the “guests-can-see-guests” property to `guests_can_see_guests` .

#### Parameters

self | a GDataCalendarEvent |
guests_can_see_guests | `TRUE` if attendees can see who's attending the event, `FALSE` otherwise |

### gdata_calendar_event_get_sequence ()

    guint
    gdata_calendar_event_get_sequence (GDataCalendarEvent *self);

Gets the “sequence” property.

#### Parameters

self | a GDataCalendarEvent |

#### Returns

the event's sequence number

### gdata_calendar_event_set_sequence ()

    void
    gdata_calendar_event_set_sequence (GDataCalendarEvent *self,
                                       guint sequence);

Sets the “sequence” property to the new sequence number, `sequence` .

#### Parameters

self | a GDataCalendarEvent |
sequence | a new sequence number, or `0` |

### gdata_calendar_event_get_status ()

    const gchar *
    gdata_calendar_event_get_status (GDataCalendarEvent *self);

Gets the “status” property.

#### Parameters

self | a GDataCalendarEvent |

#### Returns

the event status, or `NULL`

Since: 0.2.0

### gdata_calendar_event_set_status ()

    void
    gdata_calendar_event_set_status (GDataCalendarEvent *self,
                                     const gchar *status);

Sets the “status” property to the new status, `status` .

Set `status` to `NULL` to unset the property in the event.

#### Parameters

self | a GDataCalendarEvent |
status | a new event status, or `NULL`. | [allow-none]

Since: 0.2.0

### gdata_calendar_event_get_transparency ()

    const gchar *
    gdata_calendar_event_get_transparency (GDataCalendarEvent *self);

Gets the “transparency” property.

#### Parameters

self | a GDataCalendarEvent |

#### Returns

the event transparency, or `NULL`

### gdata_calendar_event_set_transparency ()

    void
    gdata_calendar_event_set_transparency (GDataCalendarEvent *self,
                                           const gchar *transparency);

Sets the “transparency” property to the new transparency, `transparency` .

Set `transparency` to `NULL` to unset the property in the event.

#### Parameters

self | a GDataCalendarEvent |
transparency | a new event transparency, or `NULL`. | [allow-none]

### gdata_calendar_event_get_uid ()

    const gchar *
    gdata_calendar_event_get_uid (GDataCalendarEvent *self);

Gets the “uid” property.

#### Parameters

self | a GDataCalendarEvent |

#### Returns

the event's UID, or `NULL`

### gdata_calendar_event_set_uid ()

    void
    gdata_calendar_event_set_uid (GDataCalendarEvent *self,
                                  const gchar *uid);

Sets the “uid” property to the new UID, `uid` .

Set `uid` to `NULL` to unset the property in the event.

#### Parameters

self | a GDataCalendarEvent |
uid | a new event UID, or `NULL`. | [allow-none]

### gdata_calendar_event_get_visibility ()

    const gchar *
    gdata_calendar_event_get_visibility (GDataCalendarEvent *self);

Gets the “visibility” property.

#### Parameters

self | a GDataCalendarEvent |

#### Returns

the event visibility, or `NULL`

### gdata_calendar_event_set_visibility ()

    void
    gdata_calendar_event_set_visibility (GDataCalendarEvent *self,
                                         const gchar *visibility);

Sets the “visibility” property to the new visibility, `visibility` .

Set `visibility` to `NULL` to unset the property in the event.

#### Parameters

self | a GDataCalendarEvent |
visibility | a new event visibility, or `NULL`. | [allow-none]

### gdata_calendar_event_get_edited ()

    gint64
    gdata_calendar_event_get_edited (GDataCalendarEvent *self);

Gets the “edited” property. If the property is unset, `-1` will be returned.

#### Parameters

self | a GDataCalendarEvent |

#### Returns

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

## Types and Values

### GDataCalendarEvent

    typedef struct _GDataCalendarEvent GDataCalendarEvent;

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

### GDataCalendarEventClass

    typedef struct {
    } GDataCalendarEventClass;

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

## Property Details

### The `“anyone-can-add-self”` property

      “anyone-can-add-self”      gboolean

Indicates whether anyone can invite themselves to the event, by adding themselves to the attendee list.

Owner: GDataCalendarEvent

Flags: Read / Write

Default value: FALSE

### The `“edited”` property

      “edited”                   gint64

The last time the event was edited. If the event has not been edited yet, the content indicates the time it was created.

For more information, see the Atom Publishing Protocol specification.

Owner: GDataCalendarEvent

Flags: Read

Allowed values: >= -1

Default value: -1

### The `“guests-can-invite-others”` property

      “guests-can-invite-others” gboolean

Indicates whether attendees may invite others to the event.

For more information, see the GData specification.

Owner: GDataCalendarEvent

Flags: Read / Write

Default value: FALSE

### The `“guests-can-modify”` property

      “guests-can-modify”        gboolean

Indicates whether attendees may modify the original event, so that changes are visible to organizers and other attendees. Otherwise, any changes made by attendees will be restricted to that attendee's calendar.

For more information, see the

GData specification.

Owner: GDataCalendarEvent

Flags: Read / Write

Default value: FALSE

### The `“guests-can-see-guests”` property

      “guests-can-see-guests”    gboolean

Indicates whether attendees can see other people invited to the event.

For more information, see the

GData specification.

Owner: GDataCalendarEvent

Flags: Read / Write

Default value: FALSE

### The `“original-event-id”` property

      “original-event-id”        char *

The event ID for the original event, if this event is an exception to a recurring event.

Owner: GDataCalendarEvent

Flags: Read

Default value: NULL

Since: 0.3.0

### The `“original-event-uri”` property

      “original-event-uri”       char *

The event URI for the original event, if this event is an exception to a recurring event.

Owner: GDataCalendarEvent

Flags: Read

Default value: NULL

Since: 0.3.0

### The `“recurrence”` property

      “recurrence”               char *

Represents the dates and times when a recurring event takes place. The returned string is in iCal format, as a list of properties.

For more information, see the GData specification.

Note: `gdata_calendar_event_add_time()` and `gdata_calendar_event_set_recurrence()` are mutually exclusive. See the documentation for `gdata_calendar_event_add_time()` for details.

Owner: GDataCalendarEvent

Flags: Read / Write

Default value: NULL

Since: 0.3.0

### The `“sequence”` property

      “sequence”                 guint

The revision sequence number of the event as defined in Section 4.8.7.4 of RFC 2445.

Owner: GDataCalendarEvent

Flags: Read / Write

Default value: 0

### The `“status”` property

      “status”                   char *

The scheduling status of the event. For example: `GDATA_GD_EVENT_STATUS_CANCELED` or `GDATA_GD_EVENT_STATUS_CONFIRMED`.

For more information, see the GData specification.

Owner: GDataCalendarEvent

Flags: Read / Write

Default value: NULL

Since: 0.2.0

### The `“transparency”` property

      “transparency”             char *

How the event is marked as consuming time on a calendar. For example: `GDATA_GD_EVENT_TRANSPARENCY_OPAQUE` or `GDATA_GD_EVENT_TRANSPARENCY_TRANSPARENT`.

For more information, see the GData specification.

Owner: GDataCalendarEvent

Flags: Read / Write

Default value: NULL

### The `“uid”` property

      “uid”                      char *

The globally unique identifier (UID) of the event as defined in Section 4.8.4.7 of RFC 2445.

Owner: GDataCalendarEvent

Flags: Read / Write

Default value: NULL

### The `“visibility”` property

      “visibility”               char *

The event's visibility to calendar users. For example: `GDATA_GD_EVENT_VISIBILITY_PUBLIC` or `GDATA_GD_EVENT_VISIBILITY_DEFAULT`.

For more information, see the GData specification.

Owner: GDataCalendarEvent

Flags: Read / Write

Default value: NULL