Fix for bug #53755 (local folders case)
authorJeffrey Stedfast <fejj@ximian.com>
Wed, 4 Feb 2004 20:24:45 +0000 (20:24 +0000)
committerJeffrey Stedfast <fejj@src.gnome.org>
Wed, 4 Feb 2004 20:24:45 +0000 (20:24 +0000)
2004-02-04  Jeffrey Stedfast  <fejj@ximian.com>

Fix for bug #53755 (local folders case)

* providers/local/camel-mbox-store.c (xrename): No longer takes an
exception arg, we just set errno. Our caller can take care of
setting an exception.
(rename_folder): Don't pass an exception to xrename(), we always
overwrote if an error occured it anyway.
(rename_folder): Rename the .sbd as well.

camel/ChangeLog
camel/camel-store.c
camel/providers/local/camel-mbox-store.c

index a1e214a..2a05f97 100644 (file)
@@ -1,3 +1,14 @@
+2004-02-04  Jeffrey Stedfast  <fejj@ximian.com>
+
+       Fix for bug #53755 (local folders case)
+
+       * providers/local/camel-mbox-store.c (xrename): No longer takes an
+       exception arg, we just set errno. Our caller can take care of
+       setting an exception.
+       (rename_folder): Don't pass an exception to xrename(), we always
+       overwrote if an error occured it anyway.
+       (rename_folder): Rename the .sbd as well.
+
 2004-02-04  Not Zed  <NotZed@Ximian.com>
 
        * camel-store.c (camel_store_sync): added 'expunge' parameter,
index 8afd13d..556d8da 100644 (file)
@@ -462,7 +462,7 @@ camel_store_rename_folder (CamelStore *store, const char *old_namein, const char
                        camel_object_unref(folder);
                }
 
-               /* Emit changed signal */
+               /* Emit renamed signal */
                if (store->flags & CAMEL_STORE_SUBSCRIPTIONS)
                        flags |= CAMEL_STORE_FOLDER_INFO_SUBSCRIBED;
                
index 74bf945..6308c70 100644 (file)
@@ -385,7 +385,7 @@ create_folder (CamelStore *store, const char *parent_name, const char *folder_na
 }
 
 static int
-xrename (CamelStore *store, const char *old_name, const char *new_name, const char *ext, gboolean missingok, CamelException *ex)
+xrename (CamelStore *store, const char *old_name, const char *new_name, const char *ext, gboolean missingok)
 {
        const char *toplevel_dir = ((CamelLocalStore *) store)->toplevel_dir;
        char *oldpath, *newpath;
@@ -430,12 +430,6 @@ xrename (CamelStore *store, const char *old_name, const char *new_name, const ch
                ret = -1;
        }
        
-       if (ret == -1) {
-               camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                     _("Could not rename %s to %s: %s"),
-                                     oldpath, newpath, g_strerror (err));
-       }
-       
        g_free (oldpath);
        g_free (newpath);
        
@@ -446,7 +440,7 @@ static void
 rename_folder (CamelStore *store, const char *old, const char *new, CamelException *ex)
 {
        CamelLocalFolder *folder = NULL;
-       char *oldibex, *newibex, *newdir;
+       char *oldibex, *newibex, *newdir, *sbd;
        int errnosav;
        
        if (new[0] == '.' || ignore_file (new, TRUE)) {
@@ -491,12 +485,17 @@ rename_folder (CamelStore *store, const char *old, const char *new, CamelExcepti
                }
        }
        
-       if (xrename (store, old, new, ".ev-summary", TRUE, ex) == -1) {
+       if (xrename (store, old, new, ".ev-summary", TRUE) == -1) {
                errnosav = errno;
                goto summary_failed;
        }
        
-       if (xrename (store, old, new, NULL, FALSE, ex) == -1) {
+       if (xrename (store, old, new, ".sbd", TRUE) == -1) {
+               errnosav = errno;
+               goto subdir_failed;
+       }
+       
+       if (xrename (store, old, new, NULL, FALSE) == -1) {
                errnosav = errno;
                goto base_failed;
        }
@@ -511,7 +510,11 @@ rename_folder (CamelStore *store, const char *old, const char *new, CamelExcepti
        
  base_failed:
        
-       xrename (store, new, old, ".ev-summary", TRUE, ex);
+       xrename (store, new, old, ".ev-summary", TRUE);
+       
+ subdir_failed:
+       
+       xrename (store, new, old, ".sbd", TRUE);
        
  summary_failed:
        
@@ -530,8 +533,8 @@ rename_folder (CamelStore *store, const char *old, const char *new, CamelExcepti
        }
        
        camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                             _("Could not rename '%s': %s"),
-                             old, g_strerror (errnosav));
+                             _("Could not rename '%s' to %s: %s"),
+                             old, new, g_strerror (errnosav));
        
        g_free (newibex);
        g_free (oldibex);