aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/pcs
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/pcs')
-rw-r--r--calendar/pcs/cal-backend-file.c13
-rw-r--r--calendar/pcs/cal-backend.c37
-rw-r--r--calendar/pcs/cal-backend.h5
-rw-r--r--calendar/pcs/cal.c20
4 files changed, 68 insertions, 7 deletions
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index 103d2a70c2..81697602d4 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -112,6 +112,10 @@ static GNOME_Evolution_Calendar_CalComponentAlarms *cal_backend_file_get_alarms_
CalBackend *backend, const char *uid,
time_t start, time_t end, gboolean *object_found);
+static CalBackendResult cal_backend_file_discard_alarm (CalBackend *backend,
+ const char *uid,
+ const char *auid);
+
static CalBackendResult cal_backend_file_update_objects (CalBackend *backend,
const char *calobj,
CalObjModType mod);
@@ -199,6 +203,7 @@ cal_backend_file_class_init (CalBackendFileClass *class)
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;
+ backend_class->discard_alarm = cal_backend_file_discard_alarm;
backend_class->update_objects = cal_backend_file_update_objects;
backend_class->remove_object = cal_backend_file_remove_object;
backend_class->send_object = cal_backend_file_send_object;
@@ -1520,6 +1525,14 @@ cal_backend_file_get_alarms_for_object (CalBackend *backend, const char *uid,
return corba_alarms;
}
+/* Discard_alarm handler for the file backend */
+static CalBackendResult
+cal_backend_file_discard_alarm (CalBackend *backend, const char *uid, const char *auid)
+{
+ /* we just do nothing with the alarm */
+ return CAL_BACKEND_RESULT_SUCCESS;
+}
+
/* Creates a CalComponent for the given icalcomponent and adds it to our
cache. Note that the icalcomponent is not added to the toplevel
icalcomponent here. That needs to be done elsewhere. It returns the uid
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
index 22eecadecc..bf974ddc70 100644
--- a/calendar/pcs/cal-backend.c
+++ b/calendar/pcs/cal-backend.c
@@ -193,6 +193,7 @@ cal_backend_class_init (CalBackendClass *class)
class->get_changes = NULL;
class->get_alarms_in_range = NULL;
class->get_alarms_for_object = NULL;
+ class->discard_alarm = NULL;
class->update_objects = NULL;
class->remove_object = NULL;
class->send_object = NULL;
@@ -825,6 +826,30 @@ cal_backend_get_alarms_for_object (CalBackend *backend, const char *uid,
}
/**
+ * cal_backend_discard_alarm
+ * @backend: A calendar backend.
+ * @uid: UID of the component to discard the alarm from.
+ * @auid: Alarm ID.
+ *
+ * Discards an alarm from the given component. This allows the specific backend
+ * to do whatever is needed to really discard the alarm.
+ *
+ * Return value: a #CalBackendResult value, which indicates the
+ * result of the operation.
+ **/
+CalBackendResult
+cal_backend_discard_alarm (CalBackend *backend, const char *uid, const char *auid)
+{
+ g_return_val_if_fail (backend != NULL, CAL_BACKEND_RESULT_NOT_FOUND);
+ g_return_val_if_fail (IS_CAL_BACKEND (backend), CAL_BACKEND_RESULT_NOT_FOUND);
+ g_return_val_if_fail (uid != NULL, CAL_BACKEND_RESULT_NOT_FOUND);
+ g_return_val_if_fail (auid != NULL, CAL_BACKEND_RESULT_NOT_FOUND);
+ g_return_val_if_fail (CLASS (backend)->discard_alarm != NULL, CAL_BACKEND_RESULT_NOT_FOUND);
+
+ return (* CLASS (backend)->discard_alarm) (backend, uid, auid);
+}
+
+/**
* cal_backend_update_objects:
* @backend: A calendar backend.
* @calobj: String representation of the new calendar object(s).
@@ -839,9 +864,9 @@ cal_backend_get_alarms_for_object (CalBackend *backend, const char *uid,
CalBackendResult
cal_backend_update_objects (CalBackend *backend, const char *calobj, CalObjModType mod)
{
- g_return_val_if_fail (backend != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_BACKEND (backend), FALSE);
- g_return_val_if_fail (calobj != NULL, FALSE);
+ g_return_val_if_fail (backend != NULL, CAL_BACKEND_RESULT_NOT_FOUND);
+ g_return_val_if_fail (IS_CAL_BACKEND (backend), CAL_BACKEND_RESULT_NOT_FOUND);
+ g_return_val_if_fail (calobj != NULL, CAL_BACKEND_RESULT_NOT_FOUND);
g_assert (CLASS (backend)->update_objects != NULL);
return (* CLASS (backend)->update_objects) (backend, calobj, mod);
@@ -861,9 +886,9 @@ cal_backend_update_objects (CalBackend *backend, const char *calobj, CalObjModTy
CalBackendResult
cal_backend_remove_object (CalBackend *backend, const char *uid, CalObjModType mod)
{
- g_return_val_if_fail (backend != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_BACKEND (backend), FALSE);
- g_return_val_if_fail (uid != NULL, FALSE);
+ g_return_val_if_fail (backend != NULL, CAL_BACKEND_RESULT_NOT_FOUND);
+ g_return_val_if_fail (IS_CAL_BACKEND (backend), CAL_BACKEND_RESULT_NOT_FOUND);
+ g_return_val_if_fail (uid != NULL, CAL_BACKEND_RESULT_NOT_FOUND);
g_assert (CLASS (backend)->remove_object != NULL);
return (* CLASS (backend)->remove_object) (backend, uid, mod);
diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h
index 962b468fc3..49d8b2d76e 100644
--- a/calendar/pcs/cal-backend.h
+++ b/calendar/pcs/cal-backend.h
@@ -47,7 +47,7 @@ typedef enum {
CAL_BACKEND_OPEN_SUCCESS, /* Loading OK */
CAL_BACKEND_OPEN_ERROR, /* We need better error reporting in libversit */
CAL_BACKEND_OPEN_NOT_FOUND,
- CAL_BACKEND_OPEN_PERMISSION_DENIED
+ CAL_BACKEND_OPEN_PERMISSION_DENIED,
} CalBackendOpenStatus;
/* Update and Remove result values */
@@ -137,6 +137,7 @@ struct _CalBackendClass {
GNOME_Evolution_Calendar_CalComponentAlarms *(* get_alarms_for_object) (
CalBackend *backend, const char *uid,
time_t start, time_t end, gboolean *object_found);
+ CalBackendResult (* discard_alarm) (CalBackend *backend, const char *uid, const char *auid);
/* Object manipulation virtual methods */
CalBackendResult (* update_objects) (CalBackend *backend, const char *calobj, CalObjModType mod);
@@ -210,6 +211,8 @@ GNOME_Evolution_Calendar_CalComponentAlarms *cal_backend_get_alarms_for_object (
time_t start, time_t end,
CalBackendGetAlarmsForObjectResult *result);
+CalBackendResult cal_backend_discard_alarm (CalBackend *backend, const char *uid, const char *auid);
+
CalBackendResult cal_backend_update_objects (CalBackend *backend, const char *calobj, CalObjModType mod);
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c
index bd6ffb4b38..7726540d5a 100644
--- a/calendar/pcs/cal.c
+++ b/calendar/pcs/cal.c
@@ -513,6 +513,25 @@ impl_Cal_getAlarmsForObject (PortableServer_Servant servant,
}
}
+/* Cal::discardAlarm method */
+static void
+impl_Cal_discardAlarm (PortableServer_Servant servant,
+ const CORBA_char *uid,
+ const CORBA_char *auid,
+ CORBA_Environment *ev)
+{
+ Cal *cal;
+ CalPrivate *priv;
+ CalBackendResult result;
+
+ cal = CAL (bonobo_object_from_servant (servant));
+ priv = cal->priv;
+
+ result = cal_backend_discard_alarm (priv->backend, uid, auid);
+ if (result == CAL_BACKEND_RESULT_NOT_FOUND)
+ bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_NotFound);
+}
+
/* Cal::updateObjects method */
static void
impl_Cal_updateObjects (PortableServer_Servant servant,
@@ -855,6 +874,7 @@ cal_class_init (CalClass *klass)
epv->getFreeBusy = impl_Cal_getFreeBusy;
epv->getAlarmsInRange = impl_Cal_getAlarmsInRange;
epv->getAlarmsForObject = impl_Cal_getAlarmsForObject;
+ epv->discardAlarm = impl_Cal_discardAlarm;
epv->updateObjects = impl_Cal_updateObjects;
epv->removeObject = impl_Cal_removeObject;
epv->sendObject = impl_Cal_sendObject;