diff options
Diffstat (limited to 'calendar/pcs')
-rw-r--r-- | calendar/pcs/cal-backend-file.c | 16 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.c | 14 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.h | 4 | ||||
-rw-r--r-- | calendar/pcs/cal.c | 13 |
4 files changed, 21 insertions, 26 deletions
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c index 967b2d4520..c906b09ffd 100644 --- a/calendar/pcs/cal-backend-file.c +++ b/calendar/pcs/cal-backend-file.c @@ -89,8 +89,7 @@ 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 gboolean cal_backend_file_update_object (CalBackend *backend, const char *uid, - const char *calobj); +static gboolean cal_backend_file_update_objects (CalBackend *backend, const char *calobj); static gboolean cal_backend_file_remove_object (CalBackend *backend, const char *uid); static icaltimezone* cal_backend_file_get_timezone (CalBackend *backend, const char *tzid); @@ -159,7 +158,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->update_object = cal_backend_file_update_object; + backend_class->update_objects = cal_backend_file_update_objects; backend_class->remove_object = cal_backend_file_remove_object; backend_class->get_timezone = cal_backend_file_get_timezone; @@ -1635,9 +1634,9 @@ notify_remove (CalBackendFile *cbfile, const char *uid) } } -/* Update_object handler for the file backend */ +/* Update_objects handler for the file backend. */ static gboolean -cal_backend_file_update_object (CalBackend *backend, const char *uid, const char *calobj) +cal_backend_file_update_objects (CalBackend *backend, const char *calobj) { CalBackendFile *cbfile; CalBackendFilePrivate *priv; @@ -1652,7 +1651,6 @@ cal_backend_file_update_object (CalBackend *backend, const char *uid, const char g_return_val_if_fail (priv->icalcomp != NULL, FALSE); - g_return_val_if_fail (uid != NULL, FALSE); g_return_val_if_fail (calobj != NULL, FALSE); /* Pull the component from the string and ensure that it is sane */ @@ -1714,18 +1712,18 @@ cal_backend_file_update_object (CalBackend *backend, const char *uid, const char return FALSE; } - /* Check the UID for sanity's sake */ + /* Get the UID, and check it isn't empty. */ cal_component_get_uid (comp, &comp_uid); - if (strcmp (uid, comp_uid) != 0) { + if (!comp_uid || !comp_uid[0]) { gtk_object_unref (GTK_OBJECT (comp)); return FALSE; } /* Update the component */ - old_comp = lookup_component (cbfile, uid); + old_comp = lookup_component (cbfile, comp_uid); if (old_comp) remove_component (cbfile, old_comp); diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c index 1ca13028a9..ad56462565 100644 --- a/calendar/pcs/cal-backend.c +++ b/calendar/pcs/cal-backend.c @@ -146,7 +146,7 @@ cal_backend_class_init (CalBackendClass *class) class->get_changes = NULL; class->get_alarms_in_range = NULL; class->get_alarms_for_object = NULL; - class->update_object = NULL; + class->update_objects = NULL; class->remove_object = NULL; } @@ -471,10 +471,9 @@ cal_backend_get_alarms_for_object (CalBackend *backend, const char *uid, } /** - * cal_backend_update_object: + * cal_backend_update_objects: * @backend: A calendar backend. - * @uid: Unique identifier of the object to update. - * @calobj: String representation of the new calendar object. + * @calobj: String representation of the new calendar object(s). * * Updates an object in a calendar backend. It will replace any existing * object that has the same UID as the specified one. The backend will in @@ -484,15 +483,14 @@ cal_backend_get_alarms_for_object (CalBackend *backend, const char *uid, * with an unsupported type. **/ gboolean -cal_backend_update_object (CalBackend *backend, const char *uid, const char *calobj) +cal_backend_update_objects (CalBackend *backend, const char *calobj) { 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 (calobj != NULL, FALSE); - g_assert (CLASS (backend)->update_object != NULL); - return (* CLASS (backend)->update_object) (backend, uid, calobj); + g_assert (CLASS (backend)->update_objects != NULL); + return (* CLASS (backend)->update_objects) (backend, calobj); } /** diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h index 568ae45034..a1ba2af4c2 100644 --- a/calendar/pcs/cal-backend.h +++ b/calendar/pcs/cal-backend.h @@ -104,7 +104,7 @@ struct _CalBackendClass { time_t start, time_t end, gboolean *object_found); /* Object manipulation virtual methods */ - gboolean (* update_object) (CalBackend *backend, const char *uid, const char *calobj); + gboolean (* update_objects) (CalBackend *backend, const char *calobj); gboolean (* remove_object) (CalBackend *backend, const char *uid); /* Timezone related virtual methods */ @@ -147,7 +147,7 @@ GNOME_Evolution_Calendar_CalComponentAlarms *cal_backend_get_alarms_for_object ( CalBackendGetAlarmsForObjectResult *result); -gboolean cal_backend_update_object (CalBackend *backend, const char *uid, const char *calobj); +gboolean cal_backend_update_objects (CalBackend *backend, const char *calobj); gboolean cal_backend_remove_object (CalBackend *backend, const char *uid); diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index 9cd5b5b219..f89d5c820f 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -347,12 +347,11 @@ impl_Cal_get_alarms_for_object (PortableServer_Servant servant, } } -/* Cal::update_object method */ +/* Cal::update_objects method */ static void -impl_Cal_update_object (PortableServer_Servant servant, - const GNOME_Evolution_Calendar_CalObjUID uid, - const GNOME_Evolution_Calendar_CalObj calobj, - CORBA_Environment *ev) +impl_Cal_update_objects (PortableServer_Servant servant, + const GNOME_Evolution_Calendar_CalObj calobj, + CORBA_Environment *ev) { Cal *cal; CalPrivate *priv; @@ -360,7 +359,7 @@ impl_Cal_update_object (PortableServer_Servant servant, cal = CAL (bonobo_object_from_servant (servant)); priv = cal->priv; - if (!cal_backend_update_object (priv->backend, uid, calobj)) + if (!cal_backend_update_objects (priv->backend, calobj)) CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Calendar_Cal_InvalidObject, NULL); @@ -592,7 +591,7 @@ cal_class_init (CalClass *klass) epv->getFreeBusy = impl_Cal_get_free_busy; epv->getAlarmsInRange = impl_Cal_get_alarms_in_range; epv->getAlarmsForObject = impl_Cal_get_alarms_for_object; - epv->updateObject = impl_Cal_update_object; + epv->updateObjects = impl_Cal_update_objects; epv->removeObject = impl_Cal_remove_object; epv->getQuery = impl_Cal_get_query; } |