## GDataCalendarCalendar

GDataCalendarCalendar — GData Calendar calendar object

## Stability Level

Stable, unless otherwise indicated

## Functions

GDataCalendarCalendar * | gdata_calendar_calendar_new ()
void | gdata_calendar_calendar_get_color ()
void | gdata_calendar_calendar_set_color ()
gboolean | gdata_calendar_calendar_is_hidden ()
void | gdata_calendar_calendar_set_is_hidden ()
gboolean | gdata_calendar_calendar_is_selected ()
void | gdata_calendar_calendar_set_is_selected ()
const gchar * | gdata_calendar_calendar_get_timezone ()
void | gdata_calendar_calendar_set_timezone ()
gint64 | gdata_calendar_calendar_get_edited ()
guint | gdata_calendar_calendar_get_times_cleaned ()
const gchar * | gdata_calendar_calendar_get_access_level ()

## Properties

char * | access-level | Read
GDataColor * | color | Read / Write
gint64 | edited | Read
gboolean | is-hidden | Read / Write
gboolean | is-selected | Read / Write
guint | times-cleaned | Read
char * | timezone | Read / Write

## Types and Values

| GDataCalendarCalendar
| GDataCalendarCalendarClass

## Object Hierarchy

        GObject
        ╰── GDataParsable
            ╰── GDataEntry
                ╰── GDataCalendarCalendar

## Implemented Interfaces

GDataCalendarCalendar implements GDataAccessHandler.

## Includes

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

## Description

GDataCalendarCalendar is a subclass of GDataEntry to represent a calendar from Google Calendar.

