aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-11-27 05:06:17 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-11-27 05:06:17 +0000
commit5d7463379b24ec9b7136da2450cf61e80a44eaaf (patch)
tree2ad49561aeac08e85a254ce97db2c3077ec5b999
parent1c3288b17cd0b3ef11a2edf43da7f5f49f0582a4 (diff)
don't save older backups of UIDL files.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2081 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.ja6
-rw-r--r--libsylph/pop.c3
-rw-r--r--libsylph/prefs.c40
-rw-r--r--libsylph/prefs.h15
5 files changed, 57 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 53be8ecb..99c8ba2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2008-11-27
+ * libsylph/prefs.[ch]: made backup generation configurable.
+ * libsylph/pop.c: pop3_write_uidl_list(): don't save older backups.
+
+2008-11-27
+
* src/addressbook.c: addressbook_refresh(): fixed a bug that the
addressbook window was not refreshed when adding sender to
addressbook.
diff --git a/ChangeLog.ja b/ChangeLog.ja
index d131a3e2..59d27f76 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,11 @@
2008-11-27
+ * libsylph/prefs.[ch]: バックアップ世代数を設定可能にした。
+ * libsylph/pop.c: pop3_write_uidl_list(): 古いバックアップを保存
+ しないようにした。
+
+2008-11-27
+
* src/addressbook.c: addressbook_refresh(): 差出人をアドレス帳に
追加した際にアドレス帳ウィンドウが更新されなかったバグを修正。
diff --git a/libsylph/pop.c b/libsylph/pop.c
index 25774cbd..57d7fd2b 100644
--- a/libsylph/pop.c
+++ b/libsylph/pop.c
@@ -1,6 +1,6 @@
/*
* LibSylph -- E-Mail client library
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 Hiroyuki Yamamoto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -543,6 +543,7 @@ gint pop3_write_uidl_list(Pop3Session *session)
g_free(path);
return -1;
}
+ prefs_file_set_backup_generation(pfile, 0);
for (n = 1; n <= session->count; n++) {
msg = &session->msg[n];
diff --git a/libsylph/prefs.c b/libsylph/prefs.c
index 230d2dc5..d2e01d2a 100644
--- a/libsylph/prefs.c
+++ b/libsylph/prefs.c
@@ -1,6 +1,6 @@
/*
* LibSylph -- E-Mail client library
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 Hiroyuki Yamamoto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -38,6 +38,14 @@ typedef enum
DUMMY_PARAM
} DummyEnum;
+typedef struct _PrefFilePrivate PrefFilePrivate;
+
+struct _PrefFilePrivate {
+ FILE *fp;
+ gchar *path;
+ gint backup_generation;
+};
+
static void prefs_config_parse_one_line (GHashTable *param_table,
const gchar *buf);
@@ -317,7 +325,7 @@ gint prefs_file_write_param(PrefFile *pfile, PrefParam *param)
PrefFile *prefs_file_open(const gchar *path)
{
- PrefFile *pfile;
+ PrefFilePrivate *pfile;
gchar *tmppath;
FILE *fp;
@@ -335,25 +343,47 @@ PrefFile *prefs_file_open(const gchar *path)
g_free(tmppath);
- pfile = g_new(PrefFile, 1);
+ pfile = g_new(PrefFilePrivate, 1);
pfile->fp = fp;
pfile->path = g_strdup(path);
+ pfile->backup_generation = 4;
+
+ return (PrefFile *)pfile;
+}
+
+void prefs_file_set_backup_generation(PrefFile *pfile, gint generation)
+{
+ PrefFilePrivate *priv = (PrefFilePrivate *)pfile;
+
+ g_return_if_fail(pfile != NULL);
+
+ priv->backup_generation = generation;
+}
+
+gint prefs_file_get_backup_generation(PrefFile *pfile)
+{
+ PrefFilePrivate *priv = (PrefFilePrivate *)pfile;
+
+ g_return_val_if_fail(pfile != NULL, -1);
- return pfile;
+ return priv->backup_generation;
}
gint prefs_file_close(PrefFile *pfile)
{
+ PrefFilePrivate *priv = (PrefFilePrivate *)pfile;
FILE *fp;
gchar *path;
gchar *tmppath;
gchar *bakpath = NULL;
+ gint generation;
gint ret = 0;
g_return_val_if_fail(pfile != NULL, -1);
fp = pfile->fp;
path = pfile->path;
+ generation = priv->backup_generation;
g_free(pfile);
tmppath = g_strconcat(path, ".tmp", NULL);
@@ -369,7 +399,7 @@ gint prefs_file_close(PrefFile *pfile)
gint i;
gchar *bakpath_n, *bakpath_p;
- for (i = 4; i > 0; i--) {
+ for (i = generation; i > 0; i--) {
bakpath_n = g_strdup_printf("%s.%d", bakpath,
i);
if (i == 1)
diff --git a/libsylph/prefs.h b/libsylph/prefs.h
index fd4783ba..733c42da 100644
--- a/libsylph/prefs.h
+++ b/libsylph/prefs.h
@@ -1,6 +1,6 @@
/*
* LibSylph -- E-Mail client library
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 Hiroyuki Yamamoto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -65,11 +65,14 @@ void prefs_write_config (PrefParam *param,
const gchar *label,
const gchar *rcfile);
-PrefFile *prefs_file_open (const gchar *path);
-gint prefs_file_write_param (PrefFile *pfile,
- PrefParam *param);
-gint prefs_file_close (PrefFile *pfile);
-gint prefs_file_close_revert (PrefFile *pfile);
+PrefFile *prefs_file_open (const gchar *path);
+gint prefs_file_write_param (PrefFile *pfile,
+ PrefParam *param);
+void prefs_file_set_backup_generation (PrefFile *pfile,
+ gint generation);
+gint prefs_file_get_backup_generation (PrefFile *pfile);
+gint prefs_file_close (PrefFile *pfile);
+gint prefs_file_close_revert (PrefFile *pfile);
void prefs_set_default (PrefParam *param);
void prefs_free (PrefParam *param);