From da12dd29a85fae5e4ebaffcfb9c40fa6068ec55d Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Sat, 26 Apr 2003 16:44:49 +0000 Subject: Fixes #41661 2003-04-24 Rodrigo Moya Fixes #41661 * idl/evolution-calendar.idl: added discardAlarm method to GNOME:Evolution:Calendar:Cal interface. * pcs/cal.c (cal_class_init): set new epv's method. (impl_Cal_discardAlarm): implementation of new CORBA method. * pcs/cal-backend.[ch]: added 'discard_alarm' virtual method, and CAL_BACKEND_RESULT_NOT_IMPLEMENTED to CalBackendResult enum. (cal_backend_class_init): initialize new class method. (cal_backend_discard_alarm): new method. (cal_backend_update_objects, cal_backend_remove_object): return proper CalBackendResult values. * pcs/cal-backend-file.c (cal_backend_file_class_init): initialize new class method. (cal_backend_file_discard_alarm): implementation of new method. * pcs/cal-client.[ch] (cal_client_discard_alarm): new function. * gui/alarm-notify/alarm-queue.c (remove_qeueud_alarm): don't remove the alarm directly from the component, call cal_client_discard_alarm and let the backend deal with it. svn path=/trunk/; revision=20973 --- calendar/cal-client/cal-client.c | 41 ++++++++++++++++++++++++++++++++++++++++ calendar/cal-client/cal-client.h | 2 ++ 2 files changed, 43 insertions(+) (limited to 'calendar/cal-client') diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index fc90c2a459..539d490a36 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -2486,6 +2486,47 @@ cal_client_get_alarms_for_object (CalClient *client, const char *uid, return retval; } +/** + * cal_client_discard_alarm + * @client: A calendar client. + * @comp: The component to discard the alarm from. + * @auid: Unique identifier of the alarm to be discarded. + * + * Tells the calendar backend to get rid of the alarm identified by the + * @auid argument in @comp. Some backends might remove the alarm or + * update internal information about the alarm be discarded, or, like + * the file backend does, ignore the operation. + * + * Return value: a #CalClientResult value indicating the result of the + * operation. + */ +CalClientResult +cal_client_discard_alarm (CalClient *client, CalComponent *comp, const char *auid) +{ + CalClientPrivate *priv; + CalClientResult retval; + CORBA_Environment ev; + const char *uid; + + g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_RESULT_NOT_FOUND); + g_return_val_if_fail (IS_CAL_COMPONENT (comp), CAL_CLIENT_RESULT_NOT_FOUND); + g_return_val_if_fail (auid != NULL, CAL_CLIENT_RESULT_NOT_FOUND); + + cal_component_get_uid (comp, &uid); + + CORBA_exception_init (&ev); + GNOME_Evolution_Calendar_Cal_discardAlarm (priv->cal, uid, auid, &ev); + if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_NotFound)) + retval = CAL_CLIENT_RESULT_NOT_FOUND; + else if (BONOBO_EX (&ev)) + retval = CAL_CLIENT_RESULT_CORBA_ERROR; + else + retval = CAL_CLIENT_RESULT_SUCCESS; + + CORBA_exception_free (&ev); + return retval; +} + typedef struct _ForeachTZIDCallbackData ForeachTZIDCallbackData; struct _ForeachTZIDCallbackData { CalClient *client; diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h index e44014b9be..556049f831 100644 --- a/calendar/cal-client/cal-client.h +++ b/calendar/cal-client/cal-client.h @@ -200,6 +200,8 @@ gboolean cal_client_get_alarms_for_object (CalClient *client, const char *uid, time_t start, time_t end, CalComponentAlarms **alarms); +CalClientResult cal_client_discard_alarm (CalClient *client, CalComponent *comp, const char *auid); + /* Add or update a single object. When adding an object only builtin timezones are allowed. To use external VTIMEZONE data call update_objects() instead.*/ CalClientResult cal_client_update_object (CalClient *client, CalComponent *comp); -- cgit