aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/pcs/cal.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-05-12 12:16:46 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2000-05-12 12:16:46 +0800
commit47c9fef15abc15c678e4cde60ee71d741dfe23bf (patch)
tree347e2e2ccc386409e254b6f25c4c94f98a9efafe /calendar/pcs/cal.c
parentd55e9e0406875ffb47f40f57da3c6abaac90734a (diff)
downloadgsoc2013-evolution-47c9fef15abc15c678e4cde60ee71d741dfe23bf.tar.gz
gsoc2013-evolution-47c9fef15abc15c678e4cde60ee71d741dfe23bf.tar.zst
gsoc2013-evolution-47c9fef15abc15c678e4cde60ee71d741dfe23bf.zip
New function to add today's alarms for a single object.
2000-05-11 Federico Mena Quintero <federico@helixcode.com> * 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
Diffstat (limited to 'calendar/pcs/cal.c')
-rw-r--r--calendar/pcs/cal.c53
1 files changed, 48 insertions, 5 deletions
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;