# MIMEDirVCal

## Name

MIMEDirVCal -- main iCalendar object

## Synopsis

    #include <mimedir/mimedir-vcal.h>

    #define             MIMEDIR_VCAL_ERROR
    enum                MIMEDirVCalError;
    #define             MIMEDIR_VCAL_ERROR_UNKNOWN_SCALE_STR

                        MIMEDirVCal;

    void                mimedir_vcal_free_list              (GList *list);

    MIMEDirVCal*        mimedir_vcal_new                    (void);
    MIMEDirVCal*        mimedir_vcal_new_from_profile       (MIMEDirProfile *profile,
                                                             GError **error);
    gboolean            mimedir_vcal_read_from_profile      (MIMEDirVCal *vcal,
                                                             MIMEDirProfile *profile,
                                                             GError **error);
    gboolean            mimedir_vcal_write_to_channel       (MIMEDirVCal *vcal,
                                                             GIOChannel *channel,
                                                             GError **error);
    MIMEDirProfile*     mimedir_vcal_write_to_profile       (MIMEDirVCal *vcal);
    gchar*              mimedir_vcal_write_to_string        (MIMEDirVCal *vcal);
    GSList*             mimedir_vcal_get_component_list     (MIMEDirVCal *vcal);
    GSList*             mimedir_vcal_get_event_list         (MIMEDirVCal *vcal);
    GSList*             mimedir_vcal_get_todo_list          (MIMEDirVCal *vcal);
    void                mimedir_vcal_add_component          (MIMEDirVCal *vcal,
                                                             MIMEDirVComponent *component);
    void                mimedir_vcal_add_component_list     (MIMEDirVCal *vcal,
                                                             GList *list);
    void                mimedir_vcal_free_component_list    (GSList *list);

## Description

## Details

### MIMEDIR_VCAL_ERROR

    #define MIMEDIR_VCAL_ERROR mimedir_vcal_error_quark ()

Error domain for MIMEDirAttribute operations. Errors in this domain will be from the MIMEDirAttributeError enumeration. See GError for information on error domains.

### enum MIMEDirVCalError

    typedef enum {
    	MIMEDIR_VCAL_ERROR_UNKNOWN_SCALE
    } MIMEDirVCalError;

Error codes returned by MIMEDirVCal operations.

`MIMEDIR_VCAL_ERROR_UNKNOWN_SCALE` | The specified time scale is unknown.

### MIMEDIR_VCAL_ERROR_UNKNOWN_SCALE_STR

    #define MIMEDIR_VCAL_ERROR_UNKNOWN_SCALE_STR	_("unknown calendar scale %s")

Default string representation of the MIMEDIR_VAL_ERROR_UNKNOWN_SCALE error code.

### MIMEDirVCal

    typedef struct {
    	GObject parent;

    	MIMEDirVCalPriv *priv;
    } MIMEDirVCal;

### mimedir_vcal_free_list ()

    void                mimedir_vcal_free_list              (GList *list);

Frees a list of vcals as returned by `mimedir_vcal_read_file()` or `mimedir_vcal_read_channel()`.

`list` : | list of vcals

### mimedir_vcal_new ()

    MIMEDirVCal*        mimedir_vcal_new                    (void);

Creates a new (empty) vcal object.

Returns : | a new vcal object

### mimedir_vcal_new_from_profile ()

    MIMEDirVCal*        mimedir_vcal_new_from_profile       (MIMEDirProfile *profile,
                                                             GError **error);

Create a new vcal object and fills it with data retrieved from the supplied profile object. If an error occurs during the read, `error` will be set and `NULL` will be returned.

`profile` : | a profile object
`error` : | error storage location or `NULL`
Returns : | the new vcal object or `NULL`

### mimedir_vcal_read_from_profile ()

    gboolean            mimedir_vcal_read_from_profile      (MIMEDirVCal *vcal,
                                                             MIMEDirProfile *profile,
                                                             GError **error);

Clears the supplied vcal object and re-initializes it with data read from the supplied profile. If an error occurs during the read, `error` will be set and `FALSE` will be returned. Otherwise, `TRUE` is returned.

`vcal` : | a vcal
`profile` : | a profile object
`error` : | error storage location or `NULL`
Returns : | success indicator

### mimedir_vcal_write_to_channel ()

    gboolean            mimedir_vcal_write_to_channel       (MIMEDirVCal *vcal,
                                                             GIOChannel *channel,
                                                             GError **error);

Saves the iCal object to the supplied I/O channel. If an error occurs during the write, `error` will be set and `FALSE` will be returned. Otherwise, `TRUE` is returned.

`vcal` : | a MIMEDirVCal object
`channel` : | I/O channel to save to
`error` : | error storage location or `NULL`
Returns : | success indicator

### mimedir_vcal_write_to_profile ()

    MIMEDirProfile*     mimedir_vcal_write_to_profile       (MIMEDirVCal *vcal);

Saves the iCal object to a newly allocated profile object.

`vcal` : | a MIMEDirVCal object
Returns : | a new profile

### mimedir_vcal_write_to_string ()

    gchar*              mimedir_vcal_write_to_string        (MIMEDirVCal *vcal);

Saves the iCal object to a newly allocated memory buffer. You should free the returned buffer with `g_free()`.

`vcal` : | a MIMEDirVCal object
Returns : | a newly allocated memory buffer

### mimedir_vcal_get_component_list ()

    GSList*             mimedir_vcal_get_component_list     (MIMEDirVCal *vcal);

Returns all components of this vCalendar. Free the returned list with `mimedir_vcal_free_component_list()`.

`vcal` : | a vCalendar object
Returns : | a GSList consisting of component objects

### mimedir_vcal_get_event_list ()

    GSList*             mimedir_vcal_get_event_list         (MIMEDirVCal *vcal);

Returns all vEvent components of this vCalendar. Free the returned list with `mimedir_vcal_free_component_list()`.

`vcal` : | a vCalendar object
Returns : | a GSList consisting of MIMEDirVEvent objects

### mimedir_vcal_get_todo_list ()

    GSList*             mimedir_vcal_get_todo_list          (MIMEDirVCal *vcal);

Returns all vTodo components of this vCalendar. Free the returned list with `mimedir_vcal_free_component_list()`.

`vcal` : | a vCalendar object
Returns : | a GSList consisting of MIMEDirVTodo objects

### mimedir_vcal_add_component ()

    void                mimedir_vcal_add_component          (MIMEDirVCal *vcal,
                                                             MIMEDirVComponent *component);

Adds a single component to the component list of `vcal`.

`vcal` : | a MIMEDirVCal
`component` : | a MIMEDirVComponent

### mimedir_vcal_add_component_list ()

    void                mimedir_vcal_add_component_list     (MIMEDirVCal *vcal,
                                                             GList *list);

Adds components to the component list of `vcal`.

`vcal` : | a MIMEDirVCal
`list` : | a GList of MIMEDirVComponent objects

### mimedir_vcal_free_component_list ()

    void                mimedir_vcal_free_component_list    (GSList *list);

Free a component list as returned by one of the get_*_list functions.

`list` : | a GSList