Statistics
| Revision:

root / libsylph / prefs_common.c @ 3253

History | View | Annotate | Download (23.1 KB)

1
/*
2
 * LibSylph -- E-Mail client library
3
 * Copyright (C) 1999-2013 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

    
57
        {"inc_local", "FALSE", &prefs_common.inc_local, P_BOOL},
58
        {"filter_on_inc_local", "TRUE", &prefs_common.filter_on_inc, P_BOOL},
59
        {"spool_path", DEFAULT_SPOOL_PATH, &prefs_common.spool_path, P_STRING},
60

    
61
        /* Send */
62
        {"save_message", "TRUE", &prefs_common.savemsg, P_BOOL},
63
        {"filter_sent_message", "FALSE", &prefs_common.filter_sent, P_BOOL},
64
        {"recipients_autoreg", "TRUE", &prefs_common.recipients_autoreg,
65
         P_BOOL},
66
        {"show_send_dialog", "TRUE", &prefs_common.show_send_dialog, P_BOOL},
67

    
68
        {"encoding_method", "0", &prefs_common.encoding_method, P_ENUM},
69
        {"mime_filename_encoding_method", "0",
70
         &prefs_common.mime_fencoding_method, P_ENUM},
71
        {"check_attach", "FALSE", &prefs_common.check_attach, P_BOOL},
72
        {"check_attach_str", NULL, &prefs_common.check_attach_str, P_STRING},
73
        {"check_recipients", "FALSE", &prefs_common.check_recipients, P_BOOL},
74
        {"check_recp_exclude", NULL, &prefs_common.check_recp_exclude,
75
         P_STRING},
76

    
77
        {"allow_jisx0201_kana", "FALSE", &prefs_common.allow_jisx0201_kana,
78
         P_BOOL},
79

    
80
        /* Compose */
81
        {"auto_signature", "TRUE", &prefs_common.auto_sig, P_BOOL},
82
        {"signature_separator", "-- ", &prefs_common.sig_sep, P_STRING},
83

    
84
        {"auto_ext_editor", "FALSE", &prefs_common.auto_exteditor, P_BOOL},
85

    
86
        {"undo_level", "50", &prefs_common.undolevels, P_INT},
87

    
88
        {"linewrap_length", "72", &prefs_common.linewrap_len, P_INT},
89
        {"linewrap_quotation", "FALSE", &prefs_common.linewrap_quote, P_BOOL},
90
        {"linewrap_auto", "FALSE", &prefs_common.autowrap, P_BOOL},
91

    
92
        {"enable_autosave", "FALSE", &prefs_common.enable_autosave, P_BOOL},
93
        {"autosave_interval", "5", &prefs_common.autosave_itv, P_INT},
94

    
95
        {"reply_with_quote", "TRUE", &prefs_common.reply_with_quote, P_BOOL},
96
        {"reply_account_autoselect", "TRUE",
97
         &prefs_common.reply_account_autosel, P_BOOL},
98
        {"default_reply_list", "TRUE", &prefs_common.default_reply_list,
99
         P_BOOL},
100
        {"inherit_recipient_on_self_reply", "FALSE",
101
         &prefs_common.inherit_recipient_on_self_reply, P_BOOL},
102
        {"reply_address_only", "FALSE",
103
         &prefs_common.reply_address_only, P_BOOL},
104

    
105
        {"show_ruler", "TRUE", &prefs_common.show_ruler, P_BOOL},
106

    
107
        /* Quote */
108
        {"reply_quote_mark", "> ", &prefs_common.quotemark, P_STRING},
109
        {"reply_quote_format", "On %d\\n%f wrote:\\n\\n%Q",
110
         &prefs_common.quotefmt, P_STRING},
111

    
112
        {"forward_quote_mark", "> ", &prefs_common.fw_quotemark, P_STRING},
113
        {"forward_quote_format",
114
         "\\n\\nBegin forwarded message:\\n\\n"
115
         "?d{Date: %d\\n}?f{From: %f\\n}?t{To: %t\\n}?c{Cc: %c\\n}"
116
         "?n{Newsgroups: %n\\n}?s{Subject: %s\\n}\\n\\n%M",
117
         &prefs_common.fw_quotefmt, P_STRING},