GDataCalendarCalendar 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`), GDataCalendarCalendar has its own, such as `GDATA_CALENDAR_ACCESS_ROLE_EDITOR` and `GDATA_CALENDAR_ACCESS_ROLE_FREE_BUSY`.

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

Example 17. Listing Calendars

    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

    GDataCalendarService *service;
    GDataFeed *feed;
    GList *i;
    GError *error = NULL;

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

    /* Query for all of the calendars the currently authenticated user has access to, including those which they have read-only
     * access to. */
    feed = gdata_calendar_service_query_all_calendars (service, NULL, NULL, NULL, NULL, &error);

    g_object_unref (service);

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

    /* Iterate through the returned calendars and do something with them */
    for (i = gdata_feed_get_entries (feed); i != NULL; i = i->next) {
    	const gchar *access_level;
    	gboolean has_write_access;
    	GDataCalendarCalendar *calendar = GDATA_CALENDAR_CALENDAR (i->data);

    	/* Determine whether we have write access to the calendar, or just read-only or free/busy access. Note that the access levels
    	 * are more detailed than this; see the documentation for gdata_calendar_calendar_get_access_level() for more information. */
    	access_level = gdata_calendar_calendar_get_access_level (calendar);
    	has_write_access = (access_level != NULL && strcmp (access_level, GDATA_CALENDAR_ACCESS_ROLE_EDITOR) == 0) ? TRUE : FALSE;

    	/* Do something with the calendar here, such as insert it into a UI */
    }

    g_object_unref (feed);

## Functions

### gdata_calendar_calendar_new ()

    GDataCalendarCalendar *
    gdata_calendar_calendar_new (const gchar *id);

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

#### Parameters

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

#### Returns

a new GDataCalendarCalendar; unref with `g_object_unref()`

### gdata_calendar_calendar_get_color ()

    void
    gdata_calendar_calendar_get_color (GDataCalendarCalendar *self,
                                       GDataColor *color);

Gets the “color” property and puts it in `color` .

#### Parameters

self | a GDataCalendarCalendar |
color | a GDataColor. | [out caller-allocates]

### gdata_calendar_calendar_set_color ()

    void
    gdata_calendar_calendar_set_color (GDataCalendarCalendar *self,
                                       const GDataColor *color);

Sets the “color” property to `color` .

#### Parameters

self | a GDataCalendarCalendar |
color | a new GDataColor |

### gdata_calendar_calendar_is_hidden ()

    gboolean
    gdata_calendar_calendar_is_hidden (GDataCalendarCalendar *self);

Gets the “is-hidden” property.

#### Parameters

self | a GDataCalendarCalendar |

#### Returns

`TRUE` if the calendar is hidden, `FALSE` otherwise

Since: 0.2.0

### gdata_calendar_calendar_set_is_hidden ()

    void
    gdata_calendar_calendar_set_is_hidden (GDataCalendarCalendar *self,
                                           gboolean is_hidden);

Sets the “is-hidden” property to `is_hidden` .

#### Parameters

self | a GDataCalendarCalendar |
is_hidden | `TRUE` to hide the calendar, `FALSE` otherwise |

Since: 0.2.0

### gdata_calendar_calendar_is_selected ()

    gboolean
    gdata_calendar_calendar_is_selected (GDataCalendarCalendar *self);

Gets the “is-selected” property.

#### Parameters

self | a GDataCalendarCalendar |

#### Returns

`TRUE` if the calendar is selected, `FALSE` otherwise

Since: 0.2.0

### gdata_calendar_calendar_set_is_selected ()

    void
    gdata_calendar_calendar_set_is_selected
                                   (GDataCalendarCalendar *self,
                                    gboolean is_selected);

Sets the “is-selected” property to `is_selected` .

#### Parameters

self | a GDataCalendarCalendar |
is_selected | `TRUE` to select the calendar, `FALSE` otherwise |

Since: 0.2.0

### gdata_calendar_calendar_get_timezone ()

    const gchar *
    gdata_calendar_calendar_get_timezone (GDataCalendarCalendar *self);

Gets the “timezone” property.

#### Parameters

self | a GDataCalendarCalendar |

#### Returns

the calendar's timezone, or `NULL`

### gdata_calendar_calendar_set_timezone ()

    void
    gdata_calendar_calendar_set_timezone (GDataCalendarCalendar *self,
                                          const gchar *_timezone);

Sets the “timezone” property to the new timezone, `_timezone` .

Set `_timezone` to `NULL` to unset the property in the calendar.

#### Parameters

self | a GDataCalendarCalendar |
_timezone | a new timezone, or `NULL`. | [allow-none]

### gdata_calendar_calendar_get_edited ()

    gint64
    gdata_calendar_calendar_get_edited (GDataCalendarCalendar *self);

`gdata_calendar_calendar_get_edited` has been deprecated since version 0.17.2 and should not be used in newly-written code.

Unsupported by the online API any more. There is no replacement; this will always return `-1`.

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

#### Parameters

self | a GDataCalendarCalendar |

#### Returns

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

### gdata_calendar_calendar_get_times_cleaned ()

    guint
    gdata_calendar_calendar_get_times_cleaned
                                   (GDataCalendarCalendar *self);

`gdata_calendar_calendar_get_times_cleaned` has been deprecated since version 0.17.2 and should not be used in newly-written code.

Unsupported by the online API any more. There is no replacement; this will always return `0`.

Gets the “times-cleaned” property.

#### Parameters

self | a GDataCalendarCalendar |

#### Returns

the number of times the calendar has been totally emptied

### gdata_calendar_calendar_get_access_level ()

    const gchar *
    gdata_calendar_calendar_get_access_level
                                   (GDataCalendarCalendar *self);

Gets the “access-level” property.

#### Parameters

self | a GDataCalendarCalendar |

#### Returns

the authenticated user's access level to the calendar, or `NULL`

## Types and Values

### GDataCalendarCalendar

    typedef struct _GDataCalendarCalendar GDataCalendarCalendar;

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

### GDataCalendarCalendarClass

    typedef struct {
    } GDataCalendarCalendarClass;

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

## Property Details

### The `“access-level”` property

      “access-level”             char *

Indicates the access level the current user has to the calendar. For example: `GDATA_CALENDAR_ACCESS_ROLE_READ` or `GDATA_CALENDAR_ACCESS_ROLE_FREE_BUSY`. The "current user" is the one authenticated against the service's “authorizer”, or the guest user.

Owner: GDataCalendarCalendar

Flags: Read

Default value: NULL

### The `“color”` property

      “color”                    GDataColor *

The background color used to highlight the calendar in the user’s browser. This used to be restricted to a limited set of colours, but since 0.17.2 may be any RGB colour.

Owner: GDataCalendarCalendar

Flags: Read / Write

### The `“edited”` property

      “edited”                   gint64

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

For more information, see the Atom Publishing Protocol specification.

`GDataCalendarCalendar:edited` has been deprecated since version 0.17.2 and should not be used in newly-written code.

Unsupported by the online API any more. There is no replacement; this will always return -1.

Owner: GDataCalendarCalendar

Flags: Read

Allowed values: >= -1

Default value: -1

### The `“is-hidden”` property

      “is-hidden”                gboolean

Indicates whether the calendar is visible.

Owner: GDataCalendarCalendar

Flags: Read / Write

Default value: FALSE

Since: 0.2.0

### The `“is-selected”` property

      “is-selected”              gboolean

Indicates whether the calendar is selected.

Owner: GDataCalendarCalendar

Flags: Read / Write

Default value: FALSE

Since: 0.2.0

### The `“times-cleaned”` property

      “times-cleaned”            guint

The number of times the calendar has been cleared of events.

`GDataCalendarCalendar:times-cleaned` has been deprecated since version 0.17.2 and should not be used in newly-written code.

Unsupported by the online API any more. There is no replacement; this will always return

`0`.

Owner: GDataCalendarCalendar

Flags: Read

Default value: 0

### The `“timezone”` property

      “timezone”                 char *

The timezone in which the calendar's times are given. This is a timezone name in tz database notation: reference.

Owner: GDataCalendarCalendar

Flags: Read / Write

Default value: NULL