aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-client
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/cal-client
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/cal-client')
-rw-r--r--calendar/cal-client/cal-client.c59
-rw-r--r--calendar/cal-client/cal-client.h4
2 files changed, 63 insertions, 0 deletions
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index 2e83345d27..97dda85acb 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -825,6 +825,65 @@ cal_client_get_alarms_in_range (CalClient *client, time_t start, time_t end)
}
/**
+ * cal_client_get_alarms_for_object:
+ * @client: A calendar client.
+ * @uid: Unique identifier for a calendar object.
+ * @start: Start time for query.
+ * @end: End time for query.
+ * @alarms: Return value for the list of alarm instances.
+ *
+ * Queries a calendar for the alarms of a particular object that trigger in the
+ * specified range of time.
+ *
+ * Return value: TRUE on success, FALSE if the object was not found.
+ **/
+gboolean
+cal_client_get_alarms_for_object (CalClient *client, const char *uid,
+ time_t start, time_t end,
+ GList **alarms)
+{
+ CalClientPrivate *priv;
+ CORBA_Environment ev;
+ Evolution_Calendar_CalAlarmInstanceSeq *seq;
+ gboolean retval;
+
+ g_return_val_if_fail (client != NULL, FALSE);
+ g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
+
+ priv = client->priv;
+ if (priv->load_state != LOAD_STATE_LOADED)
+ return FALSE;
+
+ g_return_val_if_fail (uid != NULL, FALSE);
+ g_return_val_if_fail (start != -1 && end != -1, FALSE);
+ g_return_val_if_fail (start <= end, FALSE);
+ g_return_val_if_fail (alarms != NULL, FALSE);
+
+ *alarms = NULL;
+ retval = FALSE;
+
+ CORBA_exception_init (&ev);
+
+ seq = Evolution_Calendar_Cal_get_alarms_for_object (priv->cal, uid, start, end, &ev);
+ if (ev._major == CORBA_USER_EXCEPTION
+ && strcmp (CORBA_exception_id (&ev), ex_Evolution_Calendar_Cal_NotFound) == 0)
+ goto out;
+ else if (ev._major != CORBA_NO_EXCEPTION) {
+ g_message ("cal_client_get_alarms_for_object(): could not get the alarm range");
+ goto out;
+ }
+
+ retval = TRUE;
+ *alarms = build_alarm_instance_list (seq);
+ CORBA_free (seq);
+
+ out:
+ CORBA_exception_free (&ev);
+ return retval;
+
+}
+
+/**
* cal_client_update_object:
* @client: A calendar client.
* @uid: Unique identifier of object to update.
diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h
index 5bb672229d..12cbcc7c87 100644
--- a/calendar/cal-client/cal-client.h
+++ b/calendar/cal-client/cal-client.h
@@ -82,6 +82,10 @@ GList *cal_client_get_events_in_range (CalClient *client, time_t start, time_t e
GList *cal_client_get_alarms_in_range (CalClient *client, time_t start, time_t end);
+gboolean cal_client_get_alarms_for_object (CalClient *client, const char *uid,
+ time_t start, time_t end,
+ GList **alarms);
+
gboolean cal_client_update_object (CalClient *client, const char *uid, const char *calobj);
gboolean cal_client_remove_object (CalClient *client, const char *uid);