diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2001-06-20 23:21:48 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2001-06-20 23:21:48 +0800 |
commit | d9e3885428ec973fc18995b83daf6a1ad82103f0 (patch) | |
tree | 8401c9b4bce95c2ab4611e23bd20388cf2cf0875 /calendar/pcs | |
parent | d4f63382f5717da28b2f5371662d4c508cccdfac (diff) | |
download | gsoc2013-evolution-d9e3885428ec973fc18995b83daf6a1ad82103f0.tar gsoc2013-evolution-d9e3885428ec973fc18995b83daf6a1ad82103f0.tar.gz gsoc2013-evolution-d9e3885428ec973fc18995b83daf6a1ad82103f0.tar.bz2 gsoc2013-evolution-d9e3885428ec973fc18995b83daf6a1ad82103f0.tar.lz gsoc2013-evolution-d9e3885428ec973fc18995b83daf6a1ad82103f0.tar.xz gsoc2013-evolution-d9e3885428ec973fc18995b83daf6a1ad82103f0.tar.zst gsoc2013-evolution-d9e3885428ec973fc18995b83daf6a1ad82103f0.zip |
added getFreeBusy method
2001-06-20 Rodrigo Moya <rodrigo@ximian.com>
* idl/evolution-calendar.idl: added getFreeBusy method
* pcs/cal.c (impl_Cal_get_free_busy): implementation of the new
getFreeBusy added method
* pcs/cal-backend.[ch]: added new virtual method to the CalBackend
class (get_free_busy)
* pcs/cal-backend-db.c (cal_backend_db_get_free_busy): new function,
not implemented yet
* pcs/cal-backend-file.c (cal_backend_file_get_free_busy): new funtion,
not implemented yet
svn path=/trunk/; revision=10333
Diffstat (limited to 'calendar/pcs')
-rw-r--r-- | calendar/pcs/cal-backend-db.c | 11 | ||||
-rw-r--r-- | calendar/pcs/cal-backend-file.c | 8 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.c | 26 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.h | 3 | ||||
-rw-r--r-- | calendar/pcs/cal.c | 35 |
5 files changed, 83 insertions, 0 deletions
diff --git a/calendar/pcs/cal-backend-db.c b/calendar/pcs/cal-backend-db.c index d4773760f8..785ba98440 100644 --- a/calendar/pcs/cal-backend-db.c +++ b/calendar/pcs/cal-backend-db.c @@ -77,6 +77,9 @@ static GList* cal_backend_db_get_objects_in_range (CalBackend *backend, CalObjType type, time_t start, time_t end); +static GList *cal_backend_db_get_free_busy (CalBackend *backend, + time_t start, + time_t end); static GNOME_Evolution_Calendar_CalObjChangeSeq *cal_backend_db_get_changes ( CalBackend *backend, CalObjType type, const char *change_id); @@ -157,6 +160,7 @@ cal_backend_db_class_init (CalBackendDBClass *klass) backend_class->get_type_by_uid = cal_backend_db_get_type_by_uid; backend_class->get_uids = cal_backend_db_get_uids; backend_class->get_objects_in_range = cal_backend_db_get_objects_in_range; + backend_class->get_free_busy = cal_backend_db_get_free_busy; backend_class->get_changes = cal_backend_db_get_changes; backend_class->get_alarms_in_range = cal_backend_db_get_alarms_in_range; backend_class->get_alarms_for_object = cal_backend_db_get_alarms_for_object; @@ -934,6 +938,13 @@ cal_backend_db_get_objects_in_range (CalBackend *backend, return list; } +/* get_free_busy handler for the DB backend */ +static GList * +cal_backend_db_get_free_busy (CalBackend *backend, time_t start, time_t end) +{ + return NULL; +} + /* get_changes handler for the DB backend */ static GNOME_Evolution_Calendar_CalObjChangeSeq * cal_backend_db_get_changes (CalBackend *backend, CalObjType type, const char *change_id) diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c index 1267f44e3f..d8951571f8 100644 --- a/calendar/pcs/cal-backend-file.c +++ b/calendar/pcs/cal-backend-file.c @@ -77,6 +77,7 @@ static CalObjType cal_backend_file_get_type_by_uid (CalBackend *backend, const c static GList *cal_backend_file_get_uids (CalBackend *backend, CalObjType type); static GList *cal_backend_file_get_objects_in_range (CalBackend *backend, CalObjType type, time_t start, time_t end); +static GList *cal_backend_file_get_free_busy (CalBackend *backend, time_t start, time_t end); static GNOME_Evolution_Calendar_CalObjChangeSeq *cal_backend_file_get_changes ( CalBackend *backend, CalObjType type, const char *change_id); @@ -150,6 +151,7 @@ cal_backend_file_class_init (CalBackendFileClass *class) backend_class->get_type_by_uid = cal_backend_file_get_type_by_uid; backend_class->get_uids = cal_backend_file_get_uids; backend_class->get_objects_in_range = cal_backend_file_get_objects_in_range; + backend_class->get_free_busy = cal_backend_file_get_free_busy; backend_class->get_changes = cal_backend_file_get_changes; backend_class->get_alarms_in_range = cal_backend_file_get_alarms_in_range; backend_class->get_alarms_for_object = cal_backend_file_get_alarms_for_object; @@ -976,6 +978,12 @@ cal_backend_file_get_objects_in_range (CalBackend *backend, CalObjType type, return event_list; } +/* Get_free_busy handler for the file backend */ +static GList * +cal_backend_file_get_free_busy (CalBackend *backend, time_t start, time_t end) +{ + return NULL; +} typedef struct { diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c index 350e6468e4..d72a6fe5e6 100644 --- a/calendar/pcs/cal-backend.c +++ b/calendar/pcs/cal-backend.c @@ -134,11 +134,13 @@ cal_backend_class_init (CalBackendClass *class) class->get_uri = NULL; class->add_cal = NULL; class->open = NULL; + class->is_loaded = NULL; class->get_n_objects = NULL; class->get_object = NULL; class->get_type_by_uid = NULL; class->get_uids = NULL; class->get_objects_in_range = NULL; + class->get_free_busy = NULL; class->get_changes = NULL; class->get_alarms_in_range = NULL; class->get_alarms_for_object = NULL; @@ -326,6 +328,30 @@ cal_backend_get_objects_in_range (CalBackend *backend, CalObjType type, } /** + * cal_backend_get_free_busy: + * @backend: A calendar backend. + * @start: Start time for query. + * @end: End time for query. + * + * Builds a list of unique identifiers corresponding to free/busy calendar + * objects of the that occur or recur within the specified time range. + * + * Return value: A list of UID strings. The list should be freed using the + * cal_obj_uid_list_free() function. + **/ +GList * +cal_backend_get_free_busy (CalBackend *backend, time_t start, time_t end) +{ + g_return_val_if_fail (backend != NULL, NULL); + g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); + g_return_val_if_fail (start != -1 && end != -1, NULL); + g_return_val_if_fail (start <= end, NULL); + + g_assert (CLASS (backend)->get_free_busy != NULL); + return (* CLASS (backend)->get_free_busy) (backend, start, end); +} + +/** * cal_backend_get_changes: * @backend: A calendar backend * @type: Bitmask with types of objects to return. diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h index dab06b21e8..35cddaa492 100644 --- a/calendar/pcs/cal-backend.h +++ b/calendar/pcs/cal-backend.h @@ -88,6 +88,7 @@ struct _CalBackendClass { GList *(* get_objects_in_range) (CalBackend *backend, CalObjType type, time_t start, time_t end); + GList *(* get_free_busy) (CalBackend *backend, time_t start, time_t end); /* Change related virtual methods */ GNOME_Evolution_Calendar_CalObjChangeSeq * (* get_changes) ( @@ -125,6 +126,8 @@ GList *cal_backend_get_uids (CalBackend *backend, CalObjType type); GList *cal_backend_get_objects_in_range (CalBackend *backend, CalObjType type, time_t start, time_t end); +GList *cal_backend_get_free_busy (CalBackend *backend, time_t start, time_t end); + GNOME_Evolution_Calendar_CalObjChangeSeq * cal_backend_get_changes ( CalBackend *backend, CalObjType type, const char *change_id); diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index 42ccbf3cee..3bcc0c1f6b 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -227,6 +227,40 @@ impl_Cal_get_objects_in_range (PortableServer_Servant servant, return seq; } +/* Cal::get_free_busy method */ +static GNOME_Evolution_Calendar_CalObjUIDSeq * +impl_Cal_get_free_busy (PortableServer_Servant servant, + GNOME_Evolution_Calendar_Time_t start, + GNOME_Evolution_Calendar_Time_t end, + CORBA_Environment *ev) +{ + Cal *cal; + CalPrivate *priv; + time_t t_start, t_end; + GNOME_Evolution_Calendar_CalObjUIDSeq *seq; + GList *uids; + + cal = CAL (bonobo_object_from_servant (servant)); + priv = cal->priv; + + t_start = (time_t) start; + t_end = (time_t) end; + + if (t_start > t_end || t_start == -1 || t_end == -1) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_GNOME_Evolution_Calendar_Cal_InvalidRange, + NULL); + return NULL; + } + + uids = cal_backend_get_free_busy (priv->backend, t_start, t_end); + seq = build_uid_seq (uids); + + cal_obj_uid_list_free (uids); + + return seq; +} + /* Cal::get_alarms_in_range method */ static GNOME_Evolution_Calendar_CalComponentAlarmsSeq * impl_Cal_get_alarms_in_range (PortableServer_Servant servant, @@ -503,6 +537,7 @@ cal_class_init (CalClass *klass) epv->getUIDs = impl_Cal_get_uids; epv->getChanges = impl_Cal_get_changes; epv->getObjectsInRange = impl_Cal_get_objects_in_range; + epv->getFreeBusy = impl_Cal_get_free_busy; epv->getAlarmsInRange = impl_Cal_get_alarms_in_range; epv->getAlarmsForObject = impl_Cal_get_alarms_for_object; epv->updateObject = impl_Cal_update_object; |