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