118

    
119
        /* Spelling */
120
        {"check_spell", "FALSE", &prefs_common.check_spell, P_BOOL},
121
        {"spell_lang", "en", &prefs_common.spell_lang, P_STRING},
122

    
123
        /* Display */
124
        {"message_font_name", DEFAULT_MESSAGE_FONT, &prefs_common.textfont,
125
         P_STRING},
126

    
127
        {"display_folder_unread_num", "TRUE",
128
         &prefs_common.display_folder_unread, P_BOOL},
129
        {"display_folder_num_columns", "FALSE",
130
         &prefs_common.display_folder_num_columns, P_BOOL},
131
        {"folder_col_show_new", "FALSE",
132
         &prefs_common.folder_col_visible[1], P_BOOL},
133
        {"folder_col_show_unread", "FALSE",
134
         &prefs_common.folder_col_visible[2], P_BOOL},
135
        {"folder_col_show_total", "FALSE",
136
         &prefs_common.folder_col_visible[3], P_BOOL},
137

    
138
        {"newsgroup_abbrev_len", "16", &prefs_common.ng_abbrev_len, P_INT},
139

    
140
        {"translate_header", "TRUE", &prefs_common.trans_hdr, P_BOOL},
141

    
142
        /* Display: Summary View */
143
        {"enable_swap_from", "FALSE", &prefs_common.swap_from, P_BOOL},
144
        {"date_format", "%y/%m/%d(%a) %H:%M", &prefs_common.date_format,
145
         P_STRING},
146
        {"expand_thread", "TRUE", &prefs_common.expand_thread, P_BOOL},
147

    
148
        {"enable_rules_hint", "TRUE", &prefs_common.enable_rules_hint, P_BOOL},
149
        {"bold_unread", "TRUE", &prefs_common.bold_unread, P_BOOL},
150

    
151
        {"persist_qsearch_filter", "TRUE", &prefs_common.persist_qsearch_filter,
152
         P_BOOL},
153

    
154
        {"toolbar_style", "4", &prefs_common.toolbar_style, P_ENUM},
155
        {"show_searchbar", "TRUE", &prefs_common.show_searchbar, P_BOOL},
156
        {"show_statusbar", "TRUE", &prefs_common.show_statusbar, P_BOOL},
157

    
158
        {"main_toolbar_setting", NULL, &prefs_common.main_toolbar_setting,
159
         P_STRING},
160
        {"compose_toolbar_setting", NULL,
161
         &prefs_common.compose_toolbar_setting, P_STRING},
162

    
163
        {"layout_type", "0", &prefs_common.layout_type, P_ENUM},
164

    
165
        {"summary_col_show_mark", "TRUE",
166
         &prefs_common.summary_col_visible[S_COL_MARK], P_BOOL},
167
        {"summary_col_show_unread", "TRUE",
168
         &prefs_common.summary_col_visible[S_COL_UNREAD], P_BOOL},
169
        {"summary_col_show_mime", "TRUE",
170
         &prefs_common.summary_col_visible[S_COL_MIME], P_BOOL},
171
        {"summary_col_show_subject", "TRUE",
172
         &prefs_common.summary_col_visible[S_COL_SUBJECT], P_BOOL},
173
        {"summary_col_show_from", "TRUE",
174
         &prefs_common.summary_col_visible[S_COL_FROM], P_BOOL},
175
        {"summary_col_show_date", "TRUE",
176
         &prefs_common.summary_col_visible[S_COL_DATE], P_BOOL},
177
        {"summary_col_show_size", "TRUE",
178
         &prefs_common.summary_col_visible[S_COL_SIZE], P_BOOL},
179
        {"summary_col_show_number", "FALSE",
180
         &prefs_common.summary_col_visible[S_COL_NUMBER], P_BOOL},
181
        {"summary_col_show_to", "FALSE",
182
         &prefs_common.summary_col_visible[S_COL_TO], P_BOOL},
183

    
184
        {"summary_col_pos_mark", "0",
185
          &prefs_common.summary_col_pos[S_COL_MARK], P_INT},
