Bug #620382 - Do not delete also directory for custom local calendars
authorMilan Crha <mcrha@redhat.com>
Fri, 30 Sep 2011 12:37:45 +0000 (14:37 +0200)
committerMilan Crha <mcrha@redhat.com>
Fri, 30 Sep 2011 12:37:45 +0000 (14:37 +0200)
calendar/backends/file/e-cal-backend-file.c

index 5f39c6f..0c59542 100644 (file)
@@ -1361,6 +1361,7 @@ e_cal_backend_file_remove (ECalBackendSync *backend,
 {
        ECalBackendFile *cbfile;
        ECalBackendFilePrivate *priv;
+       ESource *source;
        gchar *str_uri = NULL, *dirname = NULL;
        gchar *full_path = NULL;
        const gchar *fname;
@@ -1378,6 +1379,12 @@ e_cal_backend_file_remove (ECalBackendSync *backend,
                goto done;
        }
 
+       source = e_backend_get_source (E_BACKEND (backend));
+       if (!source || e_source_get_property (source, "custom-file")) {
+               /* skip file and directory removal for custom calendars */
+               goto done;
+       }
+
        if (g_access (str_uri, W_OK) != 0) {
                err = EDC_ERROR (PermissionDenied);
                goto done;