root / libsylph / prefs_common.c @ 548
History | View | Annotate | Download (15.2 kB)
| 1 | /*
|
|---|---|
| 2 | * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client |
| 3 | * Copyright (C) 1999-2005 Hiroyuki Yamamoto |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program 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 |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 | {"use_ext_inc", "FALSE", &prefs_common.use_extinc, P_BOOL},
|
| 42 | {"ext_inc_path", DEFAULT_INC_PATH, &prefs_common.extinc_cmd, P_STRING},
|
| 43 | |
| 44 | {"inc_local", "FALSE", &prefs_common.inc_local, P_BOOL},
|
| 45 | {"filter_on_inc_local", "TRUE", &prefs_common.filter_on_inc, P_BOOL},
|
| 46 | {"spool_path", DEFAULT_SPOOL_PATH, &prefs_common.spool_path, P_STRING},
|
| 47 | |
| 48 | {"autochk_newmail", "FALSE", &prefs_common.autochk_newmail, P_BOOL},
|
| 49 | {"autochk_interval", "10", &prefs_common.autochk_itv, P_INT},
|
| 50 | {"check_on_startup", "FALSE", &prefs_common.chk_on_startup, P_BOOL},
|
| 51 | {"scan_all_after_inc", "FALSE", &prefs_common.scan_all_after_inc,
|
| 52 | P_BOOL}, |
| 53 | {"enable_newmsg_notify", "FALSE", &prefs_common.enable_newmsg_notify,
|
| 54 | P_BOOL}, |
| 55 | {"newmsg_notify_command", NULL, &prefs_common.newmsg_notify_cmd,
|
| 56 | P_STRING}, |
| 57 | |
| 58 | /* Send */
|
| 59 | {"use_ext_sendmail", "FALSE", &prefs_common.use_extsend, P_BOOL},
|
| 60 | {"ext_sendmail_cmd", DEFAULT_SENDMAIL_CMD, &prefs_common.extsend_cmd,
|
| 61 | P_STRING}, |
| 62 | {"save_message", "TRUE", &prefs_common.savemsg, P_BOOL},
|
| 63 | {"filter_sent_message", "FALSE", &prefs_common.filter_sent, P_BOOL},
|
| 64 | |
| 65 | {"outgoing_charset", CS_AUTO, &prefs_common.outgoing_charset, P_STRING},
|
| 66 | {"encoding_method", "0", &prefs_common.encoding_method, P_ENUM},
|
| 67 | |
| 68 | {"allow_jisx0201_kana", "FALSE", &prefs_common.allow_jisx0201_kana,
|
| 69 | P_BOOL}, |
| 70 | |
| 71 | /* Compose */
|
| 72 | {"auto_signature", "TRUE", &prefs_common.auto_sig, P_BOOL},
|
| 73 | {"signature_separator", "-- ", &prefs_common.sig_sep, P_STRING},
|
| 74 | |
| 75 | {"auto_ext_editor", "FALSE", &prefs_common.auto_exteditor, P_BOOL},
|
| 76 | |
| 77 | {"undo_level", "50", &prefs_common.undolevels, P_INT},
|
| 78 | |
| 79 | {"linewrap_length", "72", &prefs_common.linewrap_len, P_INT},
|
| 80 | {"linewrap_quotation", "FALSE", &prefs_common.linewrap_quote, P_BOOL},
|
| 81 | {"linewrap_auto", "FALSE", &prefs_common.autowrap, P_BOOL},
|
| 82 | {"linewrap_before_sending", "FALSE", &prefs_common.linewrap_at_send,
|
| 83 | P_BOOL}, |
| 84 | |
| 85 | {"reply_with_quote", "TRUE", &prefs_common.reply_with_quote, P_BOOL},
|
| 86 | {"reply_account_autoselect", "TRUE",
|
| 87 | &prefs_common.reply_account_autosel, P_BOOL}, |
| 88 | {"default_reply_list", "TRUE", &prefs_common.default_reply_list,
|
| 89 | P_BOOL}, |
| 90 | |
| 91 | {"show_ruler", "TRUE", &prefs_common.show_ruler, P_BOOL},
|
| 92 | |
| 93 | /* Quote */
|
| 94 | {"reply_quote_mark", "> ", &prefs_common.quotemark, P_STRING},
|
| 95 | {"reply_quote_format", "On %d\\n%f wrote:\\n\\n%Q",
|
| 96 | &prefs_common.quotefmt, P_STRING}, |
| 97 | |
| 98 | {"forward_quote_mark", "> ", &prefs_common.fw_quotemark, P_STRING},
|
| 99 | {"forward_quote_format",
|
| 100 | "\\n\\nBegin forwarded message:\\n\\n"
|
| 101 | "?d{Date: %d\\n}?f{From: %f\\n}?t{To: %t\\n}?c{Cc: %c\\n}"
|
| 102 | "?n{Newsgroups: %n\\n}?s{Subject: %s\\n}\\n\\n%M",
|
| 103 | &prefs_common.fw_quotefmt, P_STRING}, |
| 104 | |
| 105 | /* Display */
|
| 106 | {"message_font_name", DEFAULT_MESSAGE_FONT, &prefs_common.textfont,
|
| 107 | P_STRING}, |
| 108 | |
| 109 | {"display_folder_unread_num", "TRUE",
|
| 110 | &prefs_common.display_folder_unread, P_BOOL}, |
| 111 | {"newsgroup_abbrev_len", "16", &prefs_common.ng_abbrev_len, P_INT},
|
| 112 | |
| 113 | {"translate_header", "TRUE", &prefs_common.trans_hdr, P_BOOL},
|
| 114 | |
| 115 | /* Display: Summary View */
|
| 116 | {"enable_swap_from", "FALSE", &prefs_common.swap_from, P_BOOL},
|
| 117 | {"date_format", "%y/%m/%d(%a) %H:%M", &prefs_common.date_format,
|
| 118 | P_STRING}, |
| 119 | {"expand_thread", "TRUE", &prefs_common.expand_thread, P_BOOL},
|
| 120 | |
| 121 | {"enable_rules_hint", "TRUE", &prefs_common.enable_rules_hint, P_BOOL},
|
| 122 | {"bold_unread", "TRUE", &prefs_common.bold_unread, P_BOOL},
|
| 123 | |
| 124 | {"toolbar_style", "3", &prefs_common.toolbar_style, P_ENUM},
|
| 125 | {"show_statusbar", "TRUE", &prefs_common.show_statusbar, P_BOOL},
|
| 126 | |
| 127 | {"folderview_vscrollbar_policy", "0",
|
| 128 | &prefs_common.folderview_vscrollbar_policy, P_ENUM}, |
| 129 | |
| 130 | {"summary_col_show_mark", "TRUE",
|
| 131 | &prefs_common.summary_col_visible[S_COL_MARK], P_BOOL}, |
| 132 | {"summary_col_show_unread", "TRUE",
|
| 133 | &prefs_common.summary_col_visible[S_COL_UNREAD], P_BOOL}, |
| 134 | {"summary_col_show_mime", "TRUE",
|
| 135 | &prefs_common.summary_col_visible[S_COL_MIME], P_BOOL}, |
| 136 | {"summary_col_show_subject", "TRUE",
|
| 137 | &prefs_common.summary_col_visible[S_COL_SUBJECT], P_BOOL}, |
| 138 | {"summary_col_show_from", "TRUE",
|
| 139 | &prefs_common.summary_col_visible[S_COL_FROM], P_BOOL}, |
| 140 | {"summary_col_show_date", "TRUE",
|
| 141 | &prefs_common.summary_col_visible[S_COL_DATE], P_BOOL}, |
| 142 | {"summary_col_show_size", "TRUE",
|
| 143 | &prefs_common.summary_col_visible[S_COL_SIZE], P_BOOL}, |
| 144 | {"summary_col_show_number", "FALSE",
|
| 145 | &prefs_common.summary_col_visible[S_COL_NUMBER], P_BOOL}, |
| 146 | |
| 147 | {"summary_col_pos_mark", "0",
|
| 148 | &prefs_common.summary_col_pos[S_COL_MARK], P_INT}, |
| 149 | {"summary_col_pos_unread", "1",
|
| 150 | &prefs_common.summary_col_pos[S_COL_UNREAD], P_INT}, |
| 151 | {"summary_col_pos_mime", "2",
|
| 152 | &prefs_common.summary_col_pos[S_COL_MIME], P_INT}, |
| 153 | {"summary_col_pos_subject", "3",
|
| 154 | &prefs_common.summary_col_pos[S_COL_SUBJECT], P_INT}, |
| 155 | {"summary_col_pos_from", "4",
|
| 156 | &prefs_common.summary_col_pos[S_COL_FROM], P_INT}, |
| 157 | {"summary_col_pos_date", "5",
|
| 158 | &prefs_common.summary_col_pos[S_COL_DATE], P_INT}, |
| 159 | {"summary_col_pos_size", "6",
|
| 160 | &prefs_common.summary_col_pos[S_COL_SIZE], P_INT}, |
| 161 | {"summary_col_pos_number", "7",
|
| 162 | &prefs_common.summary_col_pos[S_COL_NUMBER], P_INT}, |
| 163 | |
| 164 | {"summary_col_size_mark", "10",
|
| 165 | &prefs_common.summary_col_size[S_COL_MARK], P_INT}, |
| 166 | {"summary_col_size_unread", "13",
|
| 167 | &prefs_common.summary_col_size[S_COL_UNREAD], P_INT}, |
| 168 | {"summary_col_size_mime", "10",
|
| 169 | &prefs_common.summary_col_size[S_COL_MIME], P_INT}, |
| 170 | {"summary_col_size_subject", "200",
|
| 171 | &prefs_common.summary_col_size[S_COL_SUBJECT], P_INT}, |
| 172 | {"summary_col_size_from", "120",
|
| 173 | &prefs_common.summary_col_size[S_COL_FROM], P_INT}, |
| 174 | {"summary_col_size_date", "118",
|
| 175 | &prefs_common.summary_col_size[S_COL_DATE], P_INT}, |
| 176 | {"summary_col_size_size", "45",
|
| 177 | &prefs_common.summary_col_size[S_COL_SIZE], P_INT}, |
| 178 | {"summary_col_size_number", "40",
|
| 179 | &prefs_common.summary_col_size[S_COL_NUMBER], P_INT}, |
| 180 | |
| 181 | /* Widget size */
|
| 182 | {"folderwin_x", "16", &prefs_common.folderwin_x, P_INT},
|
| 183 | {"folderwin_y", "16", &prefs_common.folderwin_y, P_INT},
|
| 184 | {"folderview_width", "179", &prefs_common.folderview_width, P_INT},
|
| 185 | {"folderview_height", "450", &prefs_common.folderview_height, P_INT},
|
| 186 | {"folderview_visible", "TRUE", &prefs_common.folderview_visible,
|
| 187 | P_BOOL}, |
| 188 | |
| 189 | {"folder_col_folder", "150", &prefs_common.folder_col_folder, P_INT},
|
| 190 | {"folder_col_new", "32", &prefs_common.folder_col_new, P_INT},
|
| 191 | {"folder_col_unread", "32", &prefs_common.folder_col_unread, P_INT},
|
| 192 | {"folder_col_total", "32", &prefs_common.folder_col_total, P_INT},
|
| 193 | |
| 194 | {"summaryview_width", "600", &prefs_common.summaryview_width, P_INT},
|
| 195 | {"summaryview_height", "157", &prefs_common.summaryview_height, P_INT},
|
| 196 | |
| 197 | {"main_messagewin_x", "256", &prefs_common.main_msgwin_x, P_INT},
|
| 198 | {"main_messagewin_y", "210", &prefs_common.main_msgwin_y, P_INT},
|
| 199 | {"messageview_width", "600", &prefs_common.msgview_width, P_INT},
|
| 200 | {"messageview_height", "300", &prefs_common.msgview_height, P_INT},
|
| 201 | {"messageview_visible", "TRUE", &prefs_common.msgview_visible, P_BOOL},
|
| 202 | |
| 203 | {"mainview_x", "64", &prefs_common.mainview_x, P_INT},
|
| 204 | {"mainview_y", "64", &prefs_common.mainview_y, P_INT},
|
| 205 | {"mainview_width", "600", &prefs_common.mainview_width, P_INT},
|
| 206 | {"mainview_height", "600", &prefs_common.mainview_height, P_INT},
|
| 207 | {"mainwin_x", "64", &prefs_common.mainwin_x, P_INT},
|
| 208 | {"mainwin_y", "64", &prefs_common.mainwin_y, P_INT},
|
| 209 | {"mainwin_width", "800", &prefs_common.mainwin_width, P_INT},
|
| 210 | {"mainwin_height", "600", &prefs_common.mainwin_height, P_INT},
|
| 211 | {"messagewin_width", "600", &prefs_common.msgwin_width, P_INT},
|
| 212 | {"messagewin_height", "540", &prefs_common.msgwin_height, P_INT},
|
| 213 | {"sourcewin_width", "600", &prefs_common.sourcewin_width, P_INT},
|
| 214 | {"sourcewin_height", "500", &prefs_common.sourcewin_height, P_INT},
|
| 215 | {"compose_width", "600", &prefs_common.compose_width, P_INT},
|
| 216 | {"compose_height", "560", &prefs_common.compose_height, P_INT},
|
| 217 | |
| 218 | /* Message */
|
| 219 | {"enable_color", "TRUE", &prefs_common.enable_color, P_BOOL},
|
| 220 | |
| 221 | {"quote_level1_color", "179", &prefs_common.quote_level1_col, P_INT},
|
| 222 | {"quote_level2_color", "179", &prefs_common.quote_level2_col, P_INT},
|
| 223 | {"quote_level3_color", "179", &prefs_common.quote_level3_col, P_INT},
|
| 224 | {"uri_color", "32512", &prefs_common.uri_col, P_INT},
|
| 225 | {"signature_color", "0", &prefs_common.sig_col, P_USHORT},
|
| 226 | {"recycle_quote_colors", "FALSE", &prefs_common.recycle_quote_colors,
|
| 227 | P_BOOL}, |
| 228 | |
| 229 | {"convert_mb_alnum", "FALSE", &prefs_common.conv_mb_alnum, P_BOOL},
|
| 230 | {"display_header_pane", "TRUE", &prefs_common.display_header_pane,
|
| 231 | P_BOOL}, |
| 232 | {"display_header", "TRUE", &prefs_common.display_header, P_BOOL},
|
| 233 | {"render_html", "TRUE", &prefs_common.render_html, P_BOOL},
|
| 234 | {"line_space", "2", &prefs_common.line_space, P_INT},
|
| 235 | |
| 236 | {"textview_cursor_visible", "FALSE",
|
| 237 | &prefs_common.textview_cursor_visible, P_BOOL}, |
| 238 | |
| 239 | {"enable_smooth_scroll", "FALSE", &prefs_common.enable_smooth_scroll,
|
| 240 | P_BOOL}, |
| 241 | {"scroll_step", "1", &prefs_common.scroll_step, P_INT},
|
| 242 | {"scroll_half_page", "FALSE", &prefs_common.scroll_halfpage, P_BOOL},
|
| 243 | |
| 244 | {"resize_image", "TRUE", &prefs_common.resize_image, P_BOOL},
|
| 245 | {"inline_image", "TRUE", &prefs_common.inline_image, P_BOOL},
|
| 246 | |
| 247 | {"show_other_header", "FALSE", &prefs_common.show_other_header, P_BOOL},
|
| 248 | |
| 249 | /* MIME viewer */
|
| 250 | {"mime_image_viewer", "display '%s'", &prefs_common.mime_image_viewer,
|
| 251 | P_STRING}, |
| 252 | {"mime_audio_player", "play '%s'", &prefs_common.mime_audio_player,
|
| 253 | P_STRING}, |
| 254 | {"mime_open_command", "gedit '%s'", &prefs_common.mime_open_cmd,
|
| 255 | P_STRING}, |
| 256 | |
| 257 | /* Junk mail */
|
| 258 | {"enable_junk", "FALSE", &prefs_common.enable_junk, P_BOOL},
|
| 259 | {"junk_learn_command", "bogofilter -s -I", &prefs_common.junk_learncmd,
|
| 260 | P_STRING}, |
| 261 | {"nojunk_learn_command", "bogofilter -n -I",
|
| 262 | &prefs_common.nojunk_learncmd, P_STRING}, |
| 263 | {"junk_classify_command", "bogofilter -I",
|
| 264 | &prefs_common.junk_classify_cmd, P_STRING}, |
| 265 | {"junk_folder", NULL, &prefs_common.junk_folder, P_STRING},
|
| 266 | {"filter_junk_on_receive", "FALSE", &prefs_common.filter_junk_on_recv,
|
| 267 | P_BOOL}, |
| 268 | |
| 269 | #if USE_GPGME
|
| 270 | /* Privacy */
|
| 271 | {"auto_check_signatures", "TRUE", &prefs_common.auto_check_signatures,
|
| 272 | P_BOOL}, |
| 273 | {"gpg_signature_popup", "FALSE", &prefs_common.gpg_signature_popup,
|
| 274 | P_BOOL}, |
| 275 | {"store_passphrase", "FALSE", &prefs_common.store_passphrase, P_BOOL},
|
| 276 | {"store_passphrase_timeout", "0",
|
| 277 | &prefs_common.store_passphrase_timeout, P_INT}, |
| 278 | #ifndef G_OS_WIN32
|
| 279 | {"passphrase_grab", "FALSE", &prefs_common.passphrase_grab, P_BOOL},
|
| 280 | #endif /* G_OS_WIN32 */ |
| 281 | {"gpg_warning", "TRUE", &prefs_common.gpg_warning, P_BOOL},
|
| 282 | #endif /* USE_GPGME */ |
| 283 | |
| 284 | /* Interface */
|
| 285 | {"separate_folder", "FALSE", &prefs_common.sep_folder, P_BOOL},
|
| 286 | {"separate_message", "FALSE", &prefs_common.sep_msg, P_BOOL},
|
| 287 | |
| 288 | {"always_show_message_when_selected", "FALSE",
|
| 289 | &prefs_common.always_show_msg, P_BOOL}, |
| 290 | {"open_unread_on_enter", "FALSE", &prefs_common.open_unread_on_enter,
|
| 291 | P_BOOL}, |
| 292 | {"mark_as_read_on_new_window", "FALSE",
|
| 293 | &prefs_common.mark_as_read_on_new_window, P_BOOL}, |
| 294 | {"open_inbox_on_inc", "FALSE", &prefs_common.open_inbox_on_inc, P_BOOL},
|
| 295 | {"immediate_execution", "TRUE", &prefs_common.immediate_exec, P_BOOL},
|
| 296 | {"receive_dialog_mode", "1", &prefs_common.recv_dialog_mode, P_ENUM},
|
| 297 | {"no_receive_error_panel", "FALSE", &prefs_common.no_recv_err_panel,
|
| 298 | P_BOOL}, |
| 299 | {"close_receive_dialog", "TRUE", &prefs_common.close_recv_dialog,
|
| 300 | P_BOOL}, |
| 301 | |
| 302 | #ifdef G_OS_WIN32
|
| 303 | {"comply_gnome_hig", "FALSE", &prefs_common.comply_gnome_hig, P_BOOL},
|
| 304 | #else
|
| 305 | {"comply_gnome_hig", "TRUE", &prefs_common.comply_gnome_hig, P_BOOL},
|
| 306 | #endif
|
| 307 | |
| 308 | /* Other */
|
| 309 | {"uri_open_command", DEFAULT_BROWSER_CMD, &prefs_common.uri_cmd,
|
| 310 | P_STRING}, |
| 311 | {"print_command", "lpr %s", &prefs_common.print_cmd, P_STRING},
|
| 312 | {"ext_editor_command", "gedit %s", &prefs_common.ext_editor_cmd,
|
| 313 | P_STRING}, |
| 314 | |
| 315 | {"add_address_by_click", "FALSE", &prefs_common.add_address_by_click,
|
| 316 | P_BOOL}, |
| 317 | |
| 318 | {"confirm_on_exit", "FALSE", &prefs_common.confirm_on_exit, P_BOOL},
|
| 319 | {"clean_trash_on_exit", "FALSE", &prefs_common.clean_on_exit, P_BOOL},
|
| 320 | {"ask_on_cleaning", "TRUE", &prefs_common.ask_on_clean, P_BOOL},
|
| 321 | {"warn_queued_on_exit", "TRUE", &prefs_common.warn_queued_on_exit,
|
| 322 | P_BOOL}, |
| 323 | |
| 324 | {"logwindow_line_limit", "1000", &prefs_common.logwin_line_limit,
|
| 325 | P_INT}, |
| 326 | |
| 327 | /* Advanced */
|
| 328 | {"strict_cache_check", "FALSE", &prefs_common.strict_cache_check,
|
| 329 | P_BOOL}, |
| 330 | {"io_timeout_secs", "60", &prefs_common.io_timeout_secs, P_INT},
|
| 331 | |
| 332 | {NULL, NULL, NULL, P_OTHER}
|
| 333 | }; |
| 334 | |
| 335 | |
| 336 | PrefParam *prefs_common_get_params(void)
|
| 337 | {
|
| 338 | return param;
|
| 339 | } |
| 340 | |
| 341 | void prefs_common_read_config(void) |
| 342 | {
|
| 343 | FILE *fp; |
| 344 | gchar *path; |
| 345 | gchar buf[PREFSBUFSIZE]; |
| 346 | |
| 347 | path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
|
| 348 | |
| 349 | prefs_read_config(param, "Common", path, NULL); |
| 350 | g_free(path); |
| 351 | |
| 352 | prefs_common.online_mode = TRUE; |
| 353 | |
| 354 | prefs_common_junk_filter_list_set(); |
| 355 | |
| 356 | path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMAND_HISTORY, |
| 357 | NULL);
|
| 358 | if ((fp = g_fopen(path, "rb")) == NULL) { |
| 359 | if (ENOENT != errno) FILE_OP_ERROR(path, "fopen"); |
| 360 | g_free(path); |
| 361 | return;
|
| 362 | } |
| 363 | g_free(path); |
| 364 | while (fgets(buf, sizeof(buf), fp) != NULL) { |
| 365 | g_strstrip(buf); |
| 366 | if (buf[0] == '\0') continue; |
| 367 | prefs_common.mime_open_cmd_history = |
| 368 | add_history(prefs_common.mime_open_cmd_history, buf); |
| 369 | } |
| 370 | fclose(fp); |
| 371 | |
| 372 | prefs_common.mime_open_cmd_history = |
| 373 | g_list_reverse(prefs_common.mime_open_cmd_history); |
| 374 | } |
| 375 | |
| 376 | void prefs_common_write_config(void) |
| 377 | {
|
| 378 | GList *cur; |
| 379 | FILE *fp; |
| 380 | gchar *path; |
| 381 | |
| 382 | prefs_write_config(param, "Common", COMMON_RC);
|
| 383 | |
| 384 | path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMAND_HISTORY, |
| 385 | NULL);
|
| 386 | if ((fp = g_fopen(path, "wb")) == NULL) { |
| 387 | FILE_OP_ERROR(path, "fopen");
|
| 388 | g_free(path); |
| 389 | return;
|
| 390 | } |
| 391 | |
| 392 | for (cur = prefs_common.mime_open_cmd_history;
|
| 393 | cur != NULL; cur = cur->next) {
|
| 394 | fputs((gchar *)cur->data, fp); |
| 395 | fputc('\n', fp);
|
| 396 | } |
| 397 | |
| 398 | fclose(fp); |
| 399 | g_free(path); |
| 400 | } |
| 401 | |
| 402 | void prefs_common_junk_filter_list_set(void) |
| 403 | {
|
| 404 | FilterRule *rule; |
| 405 | FilterCond *cond; |
| 406 | FilterAction *action; |
| 407 | GSList *cond_list = NULL, *action_list = NULL; |
| 408 | |
| 409 | if (prefs_common.junk_fltlist) {
|
| 410 | filter_rule_list_free(prefs_common.junk_fltlist); |
| 411 | prefs_common.junk_fltlist = NULL;
|
| 412 | } |
| 413 | |
| 414 | if (!prefs_common.junk_classify_cmd || !prefs_common.junk_folder)
|
| 415 | return;
|
| 416 | |
| 417 | cond = filter_cond_new(FLT_COND_CMD_TEST, 0, 0, NULL, |
| 418 | prefs_common.junk_classify_cmd); |
| 419 | cond_list = g_slist_append(NULL, cond);
|
| 420 | action = filter_action_new(FLT_ACTION_COPY, prefs_common.junk_folder); |
| 421 | action_list = g_slist_append(NULL, action);
|
| 422 | action = filter_action_new(FLT_ACTION_DELETE, NULL);
|
| 423 | action_list = g_slist_append(action_list, action); |
| 424 | |
| 425 | rule = filter_rule_new(_("Junk mail filter"), FLT_OR,
|
| 426 | cond_list, action_list); |
| 427 | |
| 428 | prefs_common.junk_fltlist = g_slist_append(NULL, rule);
|
| 429 | } |