Simplify hidden prefs for too many recipients
[claws.git] / src / prefs_common.c
index fcb9a9b418862634af4e477ef227f558737648bb..da80d2c4274fa360087ba50cd0d770feedc750bb 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2009 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail 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
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * 
  */
 
 #ifdef HAVE_CONFIG_H
-#  include "config.h"
+#include "config.h"
+#include "claws-features.h"
 #endif
 
 #include "defs.h"
@@ -59,7 +59,9 @@
 #include "stock_pixmap.h"
 #include "prefswindow.h"
 #include "colorlabel.h"
-#include "addrcustomattr.h"
+#ifndef USE_ALT_ADDRBOOK
+       #include "addrcustomattr.h"
+#endif
 
 enum {
        DATEFMT_FMT,
@@ -119,6 +121,16 @@ static PrefParam param_os_specific[] = {
        /* Interface */
        {"pixmap_theme_path", DEFAULT_PIXMAP_THEME, 
         &prefs_common.pixmap_theme_path, P_STRING, NULL, NULL, NULL},
+#ifdef HAVE_SVG
+       {"enable_alpha_svg", "TRUE",
+        &prefs_common.enable_alpha_svg, P_BOOL, NULL, NULL, NULL},
+       {"enable_pixmap_scaling", "TRUE",
+        &prefs_common.enable_pixmap_scaling, P_BOOL, NULL, NULL, NULL},
+       {"pixmap_scaling_auto", "TRUE",
+        &prefs_common.pixmap_scaling_auto, P_BOOL, NULL, NULL, NULL},
+       {"pixmap_scaling_ppi", "96",
+        &prefs_common.pixmap_scaling_ppi, P_INT, NULL, NULL, NULL},
+#endif
 
        /* Other */
        {"ext_editor_command", "notepad %s",
@@ -138,10 +150,9 @@ static PrefParam param_os_specific[] = {
  */
 
 static PrefParam param[] = {
-#ifdef MAEMO
-       {"data_root", "", &prefs_common.data_root, P_STRING,
-        NULL, NULL, NULL},
-#endif
+       {"config_version", "0",
+        &prefs_common.config_version, P_INT, NULL, NULL, NULL},
+
        /* Receive */
        {"use_ext_inc", "FALSE", &prefs_common.use_extinc, P_BOOL,
         NULL, NULL, NULL},
@@ -150,7 +161,7 @@ static PrefParam param[] = {
 
        {"autochk_newmail", "FALSE", &prefs_common.autochk_newmail, P_BOOL,
         NULL, NULL, NULL},
-       {"autochk_interval", "10", &prefs_common.autochk_itv, P_INT,
+       {"autochk_interval", "600", &prefs_common.autochk_itv, P_INT,
         NULL, NULL, NULL},
        {"check_on_startup", "FALSE", &prefs_common.chk_on_startup, P_BOOL,
         NULL, NULL, NULL},
@@ -164,14 +175,6 @@ static PrefParam param[] = {
        P_BOOL, NULL, NULL, NULL},
        {"newmail_notify_cmd", "", &SPECIFIC_PREFS.newmail_notify_cmd, P_STRING,
         NULL, NULL, NULL},
-#ifdef MAEMO
-       {"maemo_show_led", "TRUE", &prefs_common.maemo_show_led, P_BOOL,
-        NULL, NULL, NULL},
-       {"maemo_play_sound", "FALSE", &prefs_common.maemo_play_sound, P_BOOL,
-        NULL, NULL, NULL},
-       {"maemo_show_banner", "FALSE", &prefs_common.maemo_show_banner, P_BOOL,
-        NULL, NULL, NULL},
-#endif
        {"receive_dialog_mode", "2", &prefs_common.recv_dialog_mode, P_ENUM,
         NULL, NULL, NULL},
        {"receivewin_width", "460", &prefs_common.receivewin_width, P_INT,
@@ -206,7 +209,14 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"outgoing_fallback_to_ascii", "TRUE", &prefs_common.outgoing_fallback_to_ascii, P_BOOL,
         NULL, NULL, NULL},
-
+        {"rewrite_first_from", "TRUE", &prefs_common.rewrite_first_from,
+         P_BOOL, NULL, NULL, NULL},
+       {"warn_empty_subj", "TRUE", &prefs_common.warn_empty_subj,
+        P_BOOL, NULL, NULL, NULL},
+       {"warn_sending_many_recipients_num", "0", &prefs_common.warn_sending_many_recipients_num, P_INT,
+        NULL, NULL, NULL},
+       {"hide_timezone", "FALSE", &prefs_common.hide_timezone,
+        P_BOOL, NULL, NULL, NULL},
        {"allow_jisx0201_kana", "FALSE", &prefs_common.allow_jisx0201_kana,
         P_BOOL, NULL, NULL, NULL},
 
@@ -228,6 +238,8 @@ static PrefParam param[] = {
         &prefs_common.compose_body_format, P_STRING, NULL, NULL, NULL},
        {"show_compose_margin", "FALSE", &prefs_common.show_compose_margin, P_BOOL,
         NULL, NULL, NULL},
+       {"type_any_header", "FALSE", &prefs_common.type_any_header, P_BOOL,
+        NULL, NULL, NULL},
        
 
        {"linewrap_length", "72", &prefs_common.linewrap_len, P_INT,
@@ -246,6 +258,8 @@ static PrefParam param[] = {
         P_BOOL, NULL, NULL, NULL},
         {"autosave_length", "50", &prefs_common.autosave_length, P_INT,
         NULL, NULL, NULL},
+        {"autosave_encrypted", "FALSE", &prefs_common.autosave_encrypted,
+        P_BOOL, NULL, NULL, NULL},
         {"warn_large_insert", "TRUE", &prefs_common.warn_large_insert,
         P_BOOL, NULL, NULL, NULL},
         {"warn_large_insert_size", "500", &prefs_common.warn_large_insert_size,
@@ -313,19 +327,7 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
 
        /* Display */
-       /* Obsolete fonts. For coexisting with Gtk+-1.2 version */
-       {"widget_font",         NULL,
-         &prefs_common.widgetfont_gtk1,        P_STRING, NULL, NULL, NULL},
-       {"message_font",        "-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*",
-        &prefs_common.textfont_gtk1,           P_STRING, NULL, NULL, NULL},
-       {"small_font",          "-*-helvetica-medium-r-normal--10-*-*-*-*-*-*-*",
-         &prefs_common.smallfont_gtk1,         P_STRING, NULL, NULL, NULL},
-       {"bold_font",           "-*-helvetica-bold-r-normal--12-*-*-*-*-*-*-*",
-         &prefs_common.boldfont_gtk1,          P_STRING, NULL, NULL, NULL},
-       {"normal_font",         "-*-helvetica-medium-r-normal--12-*-*-*-*-*-*-*",
-         &prefs_common.normalfont_gtk1,        P_STRING, NULL, NULL, NULL},
-
-       /* new fonts */
+       /* fonts */
 #ifndef GENERIC_UMPC
        {"widget_font_gtk2",    NULL,
          &SPECIFIC_PREFS.widgetfont,           P_STRING, NULL, NULL, NULL},
@@ -440,14 +442,23 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
 
        /* Display: Summary View */
+       {"default_sort_key", "3", &prefs_common.default_sort_key, P_ENUM,
+        NULL, NULL, NULL},
+       {"default_sort_type", "1", &prefs_common.default_sort_type, P_ENUM,
+        NULL, NULL, NULL},
        {"use_address_book", "FALSE", &prefs_common.use_addr_book, P_BOOL,
         NULL, NULL, NULL},
        {"thread_by_subject", "TRUE", &prefs_common.thread_by_subject, P_BOOL,
         NULL, NULL, NULL},
-       {"date_format", N_("%y/%m/%d(%a) %H:%M"), &prefs_common.date_format,
+       {"date_format", N_("%x(%a) %H:%M"), &prefs_common.date_format,
         P_STRING, NULL, NULL, NULL},
+       {"msgview_date_format", "FALSE", &prefs_common.msgview_date_format, P_BOOL,
+        NULL, NULL, NULL},
+
+       {"next_on_delete", "FALSE", &prefs_common.next_on_delete, P_BOOL,
+        NULL, NULL, NULL},
 
-       {"bold_unread", "TRUE", &prefs_common.bold_unread, P_BOOL,
+        {"bold_unread", "TRUE", &prefs_common.bold_unread, P_BOOL,
         NULL, NULL, NULL},
 
        {"enable_thread", "TRUE", &prefs_common.enable_thread, P_BOOL,
@@ -641,6 +652,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"mainwin_fullscreen", "FALSE", &prefs_common.mainwin_fullscreen, P_BOOL,
         NULL, NULL, NULL},
+       {"mainwin_menubar", "TRUE", &prefs_common.mainwin_menubar, P_BOOL,
+        NULL, NULL, NULL},
 #ifndef GENERIC_UMPC
        {"mainwin_width", "800", &prefs_common.mainwin_width, P_INT,
         NULL, NULL, NULL},
@@ -650,6 +663,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"messagewin_height", "540", &prefs_common.msgwin_height, P_INT,
         NULL, NULL, NULL},
+       {"mimeview_tree_height", "60", &prefs_common.mimeview_tree_height, P_INT,
+        NULL, NULL, NULL},      
        {"sourcewin_width", "600", &prefs_common.sourcewin_width, P_INT,
         NULL, NULL, NULL},
        {"sourcewin_height", "500", &prefs_common.sourcewin_height, P_INT,
@@ -676,6 +691,8 @@ static PrefParam param[] = {
        {"compose_height", "470", &prefs_common.compose_height, P_INT,
         NULL, NULL, NULL},
 #endif
+       {"compose_notebook_height", "130", &prefs_common.compose_notebook_height, P_INT,
+        NULL, NULL, NULL},
        {"compose_x", "0", &prefs_common.compose_x, P_INT,
         NULL, NULL, NULL},
        {"compose_y", "0", &prefs_common.compose_y, P_INT,
@@ -709,6 +726,23 @@ static PrefParam param[] = {
        {"recycle_quote_colors", "FALSE", &prefs_common.recycle_quote_colors,
         P_BOOL, NULL, NULL, NULL},
 
+       {"default_header_color", "#000000", &prefs_common.default_header_color, P_COLOR,
+        NULL, NULL, NULL},
+       {"default_header_bgcolor", "#f5f6be", &prefs_common.default_header_bgcolor, P_COLOR,
+        NULL, NULL, NULL},
+       {"tags_color", "#000000", &prefs_common.tags_color, P_COLOR,
+        NULL, NULL, NULL},
+       {"tags_bgcolor", "#f5f6be", &prefs_common.tags_bgcolor, P_COLOR,
+        NULL, NULL, NULL},
+       {"qs_active_color", "#000000", &prefs_common.qs_active_color, P_COLOR,
+        NULL, NULL, NULL},
+       {"qs_active_bgcolor", "#f5f6be", &prefs_common.qs_active_bgcolor, P_COLOR,
+        NULL, NULL, NULL},
+       {"qs_error_color", "#000000", &prefs_common.qs_error_color, P_COLOR,
+        NULL, NULL, NULL},
+       {"qs_error_bgcolor", "#ff7070", &prefs_common.qs_error_bgcolor, P_COLOR,
+        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,
@@ -738,6 +772,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"respect_flowed_format", "FALSE", &prefs_common.respect_flowed_format, P_BOOL,
         NULL, NULL, NULL},
+       {"show_all_headers", "FALSE", &prefs_common.show_all_headers, P_BOOL,
+        NULL, NULL, NULL},
 
        {"show_other_header", "FALSE", &prefs_common.show_other_header, P_BOOL,
         NULL, NULL, NULL},
@@ -752,8 +788,10 @@ static PrefParam param[] = {
        /* MIME viewer */
        {"mime_textviewer",   NULL,
         &SPECIFIC_PREFS.mime_textviewer,   P_STRING, NULL, NULL, NULL},
-       {"mime_open_command", "gedit '%s'",
+       {"mime_open_command", "xdg-open '%s'",
         &SPECIFIC_PREFS.mime_open_cmd,     P_STRING, NULL, NULL, NULL},
+       {"show_inline_attachments", "TRUE", 
+        &prefs_common.show_inline_attachments, P_BOOL, NULL, NULL, NULL},
 
        /* Interface */
 #ifndef GENERIC_UMPC
@@ -765,6 +803,9 @@ static PrefParam param[] = {
 #endif
        /* {"emulate_emacs", "FALSE", &prefs_common.emulate_emacs, P_BOOL,
         NULL, NULL, NULL}, */
+       {"open_selected_message_on_folder_open", "FALSE",
+        &prefs_common.open_selected_on_folder_open,
+        P_BOOL, NULL, NULL, NULL},
        {"always_show_message_when_selected", "0",
         &prefs_common.always_show_msg,
         P_ENUM, NULL, NULL, NULL},
@@ -799,10 +840,26 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"nextunreadmsg_dialog", "1", &prefs_common.next_unread_msg_dialog, P_ENUM,
         NULL, NULL, NULL},
+       {"summary_from_show", "0", &prefs_common.summary_from_show, P_ENUM,
+        NULL, NULL, NULL},
 
        {"pixmap_theme_path", DEFAULT_PIXMAP_THEME, 
         &SPECIFIC_PREFS.pixmap_theme_path, P_STRING,
         NULL, NULL, NULL},
+#ifdef HAVE_SVG
+       {"enable_alpha_svg", "TRUE",
+        &SPECIFIC_PREFS.enable_alpha_svg, P_BOOL,
+        NULL, NULL, NULL},
+       {"enable_pixmap_scaling", "TRUE",
+        &SPECIFIC_PREFS.enable_pixmap_scaling, P_BOOL,
+        NULL, NULL, NULL},
+       {"pixmap_scaling_auto", "TRUE",
+        &SPECIFIC_PREFS.pixmap_scaling_auto, P_BOOL,
+        NULL, NULL, NULL},
+       {"pixmap_scaling_ppi", "96",
+        &SPECIFIC_PREFS.pixmap_scaling_ppi, P_INT,
+        NULL, NULL, NULL},
+#endif
 
        {"ask_mark_all_read", "TRUE", &prefs_common.ask_mark_all_read, P_BOOL,
         NULL, NULL, NULL},
@@ -824,6 +881,9 @@ static PrefParam param[] = {
 #ifndef G_OS_WIN32
        {"uri_open_command", DEFAULT_BROWSER_CMD,
         &SPECIFIC_PREFS.uri_cmd, P_STRING, NULL, NULL, NULL},
+#else
+       {"gtk_theme", DEFAULT_W32_GTK_THEME,
+        &SPECIFIC_PREFS.gtk_theme, P_STRING, NULL, NULL, NULL},
 #endif
        {"ext_editor_command", DEFAULT_EDITOR_CMD,
         &SPECIFIC_PREFS.ext_editor_cmd, P_STRING, NULL, NULL, NULL},
@@ -1058,8 +1118,6 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"stripes_color_offset", "4000", &prefs_common.stripes_color_offset, P_INT,
         NULL, NULL, NULL},
-       {"enable_dotted_lines", "FALSE", &prefs_common.enable_dotted_lines, P_BOOL,
-        NULL, NULL, NULL},
        {"enable_hscrollbar", "TRUE", &prefs_common.enable_hscrollbar, P_BOOL,
         NULL, NULL, NULL},
        {"folderview_vscrollbar_policy", "0",
@@ -1155,6 +1213,28 @@ static PrefParam param[] = {
        {"flush_metadata", "TRUE", &prefs_common.flush_metadata, P_BOOL,
         NULL, NULL, NULL},
 
+       {"nav_history_length", "50", &prefs_common.nav_history_length, P_INT,
+        NULL, NULL, NULL},
+
+       {"diff_added_color", "#008b8b", &prefs_common.diff_added_color, P_COLOR,
+        NULL, NULL, NULL},
+       {"diff_deleted_color", "#6a5acd", &prefs_common.diff_deleted_color, P_COLOR,
+        NULL, NULL, NULL},
+       {"diff_hunk_color", "#a52a2a", &prefs_common.diff_hunk_color, P_COLOR,
+        NULL, NULL, NULL},
+
+       {"folder_search_wildcard", "TRUE", &prefs_common.folder_search_wildcard, P_BOOL,
+        NULL, NULL, NULL},
+       {"address_search_wildcard", "TRUE", &prefs_common.address_search_wildcard, P_BOOL,
+        NULL, NULL, NULL},
+       {"enable_avatars", "3", &prefs_common.enable_avatars, P_INT, NULL, NULL, NULL},
+#ifndef PASSWORD_CRYPTO_OLD
+       {"use_master_passphrase", FALSE, &prefs_common.use_master_passphrase, P_BOOL, NULL, NULL, NULL },
+       {"master_passphrase", "", &prefs_common.master_passphrase, P_STRING, NULL, NULL, NULL },
+       {"master_passphrase_salt", "", &prefs_common.master_passphrase_salt, P_STRING, NULL, NULL, NULL },
+       {"master_passphrase_pbkdf2_rounds", "50000", &prefs_common.master_passphrase_pbkdf2_rounds, P_INT, NULL, NULL, NULL},
+#endif
+
        {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };
 
@@ -1248,16 +1328,16 @@ void prefs_common_read_config(void)
                prefs_common_read_history(MESSAGE_SEARCH_HISTORY);
        prefs_common.compose_save_to_history =
                prefs_common_read_history(COMPOSE_SAVE_TO_HISTORY);
-
+#ifndef USE_ALT_ADDRBOOK
        prefs_common.addressbook_custom_attributes = addressbook_update_custom_attr_from_prefs();
-
+#endif
        colorlabel_update_colortable_from_prefs();
 }
 
 #define TRY(func) \
 if (!(func)) \
 { \
-       g_warning("failed to write\n"); \
+       g_warning("failed to write"); \
        goto out;                       \
 } \
 
@@ -1347,9 +1427,11 @@ void prefs_common_write_config(void)
        prefs_common_save_history(COMPOSE_SAVE_TO_HISTORY, 
                prefs_common.compose_save_to_history);
 
-       prefs_common_save_history_to_dir(ADDRBOOK_DIR,
+#ifndef USE_ALT_ADDRBOOK
+               prefs_common_save_history_to_dir(ADDRBOOK_DIR,
                ADDRESSBOOK_CUSTOM_ATTRIBUTES, 
                prefs_common.addressbook_custom_attributes);
+#endif
 }
 
 /* make a copy of string 'in' into buffer 'out'. un-escape \ sequences.
@@ -1437,11 +1519,11 @@ void pref_set_textview_from_pref(GtkTextView *textview, const gchar *txt)
        if (!txt) {
                gtk_text_buffer_set_text(buffer, "", -1);
        } else {
-               out = malloc(strlen(txt)+1);
+               out = g_malloc(strlen(txt)+1);
 
                pref_get_unescaped_pref(out, txt);
 
-               gtk_text_buffer_set_text(buffer, out?out:"", -1);
+               gtk_text_buffer_set_text(buffer, out, -1);
                g_free(out);
        }
 }
@@ -1456,11 +1538,11 @@ void pref_set_entry_from_pref(GtkEntry *entry, const gchar *txt)
        if (!txt) {
                gtk_entry_set_text(entry, "");
        } else {
-               out = malloc(strlen(txt)+1);
+               out = g_malloc(strlen(txt)+1);
 
                pref_get_unescaped_pref(out, txt);
 
-               gtk_entry_set_text(entry, out?out:"");
+               gtk_entry_set_text(entry, out);
                g_free(out);
        }
 }
@@ -1529,15 +1611,6 @@ gboolean prefs_common_enable_log_status(void)
        return prefs_common.enable_log_status;
 }
 
-#ifdef MAEMO
-const gchar *prefs_common_get_data_root(void)
-{
-       if (prefs_common.data_root && *prefs_common.data_root)
-               return prefs_common.data_root;
-       else
-               return NULL;
-}
-#endif
 /**
    return the translated name of a header, if the translate_header option is
    set, otherwise return the untranslated header name (header_name itself).