diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2007-07-13 08:25:16 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2007-07-13 08:25:16 +0000 |
commit | 174df0c34591a06bef42c9a01b72361a8c8402af (patch) | |
tree | 307af3c47a7e317544ab01b53496ca9e06e7ea0d | |
parent | 45df4ba499e0c859f49a0bc10747bd3a24cfeddb (diff) |
also update junk folder path when a folder is renamed.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1864 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ChangeLog.ja | 7 | ||||
-rw-r--r-- | libsylph/prefs_common.c | 33 | ||||
-rw-r--r-- | libsylph/prefs_common.h | 4 | ||||
-rw-r--r-- | src/folderview.c | 10 |
5 files changed, 58 insertions, 3 deletions
@@ -1,5 +1,12 @@ 2007-07-13 + * libsylph/prefs_common.[ch]: prefs_common_junk_folder_rename_path(): + added. + * src/folderview.c: also update junk folder path when a folder is + renamed. + +2007-07-13 + * libsylph/filter.c: filter_rule_rename_dest_path() filter_rule_delete_action_by_dest_path(): fixed path separator (win32: fixes renaming of folder didn't modify filter actions). diff --git a/ChangeLog.ja b/ChangeLog.ja index 0b849f18..99aa3c12 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,12 @@ 2007-07-13 + * libsylph/prefs_common.[ch]: prefs_common_junk_folder_rename_path(): + 追加。 + * src/folderview.c: フォルダが名称変更された場合は迷惑メールフォルダ + のパスも更新するようにした。 + +2007-07-13 + * libsylph/filter.c: filter_rule_rename_dest_path() filter_rule_delete_action_by_dest_path(): パスセパレータを修正 (win32: フォルダの名称変更でフィルタアクションが修正されないバグを diff --git a/libsylph/prefs_common.c b/libsylph/prefs_common.c index b00e7620..86da293a 100644 --- a/libsylph/prefs_common.c +++ b/libsylph/prefs_common.c @@ -540,3 +540,36 @@ void prefs_common_junk_filter_list_set(void) rule = prefs_common_junk_filter_rule_create(TRUE); prefs_common.manual_junk_fltlist = g_slist_append(NULL, rule); } + +void prefs_common_junk_folder_rename_path(const gchar *old_path, + const gchar *new_path) +{ + gint len; + gchar *base; + gchar *dest_path; + + g_return_if_fail(old_path != NULL); + g_return_if_fail(new_path != NULL); + + if (!prefs_common.junk_folder) + return; + + len = strlen(prefs_common.junk_folder); + + if (!strncmp(old_path, prefs_common.junk_folder, len)) { + base = prefs_common.junk_folder + len; + if (*base != '/' && *base != '\0') + return; + while (*base == '/') base++; + if (*base == '\0') + dest_path = g_strdup(new_path); + else + dest_path = g_strconcat(new_path, "/", base, NULL); + debug_print("prefs_common_junk_folder_rename_path(): " + "renaming %s -> %s\n", prefs_common.junk_folder, + dest_path); + g_free(prefs_common.junk_folder); + prefs_common.junk_folder = dest_path; + prefs_common_junk_filter_list_set(); + } +} diff --git a/libsylph/prefs_common.h b/libsylph/prefs_common.h index 52812454..279d4a46 100644 --- a/libsylph/prefs_common.h +++ b/libsylph/prefs_common.h @@ -298,6 +298,8 @@ PrefParam *prefs_common_get_params (void); void prefs_common_read_config (void); void prefs_common_write_config (void); -void prefs_common_junk_filter_list_set (void); +void prefs_common_junk_filter_list_set (void); +void prefs_common_junk_folder_rename_path (const gchar *old_path, + const gchar *new_path); #endif /* __PREFS_COMMON_H__ */ diff --git a/src/folderview.c b/src/folderview.c index 94c9d9b4..b777ae6e 100644 --- a/src/folderview.c +++ b/src/folderview.c @@ -2343,10 +2343,13 @@ static void folderview_rename_folder_cb(FolderView *folderview, guint action, return; } - if (folder_get_default_folder() == item->folder) + if (folder_get_default_folder() == item->folder) { filter_list_rename_path(old_path, item->path); + prefs_common_junk_folder_rename_path(old_path, item->path); + } new_id = folder_item_get_identifier(item); filter_list_rename_path(old_id, new_id); + prefs_common_junk_folder_rename_path(old_id, new_id); g_free(old_id); g_free(new_id); @@ -2413,10 +2416,13 @@ static void folderview_move_folder_cb(FolderView *folderview, guint action, return; } - if (folder_get_default_folder() == item->folder) + if (folder_get_default_folder() == item->folder) { filter_list_rename_path(old_path, item->path); + prefs_common_junk_folder_rename_path(old_path, item->path); + } new_id = folder_item_get_identifier(item); filter_list_rename_path(old_id, new_id); + prefs_common_junk_folder_rename_path(old_id, new_id); g_free(new_id); g_free(old_id); g_free(old_path); |