aboutsummaryrefslogtreecommitdiff
path: root/libsylph
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-07-13 08:25:16 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-07-13 08:25:16 +0000
commit174df0c34591a06bef42c9a01b72361a8c8402af (patch)
tree307af3c47a7e317544ab01b53496ca9e06e7ea0d /libsylph
parent45df4ba499e0c859f49a0bc10747bd3a24cfeddb (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
Diffstat (limited to 'libsylph')
-rw-r--r--libsylph/prefs_common.c33
-rw-r--r--libsylph/prefs_common.h4
2 files changed, 36 insertions, 1 deletions
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__ */