diff options
| author | Simeon Simeonov | 2018-02-26 11:23:00 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2018-02-26 11:23:00 +0100 |
| commit | 0b3cbf57875fd692e4ba0b336fefa4bee1ed00dc (patch) | |
| tree | af916a30553c78ce9d4f2d8658656a175c5b6921 /libsylph/prefs_common.c | |
Initial commit for sylpheed 3.7.0
Diffstat (limited to 'libsylph/prefs_common.c')
| -rw-r--r-- | libsylph/prefs_common.c | 634 |
1 files changed, 634 insertions, 0 deletions
diff --git a/libsylph/prefs_common.c b/libsylph/prefs_common.c new file mode 100644 index 0000000..8ed74a3 --- /dev/null +++ b/libsylph/prefs_common.c | |||
| @@ -0,0 +1,634 @@ | |||
| 1 | /* | ||
| 2 | * LibSylph -- E-Mail client library | ||
| 3 | * Copyright (C) 1999-2017 Hiroyuki Yamamoto | ||
| 4 | * | ||
| 5 | * This library is free software; you can redistribute it and/or | ||
| 6 | * modify it under the terms of the GNU Lesser General Public | ||
| 7 | * License as published by the Free Software Foundation; either | ||
| 8 | * version 2.1 of the License, or (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This library is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 13 | * Lesser General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU Lesser General Public | ||
| 16 | * License along with this library; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifdef HAVE_CONFIG_H | ||
| 21 | # include "config.h" | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #include "defs.h" | ||
| 25 | |||
| 26 | #include <glib.h> | ||
| 27 | #include <glib/gi18n.h> | ||
| 28 | #include <stdio.h> | ||
| 29 | #include <errno.h> | ||
| 30 | |||
| 31 | #include "prefs.h" | ||
| 32 | #include "prefs_common.h" | ||
| 33 | #include "filter.h" | ||
| 34 | #include "codeconv.h" | ||
| 35 | #include "utils.h" | ||
| 36 | |||
| 37 | PrefsCommon prefs_common; | ||
| 38 | |||
| 39 | static PrefParam param[] = { | ||
| 40 | /* Receive */ | ||
| 41 | {"autochk_newmail", "FALSE", &prefs_common.autochk_newmail, P_BOOL}, | ||
| 42 | {"autochk_interval", "10", &prefs_common.autochk_itv, P_INT}, | ||
| 43 | {"check_on_startup", "FALSE", &prefs_common.chk_on_startup, P_BOOL}, | ||
| 44 | {"scan_all_after_inc", "FALSE", &prefs_common.scan_all_after_inc, | ||
| 45 | P_BOOL}, | ||
| 46 | {"enable_newmsg_notify", "FALSE", &prefs_common.enable_newmsg_notify, | ||
| 47 | P_BOOL}, | ||
| 48 | {"newmsg_notify_command", NULL, &prefs_common.newmsg_notify_cmd, | ||
| 49 | P_STRING}, | ||
| 50 | {"enable_newmsg_notify_sound", "FALSE", | ||
| 51 | &prefs_common.enable_newmsg_notify_sound, P_BOOL}, | ||
| 52 | {"newmsg_notify_sound", NULL, &prefs_common.newmsg_notify_sound, | ||
| 53 | P_STRING}, | ||
| 54 | {"enable_newmsg_notify_window", "TRUE", | ||
| 55 | &prefs_common.enable_newmsg_notify_window, P_BOOL}, | ||
| 56 | {"notify_window_period", "10", | ||
| 57 | &prefs_common.notify_window_period, P_INT}, | ||
| 58 | |||
| 59 | {"inc_local", "FALSE", &prefs_common.inc_local, P_BOOL}, | ||
| 60 | {"filter_on_inc_local", "TRUE", &prefs_common.filter_on_inc, P_BOOL}, | ||
| 61 | {"spool_path", DEFAULT_SPOOL_PATH, &prefs_common.spool_path, P_STRING}, | ||
| 62 | |||
| 63 | /* Send */ | ||
| 64 | {"save_message", "TRUE", &prefs_common.savemsg, P_BOOL}, | ||
| 65 | {"filter_sent_message", "FALSE", &prefs_common.filter_sent, P_BOOL}, | ||
| 66 | {"recipients_autoreg", "TRUE", &prefs_common.recipients_autoreg, | ||
| 67 | P_BOOL}, | ||
| 68 | {"show_send_dialog", "TRUE", &prefs_common.show_send_dialog, P_BOOL}, | ||
| 69 | |||
| 70 | {"encoding_method", "0", &prefs_common.encoding_method, P_ENUM}, | ||
| 71 | {"mime_filename_encoding_method", "0", | ||
| 72 | &prefs_common.mime_fencoding_method, P_ENUM}, | ||
| 73 | {"check_attach", "FALSE", &prefs_common.check_attach, P_BOOL}, | ||
| 74 | {"check_attach_str", NULL, &prefs_common.check_attach_str, P_STRING}, | ||
| 75 | {"check_recipients", "FALSE", &prefs_common.check_recipients, P_BOOL}, | ||
| 76 | {"check_recp_exclude", NULL, &prefs_common.check_recp_exclude, | ||
| 77 | P_STRING}, | ||
| 78 | |||
| 79 | {"allow_jisx0201_kana", "FALSE", &prefs_common.allow_jisx0201_kana, | ||
| 80 | P_BOOL}, | ||
| 81 | |||
| 82 | /* Compose */ | ||
| 83 | {"auto_signature", "TRUE", &prefs_common.auto_sig, P_BOOL}, | ||
| 84 | {"signature_separator", "-- ", &prefs_common.sig_sep, P_STRING}, | ||
| 85 | |||
| 86 | {"auto_ext_editor", "FALSE", &prefs_common.auto_exteditor, P_BOOL}, | ||
| 87 | |||
| 88 | {"undo_level", "50", &prefs_common.undolevels, P_INT}, | ||
| 89 | |||
| 90 | {"linewrap_length", "72", &prefs_common.linewrap_len, P_INT}, | ||
| 91 | {"linewrap_quotation", "FALSE", &prefs_common.linewrap_quote, P_BOOL}, | ||
| 92 | {"linewrap_auto", "FALSE", &prefs_common.autowrap, P_BOOL}, | ||
| 93 | |||
| 94 | {"enable_autosave", "FALSE", &prefs_common.enable_autosave, P_BOOL}, | ||
| 95 | {"autosave_interval", "5", &prefs_common.autosave_itv, P_INT}, | ||
| 96 | |||
| 97 | {"reply_with_quote", "TRUE", &prefs_common.reply_with_quote, P_BOOL}, | ||
| 98 | {"reply_account_autoselect", "TRUE", | ||
| 99 | &prefs_common.reply_account_autosel, P_BOOL}, | ||
| 100 | {"default_reply_list", "TRUE", &prefs_common.default_reply_list, | ||
| 101 | P_BOOL}, | ||
| 102 | {"inherit_recipient_on_self_reply", "FALSE", | ||
| 103 | &prefs_common.inherit_recipient_on_self_reply, P_BOOL}, | ||
| 104 | {"reply_address_only", "FALSE", | ||
| 105 | &prefs_common.reply_address_only, P_BOOL}, | ||
| 106 | |||
| 107 | {"show_ruler", "TRUE", &prefs_common.show_ruler, P_BOOL}, | ||
| 108 | |||
| 109 | /* Quote */ | ||
| 110 | {"reply_quote_mark", "> ", &prefs_common.quotemark, P_STRING}, | ||
| 111 | {"reply_quote_format", "On %d\\n%f wrote:\\n\\n%Q", | ||
| 112 | &prefs_common.quotefmt, P_STRING}, | ||
| 113 | |||
| 114 | {"forward_quote_mark", "> ", &prefs_common.fw_quotemark, P_STRING}, | ||
| 115 | {"forward_quote_format", | ||
| 116 | "\\n\\nBegin forwarded message:\\n\\n" | ||
| 117 | "?d{Date: %d\\n}?f{From: %f\\n}?t{To: %t\\n}?c{Cc: %c\\n}" | ||
| 118 | "?n{Newsgroups: %n\\n}?s{Subject: %s\\n}\\n\\n%M", | ||
| 119 | &prefs_common.fw_quotefmt, P_STRING}, | ||
| 120 | |||
| 121 | /* Spelling */ | ||
| 122 | {"check_spell", "FALSE", &prefs_common.check_spell, P_BOOL}, | ||
| 123 | {"spell_lang", "en", &prefs_common.spell_lang, P_STRING}, | ||
| 124 | |||
| 125 | /* Display */ | ||
| 126 | {"message_font_name", DEFAULT_MESSAGE_FONT, &prefs_common.textfont, | ||
| 127 | P_STRING}, | ||
| 128 | |||
| 129 | {"display_folder_unread_num", "TRUE", | ||
| 130 | &prefs_common.display_folder_unread, P_BOOL}, | ||
| 131 | {"display_folder_num_columns", "FALSE", | ||
| 132 | &prefs_common.display_folder_num_columns, P_BOOL}, | ||
| 133 | {"folder_col_show_new", "FALSE", | ||
| 134 | &prefs_common.folder_col_visible[1], P_BOOL}, | ||
| 135 | {"folder_col_show_unread", "FALSE", | ||
| 136 | &prefs_common.folder_col_visible[2], P_BOOL}, | ||
| 137 | {"folder_col_show_total", "FALSE", | ||
| 138 | &prefs_common.folder_col_visible[3], P_BOOL}, | ||
| 139 | |||
| 140 | {"newsgroup_abbrev_len", "16", &prefs_common.ng_abbrev_len, P_INT}, | ||
| 141 | |||
| 142 | {"translate_header", "TRUE", &prefs_common.trans_hdr, P_BOOL}, | ||
| 143 | |||
| 144 | /* Display: Summary View */ | ||
| 145 | {"enable_swap_from", "FALSE", &prefs_common.swap_from, P_BOOL}, | ||
| 146 | {"date_format", "%y/%m/%d(%a) %H:%M", &prefs_common.date_format, | ||
| 147 | P_STRING}, | ||
| 148 | {"expand_thread", "TRUE", &prefs_common.expand_thread, P_BOOL}, | ||
| 149 | |||
| 150 | {"enable_rules_hint", "TRUE", &prefs_common.enable_rules_hint, P_BOOL}, | ||
| 151 | {"bold_unread", "TRUE", &prefs_common.bold_unread, P_BOOL}, | ||
| 152 | |||
| 153 | {"persist_qsearch_filter", "TRUE", &prefs_common.persist_qsearch_filter, | ||
| 154 | P_BOOL}, | ||
| 155 | |||
| 156 | {"toolbar_style", "4", &prefs_common.toolbar_style, P_ENUM}, | ||
| 157 | {"show_searchbar", "TRUE", &prefs_common.show_searchbar, P_BOOL}, | ||
| 158 | {"show_statusbar", "TRUE", &prefs_common.show_statusbar, P_BOOL}, | ||
| 159 | |||
| 160 | {"main_toolbar_setting", NULL, &prefs_common.main_toolbar_setting, | ||
| 161 | P_STRING}, | ||
| 162 | {"compose_toolbar_setting", NULL, | ||
| 163 | &prefs_common.compose_toolbar_setting, P_STRING}, | ||
| 164 | |||
| 165 | {"layout_type", "0", &prefs_common.layout_type, P_ENUM}, | ||
| 166 | |||
| 167 | {"summary_col_show_mark", "TRUE", | ||
| 168 | &prefs_common.summary_col_visible[S_COL_MARK], P_BOOL}, | ||
| 169 | {"summary_col_show_unread", "TRUE", | ||
| 170 | &prefs_common.summary_col_visible[S_COL_UNREAD], P_BOOL}, | ||
| 171 | {"summary_col_show_mime", "TRUE", | ||
| 172 | &prefs_common.summary_col_visible[S_COL_MIME], P_BOOL}, | ||
| 173 | {"summary_col_show_subject", "TRUE", | ||
| 174 | &prefs_common.summary_col_visible[S_COL_SUBJECT], P_BOOL}, | ||
| 175 | {"summary_col_show_from", "TRUE", | ||
| 176 | &prefs_common.summary_col_visible[S_COL_FROM], P_BOOL}, | ||
| 177 | {"summary_col_show_date", "TRUE", | ||
| 178 | &prefs_common.summary_col_visible[S_COL_DATE], P_BOOL}, | ||
| 179 | {"summary_col_show_size", "TRUE", | ||
| 180 | &prefs_common.summary_col_visible[S_COL_SIZE], P_BOOL}, | ||
| 181 | {"summary_col_show_number", "FALSE", | ||
| 182 | &prefs_common.summary_col_visible[S_COL_NUMBER], P_BOOL}, | ||
| 183 | {"summary_col_show_to", "FALSE", | ||
| 184 | &prefs_common.summary_col_visible[S_COL_TO], P_BOOL}, | ||
| 185 | |||
| 186 | {"summary_col_pos_mark", "0", | ||
| 187 | &prefs_common.summary_col_pos[S_COL_MARK], P_INT}, | ||
| 188 | {"summary_col_pos_unread", "1", | ||
| 189 | &prefs_common.summary_col_pos[S_COL_UNREAD], P_INT}, | ||
| 190 | {"summary_col_pos_mime", "2", | ||
| 191 | &prefs_common.summary_col_pos[S_COL_MIME], P_INT}, | ||
| 192 | {"summary_col_pos_subject", "3", | ||
| 193 | &prefs_common.summary_col_pos[S_COL_SUBJECT], P_INT}, | ||
| 194 | {"summary_col_pos_from", "4", | ||
| 195 | &prefs_common.summary_col_pos[S_COL_FROM], P_INT}, | ||
| 196 | {"summary_col_pos_date", "5", | ||
| 197 | &prefs_common.summary_col_pos[S_COL_DATE], P_INT}, | ||
| 198 | {"summary_col_pos_size", "6", | ||
| 199 | &prefs_common.summary_col_pos[S_COL_SIZE], P_INT}, | ||
| 200 | {"summary_col_pos_number", "7", | ||
| 201 | &prefs_common.summary_col_pos[S_COL_NUMBER], P_INT}, | ||
| 202 | {"summary_col_pos_to", "8", | ||
| 203 | &prefs_common.summary_col_pos[S_COL_TO], P_INT}, | ||
| 204 | |||
| 205 | {"summary_sent_col_show_mark", "TRUE", | ||
| 206 | &prefs_common.summary_sent_col_visible[S_COL_MARK], P_BOOL}, | ||
| 207 | {"summary_sent_col_show_unread", "TRUE", | ||
| 208 | &prefs_common.summary_sent_col_visible[S_COL_UNREAD], P_BOOL}, | ||
| 209 | {"summary_sent_col_show_mime", "TRUE", | ||
| 210 | &prefs_common.summary_sent_col_visible[S_COL_MIME], P_BOOL}, | ||
| 211 | {"summary_sent_col_show_subject", "TRUE", | ||
| 212 | &prefs_common.summary_sent_col_visible[S_COL_SUBJECT], P_BOOL}, | ||
| 213 | {"summary_sent_col_show_from", "FALSE", | ||
| 214 | &prefs_common.summary_sent_col_visible[S_COL_FROM], P_BOOL}, | ||
| 215 | {"summary_sent_col_show_date", "TRUE", | ||
| 216 | &prefs_common.summary_sent_col_visible[S_COL_DATE], P_BOOL}, | ||
| 217 | {"summary_sent_col_show_size", "TRUE", | ||
| 218 | &prefs_common.summary_sent_col_visible[S_COL_SIZE], P_BOOL}, | ||
| 219 | {"summary_sent_col_show_number", "FALSE", | ||
| 220 | &prefs_common.summary_sent_col_visible[S_COL_NUMBER], P_BOOL}, | ||
| 221 | {"summary_sent_col_show_to", "TRUE", | ||
| 222 | &prefs_common.summary_sent_col_visible[S_COL_TO], P_BOOL}, | ||
| 223 | |||
| 224 | {"summary_sent_col_pos_mark", "0", | ||
| 225 | &prefs_common.summary_sent_col_pos[S_COL_MARK], P_INT}, | ||
| 226 | {"summary_sent_col_pos_unread", "1", | ||
| 227 | &prefs_common.summary_sent_col_pos[S_COL_UNREAD], P_INT}, | ||
| 228 | {"summary_sent_col_pos_mime", "2", | ||
| 229 | &prefs_common.summary_sent_col_pos[S_COL_MIME], P_INT}, | ||
| 230 | {"summary_sent_col_pos_subject", "3", | ||
| 231 | &prefs_common.summary_sent_col_pos[S_COL_SUBJECT], P_INT}, | ||
| 232 | {"summary_sent_col_pos_from", "8", | ||
| 233 | &prefs_common.summary_sent_col_pos[S_COL_FROM], P_INT}, | ||
| 234 | {"summary_sent_col_pos_date", "5", | ||
| 235 | &prefs_common.summary_sent_col_pos[S_COL_DATE], P_INT}, | ||
| 236 | {"summary_sent_col_pos_size", "6", | ||
| 237 | &prefs_common.summary_sent_col_pos[S_COL_SIZE], P_INT}, | ||
| 238 | {"summary_sent_col_pos_number", "7", | ||
| 239 | &prefs_common.summary_sent_col_pos[S_COL_NUMBER], P_INT}, | ||
| 240 | {"summary_sent_col_pos_to", "4", | ||
| 241 | &prefs_common.summary_sent_col_pos[S_COL_TO], P_INT}, | ||
| 242 | |||
| 243 | {"summary_col_size_mark", "10", | ||
| 244 | &prefs_common.summary_col_size[S_COL_MARK], P_INT}, | ||
| 245 | {"summary_col_size_unread", "13", | ||
| 246 | &prefs_common.summary_col_size[S_COL_UNREAD], P_INT}, | ||
| 247 | {"summary_col_size_mime", "10", | ||
| 248 | &prefs_common.summary_col_size[S_COL_MIME], P_INT}, | ||
| 249 | {"summary_col_size_subject", "200", | ||
| 250 | &prefs_common.summary_col_size[S_COL_SUBJECT], P_INT}, | ||
| 251 | {"summary_col_size_from", "120", | ||
| 252 | &prefs_common.summary_col_size[S_COL_FROM], P_INT}, | ||
| 253 | {"summary_col_size_date", "118", | ||
| 254 | &prefs_common.summary_col_size[S_COL_DATE], P_INT}, | ||
| 255 | {"summary_col_size_size", "45", | ||
| 256 | &prefs_common.summary_col_size[S_COL_SIZE], P_INT}, | ||
| 257 | {"summary_col_size_number", "40", | ||
| 258 | &prefs_common.summary_col_size[S_COL_NUMBER], P_INT}, | ||
| 259 | {"summary_col_size_to", "120", | ||
| 260 | &prefs_common.summary_col_size[S_COL_TO], P_INT}, | ||
| 261 | |||
| 262 | /* Widget size */ | ||
| 263 | {"folderwin_x", "16", &prefs_common.folderwin_x, P_INT}, | ||
| 264 | {"folderwin_y", "16", &prefs_common.folderwin_y, P_INT}, | ||
| 265 | {"folderview_width", "179", &prefs_common.folderview_width, P_INT}, | ||
| 266 | {"folderview_height", "450", &prefs_common.folderview_height, P_INT}, | ||
| 267 | {"folderview_visible", "TRUE", &prefs_common.folderview_visible, | ||
| 268 | P_BOOL}, | ||
| 269 | |||
| 270 | {"folder_col_folder", "150", &prefs_common.folder_col_folder, P_INT}, | ||
| 271 | {"folder_col_new", "32", &prefs_common.folder_col_new, P_INT}, | ||
| 272 | {"folder_col_unread", "32", &prefs_common.folder_col_unread, P_INT}, | ||
| 273 | {"folder_col_total", "32", &prefs_common.folder_col_total, P_INT}, | ||
| 274 | |||
| 275 | {"summaryview_width", "600", &prefs_common.summaryview_width, P_INT}, | ||
| 276 | {"summaryview_height", "180", &prefs_common.summaryview_height, P_INT}, | ||
| 277 | {"summaryview_vwidth", "300", &prefs_common.summaryview_vwidth, P_INT}, | ||
| 278 | {"summaryview_vheight", "600", &prefs_common.summaryview_vheight, | ||
| 279 | P_INT}, | ||
| 280 | |||
| 281 | {"main_messagewin_x", "256", &prefs_common.main_msgwin_x, P_INT}, | ||
| 282 | {"main_messagewin_y", "210", &prefs_common.main_msgwin_y, P_INT}, | ||
| 283 | {"messageview_width", "600", &prefs_common.msgview_width, P_INT}, | ||
| 284 | {"messageview_height", "300", &prefs_common.msgview_height, P_INT}, | ||
| 285 | {"messageview_vwidth", "300", &prefs_common.msgview_vwidth, P_INT}, | ||
| 286 | {"messageview_vheight", "600", &prefs_common.msgview_vheight, P_INT}, | ||
| 287 | {"messageview_visible", "TRUE", &prefs_common.msgview_visible, P_BOOL}, | ||
| 288 | |||
| 289 | {"mainview_x", "64", &prefs_common.mainview_x, P_INT}, | ||
| 290 | {"mainview_y", "64", &prefs_common.mainview_y, P_INT}, | ||
| 291 | {"mainview_width", "600", &prefs_common.mainview_width, P_INT}, | ||
| 292 | {"mainview_height", "600", &prefs_common.mainview_height, P_INT}, | ||
| 293 | {"mainwin_x", "64", &prefs_common.mainwin_x, P_INT}, | ||
| 294 | {"mainwin_y", "64", &prefs_common.mainwin_y, P_INT}, | ||
| 295 | {"mainwin_width", "800", &prefs_common.mainwin_width, P_INT}, | ||
| 296 | {"mainwin_height", "600", &prefs_common.mainwin_height, P_INT}, | ||
| 297 | {"messagewin_width", "600", &prefs_common.msgwin_width, P_INT}, | ||
| 298 | {"messagewin_height", "540", &prefs_common.msgwin_height, P_INT}, | ||
| 299 | |||
| 300 | {"mainwin_maximized", "FALSE", &prefs_common.mainwin_maximized, P_BOOL}, | ||
| 301 | |||
| 302 | {"sourcewin_width", "600", &prefs_common.sourcewin_width, P_INT}, | ||
| 303 | {"sourcewin_height", "500", &prefs_common.sourcewin_height, P_INT}, | ||
| 304 | |||
| 305 | {"compose_x", "32", &prefs_common.compose_x, P_INT}, | ||
| 306 | {"compose_y", "32", &prefs_common.compose_y, P_INT}, | ||
| 307 | {"compose_width", "600", &prefs_common.compose_width, P_INT}, | ||
| 308 | {"compose_height", "560", &prefs_common.compose_height, P_INT}, | ||
| 309 | |||
| 310 | {"compose_maximized", "FALSE", &prefs_common.compose_maximized, P_BOOL}, | ||
| 311 | |||
| 312 | {"addressbook_x", "32", &prefs_common.addressbook_x, P_INT}, | ||
| 313 | {"addressbook_y", "32", &prefs_common.addressbook_y, P_INT}, | ||
| 314 | {"addressbook_width", "620", &prefs_common.addressbook_width, P_INT}, | ||
| 315 | {"addressbook_height", "360", &prefs_common.addressbook_height, P_INT}, | ||
| 316 | {"addressbook_folder_width", "190", &prefs_common.addressbook_folder_width, P_INT}, | ||
| 317 | {"addressbook_col_name", "164", &prefs_common.addressbook_col_name, P_INT}, | ||
| 318 | {"addressbook_col_addr", "156", &prefs_common.addressbook_col_addr, P_INT}, | ||
| 319 | {"addressbook_col_nickname", "120", &prefs_common.addressbook_col_nickname, P_INT}, | ||
| 320 | {"addressbook_col_rem", "100", &prefs_common.addressbook_col_rem, P_INT}, | ||
| 321 | |||
| 322 | /* Message */ | ||
| 323 | {"enable_color", "TRUE", &prefs_common.enable_color, P_BOOL}, | ||
| 324 | |||
| 325 | {"quote_level1_color", "179", &prefs_common.quote_level1_col, P_INT}, | ||
| 326 | {"quote_level2_color", "179", &prefs_common.quote_level2_col, P_INT}, | ||
| 327 | {"quote_level3_color", "179", &prefs_common.quote_level3_col, P_INT}, | ||
| 328 | {"uri_color", "32512", &prefs_common.uri_col, P_INT}, | ||
| 329 | {"signature_color", "0", &prefs_common.sig_col, P_USHORT}, | ||
| 330 | {"recycle_quote_colors", "FALSE", &prefs_common.recycle_quote_colors, | ||
| 331 | P_BOOL}, | ||
| 332 | |||
| 333 | {"convert_mb_alnum", "FALSE", &prefs_common.conv_mb_alnum, P_BOOL}, | ||
| 334 | {"display_header_pane", "TRUE", &prefs_common.display_header_pane, | ||
| 335 | P_BOOL}, | ||
| 336 | {"show_attach_tab", "FALSE", &prefs_common.show_attach_tab, P_BOOL}, | ||
| 337 | {"show_attached_files_first", "TRUE", | ||
| 338 | &prefs_common.show_attached_files_first, P_BOOL}, | ||
| 339 | {"attach_toolbutton_pos", "0", &prefs_common.attach_toolbutton_pos, | ||
| 340 | P_INT}, | ||
| 341 | {"display_header", "TRUE", &prefs_common.display_header, P_BOOL}, | ||
| 342 | {"render_html", "TRUE", &prefs_common.render_html, P_BOOL}, | ||
| 343 | {"alt_prefer_html", "FALSE", &prefs_common.alt_prefer_html, P_BOOL}, | ||
| 344 | {"html_only_as_attach", "FALSE", &prefs_common.html_only_as_attach, | ||
| 345 | P_BOOL}, | ||
| 346 | {"line_space", "2", &prefs_common.line_space, P_INT}, | ||
| 347 | |||
| 348 | {"textview_cursor_visible", "FALSE", | ||
| 349 | &prefs_common.textview_cursor_visible, P_BOOL}, | ||
| 350 | |||
| 351 | {"enable_smooth_scroll", "FALSE", &prefs_common.enable_smooth_scroll, | ||
| 352 | P_BOOL}, | ||
| 353 | {"scroll_step", "1", &prefs_common.scroll_step, P_INT}, | ||
| 354 | {"scroll_half_page", "FALSE", &prefs_common.scroll_halfpage, P_BOOL}, | ||
| 355 | |||
| 356 | {"resize_image", "TRUE", &prefs_common.resize_image, P_BOOL}, | ||
| 357 | {"inline_image", "TRUE", &prefs_common.inline_image, P_BOOL}, | ||
| 358 | |||
| 359 | /* Encoding */ | ||
| 360 | {"default_encoding", NULL, &prefs_common.default_encoding, P_STRING}, | ||
| 361 | {"outgoing_charset", NULL, &prefs_common.outgoing_charset, P_STRING}, | ||
| 362 | |||
| 363 | {"show_other_header", "FALSE", &prefs_common.show_other_header, P_BOOL}, | ||
| 364 | |||
| 365 | /* MIME viewer */ | ||
| 366 | {"mime_image_viewer", NULL, &prefs_common.mime_image_viewer, P_STRING}, | ||
| 367 | {"mime_audio_player", NULL, &prefs_common.mime_audio_player, P_STRING}, | ||
| 368 | #ifdef G_OS_WIN32 | ||
| 369 | {"mime_open_command", "notepad '%s'", &prefs_common.mime_open_cmd, | ||
| 370 | #else | ||
| 371 | {"mime_open_command", "gedit '%s'", &prefs_common.mime_open_cmd, | ||
| 372 | #endif | ||
| 373 | P_STRING}, | ||
| 374 | {"mime_command", NULL, &prefs_common.mime_cmd, P_STRING}, | ||
| 375 | |||
| 376 | /* Junk mail */ | ||
| 377 | {"enable_junk", "FALSE", &prefs_common.enable_junk, P_BOOL}, | ||
| 378 | #ifdef G_OS_WIN32 | ||
| 379 | {"junk_learn_command", "sylfilter -j", | ||
| 380 | &prefs_common.junk_learncmd, P_STRING}, | ||
| 381 | {"nojunk_learn_command", "sylfilter -c", | ||
| 382 | &prefs_common.nojunk_learncmd, P_STRING}, | ||
| 383 | {"junk_classify_command", "sylfilter", | ||
| 384 | &prefs_common.junk_classify_cmd, P_STRING}, | ||
| 385 | #else | ||
| 386 | {"junk_learn_command", "bogofilter -N -s -I", | ||
| 387 | &prefs_common.junk_learncmd, P_STRING}, | ||
| 388 | {"nojunk_learn_command", "bogofilter -n -S -I", | ||
| 389 | &prefs_common.nojunk_learncmd, P_STRING}, | ||
| 390 | {"junk_classify_command", "bogofilter -I", | ||
| 391 | &prefs_common.junk_classify_cmd, P_STRING}, | ||
| 392 | #endif | ||
| 393 | {"junk_folder", NULL, &prefs_common.junk_folder, P_STRING}, | ||
| 394 | {"filter_junk_on_receive", "FALSE", &prefs_common.filter_junk_on_recv, | ||
| 395 | P_BOOL}, | ||
| 396 | {"filter_junk_before", "FALSE", &prefs_common.filter_junk_before, | ||
| 397 | P_BOOL}, | ||
| 398 | {"delete_junk_on_receive", "TRUE", &prefs_common.delete_junk_on_recv, | ||
| 399 | P_BOOL}, | ||
| 400 | {"nofilter_junk_sender_in_book", "TRUE", | ||
| 401 | &prefs_common.nofilter_junk_sender_in_book, P_BOOL}, | ||
| 402 | {"mark_junk_as_read", "FALSE", &prefs_common.mark_junk_as_read, P_BOOL}, | ||
| 403 | |||
| 404 | /* Privacy */ | ||
| 405 | {"auto_check_signatures", "TRUE", &prefs_common.auto_check_signatures, | ||
| 406 | P_BOOL}, | ||
| 407 | {"gpg_signature_popup", "FALSE", &prefs_common.gpg_signature_popup, | ||
| 408 | P_BOOL}, | ||
| 409 | {"store_passphrase", "FALSE", &prefs_common.store_passphrase, P_BOOL}, | ||
| 410 | {"store_passphrase_timeout", "0", | ||
| 411 | &prefs_common.store_passphrase_timeout, P_INT}, | ||
| 412 | {"passphrase_grab", "FALSE", &prefs_common.passphrase_grab, P_BOOL}, | ||
| 413 | #ifdef G_OS_WIN32 | ||
| 414 | {"show_gpg_warning", "FALSE", &prefs_common.gpg_warning, P_BOOL}, | ||
| 415 | #else | ||
| 416 | {"show_gpg_warning", "TRUE", &prefs_common.gpg_warning, P_BOOL}, | ||
| 417 | #endif | ||
| 418 | |||
| 419 | /* Interface */ | ||
| 420 | {"separate_folder", "FALSE", &prefs_common.sep_folder, P_BOOL}, | ||
| 421 | {"separate_message", "FALSE", &prefs_common.sep_msg, P_BOOL}, | ||
| 422 | |||
| 423 | {"always_show_message_when_selected", "TRUE", | ||
| 424 | &prefs_common.always_show_msg, P_BOOL}, | ||
| 425 | {"open_unread_on_enter", "FALSE", &prefs_common.open_unread_on_enter, | ||
| 426 | P_BOOL}, | ||
| 427 | {"always_mark_read_on_show_msg", "FALSE", | ||
| 428 | &prefs_common.always_mark_read_on_show_msg, P_BOOL}, | ||
| 429 | {"remember_last_selected", "FALSE", | ||
| 430 | &prefs_common.remember_last_selected, P_BOOL}, | ||
| 431 | {"mark_as_read_on_new_window", "FALSE", | ||
| 432 | &prefs_common.mark_as_read_on_new_window, P_BOOL}, | ||
| 433 | {"open_inbox_on_inc", "FALSE", &prefs_common.open_inbox_on_inc, P_BOOL}, | ||
| 434 | {"open_inbox_on_startup", "FALSE", &prefs_common.open_inbox_on_startup, | ||
| 435 | P_BOOL}, | ||
| 436 | {"change_account_on_folder_selection", "TRUE", | ||
| 437 | &prefs_common.change_account_on_folder_sel, P_BOOL}, | ||
| 438 | {"immediate_execution", "TRUE", &prefs_common.immediate_exec, P_BOOL}, | ||
| 439 | |||
| 440 | #ifdef G_OS_WIN32 | ||
| 441 | {"comply_gnome_hig", "FALSE", &prefs_common.comply_gnome_hig, P_BOOL}, | ||
| 442 | #else | ||
| 443 | {"comply_gnome_hig", "TRUE", &prefs_common.comply_gnome_hig, P_BOOL}, | ||
| 444 | #endif | ||
| 445 | |||
| 446 | {"show_trayicon", "TRUE", &prefs_common.show_trayicon, P_BOOL}, | ||
| 447 | {"minimize_to_tray", "FALSE", &prefs_common.minimize_to_tray, P_BOOL}, | ||
| 448 | #ifdef G_OS_WIN32 | ||
| 449 | {"toggle_window_on_trayicon_click", "FALSE", | ||
| 450 | #else | ||
| 451 | {"toggle_window_on_trayicon_click", "TRUE", | ||
| 452 | #endif | ||
| 453 | &prefs_common.toggle_window_on_trayicon_click, P_BOOL}, | ||
| 454 | |||
| 455 | /* Other */ | ||
| 456 | {"receive_dialog_mode", "1", &prefs_common.recv_dialog_mode, P_ENUM}, | ||
| 457 | {"no_receive_error_panel", "FALSE", &prefs_common.no_recv_err_panel, | ||
| 458 | P_BOOL}, | ||
| 459 | {"close_receive_dialog", "TRUE", &prefs_common.close_recv_dialog, | ||
| 460 | P_BOOL}, | ||
| 461 | |||
| 462 | {"add_address_by_click", "FALSE", &prefs_common.add_address_by_click, | ||
| 463 | P_BOOL}, | ||
| 464 | {"enable_address_completion", "TRUE", | ||
| 465 | &prefs_common.enable_address_completion, P_BOOL}, | ||
| 466 | {"fullauto_completion_mode", "TRUE", | ||
| 467 | &prefs_common.fullauto_completion_mode, P_BOOL}, | ||
| 468 | {"always_add_address_only", "FALSE", | ||
| 469 | &prefs_common.always_add_address_only, P_BOOL}, | ||
| 470 | |||
| 471 | {"confirm_on_exit", "FALSE", &prefs_common.confirm_on_exit, P_BOOL}, | ||
| 472 | {"clean_trash_on_exit", "FALSE", &prefs_common.clean_on_exit, P_BOOL}, | ||
| 473 | {"ask_on_cleaning", "TRUE", &prefs_common.ask_on_clean, P_BOOL}, | ||
| 474 | {"warn_queued_on_exit", "TRUE", &prefs_common.warn_queued_on_exit, | ||
| 475 | P_BOOL}, | ||
| 476 | |||
| 477 | {"logwindow_line_limit", "1000", &prefs_common.logwin_line_limit, | ||
| 478 | P_INT}, | ||
| 479 | |||
| 480 | {"online_mode", "TRUE", &prefs_common.online_mode, P_BOOL}, | ||
| 481 | {"startup_online_mode", "1", &prefs_common.startup_online_mode, P_INT}, | ||
| 482 | |||
| 483 | /* External commands */ | ||
| 484 | #ifdef G_OS_WIN32 | ||
| 485 | {"uri_open_command", NULL, &prefs_common.uri_cmd, | ||
| 486 | #else | ||
| 487 | {"uri_open_command", DEFAULT_BROWSER_CMD, &prefs_common.uri_cmd, | ||
| 488 | #endif | ||
| 489 | P_STRING}, | ||
| 490 | #ifdef G_OS_WIN32 | ||
| 491 | {"ext_editor_command", "notepad '%s'", &prefs_common.ext_editor_cmd, | ||
| 492 | #else | ||
| 493 | {"ext_editor_command", "gedit %s", &prefs_common.ext_editor_cmd, | ||
| 494 | #endif | ||
| 495 | P_STRING}, | ||
| 496 | |||
| 497 | {"use_print_command", "FALSE", &prefs_common.use_print_cmd, P_BOOL}, | ||
| 498 | #ifdef G_OS_WIN32 | ||
| 499 | {"print_command", NULL, &prefs_common.print_cmd, P_STRING}, | ||
| 500 | #else | ||
| 501 | {"print_command", "lpr %s", &prefs_common.print_cmd, P_STRING}, | ||
| 502 | #endif | ||
| 503 | |||
| 504 | {"use_ext_inc", "FALSE", &prefs_common.use_extinc, P_BOOL}, | ||
| 505 | {"ext_inc_path", DEFAULT_INC_PATH, &prefs_common.extinc_cmd, P_STRING}, | ||
| 506 | {"use_ext_sendmail", "FALSE", &prefs_common.use_extsend, P_BOOL}, | ||
| 507 | {"ext_sendmail_cmd", DEFAULT_SENDMAIL_CMD, &prefs_common.extsend_cmd, | ||
| 508 | P_STRING}, | ||
| 509 | |||
| 510 | /* Update check */ | ||
| 511 | {"auto_update_check", "TRUE", &prefs_common.auto_update_check, P_BOOL}, | ||
| 512 | {"use_http_proxy", "FALSE", &prefs_common.use_http_proxy, P_BOOL}, | ||
| 513 | {"http_proxy_host", NULL, &prefs_common.http_proxy_host, P_STRING}, | ||
| 514 | |||
| 515 | /* Advanced */ | ||
| 516 | {"strict_cache_check", "FALSE", &prefs_common.strict_cache_check, | ||
| 517 | P_BOOL}, | ||
| 518 | {"io_timeout_secs", "60", &prefs_common.io_timeout_secs, P_INT}, | ||
| 519 | |||
| 520 | /* File selector */ | ||
| 521 | {"filesel_prev_open_dir", NULL, &prefs_common.prev_open_dir, P_STRING}, | ||
| 522 | {"filesel_prev_save_dir", NULL, &prefs_common.prev_save_dir, P_STRING}, | ||
| 523 | {"filesel_prev_folder_dir", NULL, &prefs_common.prev_folder_dir, P_STRING}, | ||
| 524 | {"filesel_save_file_type", "0", &prefs_common.save_file_type, P_INT}, | ||
| 525 | |||
| 526 | {NULL, NULL, NULL, P_OTHER} | ||
| 527 | }; | ||
| 528 | |||
| 529 | |||
| 530 | PrefsCommon *prefs_common_get(void) | ||
| 531 | { | ||
| 532 | return &prefs_common; | ||
| 533 | } | ||
| 534 | |||
| 535 | PrefParam *prefs_common_get_params(void) | ||
| 536 | { | ||
| 537 | return param; | ||
| 538 | } | ||
| 539 | |||
| 540 | void prefs_common_read_config(void) | ||
| 541 | { | ||
| 542 | FILE *fp; | ||
| 543 | gchar *path; | ||
| 544 | gchar buf[PREFSBUFSIZE]; | ||
| 545 | |||
| 546 | path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL); | ||
| 547 | |||
| 548 | prefs_read_config(param, "Common", path, NULL); | ||
| 549 | |||
| 550 | g_free(path); | ||
| 551 | |||
| 552 | //prefs_common.online_mode = TRUE; | ||
| 553 | |||
| 554 | path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMAND_HISTORY, | ||
| 555 | NULL); | ||
| 556 | if ((fp = g_fopen(path, "rb")) == NULL) { | ||
| 557 | if (ENOENT != errno) FILE_OP_ERROR(path, "fopen"); | ||
| 558 | g_free(path); | ||
| 559 | return; | ||
| 560 | } | ||
| 561 | g_free(path); | ||
| 562 | while (fgets(buf, sizeof(buf), fp) != NULL) { | ||
| 563 | g_strstrip(buf); | ||
| 564 | if (buf[0] == '\0') continue; | ||
| 565 | prefs_common.mime_open_cmd_history = | ||
| 566 | add_history(prefs_common.mime_open_cmd_history, buf); | ||
| 567 | } | ||
| 568 | fclose(fp); | ||
| 569 | |||
| 570 | prefs_common.mime_open_cmd_history = | ||
| 571 | g_list_reverse(prefs_common.mime_open_cmd_history); | ||
| 572 | } | ||
| 573 | |||
| 574 | void prefs_common_write_config(void) | ||
| 575 | { | ||
| 576 | GList *cur; | ||
| 577 | FILE *fp; | ||
| 578 | gchar *path; | ||
| 579 | |||
| 580 | prefs_write_config(param, "Common", COMMON_RC); | ||
| 581 | |||
| 582 | path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMAND_HISTORY, | ||
| 583 | NULL); | ||
| 584 | if ((fp = g_fopen(path, "wb")) == NULL) { | ||
| 585 | FILE_OP_ERROR(path, "fopen"); | ||
| 586 | g_free(path); | ||
| 587 | return; | ||
| 588 | } | ||
| 589 | |||
| 590 | for (cur = prefs_common.mime_open_cmd_history; | ||
| 591 | cur != NULL; cur = cur->next) { | ||
| 592 | fputs((gchar *)cur->data, fp); | ||
| 593 | fputc('\n', fp); | ||
| 594 | } | ||
| 595 | |||
| 596 | fclose(fp); | ||
| 597 | g_free(path); | ||
| 598 | } | ||
| 599 | |||
| 600 | void prefs_common_junk_filter_list_set(void) | ||
| 601 | { | ||
| 602 | } | ||
| 603 | |||
| 604 | void prefs_common_junk_folder_rename_path(const gchar *old_path, | ||
| 605 | const gchar *new_path) | ||
| 606 | { | ||
| 607 | gint len; | ||
| 608 | gchar *base; | ||
| 609 | gchar *dest_path; | ||
| 610 | |||
| 611 | g_return_if_fail(old_path != NULL); | ||
| 612 | g_return_if_fail(new_path != NULL); | ||
| 613 | |||
| 614 | if (!prefs_common.junk_folder) | ||
| 615 | return; | ||
| 616 | |||
| 617 | len = strlen(old_path); | ||
| 618 | |||
| 619 | if (!strncmp(old_path, prefs_common.junk_folder, len)) { | ||
| 620 | base = prefs_common.junk_folder + len; | ||
| 621 | if (*base != '/' && *base != '\0') | ||
| 622 | return; | ||
| 623 | while (*base == '/') base++; | ||
| 624 | if (*base == '\0') | ||
| 625 | dest_path = g_strdup(new_path); | ||
| 626 | else | ||
| 627 | dest_path = g_strconcat(new_path, "/", base, NULL); | ||
| 628 | debug_print("prefs_common_junk_folder_rename_path(): " | ||
| 629 | "renaming %s -> %s\n", prefs_common.junk_folder, | ||
| 630 | dest_path); | ||
| 631 | g_free(prefs_common.junk_folder); | ||
| 632 | prefs_common.junk_folder = dest_path; | ||
| 633 | } | ||
| 634 | } | ||
