aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-01-20 10:48:53 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-01-20 10:48:53 +0000
commit213dad2c099e381de87461c1e753bc6a4b83ac36 (patch)
tree9c987b078eaea764ec3eb4d1f53bad53459a64d4
parenta5fddd5b417a3aff4e4f1771a45763c280df0823 (diff)
also migrate templates.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@25 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.ja6
-rw-r--r--src/codeconv.c35
-rw-r--r--src/codeconv.h3
-rw-r--r--src/main.c3
5 files changed, 53 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 490122a4..0e8b3d4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2005-01-20
+ * src/codeconv.[ch]: conv_copy_dir(): copy directory contents with
+ code conversion.
+ * src/main.c: migrate_old_config(): migrate templates.
+
+2005-01-20
+
* src/action.c: convert locale strings to UTF-8 before displaying
it (thanks to Alfons).
diff --git a/ChangeLog.ja b/ChangeLog.ja
index e94c1b17..a653e965 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,11 @@
2005-01-20
+ * src/codeconv.[ch]: conv_copy_dir(): コード変換してディレクトリの
+ 内容をコピー。
+ * src/main.c: migrate_old_config(): テンプレートを移行。
+
+2005-01-20
+
* src/action.c: 表示する前に locale 文字列を UTF-8 に変換するように
した(Alfons さん thanks)。
diff --git a/src/codeconv.c b/src/codeconv.c
index 3502f1d3..28659b2f 100644
--- a/src/codeconv.c
+++ b/src/codeconv.c
@@ -1812,3 +1812,38 @@ gint conv_copy_file(const gchar *src, const gchar *dest, const gchar *encoding)
return 0;
}
+
+gint conv_copy_dir(const gchar *src, const gchar *dest, const gchar *encoding)
+{
+ DIR *dp;
+ struct dirent *d;
+ gchar *src_file;
+ gchar *dest_file;
+
+ if ((dp = opendir(src)) == NULL) {
+ FILE_OP_ERROR(src, "opendir");
+ return -1;
+ }
+
+ if (make_dir_hier(dest) < 0) {
+ closedir(dp);
+ return -1;
+ }
+
+ while ((d = readdir(dp)) != NULL) {
+ if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
+ continue;
+
+ src_file = g_strconcat(src, G_DIR_SEPARATOR_S, d->d_name, NULL);
+ dest_file = g_strconcat(dest, G_DIR_SEPARATOR_S, d->d_name,
+ NULL);
+ if (is_file_exist(src_file))
+ conv_copy_file(src_file, dest_file, encoding);
+ g_free(dest_file);
+ g_free(src_file);
+ }
+
+ closedir(dp);
+
+ return 0;
+}
diff --git a/src/codeconv.h b/src/codeconv.h
index 2c1ff3c7..7f3fee8c 100644
--- a/src/codeconv.h
+++ b/src/codeconv.h
@@ -240,5 +240,8 @@ void conv_encode_header (gchar *dest,
gint conv_copy_file (const gchar *src,
const gchar *dest,
const gchar *src_encoding);
+gint conv_copy_dir (const gchar *src,
+ const gchar *dest,
+ const gchar *src_encoding);
#endif /* __CODECONV_H__ */
diff --git a/src/main.c b/src/main.c
index 45112282..65a755a4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -722,6 +722,9 @@ static void migrate_old_config(void)
copy_file(OLD_RC_DIR G_DIR_SEPARATOR_S FOLDER_LIST,
RC_DIR G_DIR_SEPARATOR_S FOLDER_LIST, FALSE);
+ conv_copy_dir(OLD_RC_DIR G_DIR_SEPARATOR_S TEMPLATE_DIR,
+ RC_DIR G_DIR_SEPARATOR_S TEMPLATE_DIR,
+ conv_get_locale_charset_str());
copy_dir(OLD_RC_DIR G_DIR_SEPARATOR_S "uidl",
RC_DIR G_DIR_SEPARATOR_S "uidl");