Files
evolution/calendar/calobj.h
Federico Mena Quintero ca082de77a Added get_uids() method to get a list of UIDs based on object types.
2000-02-08  Federico Mena Quintero  <federico@helixcode.com>

	* evolution-calendar.idl (Cal): Added get_uids() method to get a
	list of UIDs based on object types.

	* cal-backend.c (cal_backend_get_uids): Implemented get_uids() in
	the backend.

	* cal.c (Cal_get_uids): Implemented get_uids() method.

	* cal-client.c (cal_client_get_uids): Implemented client-side
	function.

	* cal-util.c (cal_obj_instance_list_free): Doh.  Free the list,
	not the last link.
	(cal_obj_uid_list_free): New function to free a list of UIDs.

	* GnomeCal.idl (Repository): Removed unused method
	get_object_by_id_list().  This is just for cleanup purposes and to
	remind me exactly of what needs to be moved over to
	evolution-calendar.idl.
	(Repository): Removed unused get_objects() method.

	* corba-cal.c (init_calendar_repo_class): Removed the unused
	get_objects method.

	* calobj.h (CalObjFindStatus): New status value enumeration for
	the find function.

	* calobj.c (ical_object_find_in_string): New function to parse a
	complete calendar and find a calendar object in it.  This should
	be used instead ical_object_new_from_string() in the future.

	* evolution-calendar.idl (CalObjInstance): Added an uid field.
	Now the idea is that whenever calendar object strings are passed
	around, their UIDs are passed along with them so that the actual
	object can be pulled from the whole VCAL object using its UID to
	identify it.

	* cal-util.h (CalObjInstance): Added uid field.

	* cal-util.c (cal_obj_instance_list_free): Free the UIDs.

	* cal-backend.c (build_event_list): Store the object's UID in the
	instance structure.

	* cal.c (Cal_get_events_in_range): Copy the UID field to the CORBA
	structure.

	* cal-client.c (cal_client_get_events_in_range): Copy the UID
	field from the CORBA structure.

	* main.c (gnome_cal_file_menu): Removed unfinished html-month stuff.

	* Makefile.am (gnomecal_SOURCES): Removed html-month.c.

	* gnome-cal.c: #include "alarm.h"
	(mail_notify): Made static.

	* alarm.h: #include "calobj.h"

	* corba-cal-factory.h (init_corba_server): Fixed prototype.

	* quick-view.c (create_items_for_event): Made static.

	* gncal-todo.c (column_resized): Made static.

	* layout.c (find_index): Made static.

svn path=/trunk/; revision=1699
2000-02-09 08:04:33 +00:00

225 lines
5.9 KiB
C

