Top |
Functions
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 |
gchar * | original-event-id | Read |
gchar * | original-event-uri | Read |
gchar * | recurrence | Read / Write |
guint | sequence | Read / Write |
gchar * | status | Read / Write |
gchar * | transparency | Read / Write |
gchar * | uid | Read / Write |
gchar * | visibility | Read / Write |
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; GTimeVal 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); g_get_current_time (¤t_time); when = gdata_gd_when_new (current_time.tv_sec, current_time.tv_sec + 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.
gdata_calendar_event_get_people ()
GList *
gdata_calendar_event_get_people (GDataCalendarEvent *self
);
Gets a list of the people attending the event.
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.
gdata_calendar_event_get_places ()
GList *
gdata_calendar_event_get_places (GDataCalendarEvent *self
);
Gets a list of the locations associated with the event.
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.
gdata_calendar_event_get_times ()
GList *
gdata_calendar_event_get_times (GDataCalendarEvent *self
);
Gets a list of the time periods associated with the event.
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 |
||
start_time |
[out caller-allocates] | |
end_time |
[out caller-allocates] | |
when |
a GDataGDWhen for the primary time structure, or |
[out callee-allocates][transfer none] |
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()
.
Since: 0.2.0
gdata_calendar_event_get_recurrence ()
const gchar *
gdata_calendar_event_get_recurrence (GDataCalendarEvent *self
);
Gets the “recurrence” property.
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.
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
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()
.
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.
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
.
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.
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
.
gdata_calendar_event_get_guests_can_modify ()
gboolean
gdata_calendar_event_get_guests_can_modify
(GDataCalendarEvent *self
);
Gets the “guests-can-modify” property.
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
.
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.
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
.
gdata_calendar_event_get_sequence ()
guint
gdata_calendar_event_get_sequence (GDataCalendarEvent *self
);
Gets the “sequence” property.
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
.
gdata_calendar_event_get_status ()
const gchar *
gdata_calendar_event_get_status (GDataCalendarEvent *self
);
Gets the “status” property.
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.
Since: 0.2.0
gdata_calendar_event_get_transparency ()
const gchar *
gdata_calendar_event_get_transparency (GDataCalendarEvent *self
);
Gets the “transparency” property.
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.
gdata_calendar_event_get_uid ()
const gchar *
gdata_calendar_event_get_uid (GDataCalendarEvent *self
);
Gets the “uid” property.
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.
gdata_calendar_event_get_visibility ()
const gchar *
gdata_calendar_event_get_visibility (GDataCalendarEvent *self
);
Gets the “visibility” property.
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.
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.
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.
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.
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.
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.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.Flags: Read / Write
Default value: FALSE
The “original-event-id”
property
“original-event-id” gchar *
The event ID for the original event, if this event is an exception to a recurring event.
Flags: Read
Default value: NULL
Since: 0.3.0
The “original-event-uri”
property
“original-event-uri” gchar *
The event URI for the original event, if this event is an exception to a recurring event.
Flags: Read
Default value: NULL
Since: 0.3.0
The “recurrence”
property
“recurrence” gchar *
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.
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.
Flags: Read / Write
Default value: 0
The “status”
property
“status” gchar *
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.
Flags: Read / Write
Default value: NULL
Since: 0.2.0
The “transparency”
property
“transparency” gchar *
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.
Flags: Read / Write
Default value: NULL
The “uid”
property
“uid” gchar *
The globally unique identifier (UID) of the event as defined in Section 4.8.4.7 of RFC 2445.
Flags: Read / Write
Default value: NULL
The “visibility”
property
“visibility” gchar *
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.
Flags: Read / Write
Default value: NULL