186
        {"summary_col_pos_unread", "1",
187
          &prefs_common.summary_col_pos[S_COL_UNREAD], P_INT},
188
        {"summary_col_pos_mime", "2",
189
          &prefs_common.summary_col_pos[S_COL_MIME], P_INT},
190
        {"summary_col_pos_subject", "3",
191
          &prefs_common.summary_col_pos[S_COL_SUBJECT], P_INT},
192
        {"summary_col_pos_from", "4",
193
          &prefs_common.summary_col_pos[S_COL_FROM], P_INT},
194
        {"summary_col_pos_date", "5",
195
          &prefs_common.summary_col_pos[S_COL_DATE], P_INT},
196
        {"summary_col_pos_size", "6",
197
          &prefs_common.summary_col_pos[S_COL_SIZE], P_INT},
198
        {"summary_col_pos_number", "7",
199
          &prefs_common.summary_col_pos[S_COL_NUMBER], P_INT},
200
        {"summary_col_pos_to", "8",
201
          &prefs_common.summary_col_pos[S_COL_TO], P_INT},
202

    
203
        {"summary_sent_col_show_mark", "TRUE",
204
         &prefs_common.summary_sent_col_visible[S_COL_MARK], P_BOOL},
205
        {"summary_sent_col_show_unread", "TRUE",
206
         &prefs_common.summary_sent_col_visible[S_COL_UNREAD], P_BOOL},
207
        {"summary_sent_col_show_mime", "TRUE",
208
         &prefs_common.summary_sent_col_visible[S_COL_MIME], P_BOOL},
209
        {"summary_sent_col_show_subject", "TRUE",
210
         &prefs_common.summary_sent_col_visible[S_COL_SUBJECT], P_BOOL},
211
        {"summary_sent_col_show_from", "FALSE",
212
         &prefs_common.summary_sent_col_visible[S_COL_FROM], P_BOOL},
213
        {"summary_sent_col_show_date", "TRUE",
214
         &prefs_common.summary_sent_col_visible[S_COL_DATE], P_BOOL},
215
        {"summary_sent_col_show_size", "TRUE",
216
         &prefs_common.summary_sent_col_visible[S_COL_SIZE], P_BOOL},
217
        {"summary_sent_col_show_number", "FALSE",
218
         &prefs_common.summary_sent_col_visible[S_COL_NUMBER], P_BOOL},
219
        {"summary_sent_col_show_to", "TRUE",
220
         &prefs_common.summary_sent_col_visible[S_COL_TO], P_BOOL},
221

    
222
        {"summary_sent_col_pos_mark", "0",
223
          &prefs_common.summary_sent_col_pos[S_COL_MARK], P_INT},
224
        {"summary_sent_col_pos_unread", "1",
225
          &prefs_common.summary_sent_col_pos[S_COL_UNREAD], P_INT},
226
        {"summary_sent_col_pos_mime", "2",
227
          &prefs_common.summary_sent_col_pos[S_COL_MIME], P_INT},
228
        {"summary_sent_col_pos_subject", "3",
229
          &prefs_common.summary_sent_col_pos[S_COL_SUBJECT], P_INT},
230
        {"summary_sent_col_pos_from", "8",
231
          &prefs_common.summary_sent_col_pos[S_COL_FROM], P_INT},
232
        {"summary_sent_col_pos_date", "5",
233
          &prefs_common.summary_sent_col_pos[S_COL_DATE], P_INT},
234
        {"summary_sent_col_pos_size", "6",
235
          &prefs_common.summary_sent_col_pos[S_COL_SIZE], P_INT},
236
        {"summary_sent_col_pos_number", "7",
237
          &prefs_common.summary_sent_col_pos[S_COL_NUMBER], P_INT},
238
        {"summary_sent_col_pos_to", "4",
239
          &prefs_common.summary_sent_col_pos[S_COL_TO], P_INT},
240

    
241
        {"summary_col_size_mark", "10",
242
         &prefs_common.summary_col_size[S_COL_MARK], P_INT},
243
        {"summary_col_size_unread", "13",
244
         &prefs_common.summary_col_size[S_COL_UNREAD], P_INT},
