2006-01-16 [colin] 1.9.100cvs160
authorColin Leroy <colin@colino.net>
Mon, 16 Jan 2006 10:43:57 +0000 (10:43 +0000)
committerColin Leroy <colin@colino.net>
Mon, 16 Jan 2006 10:43:57 +0000 (10:43 +0000)
* src/account.c
* src/account.h
* src/folder.c
* src/imap_gtk.c
* src/mh_gtk.c
Fix bug #883 (default inbox does not track folder move)

ChangeLog
PATCHSETS
configure.ac
src/account.c
src/account.h
src/folder.c
src/imap_gtk.c
src/mh_gtk.c

index 267937e..e89e238 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-01-16 [colin]     1.9.100cvs160
+
+       * src/account.c
+       * src/account.h
+       * src/folder.c
+       * src/imap_gtk.c
+       * src/mh_gtk.c
+               Fix bug #883 (default inbox does not track folder move)
+
 2006-01-16 [colin]     1.9.100cvs159
 
        * src/compose.c
index 3cf09c4..a13d5d2 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.60.2.45 -r 1.60.2.46 src/addressbook.c;  cvs diff -u -r 1.59.2.31 -r 1.59.2.32 src/prefs_filtering.c;  ) > 1.9.100cvs157.patchset
 ( cvs diff -u -r 1.60.2.31 -r 1.60.2.32 src/prefs_actions.c;  cvs diff -u -r 1.1.4.23 -r 1.1.4.24 src/prefs_filtering_action.c;  cvs diff -u -r 1.43.2.33 -r 1.43.2.34 src/prefs_matcher.c;  cvs diff -u -r 1.8.2.5 -r 1.8.2.6 src/quote_fmt.c;  cvs diff -u -r 1.5.2.16 -r 1.5.2.17 src/gtk/description_window.c;  cvs diff -u -r 1.1.4.3 -r 1.1.4.4 src/gtk/description_window.h;  cvs diff -u -r 1.1.2.29 -r 1.1.2.30 src/gtk/quicksearch.c;  ) > 1.9.100cvs158.patchset
 ( cvs diff -u -r 1.382.2.222 -r 1.382.2.223 src/compose.c;  cvs diff -u -r 1.1.2.10 -r 1.1.2.11 src/plugins/pgpcore/passphrase.c;  ) > 1.9.100cvs159.patchset
+( cvs diff -u -r 1.61.2.44 -r 1.61.2.45 src/account.c;  cvs diff -u -r 1.11.2.4 -r 1.11.2.5 src/account.h;  cvs diff -u -r 1.213.2.76 -r 1.213.2.77 src/folder.c;  cvs diff -u -r 1.1.2.28 -r 1.1.2.29 src/imap_gtk.c;  cvs diff -u -r 1.2.2.19 -r 1.2.2.20 src/mh_gtk.c;  ) > 1.9.100cvs160.patchset
index 0aaa781..907ad48 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=100
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=159
+EXTRA_VERSION=160
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 0184e37..1f6b235 100644 (file)
@@ -516,6 +516,37 @@ void account_set_missing_folder(void)
        }
 }
 
+#define CHECK_CHANGE_FOLDER(folder) {                                          \
+       if (folder && !strncmp(folder, old_id, strlen(old_id))) {               \
+               if (strlen(folder) == strlen(old_id)) {                         \
+                       g_free(folder);                                         \
+                       folder = g_strdup(new_id);                              \
+               } else if (strlen(folder) > strlen(old_id)                      \
+                 && folder[strlen(old_id)] == G_DIR_SEPARATOR) {               \
+                       gchar *new_path = g_strdup_printf("%s%s",               \
+                                       new_id, (folder + strlen(old_id)));     \
+                       g_free(folder);                                         \
+                       folder = new_path;                                      \
+               }                                                               \
+       }                                                                       \
+}
+
+void account_rename_path(const gchar *old_id, const gchar *new_id)
+{
+       GList *cur = account_list;
+       for (; cur != NULL; cur = g_list_next(cur)) {
+               PrefsAccount *ap = (PrefsAccount *)cur->data;
+               CHECK_CHANGE_FOLDER(ap->inbox);
+               CHECK_CHANGE_FOLDER(ap->local_inbox);
+               CHECK_CHANGE_FOLDER(ap->queue_folder);
+               CHECK_CHANGE_FOLDER(ap->sent_folder);
+               CHECK_CHANGE_FOLDER(ap->draft_folder);
+               CHECK_CHANGE_FOLDER(ap->trash_folder);
+       }
+}
+
+#undef CHECK_CHANGE_FOLDER
+
 FolderItem *account_get_special_folder(PrefsAccount *ac_prefs,
                                       SpecialFolderItemType type)
 {
index dc902e2..5264b55 100644 (file)
@@ -63,5 +63,7 @@ FolderItem   *account_get_special_folder(PrefsAccount         *ac_prefs,
 void         account_destroy           (PrefsAccount   *ac_prefs);
 PrefsAccount *account_get_reply_account        (MsgInfo        *msginfo, 
                                         gboolean        reply_autosel);
+void         account_rename_path       (const gchar    *old_id, 
+                                        const gchar    *new_id);
 
 #endif /* __ACCOUNT_H__ */
index 3f9b80c..586e4fb 100644 (file)
@@ -2661,8 +2661,10 @@ FolderItem *folder_item_move_recursive(FolderItem *src, FolderItem *dest)
                src->folder->klass->remove_folder(src->folder, src);
        folder_write_list();
 
-       if (old_id != NULL && new_id != NULL)
+       if (old_id != NULL && new_id != NULL) {
                prefs_filtering_rename_path(old_id, new_id);
+               account_rename_path(old_id, new_id);
+       }
        g_free(old_id);
        g_free(new_id);
        
index b7f36ff..80e79d3 100644 (file)
@@ -219,6 +219,7 @@ static void rename_folder_cb(FolderView *folderview, guint action,
                prefs_filtering_rename_path(old_path, item->path); */
        new_id = folder_item_get_identifier(item);
        prefs_filtering_rename_path(old_id, new_id);
+       account_rename_path(old_id, new_id);
 
        g_free(old_id);
        g_free(new_id);
index 906f28c..b8444d0 100644 (file)
@@ -262,7 +262,7 @@ static void rename_folder_cb(FolderView *folderview, guint action,
                prefs_filtering_rename_path(old_path, item->path); */
        new_id = folder_item_get_identifier(item);
        prefs_filtering_rename_path(old_id, new_id);
-
+       account_rename_path(old_id, new_id);
        g_free(old_id);
        g_free(new_id);