{"default_reply_list", "TRUE", &prefs_common.default_reply_list, P_BOOL,
NULL, NULL, NULL},
+#ifndef MAEMO
{"show_ruler", "TRUE", &prefs_common.show_ruler, P_BOOL,
NULL, NULL, NULL},
+#else
+ {"show_ruler", "FALSE", &prefs_common.show_ruler, P_BOOL,
+ NULL, NULL, NULL},
+#endif
/* Quote */
{"reply_quote_mark", "> ", &prefs_common.quotemark, P_STRING,
NULL, NULL, NULL},
{"hover_timeout", "500", &prefs_common.hover_timeout, P_INT,
NULL, NULL, NULL},
+#ifndef MAEMO
{"cache_max_mem_usage", "4096", &prefs_common.cache_max_mem_usage, P_INT,
NULL, NULL, NULL},
{"cache_min_keep_time", "15", &prefs_common.cache_min_keep_time, P_INT,
NULL, NULL, NULL},
+#else
+ {"cache_max_mem_usage", "4096", &prefs_common.cache_max_mem_usage, P_INT,
+ NULL, NULL, NULL},
+ {"cache_min_keep_time", "0", &prefs_common.cache_min_keep_time, P_INT,
+ NULL, NULL, NULL},
+#endif
{"thread_by_subject_max_age", "10", &prefs_common.thread_by_subject_max_age,
P_INT, NULL, NULL, NULL },
{"summary_quicksearch_sticky", "1", &prefs_common.summary_quicksearch_sticky, P_INT,
colorlabel_update_colortable_from_prefs();
}
+#define TRY(func) \
+if (!(func)) \
+{ \
+ g_warning("failed to write\n"); \
+ goto out; \
+} \
+
/*
* Save history list to the specified history file
*/
{
GList *cur;
FILE *fp;
- gchar *path;
+ gchar *path, *tmp_path;
path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, history,
NULL);
- if ((fp = g_fopen(path, "wb")) == NULL) {
- FILE_OP_ERROR(path, "fopen");
- g_free(path);
- return;
+ tmp_path = g_strconcat(path, ".tmp", NULL);
+
+ if ((fp = g_fopen(tmp_path, "wb")) == NULL) {
+ FILE_OP_ERROR(tmp_path, "fopen");
+ goto out;
}
for (cur = list; cur != NULL; cur = cur->next) {
- fputs((gchar *)cur->data, fp);
- fputc('\n', fp);
+ TRY(fputs((gchar *)cur->data, fp) != EOF &&
+ fputc('\n', fp) != EOF);
}
- fclose(fp);
+ if (fclose(fp) == EOF) {
+ FILE_OP_ERROR(tmp_path, "fclose");
+ fp = NULL;
+ goto out;
+ }
+ fp = NULL;
+#ifdef G_OS_WIN32
+ g_unlink(path);
+#endif
+ if (g_rename(tmp_path, path) < 0) {
+ FILE_OP_ERROR(path, "rename");
+ goto out;
+ }
+
+out:
+ if (fp)
+ fclose(fp);
+ g_free(tmp_path);
g_free(path);
}
+#undef TRY
+
void prefs_common_write_config(void)
{
prefs_write_config(param, "Common", COMMON_RC);