245
        {"summary_col_size_mime", "10",
246
         &prefs_common.summary_col_size[S_COL_MIME], P_INT},
247
        {"summary_col_size_subject", "200",
248
         &prefs_common.summary_col_size[S_COL_SUBJECT], P_INT},
249
        {"summary_col_size_from", "120",
250
         &prefs_common.summary_col_size[S_COL_FROM], P_INT},
251
        {"summary_col_size_date", "118",
252
         &prefs_common.summary_col_size[S_COL_DATE], P_INT},
253
        {"summary_col_size_size", "45",
254
         &prefs_common.summary_col_size[S_COL_SIZE], P_INT},
255
        {"summary_col_size_number", "40",
256
         &prefs_common.summary_col_size[S_COL_NUMBER], P_INT},
257
        {"summary_col_size_to", "120",
258
         &prefs_common.summary_col_size[S_COL_TO], P_INT},
259

    
260
        /* Widget size */
261
        {"folderwin_x", "16", &prefs_common.folderwin_x, P_INT},
262
        {"folderwin_y", "16", &prefs_common.folderwin_y, P_INT},
263
        {"folderview_width", "179", &prefs_common.folderview_width, P_INT},
264
        {"folderview_height", "450", &prefs_common.folderview_height, P_INT},
265
        {"folderview_visible", "TRUE", &prefs_common.folderview_visible,
266
         P_BOOL},
267

    
268
        {"folder_col_folder", "150", &prefs_common.folder_col_folder, P_INT},
269
        {"folder_col_new", "32", &prefs_common.folder_col_new, P_INT},
270
        {"folder_col_unread", "32", &prefs_common.folder_col_unread, P_INT},
271
        {"folder_col_total", "32", &prefs_common.folder_col_total, P_INT},
272

    
273
        {"summaryview_width", "600", &prefs_common.summaryview_width, P_INT},
274
        {"summaryview_height", "180", &prefs_common.summaryview_height, P_INT},
275
        {"summaryview_vwidth", "300", &prefs_common.summaryview_vwidth, P_INT},
276
        {"summaryview_vheight", "600", &prefs_common.summaryview_vheight,
277
         P_INT},
278

    
279
        {"main_messagewin_x", "256", &prefs_common.main_msgwin_x, P_INT},
280
        {"main_messagewin_y", "210", &prefs_common.main_msgwin_y, P_INT},
281
        {"messageview_width", "600", &prefs_common.msgview_width, P_INT},
282
        {"messageview_height", "300", &prefs_common.msgview_height, P_INT},
283
        {"messageview_vwidth", "300", &prefs_common.msgview_vwidth, P_INT},
284
        {"messageview_vheight", "600", &prefs_common.msgview_vheight, P_INT},
285
        {"messageview_visible", "TRUE", &prefs_common.msgview_visible, P_BOOL},
286

    
287
        {"mainview_x", "64", &prefs_common.mainview_x, P_INT},
288
        {"mainview_y", "64", &prefs_common.mainview_y, P_INT},
289
        {"mainview_width", "600", &prefs_common.mainview_width, P_INT},
290
        {"mainview_height", "600", &prefs_common.mainview_height, P_INT},
291
        {"mainwin_x", "64", &prefs_common.mainwin_x, P_INT},
292
        {"mainwin_y", "64", &prefs_common.mainwin_y, P_INT},
293
        {"mainwin_width", "800", &prefs_common.mainwin_width, P_INT},
294
        {"mainwin_height", "600", &prefs_common.mainwin_height, P_INT},
295
        {"messagewin_width", "600", &prefs_common.msgwin_width, P_INT},
296
        {"messagewin_height", "540", &prefs_common.msgwin_height, P_INT},
297

    
298
        {"mainwin_maximized", "FALSE", &prefs_common.mainwin_maximized, P_BOOL},
299

    
300
        {"sourcewin_width", "600", &prefs_common.sourcewin_width, P_INT},
301
        {"sourcewin_height", "500", &prefs_common.sourcewin_height, P_INT},
302

    
303
        {"compose_x", "32", &prefs_common.compose_x, P_INT},
