From 47c9fef15abc15c678e4cde60ee71d741dfe23bf Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 12 May 2000 04:16:46 +0000 Subject: New function to add today's alarms for a single object. 2000-05-11 Federico Mena Quintero * gui/gnome-cal.c (add_alarms_for_object): New function to add today's alarms for a single object. (gnome_calendar_object_updated_cb): Update the object's alarms. * idl/evolution-calendar.idl (Cal): Added a get_alarms_for_object() method. * pcs/cal.c (Cal_get_alarms_for_object): Implemented method. * pcs/cal-backend.c (cal_backend_get_alarms_for_object): New function. * pcs/cal-backend-imc.c (cal_backend_imc_get_alarms_for_object): Implemented. * cal-client/cal-client.c (cal_client_get_alarms_for_object): New function. svn path=/trunk/; revision=3003 --- calendar/pcs/cal.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 5 deletions(-) (limited to 'calendar/pcs/cal.c') diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index 8fc1de51b2..13fab067f8 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -201,7 +201,7 @@ Cal_get_object (PortableServer_Servant servant, /* Cal::get_uids method */ static Evolution_Calendar_CalObjUIDSeq * Cal_get_uids (PortableServer_Servant servant, - const Evolution_Calendar_CalObjType type, + Evolution_Calendar_CalObjType type, CORBA_Environment *ev) { Cal *cal; @@ -287,8 +287,8 @@ build_object_instance_seq (GList *list) /* Cal::get_events_in_range method */ static Evolution_Calendar_CalObjInstanceSeq * Cal_get_events_in_range (PortableServer_Servant servant, - const Evolution_Calendar_Time_t start, - const Evolution_Calendar_Time_t end, + Evolution_Calendar_Time_t start, + Evolution_Calendar_Time_t end, CORBA_Environment *ev) { Cal *cal; @@ -378,8 +378,8 @@ build_alarm_instance_seq (GList *alarms) /* Cal::get_alarms_in_range method */ static Evolution_Calendar_CalAlarmInstanceSeq * Cal_get_alarms_in_range (PortableServer_Servant servant, - const Evolution_Calendar_Time_t start, - const Evolution_Calendar_Time_t end, + Evolution_Calendar_Time_t start, + Evolution_Calendar_Time_t end, CORBA_Environment *ev) { Cal *cal; @@ -410,6 +410,48 @@ Cal_get_alarms_in_range (PortableServer_Servant servant, return seq; } +/* Cal::get_alarms_for_object method */ +static Evolution_Calendar_CalAlarmInstanceSeq * +Cal_get_alarms_for_object (PortableServer_Servant servant, + const Evolution_Calendar_CalObjUID uid, + Evolution_Calendar_Time_t start, + Evolution_Calendar_Time_t end, + CORBA_Environment *ev) +{ + Cal *cal; + CalPrivate *priv; + time_t t_start, t_end; + Evolution_Calendar_CalAlarmInstanceSeq *seq; + GList *alarms; + gboolean result; + + 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_Evolution_Calendar_Cal_InvalidRange, + NULL); + return NULL; + } + + result = cal_backend_get_alarms_for_object (priv->backend, uid, t_start, t_end, &alarms); + if (!result) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_Evolution_Calendar_Cal_NotFound, + NULL); + return NULL; + } + + seq = build_alarm_instance_seq (alarms); + cal_alarm_instance_list_free (alarms); + + return seq; +} + /* Cal::update_object method */ static void Cal_update_object (PortableServer_Servant servant, @@ -466,6 +508,7 @@ cal_get_epv (void) epv->get_uids = Cal_get_uids; epv->get_events_in_range = Cal_get_events_in_range; epv->get_alarms_in_range = Cal_get_alarms_in_range; + epv->get_alarms_for_object = Cal_get_alarms_for_object; epv->update_object = Cal_update_object; epv->remove_object = Cal_remove_object; -- cgit