Event Database

Event Database — Event database programmers interface.

Synopsis




#define     SECONDS_IN_DAY
#define     MON
#define     TUE
#define     WED
#define     THU
#define     FRI
#define     SAT
#define     SUN
enum        recur_type_t;
#define     FLAG_UNTIMED
#define     FLAG_ALARM
#define     FLAG_TENTATIVE
#define     FLAG_CLONE
#define     FLAG_RECUR
struct      calendar_time_s;
typedef     calendar_time_t;
#define     EVENT_DB_USE_MEMCHUNK
#define     event_db__alloc_event           ()
#define     event_db__alloc_recur           ()
#define     event_db__free_event            (_x)
#define     event_db__free_recur            (_x)
gboolean    event_db_start                  (void);
gboolean    event_db_refresh                (void);
gboolean    event_db_stop                   (void);
gboolean    event_db_add                    (event_t ev);
gboolean    event_db_remove                 (event_t ev);
gboolean    event_db_flush                  (event_t ev);
event_t     event_db_clone                  (event_t ev);
event_t     event_db_new                    (void);
event_t     event_db_find_by_uid            (guint uid);
void        event_db_destroy                (event_t ev);
event_details_t event_db_alloc_details      (event_t ev);
event_details_t event_db_get_details        (event_t ev);
void        event_db_forget_details         (event_t ev);
GSList*     event_db_list_for_period        (time_t start,
                                             time_t end);
GSList*     event_db_list_alarms_for_period (time_t start,
                                             time_t end);
GSList*     event_db_list_for_future        (time_t start,
                                             guint max);
GSList*     event_db_untimed_list_for_period
                                            (time_t start,
                                             time_t end,
                                             gboolean yes);
void        event_db_list_destroy           (GSList *l);
recur_t     event_db_get_recurrence         (event_t ev);

Description

Details

SECONDS_IN_DAY

#define SECONDS_IN_DAY (24*60*60)


MON

#define MON  (1 << 0)


TUE

#define TUE  (1 << 1)


WED

#define WED  (1 << 2)


THU

#define THU  (1 << 3)


FRI

#define FRI  (1 << 4)


SAT

#define SAT  (1 << 5)


SUN

#define SUN  (1 << 6)


enum recur_type_t

typedef enum
{
  RECUR_NONE,
  RECUR_DAILY,
  RECUR_WEEKLY,
  RECUR_MONTHLY,
  RECUR_YEARLY
} recur_type_t;


FLAG_UNTIMED

#define FLAG_UNTIMED   (1 << 0)


FLAG_ALARM

#define FLAG_ALARM     (1 << 1)


FLAG_TENTATIVE

#define FLAG_TENTATIVE (1 << 2)


FLAG_CLONE

#define FLAG_CLONE     (1 << 3)


FLAG_RECUR

#define FLAG_RECUR     (1 << 4)


struct calendar_time_s

struct calendar_time_s {
  GDate date;
  GTime time;
};


calendar_time_t

typedef time_t calendar_time_t;


EVENT_DB_USE_MEMCHUNK

#define EVENT_DB_USE_MEMCHUNK


event_db__alloc_event()

#define     event_db__alloc_event()


event_db__alloc_recur()

#define     event_db__alloc_recur()


event_db__free_event()

#define     event_db__free_event(_x)

_x :

event_db__free_recur()

#define     event_db__free_recur(_x)

_x :

event_db_start ()

gboolean    event_db_start                  (void);

Initialise the event database for use. Needs to be called on application start before acessing events.

Returns : TRUE on success, FALSE otherwise.

event_db_refresh ()

gboolean    event_db_refresh                (void);

Refresh event information from database on disk.

Returns : TRUE on success, FALSE otherwise.

event_db_stop ()

gboolean    event_db_stop                   (void);

Closes the event database and frees all remaining events in memory.

Returns : TRUE on success, FALSE otherwise.

event_db_add ()

gboolean    event_db_add                    (event_t ev);

Add an event to both the in-memory list and the SQL database. This makes sure the event is accessible by all application including the application which adds the event instantly.

ev : Event
Returns : TRUE on success, FALSE otherwise.

event_db_remove ()

gboolean    event_db_remove                 (event_t ev);

This function removes an event from the event database.

ev : Event
Returns : TRUE on success, FALSE otherwise.

event_db_flush ()

gboolean    event_db_flush                  (event_t ev);

Remove an event from the database.

ev : Event
Returns : TRUE on success, FALSE otherwise.

event_db_clone ()

event_t     event_db_clone                  (event_t ev);

Clones a given event. The new event is marked to be a clone instead of the original event by setting the FLAG_CLONE flag.

ev : Event to clone.
Returns : The event clone.

event_db_new ()

event_t     event_db_new                    (void);

Create and initialise a new event_t event structure.

Returns : A new event.

event_db_find_by_uid ()

event_t     event_db_find_by_uid            (guint uid);

uid :
Returns :

event_db_destroy ()

void        event_db_destroy                (event_t ev);

Free a given event.

ev : Event

event_db_alloc_details ()

event_details_t event_db_alloc_details      (event_t ev);

Allocates a new, clean event_details_t structure which is attached to the given event.

ev : Event
Returns : The new details structure.

event_db_get_details ()

event_details_t event_db_get_details        (event_t ev);

Retrieves detailed information for a given event and increments the reference counter of the event_details_t structure which will be attached to the event. If the event details are already there they will not be loaded again but the reference counter is increased. If you mant to make sure the event details are updated you need to use event_db_forget_details() first.

ev : Event to get details for.
Returns : The event_details_t event detail data attached to the event.

event_db_forget_details ()

void        event_db_forget_details         (event_t ev);

Decrease the reference counter of the event detail information in an event_t. If the reference counter is 0 the detail information is freed.

ev : Event to get details for.

event_db_list_for_period ()

GSList*     event_db_list_for_period        (time_t start,
                                             time_t end);

Create a list of all events for a given period.

start : Start time
end : End time
Returns : A list of events.

event_db_list_alarms_for_period ()

GSList*     event_db_list_alarms_for_period (time_t start,
                                             time_t end);

Create a list of all alarm events for a given period.

start : Start time
end : End time
Returns : A list of events.

event_db_list_for_future ()

GSList*     event_db_list_for_future        (time_t start,
                                             guint max);

Get a list of all future events starting at a given time. The total amount of events may be limited by the max parameter. Set this to 0 for an unlimited amount of events.

start : Start time
max : Maximum number of events to retrieve.
Returns : A list of events.

event_db_untimed_list_for_period ()

GSList*     event_db_untimed_list_for_period
                                            (time_t start,
                                             time_t end,
                                             gboolean yes);

Create a list of all untimed events for a given period.

start : Start time
end : End time
yes :
Returns : A list of events.

event_db_list_destroy ()

void        event_db_list_destroy           (GSList *l);

This function frees a given list of events including the list itself.

l : Event list

event_db_get_recurrence ()

recur_t     event_db_get_recurrence         (event_t ev);

Retrieves recurrence information for an event.

ev : Event
Returns : Recurrence information for the given event.