304
        {"compose_y", "32", &prefs_common.compose_y, P_INT},
305
        {"compose_width", "600", &prefs_common.compose_width, P_INT},
306
        {"compose_height", "560", &prefs_common.compose_height, P_INT},
307

    
308
        {"compose_maximized", "FALSE", &prefs_common.compose_maximized, P_BOOL},
309

    
310
        {"addressbook_x", "32", &prefs_common.addressbook_x, P_INT},
311
        {"addressbook_y", "32", &prefs_common.addressbook_y, P_INT},
312
        {"addressbook_width", "620", &prefs_common.addressbook_width, P_INT},
313
        {"addressbook_height", "360", &prefs_common.addressbook_height, P_INT},
314
        {"addressbook_folder_width", "190", &prefs_common.addressbook_folder_width, P_INT},
315
        {"addressbook_col_name", "164", &prefs_common.addressbook_col_name, P_INT},
316
        {"addressbook_col_addr", "156", &prefs_common.addressbook_col_addr, P_INT},
317
        {"addressbook_col_rem", "100", &prefs_common.addressbook_col_rem, P_INT},
318

    
319
        /* Message */
320
        {"enable_color", "TRUE", &prefs_common.enable_color, P_BOOL},
321

    
322
        {"quote_level1_color", "179", &prefs_common.quote_level1_col, P_INT},
323
        {"quote_level2_color", "179", &prefs_common.quote_level2_col, P_INT},
324
        {"quote_level3_color", "179", &prefs_common.quote_level3_col, P_INT},
325
        {"uri_color", "32512", &prefs_common.uri_col, P_INT},
326
        {"signature_color", "0", &prefs_common.sig_col, P_USHORT},
327
        {"recycle_quote_colors", "FALSE", &prefs_common.recycle_quote_colors,
328
         P_BOOL},
329

    
330
        {"convert_mb_alnum", "FALSE", &prefs_common.conv_mb_alnum, P_BOOL},
331
        {"display_header_pane", "TRUE", &prefs_common.display_header_pane,
332
         P_BOOL},
333
        {"show_attach_tab", "FALSE", &prefs_common.show_attach_tab, P_BOOL},
334
        {"show_attached_files_first", "TRUE",
335
         &prefs_common.show_attached_files_first, P_BOOL},
336
        {"attach_toolbutton_pos", "0", &prefs_common.attach_toolbutton_pos,
337
         P_INT},
338
        {"display_header", "TRUE", &prefs_common.display_header, P_BOOL},
339
        {"render_html", "TRUE", &prefs_common.render_html, P_BOOL},
340
        {"alt_prefer_html", "FALSE", &prefs_common.alt_prefer_html, P_BOOL},
341
        {"html_only_as_attach", "FALSE", &prefs_common.html_only_as_attach,
342
         P_BOOL},
343
        {"line_space", "2", &prefs_common.line_space, P_INT},
344

    
345
        {"textview_cursor_visible", "FALSE",
346
         &prefs_common.textview_cursor_visible, P_BOOL},
347

    
348
        {"enable_smooth_scroll", "FALSE", &prefs_common.enable_smooth_scroll,
349
         P_BOOL},
350
        {"scroll_step", "1", &prefs_common.scroll_step, P_INT},
351
        {"scroll_half_page", "FALSE", &prefs_common.scroll_halfpage, P_BOOL},
352

    
353
        {"resize_image", "TRUE", &prefs_common.resize_image, P_BOOL},
354
        {"inline_image", "TRUE", &prefs_common.inline_image, P_BOOL},
355

    
356
        /* Encoding */
357
        {"default_encoding", NULL, &prefs_common.default_encoding, P_STRING},
358
        {"outgoing_charset", NULL, &prefs_common.outgoing_charset, P_STRING},
359

    
360
        {"show_other_header", "FALSE", &prefs_common.show_other_header, P_BOOL},
361

    
362
        /* MIME viewer */
363
        {"mime_image_viewer", NULL, &prefs_common.mime_image_viewer, P_STRING},
364
        {"mime_audio_player", NULL, &prefs_common.mime_audio_player, P_STRING},
