return AUTH_REQUIRED error if we don't get a password from the
authorRodrigo Moya <rodrigo@ximian.com>
Fri, 16 Jan 2004 18:15:14 +0000 (18:15 +0000)
committerRodrigo Moya <rodrigo@src.gnome.org>
Fri, 16 Jan 2004 18:15:14 +0000 (18:15 +0000)
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.

calendar/ChangeLog
calendar/backends/file/e-cal-backend-file.c
calendar/libecal/e-cal.c
calendar/libedata-cal/e-cal-backend-cache.c

index 51985be..6a32f7c 100644 (file)
@@ -1,3 +1,12 @@
+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
index fccc188..3a4f095 100644 (file)
@@ -1626,7 +1626,7 @@ e_cal_backend_file_create_object (ECalBackendSync *backend, EDataCal *cal, const
 
 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;
@@ -1666,7 +1666,7 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, const
        /* 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, &current);
@@ -1685,6 +1685,9 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, const
 
                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));
@@ -1707,7 +1710,10 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, const
 
                        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);
                }
 
@@ -1724,6 +1730,9 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, const
                /* 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 */
@@ -1733,9 +1742,6 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, const
 
        save (cbfile);
 
-       if (old_object)
-               *old_object = e_cal_component_get_as_string (comp);
-
        return GNOME_Evolution_Calendar_Success;
 }
 
index c473150..d8f2a2b 100644 (file)
@@ -1448,6 +1448,10 @@ e_cal_open (ECal *ecal, gboolean only_if_exists, GError **error)
                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);
index 96f5650..a44fe4d 100644 (file)
@@ -364,7 +364,7 @@ GSList *
 e_cal_backend_cache_get_components (ECalBackendCache *cache)
 {
         char *comp_str;
-        GSList *l,*list = NULL;
+        GSList *l, *list = NULL;
        icalcomponent *icalcomp;
        ECalComponent *comp = NULL;
         
@@ -385,7 +385,6 @@ e_cal_backend_cache_get_components (ECalBackendCache *cache)
                 }
                 
         }
+
         return list;
 }
-
-