2006-02-16 [wwp] 2.0.0cvs58
[claws.git] / src / prefs_common.c
index 9625d26b77258563e5c0be41eea4766d7ce023c9..ca19532fceae831495bca48cbea6ab74bba8cde5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -69,6 +69,68 @@ PrefsCommon prefs_common;
 
 GtkWidget *notebook;
 
+#ifdef G_OS_WIN32
+/*
+ * In the Windows version prefs_common contains
+ *   - the non-OS-specific settings of the "Common" section and
+ *   - the OS-specific settings of the "CommonWin32" section
+ * The OS-specific settings of the "Common" section are not used
+ * but saved in prefs_unix.
+ */
+
+#  define SPECIFIC_PREFS prefs_unix
+
+static PrefsCommon prefs_unix;
+
+static PrefParam param_os_specific[] = {
+       /* Receive */
+       {"ext_inc_path", "",
+        &prefs_common.extinc_cmd, P_STRING, NULL, NULL, NULL},
+       {"newmail_notify_cmd", "",
+        &prefs_common.newmail_notify_cmd, P_STRING, NULL, NULL, NULL},
+
+       /* new fonts */
+       {"widget_font_gtk2",    NULL,
+         &prefs_common.widgetfont,             P_STRING, NULL, NULL, NULL},
+       {"message_font_gtk2",   "Monospace 9",
+        &prefs_common.textfont,                P_STRING, NULL, NULL, NULL},
+       {"small_font_gtk2",     "Sans 9",
+         &prefs_common.smallfont,              P_STRING, NULL, NULL, NULL},
+       {"normal_font_gtk2",    "Sans 9",
+         &prefs_common.normalfont,             P_STRING, NULL, NULL, NULL},
+
+       /* Message */
+       {"attach_save_directory", NULL,
+        &prefs_common.attach_save_dir, P_STRING, NULL, NULL, NULL},
+       {"attach_load_directory", NULL,
+        &prefs_common.attach_load_dir, P_STRING, NULL, NULL, NULL},
+
+       /* MIME viewer */
+       {"mime_image_viewer", NULL,
+        &prefs_common.mime_image_viewer, P_STRING, NULL, NULL, NULL},
+       {"mime_audio_player", NULL,
+        &prefs_common.mime_audio_player, P_STRING, NULL, NULL, NULL},
+       {"mime_open_command", "notepad '%s'",
+        &prefs_common.mime_open_cmd, P_STRING, NULL, NULL, NULL},
+
+       /* Interface */
+       {"pixmap_theme_path", DEFAULT_PIXMAP_THEME, 
+        &prefs_common.pixmap_theme_path, P_STRING, NULL, NULL, NULL},
+
+       /* Other */
+       {"uri_open_command", NULL,
+        &prefs_common.uri_cmd, P_STRING, NULL, NULL, NULL},
+       {"print_command", "notepad /p %s",
+        &prefs_common.print_cmd, P_STRING, NULL, NULL, NULL},
+       {"ext_editor_command", "notepad %s",
+        &prefs_common.ext_editor_cmd, P_STRING, NULL, NULL, NULL},
+
+       {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
+};
+#else
+#  define SPECIFIC_PREFS prefs_common
+#endif
+
 /*
    parameter name, default value, pointer to the prefs variable, data type,
    pointer to the widget pointer,
@@ -80,7 +142,7 @@ static PrefParam param[] = {
        /* Receive */
        {"use_ext_inc", "FALSE", &prefs_common.use_extinc, P_BOOL,
         NULL, NULL, NULL},
-       {"ext_inc_path", DEFAULT_INC_PATH, &prefs_common.extinc_cmd, P_STRING,
+       {"ext_inc_path", DEFAULT_INC_PATH, &SPECIFIC_PREFS.extinc_cmd, P_STRING,
         NULL, NULL, NULL},
 
        {"autochk_newmail", "FALSE", &prefs_common.autochk_newmail, P_BOOL,
@@ -89,13 +151,15 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"check_on_startup", "FALSE", &prefs_common.chk_on_startup, P_BOOL,
         NULL, NULL, NULL},
+       {"open_inbox_on_inc", "FALSE", &prefs_common.open_inbox_on_inc,
+        P_BOOL, NULL, NULL, NULL},
        {"scan_all_after_inc", "FALSE", &prefs_common.scan_all_after_inc,
         P_BOOL, NULL, NULL, NULL},
        {"newmail_notify_manu", "FALSE", &prefs_common.newmail_notify_manu,
         P_BOOL, NULL, NULL, NULL},
        {"newmail_notify_auto", "FALSE", &prefs_common.newmail_notify_auto,
        P_BOOL, NULL, NULL, NULL},
-       {"newmail_notify_cmd", "", &prefs_common.newmail_notify_cmd, P_STRING,
+       {"newmail_notify_cmd", "", &SPECIFIC_PREFS.newmail_notify_cmd, P_STRING,
         NULL, NULL, NULL},
        {"receive_dialog_mode", "1", &prefs_common.recv_dialog_mode, P_ENUM,
         NULL, NULL, NULL},
@@ -139,8 +203,6 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"linewrap_auto", "TRUE", &prefs_common.autowrap, P_BOOL,
         NULL, NULL, NULL},
-       {"linewrap_before_sending", "FALSE", &prefs_common.linewrap_at_send, P_BOOL, 
-        NULL, NULL, NULL},
         {"autosave", "TRUE", &prefs_common.autosave,
         P_BOOL, NULL, NULL, NULL},
         {"autosave_length", "50", &prefs_common.autosave_length, P_INT,
@@ -158,6 +220,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"check_while_typing", "TRUE", &prefs_common.check_while_typing, P_BOOL,
         NULL, NULL, NULL},
+       {"recheck_when_changing_dict", "TRUE", &prefs_common.recheck_when_changing_dict,
+        P_BOOL, NULL, NULL, NULL},
        {"misspelled_color", "16711680", &prefs_common.misspelled_col, P_COLOR,
         NULL, NULL, NULL},
 #endif
@@ -184,15 +248,15 @@ static PrefParam param[] = {
        /* Quote */
        {"reply_quote_mark", "> ", &prefs_common.quotemark, P_STRING,
         NULL, NULL, NULL},
-       {"reply_quote_format", "On %d\\n%f wrote:\\n\\n%q",
+       {"reply_quote_format", N_("On %d\\n%f wrote:\\n\\n%q"),
         &prefs_common.quotefmt, P_STRING, NULL, NULL, NULL},
 
        {"forward_quote_mark", "> ", &prefs_common.fw_quotemark, P_STRING,
         NULL, NULL, NULL},
        {"forward_quote_format",
-        "\\n\\nBegin forwarded message:\\n\\n"
+        N_("\\n\\nBegin forwarded message:\\n\\n"
         "?d{Date: %d\\n}?f{From: %f\\n}?t{To: %t\\n}?c{Cc: %c\\n}"
-        "?n{Newsgroups: %n\\n}?s{Subject: %s\\n}\\n\\n%M",
+        "?n{Newsgroups: %n\\n}?s{Subject: %s\\n}\\n\\n%M"),
         &prefs_common.fw_quotefmt, P_STRING, NULL, NULL, NULL},
        {"quote_chars", ">", &prefs_common.quote_chars, P_STRING,
         NULL, NULL, NULL},
@@ -212,13 +276,13 @@ static PrefParam param[] = {
 
        /* new fonts */
        {"widget_font_gtk2",    NULL,
-         &prefs_common.widgetfont,             P_STRING, NULL, NULL, NULL},
+         &SPECIFIC_PREFS.widgetfont,           P_STRING, NULL, NULL, NULL},
        {"message_font_gtk2",   "Monospace 9",
-        &prefs_common.textfont,                P_STRING, NULL, NULL, NULL},
+        &SPECIFIC_PREFS.textfont,                      P_STRING, NULL, NULL, NULL},
        {"small_font_gtk2",     "Sans 9",
-         &prefs_common.smallfont,              P_STRING, NULL, NULL, NULL},
+         &SPECIFIC_PREFS.smallfont,            P_STRING, NULL, NULL, NULL},
        {"normal_font_gtk2",    "Sans 9",
-         &prefs_common.normalfont,             P_STRING, NULL, NULL, NULL},
+         &SPECIFIC_PREFS.normalfont,           P_STRING, NULL, NULL, NULL},
 
        /* image viewer */
        {"display_image", "TRUE", &prefs_common.display_img, P_BOOL,
@@ -243,7 +307,7 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"thread_by_subject", "TRUE", &prefs_common.thread_by_subject, P_BOOL,
         NULL, NULL, NULL},
-       {"date_format", "%y/%m/%d(%a) %H:%M", &prefs_common.date_format,
+       {"date_format", N_("%y/%m/%d(%a) %H:%M"), &prefs_common.date_format,
         P_STRING, NULL, NULL, NULL},
 
        {"bold_unread", "TRUE", &prefs_common.bold_unread, P_BOOL,
@@ -436,12 +500,12 @@ static PrefParam param[] = {
        {"recycle_quote_colors", "FALSE", &prefs_common.recycle_quote_colors,
         P_BOOL, NULL, NULL, NULL},
 
-       {"convert_mb_alnum", "FALSE", &prefs_common.conv_mb_alnum, P_BOOL,
-        NULL, NULL, NULL},
        {"display_header_pane", "FALSE", &prefs_common.display_header_pane,
         P_BOOL, NULL, NULL, NULL},
        {"display_header", "TRUE", &prefs_common.display_header, P_BOOL,
         NULL, NULL, NULL},
+       {"display_xface", "TRUE", &prefs_common.display_xface,
+        P_BOOL, NULL, NULL, NULL},
        {"render_html", "TRUE", &prefs_common.render_html, P_BOOL,
         NULL, NULL, NULL},
        {"line_space", "2", &prefs_common.line_space, P_INT,
@@ -461,15 +525,17 @@ static PrefParam param[] = {
        {"attach_desc", "TRUE", &prefs_common.attach_desc, P_BOOL,
         NULL, NULL, NULL},
        {"attach_save_directory", NULL,
-        &prefs_common.attach_save_dir, P_STRING, NULL, NULL, NULL},
+        &SPECIFIC_PREFS.attach_save_dir, P_STRING, NULL, NULL, NULL},
+       {"attach_load_directory", NULL,
+        &SPECIFIC_PREFS.attach_load_dir, P_STRING, NULL, NULL, NULL},
 
        /* MIME viewer */
        {"mime_image_viewer", DEFAULT_IMAGE_VIEWER_CMD,
-        &prefs_common.mime_image_viewer, P_STRING, NULL, NULL, NULL},
+        &SPECIFIC_PREFS.mime_image_viewer,     P_STRING, NULL, NULL, NULL},
        {"mime_audio_player", DEFAULT_AUDIO_PLAYER_CMD,
-        &prefs_common.mime_audio_player, P_STRING, NULL, NULL, NULL},
+        &SPECIFIC_PREFS.mime_audio_player, P_STRING, NULL, NULL, NULL},
        {"mime_open_command", "gedit '%s'",
-        &prefs_common.mime_open_cmd, P_STRING, NULL, NULL, NULL},
+        &SPECIFIC_PREFS.mime_open_cmd, P_STRING, NULL, NULL, NULL},
 
        /* Interface */
        {"separate_folder", "FALSE", &prefs_common.sep_folder, P_BOOL,
@@ -490,15 +556,13 @@ static PrefParam param[] = {
        {"mark_as_read_delay", "0",
         &prefs_common.mark_as_read_delay, P_INT, 
         NULL, NULL, NULL},
-       {"open_inbox_on_inc", "FALSE", &prefs_common.open_inbox_on_inc,
-        P_BOOL, NULL, NULL, NULL},
        {"immediate_execution", "TRUE", &prefs_common.immediate_exec, P_BOOL,
         NULL, NULL, NULL},
        {"nextunreadmsg_dialog", "1", &prefs_common.next_unread_msg_dialog, P_ENUM,
         NULL, NULL, NULL},
 
        {"pixmap_theme_path", DEFAULT_PIXMAP_THEME, 
-        &prefs_common.pixmap_theme_path, P_STRING,
+        &SPECIFIC_PREFS.pixmap_theme_path, P_STRING,
         NULL, NULL, NULL},
 
        {"ask_mark_all_read", "TRUE", &prefs_common.ask_mark_all_read, P_BOOL,
@@ -506,11 +570,11 @@ static PrefParam param[] = {
 
        /* Other */
        {"uri_open_command", DEFAULT_BROWSER_CMD,
-        &prefs_common.uri_cmd, P_STRING, NULL, NULL, NULL},
-       {"print_command", "lpr %s", &prefs_common.print_cmd, P_STRING,
-        NULL, NULL, NULL},
-       {"ext_editor_command", "gedit %s",
-        &prefs_common.ext_editor_cmd, P_STRING, NULL, NULL, NULL},
+        &SPECIFIC_PREFS.uri_cmd, P_STRING, NULL, NULL, NULL},
+       {"print_command", "lpr %s",
+        &SPECIFIC_PREFS.print_cmd, P_STRING, NULL, NULL, NULL},
+       {"ext_editor_command", DEFAULT_EDITOR_CMD,
+        &SPECIFIC_PREFS.ext_editor_cmd, P_STRING, NULL, NULL, NULL},
 
        {"add_address_by_click", "FALSE", &prefs_common.add_address_by_click,
         P_BOOL, NULL, NULL, NULL},
@@ -681,11 +745,19 @@ GList *prefs_common_read_history(const gchar *history)
 void prefs_common_read_config(void)
 {
        gchar *rcpath;
-       
+
        rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
        prefs_read_config(param, "Common", rcpath, NULL);
+#ifdef G_OS_WIN32
+       prefs_read_config(param_os_specific, "CommonWin32", rcpath, NULL);
+#endif
+
        g_free(rcpath);
-       
+
+       prefs_common.quotefmt = gettext(prefs_common.quotefmt);
+       prefs_common.fw_quotefmt = gettext(prefs_common.fw_quotefmt);
+       prefs_common.date_format = gettext(prefs_common.date_format);
+
        prefs_common.mime_open_cmd_history =
                prefs_common_read_history(COMMAND_HISTORY);
        prefs_common.summary_quicksearch_history =
@@ -721,6 +793,9 @@ void prefs_common_save_history(const gchar *history, GList *list)
 void prefs_common_write_config(void)
 {
        prefs_write_config(param, "Common", COMMON_RC);
+#ifdef G_OS_WIN32
+       prefs_write_config(param_os_specific, "CommonWin32", COMMON_RC);
+#endif
 
        prefs_common_save_history(COMMAND_HISTORY, 
                prefs_common.mime_open_cmd_history);