365
#ifdef G_OS_WIN32
366
        {"mime_open_command", "notepad '%s'", &prefs_common.mime_open_cmd,
367
#else
368
        {"mime_open_command", "gedit '%s'", &prefs_common.mime_open_cmd,
369
#endif
370
         P_STRING},
371
        {"mime_command", NULL, &prefs_common.mime_cmd, P_STRING},
372

    
373
        /* Junk mail */
374
        {"enable_junk", "FALSE", &prefs_common.enable_junk, P_BOOL},
375
#ifdef G_OS_WIN32
376
        {"junk_learn_command", "sylfilter -j",
377
         &prefs_common.junk_learncmd, P_STRING},
378
        {"nojunk_learn_command", "sylfilter -c",
379
         &prefs_common.nojunk_learncmd, P_STRING},
380
        {"junk_classify_command", "sylfilter",
381
         &prefs_common.junk_classify_cmd, P_STRING},
382
#else
383
        {"junk_learn_command", "bogofilter -N -s -I",
384
         &prefs_common.junk_learncmd, P_STRING},
385
        {"nojunk_learn_command", "bogofilter -n -S -I",
386
         &prefs_common.nojunk_learncmd, P_STRING},
387
        {"junk_classify_command", "bogofilter -I",
388
         &prefs_common.junk_classify_cmd, P_STRING},
389
#endif
390
        {"junk_folder", NULL, &prefs_common.junk_folder, P_STRING},
391
        {"filter_junk_on_receive", "FALSE", &prefs_common.filter_junk_on_recv,
392
         P_BOOL},
393
        {"filter_junk_before", "FALSE", &prefs_common.filter_junk_before,
394
         P_BOOL},
395
        {"delete_junk_on_receive", "TRUE", &prefs_common.delete_junk_on_recv,
396
         P_BOOL},
397
        {"nofilter_junk_sender_in_book", "TRUE",
398
         &prefs_common.nofilter_junk_sender_in_book, P_BOOL},
399
        {"mark_junk_as_read", "FALSE", &prefs_common.mark_junk_as_read, P_BOOL},
400

    
401
        /* Privacy */
402
        {"auto_check_signatures", "TRUE", &prefs_common.auto_check_signatures,
403
         P_BOOL},
404
        {"gpg_signature_popup", "FALSE", &prefs_common.gpg_signature_popup,
405
         P_BOOL},
406
        {"store_passphrase", "FALSE", &prefs_common.store_passphrase, P_BOOL},
407
        {"store_passphrase_timeout", "0",
408
         &prefs_common.store_passphrase_timeout, P_INT},
409
        {"passphrase_grab", "FALSE", &prefs_common.passphrase_grab, P_BOOL},
410
#ifdef G_OS_WIN32
411
        {"show_gpg_warning", "FALSE", &prefs_common.gpg_warning, P_BOOL},
412
#else
413
        {"show_gpg_warning", "TRUE", &prefs_common.gpg_warning, P_BOOL},
414
#endif
415

    
416
        /* Interface */
417
        {"separate_folder", "FALSE", &prefs_common.sep_folder, P_BOOL},
418
        {"separate_message", "FALSE", &prefs_common.sep_msg, P_BOOL},
419

    
420
        {"always_show_message_when_selected", "TRUE",
421
         &prefs_common.always_show_msg, P_BOOL},
422
        {"open_unread_on_enter", "FALSE", &prefs_common.open_unread_on_enter,
423
         P_BOOL},
424
        {"always_mark_read_on_show_msg", "FALSE",
425
         &prefs_common.always_mark_read_on_show_msg, P_BOOL},
426
        {"remember_last_selected", "FALSE",
427
         &prefs_common.remember_last_selected, P_BOOL},
428
        {"mark_as_read_on_new_window", "FALSE",
429
         &prefs_common.mark_as_read_on_new_window, P_BOOL},
430
        {"open_inbox_on_inc", "FALSE", &prefs_common.open_inbox_on_inc, P_BOOL},
431
        {"open_inbox_on_startup", "FALSE", &prefs_common.open_inbox_on_startup,
432
         P_BOOL},
433
        {"change_account_on_folder_selection", "TRUE",
434
         &prefs_common.change_account_on_folder_sel, P_BOOL},
435
        {"immediate_execution", "TRUE", &prefs_common.immediate_exec, P_BOOL},
436

    
437
#ifdef G_OS_WIN32
438
        {"comply_gnome_hig", "FALSE", &prefs_common.comply_gnome_hig, P_BOOL},
439
#else
440
        {"comply_gnome_hig", "TRUE", &prefs_common.comply_gnome_hig, P_BOOL},
441
#endif
442

    
443
        {"show_trayicon", "TRUE", &prefs_common.show_trayicon, P_BOOL},
444
        {"minimize_to_tray", "FALSE", &prefs_common.minimize_to_tray, P_BOOL},
445
#ifdef G_OS_WIN32
446
        {"toggle_window_on_trayicon_click", "FALSE",
447
#else
448
        {"toggle_window_on_trayicon_click", "TRUE",
449
#endif
450
         &prefs_common.toggle_window_on_trayicon_click, P_BOOL},
451

    
452
        /* Other */
453
        {"receive_dialog_mode", "1", &prefs_common.recv_dialog_mode, P_ENUM},
454
        {"no_receive_error_panel", "FALSE", &prefs_common.no_recv_err_panel,
455
         P_BOOL},
456
        {"close_receive_dialog", "TRUE", &prefs_common.close_recv_dialog,
457
         P_BOOL},
458

    
459
        {"add_address_by_click", "FALSE", &prefs_common.add_address_by_click,
460
         P_BOOL},
461
        {"enable_address_completion", "TRUE",
462
         &prefs_common.enable_address_completion, P_BOOL},
463
        {"fullauto_completion_mode", "TRUE",
464
         &prefs_common.fullauto_completion_mode, P_BOOL},
465
        {"always_add_address_only", "FALSE",
466
         &prefs_common.always_add_address_only, P_BOOL},
467

    
468
        {"confirm_on_exit", "FALSE", &prefs_common.confirm_on_exit, P_BOOL},
469
        {"clean_trash_on_exit", "FALSE", &prefs_common.clean_on_exit, P_BOOL},
470
        {"ask_on_cleaning", "TRUE", &prefs_common.ask_on_clean, P_BOOL},
471
        {"warn_queued_on_exit", "TRUE", &prefs_common.warn_queued_on_exit,
472
         P_BOOL},
473

    
474
        {"logwindow_line_limit", "1000", &prefs_common.logwin_line_limit,
475
         P_INT},
476

    
477
        /* External commands */
478
#ifdef G_OS_WIN32
479
        {"uri_open_command", NULL, &prefs_common.uri_cmd,
480
#else
481
        {"uri_open_command", DEFAULT_BROWSER_CMD, &prefs_common.uri_cmd,
482
#endif
483
         P_STRING},
484
#ifdef G_OS_WIN32
485
        {"ext_editor_command", "notepad '%s'", &prefs_common.ext_editor_cmd,
486
#else
487
        {"ext_editor_command", "gedit %s", &prefs_common.ext_editor_cmd,
488
#endif
489
         P_STRING},
490

    
491
        {"use_print_command", "FALSE", &prefs_common.use_print_cmd, P_BOOL},
492
#ifdef G_OS_WIN32
493
        {"print_command", NULL, &prefs_common.print_cmd, P_STRING},
494
#else
495
        {"print_command", "lpr %s", &prefs_common.print_cmd, P_STRING},
496
#endif
497

    
498
        {"use_ext_inc", "FALSE", &prefs_common.use_extinc, P_BOOL},
499
        {"ext_inc_path", DEFAULT_INC_PATH, &prefs_common.extinc_cmd, P_STRING},
500
        {"use_ext_sendmail", "FALSE", &prefs_common.use_extsend, P_BOOL},
501
        {"ext_sendmail_cmd", DEFAULT_SENDMAIL_CMD, &prefs_common.extsend_cmd,
502
         P_STRING},
503

    
504
        /* Update check */
505
        {"auto_update_check", "TRUE", &prefs_common.auto_update_check, P_BOOL},
506
        {"use_http_proxy", "FALSE", &prefs_common.use_http_proxy, P_BOOL},
507
        {"http_proxy_host", NULL, &prefs_common.http_proxy_host, P_STRING},
508

    
509
        /* Advanced */
510
        {"strict_cache_check", "FALSE", &prefs_common.strict_cache_check,
511
         P_BOOL},
512
        {"io_timeout_secs", "60", &prefs_common.io_timeout_secs, P_INT},
513

    
514
        /* File selector */
515
        {"filesel_prev_open_dir", NULL, &prefs_common.prev_open_dir, P_STRING},
516
        {"filesel_prev_save_dir", NULL, &prefs_common.prev_save_dir, P_STRING},
517
        {"filesel_prev_folder_dir", NULL, &prefs_common.prev_folder_dir, P_STRING},
518

    
519
        {NULL, NULL, NULL, P_OTHER}
520
};
521

    
522

    
523
PrefsCommon *prefs_common_get(void)
524
{
525
        return &prefs_common;
526
}
527

    
528
PrefParam *prefs_common_get_params(void)
529
{
530
        return param;
531
}
532

    
533
void prefs_common_read_config(void)
534
{
535
        FILE *fp;
536
        gchar *path;
537
        gchar buf[PREFSBUFSIZE];
538

    
539
        path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
540

    
541
        prefs_read_config(param, "Common", path, NULL);
542

    
543
        g_free(path);
544

    
545
        prefs_common.online_mode = TRUE;
546

    
547
        path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMAND_HISTORY,
548
                           NULL);
549
        if ((fp = g_fopen(path, "rb")) == NULL) {
550
                if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
551
                g_free(path);
552
                return;
553
        }
554
        g_free(path);
555
        while (fgets(buf, sizeof(buf), fp) != NULL) {
556
                g_strstrip(buf);
557
                if (buf[0] == '\0') continue;
558
                prefs_common.mime_open_cmd_history =
559
                        add_history(prefs_common.mime_open_cmd_history, buf);
560
        }
561
        fclose(fp);
562

    
563
        prefs_common.mime_open_cmd_history =
564
                g_list_reverse(prefs_common.mime_open_cmd_history);
565
}
566

    
567
void prefs_common_write_config(void)
568
{
569
        GList *cur;
570
        FILE *fp;
571
        gchar *path;
572

    
573
        prefs_write_config(param, "Common", COMMON_RC);
574

    
575
        path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMAND_HISTORY,
576
                           NULL);
577
        if ((fp = g_fopen(path, "wb")) == NULL) {
578
                FILE_OP_ERROR(path, "fopen");
579
                g_free(path);
580
                return;
581
        }
582

    
583
        for (cur = prefs_common.mime_open_cmd_history;
584
             cur != NULL; cur = cur->next) {
585
                fputs((gchar *)cur->data, fp);
586
                fputc('\n', fp);
587
        }
588

    
589
        fclose(fp);
590
        g_free(path);
591
}
592

    
593
void prefs_common_junk_filter_list_set(void)
594
{
595
}
596

    
597
void prefs_common_junk_folder_rename_path(const gchar *old_path,
598
                                          const gchar *new_path)
599
{
600
        gint len;
601
        gchar *base;
602
        gchar *dest_path;
603

    
604
        g_return_if_fail(old_path != NULL);
605
        g_return_if_fail(new_path != NULL);
606

    
607
        if (!prefs_common.junk_folder)
608
                return;
609

    
610
        len = strlen(old_path);
611

    
612
        if (!strncmp(old_path, prefs_common.junk_folder, len)) {
613
                base = prefs_common.junk_folder + len;
614
                if (*base != '/' && *base != '\0')
615
                        return;
616
                while (*base == '/') base++;
617
                if (*base == '\0')
618
                        dest_path = g_strdup(new_path);
619
                else
620
                        dest_path = g_strconcat(new_path, "/", base, NULL);
621
                debug_print("prefs_common_junk_folder_rename_path(): "
622
                            "renaming %s -> %s\n", prefs_common.junk_folder,
623
                            dest_path);
624
                g_free(prefs_common.junk_folder);
625
                prefs_common.junk_folder = dest_path;
626
        }
627
}