+2004-01-16 Rodrigo Moya <rodrigo@ximian.com>
+
+ * libecal/e-cal.c (e_cal_open): return AUTH_REQUIRED error if
+ we don't get a password from the authentication function.
+
+ * backends/file/e-cal-backend-file.c
+ (e_cal_backend_file_modify_object): store the old object before
+ actually losing it.
+
2004-01-16 JP Rosevear <jpr@ximian.com>
* libecal/e-cal.c: name space the idle data structs properly
static ECalBackendSyncStatus
e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, const char *calobj,
- CalObjModType mod, char **old_object)
+ CalObjModType mod, char **old_object)
{
ECalBackendFile *cbfile;
ECalBackendFilePrivate *priv;
/* Create the cal component */
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomp);
-
+
/* Set the last modified time on the component */
current = icaltime_from_timet (time (NULL), 0);
e_cal_component_set_last_modified (comp, ¤t);
if (g_hash_table_lookup_extended (obj_data->recurrences, rid,
&real_rid, &recurrence)) {
+ if (old_object)
+ *old_object = e_cal_component_get_as_string (recurrence);
+
/* remove the component from our data */
icalcomponent_remove_component (priv->icalcomp,
e_cal_component_get_icalcomponent (recurrence));
e_cal_backend_notify_object_modified (E_CAL_BACKEND (backend), old, new);
- g_free (old);
+ if (old_object)
+ *old_object = old;
+ else
+ g_free (old);
g_free (new);
}
/* in this case, we blow away all recurrences, and start over
with a clean component */
/* Remove the old version */
+ if (old_object)
+ *old_object = e_cal_component_get_as_string (obj_data->full_object);
+
remove_component (cbfile, obj_data->full_object);
/* Add the new object */
save (cbfile);
- if (old_object)
- *old_object = e_cal_component_get_as_string (comp);
-
return GNOME_Evolution_Calendar_Success;
}
key = e_source_get_uri (priv->source);
password = priv->auth_func (ecal, prompt, key, priv->auth_user_data);
+ if (!password) {
+ g_mutex_unlock (priv->mutex);
+ E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
+ }
g_free (prompt);
g_free (key);