/*
* Internal representation of a Calendar object. This is modeled after the
* iCalendar/vCalendar specificiation
*
* Authors: Miguel de Icaza (miguel@gnu.org)
* Federico Mena (quartic@gimp.org).
*/
#ifndef CALOBJ_H
#define CALOBJ_H
#include <libgnome/libgnome.h>
#include "../libversit/vcc.h"
BEGIN_GNOME_DECLS
enum AlarmType {
ALARM_MAIL,
ALARM_PROGRAM,
ALARM_DISPLAY,
ALARM_AUDIO
};
enum AlarmUnit {
ALARM_MINUTES,
ALARM_HOURS,
ALARM_DAYS
};
typedef struct {
enum AlarmType type;
int enabled;
int count;
enum AlarmUnit units;
char *data;
/* Does not get saved, internally used */
time_t offset;
time_t trigger;
int snooze_secs;
int snooze_repeat;
/* Widgets */
void *w_count; /* A GtkEntry */
void *w_enabled; /* A GtkChecButton */
void *w_timesel; /* A GtkMenu */
void *w_entry; /* A GnomeEntryFile/GtkEntry for PROGRAM/MAIL */
void *w_label;
} CalendarAlarm;
/* Calendar object type */
typedef enum {
ICAL_EVENT,
ICAL_TODO,
ICAL_JOURNAL,
ICAL_FBREQUEST,
ICAL_FBREPLY,
ICAL_BUSYTIME,
ICAL_TIMEZONE
} iCalType;
/* For keys that might contain binary or text/binary */
typedef struct {
char *data;
int len;
} iCalValue;
typedef enum {
ICAL_PILOT_SYNC_NONE = 0,
ICAL_PILOT_SYNC_MOD = 1,
ICAL_PILOT_SYNC_DEL = 3
} iCalPilotState;
typedef struct {
int valid; /* true if the Geography was specified */
double latitude;
double longitude;
} iCalGeo;
typedef enum {
ICAL_OPAQUE,
ICAL_TRANSPARENT
} iCalTransp;
typedef char NotYet;
enum RecurType {
RECUR_DAILY,
RECUR_WEEKLY,
RECUR_MONTHLY_BY_POS,
RECUR_MONTHLY_BY_DAY,
RECUR_YEARLY_BY_MONTH,
RECUR_YEARLY_BY_DAY,
};
#define DAY_LASTDAY 10000
typedef struct {
enum RecurType type;
int interval;
/* Used for recur computation */
time_t enddate; /* If the value is zero, it is an infinite event
* otherwise, it is either the _enddate value (if
* this is what got specified) or it is our computed
* ending date (computed from the duration item).
*/
int weekday;
union {
int month_pos;
int month_day;
} u;
int duration;
time_t _enddate; /* As found on the vCalendar file */
int __count;
} Recurrence;
#define IS_INFINITE(r) (r->duration == 0)
/* Flags to indicate what has changed in an object */
typedef enum {
CHANGE_NEW = 1 << 0, /* new object */
CHANGE_SUMMARY = 1 << 1, /* summary */
CHANGE_DATES = 1 << 2, /* dtstart / dtend */
CHANGE_ALL = CHANGE_SUMMARY | CHANGE_DATES
} CalObjectChange;
/*
* This describes an iCalendar object, note that we never store durations, instead we
* always compute the end time computed from the start + duration.
*/
typedef struct {
iCalType type;
GList *attach; /* type: one or more URIs or binary data */
GList *attendee; /* type: CAL-ADDRESS */
GList *categories; /* type: one or more TEXT */
char *class;
char *comment; /* we collapse one or more TEXTs into one */
time_t completed;
time_t created;
GList *contact; /* type: one or more TEXT */
time_t dtstamp;
time_t dtstart;
time_t dtend;
GList *exdate; /* type: one or more time_t's */
GList *exrule; /* type: one or more RECUR */
iCalGeo geo;
time_t last_mod;
char *location;
char *organizer;
int percent;
int priority;
char *rstatus; /* request status for freebusy */
GList *related; /* type: one or more TEXT */
GList *resources; /* type: one or more TEXT */
GList *rdate; /* type: one or more recurrence date */
GList *rrule; /* type: one or more recurrence rules */
int seq;
char *status;
char *summary;
iCalTransp transp;
char *uid;
char *url;
time_t recurid;
CalendarAlarm dalarm;
CalendarAlarm aalarm;
CalendarAlarm palarm;
CalendarAlarm malarm;
Recurrence *recur;
int new;
void *user_data; /* Generic data pointer */
/* Pilot */
iCalPilotState pilot_status; /* Status information */
guint32 pilot_id; /* Pilot ID */
} iCalObject;
/* The callback for the recurrence generator */
typedef int (*calendarfn) (iCalObject *, time_t, time_t, void *);
iCalObject *ical_new (char *comment, char *organizer, char *summary);
iCalObject *ical_object_new (void);
iCalObject *ical_object_new_from_string (const char *vcalendar_string);
void ical_object_destroy (iCalObject *ico);
iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name);
VObject *ical_object_to_vobject (iCalObject *ical);
iCalObject *ical_object_duplicate (iCalObject *o);
void ical_foreach (GList *events, calendarfn fn, void *closure);
void ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendarfn cb, void *closure);
void ical_object_add_exdate (iCalObject *o, time_t t);
/* Computes the enddate field of the recurrence based on the duration */
void ical_object_compute_end (iCalObject *ico);
typedef enum {
CAL_OBJ_FIND_SUCCESS,
CAL_OBJ_FIND_SYNTAX_ERROR,
CAL_OBJ_FIND_NOT_FOUND
} CalObjFindStatus;
CalObjFindStatus ical_object_find_in_string (const char *uid, const char *vcalobj, iCalObject **ico);
/* Returns the first toggled day in a weekday mask -- we do this because we do not support multiple
* days on a monthly-by-pos recurrence. If no days are toggled, it returns -1.
*/
int ical_object_get_first_weekday (int weekday_mask);
/* Returns the number of seconds configured to trigger the alarm in advance to an event */
int alarm_compute_offset (CalendarAlarm *a);
END_GNOME_DECLS
#endif