0.9.6claws97
[claws.git] / src / prefs_common.c
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2003 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 <gtk/gtk.h>
28 #include <gdk/gdkkeysyms.h>
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #include <unistd.h>
33 #include <sys/types.h>
34 #include <sys/stat.h>
35 #include <errno.h>
36
37 #include "intl.h"
38 #include "main.h"
39 #include "prefs_gtk.h"
40 #include "prefs_common.h"
41 #include "prefs_display_header.h"
42 #include "prefs_summary_column.h"
43 #include "mainwindow.h"
44 #include "summaryview.h"
45 #include "messageview.h"
46 #include "manage_window.h"
47 #include "inc.h"
48 #include "menu.h"
49 #include "codeconv.h"
50 #include "utils.h"
51 #include "gtkutils.h"
52 #include "alertpanel.h"
53 #include "folder.h"
54 #include "socket.h"
55 #include "filesel.h"
56 #include "folderview.h"
57 #include "stock_pixmap.h"
58 #include "quote_fmt.h"
59
60 PrefsCommon prefs_common;
61
62 static PrefsDialog dialog;
63
64 static struct Receive {
65         GtkWidget *checkbtn_incext;
66         GtkWidget *entry_incext;
67         GtkWidget *button_incext;
68
69         GtkWidget *checkbtn_autochk;
70         GtkWidget *spinbtn_autochk;
71         GtkObject *spinbtn_autochk_adj;
72
73         GtkWidget *checkbtn_chkonstartup;
74         GtkWidget *checkbtn_scan_after_inc;
75
76
77         GtkWidget *checkbtn_newmail_auto;
78         GtkWidget *checkbtn_newmail_manu;
79         GtkWidget *entry_newmail_notify_cmd;
80         GtkWidget *hbox_newmail_notify;
81         GtkWidget *optmenu_recvdialog;
82         GtkWidget *checkbtn_no_recv_err_panel;
83         GtkWidget *checkbtn_close_recv_dialog;
84 } receive;
85
86 static struct Send {
87         GtkWidget *checkbtn_savemsg;
88         GtkWidget *checkbtn_queuemsg;
89         GtkWidget *optmenu_senddialog;
90
91         GtkWidget *optmenu_charset;
92         GtkWidget *optmenu_encoding_method;
93 } p_send;
94
95 static struct Compose {
96         GtkWidget *entry_fw_quotemark;
97         GtkWidget *text_fw_quotefmt;
98
99         GtkWidget *checkbtn_autoextedit;
100         GtkWidget *spinbtn_undolevel;
101         GtkObject *spinbtn_undolevel_adj;
102         GtkWidget *spinbtn_linewrap;
103         GtkObject *spinbtn_linewrap_adj;
104         GtkWidget *checkbtn_wrapquote;
105         GtkWidget *checkbtn_autowrap;
106         GtkWidget *checkbtn_wrapatsend;
107
108         GtkWidget *checkbtn_reply_account_autosel;
109         GtkWidget *checkbtn_forward_account_autosel;
110         GtkWidget *checkbtn_reedit_account_autosel;
111         GtkWidget *checkbtn_quote;
112         GtkWidget *checkbtn_default_reply_list;
113         GtkWidget *checkbtn_forward_as_attachment;
114         GtkWidget *checkbtn_redirect_keep_from;
115         GtkWidget *checkbtn_smart_wrapping;
116         GtkWidget *checkbtn_block_cursor;
117         GtkWidget *checkbtn_reply_with_quote;
118         
119         GtkWidget *checkbtn_autosave;
120         GtkWidget *entry_autosave_length;
121 } compose;
122
123 static struct Quote {
124         GtkWidget *entry_quotemark;
125         GtkWidget *text_quotefmt;
126
127         GtkWidget *entry_fw_quotemark;
128         GtkWidget *text_fw_quotefmt;
129         
130         GtkWidget *entry_quote_chars;
131 } quote;
132
133 static struct Display {
134         GtkWidget *chkbtn_folder_unread;
135         GtkWidget *entry_ng_abbrev_len;
136         GtkWidget *spinbtn_ng_abbrev_len;
137         GtkObject *spinbtn_ng_abbrev_len_adj;
138
139         GtkWidget *chkbtn_transhdr;
140
141         GtkWidget *chkbtn_swapfrom;
142         GtkWidget *chkbtn_useaddrbook;
143         GtkWidget *chkbtn_threadsubj;
144         GtkWidget *entry_datefmt;
145 } display;
146
147 static struct Message {
148         GtkWidget *chkbtn_enablecol;
149         GtkWidget *button_edit_col;
150         GtkWidget *chkbtn_mbalnum;
151         GtkWidget *chkbtn_disphdrpane;
152         GtkWidget *chkbtn_disphdr;
153         GtkWidget *spinbtn_linespc;
154         GtkObject *spinbtn_linespc_adj;
155         GtkWidget *chkbtn_headspc;
156
157         GtkWidget *chkbtn_smoothscroll;
158         GtkWidget *spinbtn_scrollstep;
159         GtkObject *spinbtn_scrollstep_adj;
160         GtkWidget *chkbtn_halfpage;
161
162         GtkWidget *chkbtn_attach_desc;
163 } message;
164
165 #if USE_GPGME
166 static struct Privacy {
167         GtkWidget *checkbtn_auto_check_signatures;
168         GtkWidget *checkbtn_store_passphrase;
169         GtkWidget *spinbtn_store_passphrase;
170         GtkObject *spinbtn_store_passphrase_adj;
171         GtkWidget *checkbtn_passphrase_grab;
172         GtkWidget *checkbtn_gpg_warning;
173 } privacy;
174 #endif
175
176 static struct Interface {
177         /* GtkWidget *checkbtn_emacs; */
178         GtkWidget *checkbtn_always_show_msg;
179         GtkWidget *checkbtn_openunread;
180         GtkWidget *checkbtn_mark_as_read_on_newwin;
181         GtkWidget *checkbtn_openinbox;
182         GtkWidget *checkbtn_immedexec;
183         GtkWidget *optmenu_nextunreadmsgdialog;
184         GtkWidget *entry_pixmap_theme;
185         GtkWidget *combo_pixmap_theme;
186 } interface;
187
188 static struct Other {
189         GtkWidget *uri_combo;
190         GtkWidget *uri_entry;
191         GtkWidget *printcmd_entry;
192         GtkWidget *exteditor_combo;
193         GtkWidget *exteditor_entry;
194
195         GtkWidget *checkbtn_addaddrbyclick;
196         GtkWidget *checkbtn_confonexit;
197         GtkWidget *checkbtn_cleanonexit;
198         GtkWidget *checkbtn_askonclean;
199         GtkWidget *checkbtn_warnqueued;
200         GtkWidget *checkbtn_cliplog;
201         GtkWidget *loglength_entry;
202 #if 0
203 #ifdef USE_OPENSSL
204         GtkWidget *checkbtn_ssl_ask_unknown_valid;
205 #endif
206 #endif
207
208         GtkWidget *spinbtn_iotimeout;
209         GtkObject *spinbtn_iotimeout_adj;
210 } other;
211
212 static struct MessageColorButtons {
213         GtkWidget *quote_level1_btn;
214         GtkWidget *quote_level2_btn;
215         GtkWidget *quote_level3_btn;
216         GtkWidget *uri_btn;
217         GtkWidget *tgt_folder_btn;
218         GtkWidget *signature_btn;
219 } color_buttons;
220
221 static struct KeybindDialog {
222         GtkWidget *window;
223         GtkWidget *combo;
224 } keybind;
225
226 static GtkWidget *quote_color_win;
227 static GtkWidget *color_dialog;
228
229 static void prefs_common_charset_set_data_from_optmenu     (PrefParam *pparam);
230 static void prefs_common_charset_set_optmenu               (PrefParam *pparam);
231 static void prefs_common_encoding_set_data_from_optmenu    (PrefParam *pparam);
232 static void prefs_common_encoding_set_optmenu              (PrefParam *pparam);
233 static void prefs_common_recv_dialog_set_data_from_optmenu (PrefParam *pparam);
234 static void prefs_common_recv_dialog_set_optmenu           (PrefParam *pparam);
235 static void prefs_common_recv_dialog_newmail_notify_toggle_cb   (GtkWidget *w,
236                                                                  gpointer data);
237 static void prefs_common_recv_dialog_set_data_from_optmenu(PrefParam *pparam);
238 static void prefs_common_recv_dialog_set_optmenu(PrefParam *pparam);
239 static void prefs_common_send_dialog_set_data_from_optmenu(PrefParam *pparam);
240 static void prefs_common_send_dialog_set_optmenu(PrefParam *pparam);
241 static void prefs_nextunreadmsgdialog_set_data_from_optmenu(PrefParam *pparam);
242 static void prefs_nextunreadmsgdialog_set_optmenu(PrefParam *pparam);
243
244 /*
245    parameter name, default value, pointer to the prefs variable, data type,
246    pointer to the widget pointer,
247    pointer to the function for data setting,
248    pointer to the function for widget setting
249  */
250
251 static PrefParam param[] = {
252         /* Receive */
253         {"use_ext_inc", "FALSE", &prefs_common.use_extinc, P_BOOL,
254          &receive.checkbtn_incext,
255          prefs_set_data_from_toggle, prefs_set_toggle},
256         {"ext_inc_path", DEFAULT_INC_PATH, &prefs_common.extinc_cmd, P_STRING,
257          &receive.entry_incext,
258          prefs_set_data_from_entry, prefs_set_entry},
259
260         {"autochk_newmail", "FALSE", &prefs_common.autochk_newmail, P_BOOL,
261          &receive.checkbtn_autochk,
262          prefs_set_data_from_toggle, prefs_set_toggle},
263         {"autochk_interval", "10", &prefs_common.autochk_itv, P_INT,
264          &receive.spinbtn_autochk,
265          prefs_set_data_from_spinbtn, prefs_set_spinbtn},
266         {"check_on_startup", "FALSE", &prefs_common.chk_on_startup, P_BOOL,
267          &receive.checkbtn_chkonstartup,
268          prefs_set_data_from_toggle, prefs_set_toggle},
269         {"scan_all_after_inc", "FALSE", &prefs_common.scan_all_after_inc,
270          P_BOOL, &receive.checkbtn_scan_after_inc,
271          prefs_set_data_from_toggle, prefs_set_toggle},
272         {"newmail_notify_manu", "FALSE", &prefs_common.newmail_notify_manu,
273          P_BOOL, &receive.checkbtn_newmail_manu,
274          prefs_set_data_from_toggle, prefs_set_toggle},
275         {"newmail_notify_auto", "FALSE", &prefs_common.newmail_notify_auto,
276         P_BOOL, &receive.checkbtn_newmail_auto,
277          prefs_set_data_from_toggle, prefs_set_toggle},
278         {"newmail_notify_cmd", "", &prefs_common.newmail_notify_cmd, P_STRING,
279          &receive.entry_newmail_notify_cmd,
280          prefs_set_data_from_entry, prefs_set_entry},
281         {"receive_dialog_mode", "1", &prefs_common.recv_dialog_mode, P_ENUM,
282          &receive.optmenu_recvdialog,
283          prefs_common_recv_dialog_set_data_from_optmenu,
284          prefs_common_recv_dialog_set_optmenu},
285         {"no_receive_error_panel", "FALSE", &prefs_common.no_recv_err_panel,
286          P_BOOL, &receive.checkbtn_no_recv_err_panel,
287          prefs_set_data_from_toggle, prefs_set_toggle},
288         {"close_receive_dialog", "TRUE", &prefs_common.close_recv_dialog,
289          P_BOOL, &receive.checkbtn_close_recv_dialog,
290          prefs_set_data_from_toggle, prefs_set_toggle},
291  
292         /* Send */
293         {"save_message", "TRUE", &prefs_common.savemsg, P_BOOL,
294          &p_send.checkbtn_savemsg,
295          prefs_set_data_from_toggle, prefs_set_toggle},
296         {"queue_message", "FALSE", &prefs_common.queue_msg, P_BOOL,
297          &p_send.checkbtn_queuemsg,
298          prefs_set_data_from_toggle, prefs_set_toggle},
299         {"send_dialog_mode", "0", &prefs_common.send_dialog_mode, P_ENUM,
300          &p_send.optmenu_senddialog,
301          prefs_common_send_dialog_set_data_from_optmenu,
302          prefs_common_send_dialog_set_optmenu},
303
304         {"outgoing_charset", CS_AUTO, &prefs_common.outgoing_charset, P_STRING,
305          &p_send.optmenu_charset,
306          prefs_common_charset_set_data_from_optmenu,
307          prefs_common_charset_set_optmenu},
308         {"encoding_method", "0", &prefs_common.encoding_method, P_ENUM,
309          &p_send.optmenu_encoding_method,
310          prefs_common_encoding_set_data_from_optmenu,
311          prefs_common_encoding_set_optmenu},
312
313         /* Compose */
314         {"auto_ext_editor", "FALSE", &prefs_common.auto_exteditor, P_BOOL,
315          &compose.checkbtn_autoextedit,
316          prefs_set_data_from_toggle, prefs_set_toggle},
317         {"forward_as_attachment", "FALSE", &prefs_common.forward_as_attachment,
318          P_BOOL, &compose.checkbtn_forward_as_attachment,
319          prefs_set_data_from_toggle, prefs_set_toggle},
320         {"redirect_keep_from", "FALSE",
321          &prefs_common.redirect_keep_from, P_BOOL,
322          &compose.checkbtn_redirect_keep_from,
323          prefs_set_data_from_toggle, prefs_set_toggle},
324         {"undo_level", "50", &prefs_common.undolevels, P_INT,
325          &compose.spinbtn_undolevel,
326          prefs_set_data_from_spinbtn, prefs_set_spinbtn},
327         {"block_cursor", "FALSE", &prefs_common.block_cursor,
328          P_BOOL, &compose.checkbtn_block_cursor,
329          prefs_set_data_from_toggle, prefs_set_toggle},
330
331         {"linewrap_length", "72", &prefs_common.linewrap_len, P_INT,
332          &compose.spinbtn_linewrap,
333          prefs_set_data_from_spinbtn, prefs_set_spinbtn},
334         {"linewrap_quotation", "FALSE", &prefs_common.linewrap_quote, P_BOOL,
335          &compose.checkbtn_wrapquote,
336          prefs_set_data_from_toggle, prefs_set_toggle},
337         {"linewrap_auto", "FALSE", &prefs_common.autowrap, P_BOOL,
338          &compose.checkbtn_autowrap,
339          prefs_set_data_from_toggle, prefs_set_toggle},
340         {"linewrap_before_sending", "FALSE",
341          &prefs_common.linewrap_at_send, P_BOOL,
342          &compose.checkbtn_wrapatsend,
343          prefs_set_data_from_toggle, prefs_set_toggle},
344         {"smart_wrapping", "TRUE", &prefs_common.smart_wrapping,
345          P_BOOL, &compose.checkbtn_smart_wrapping,
346          prefs_set_data_from_toggle, prefs_set_toggle},
347         {"autosave", "FALSE", &prefs_common.autosave,
348          P_BOOL, &compose.checkbtn_autosave,
349          prefs_set_data_from_toggle, prefs_set_toggle},
350         {"autosave_length", "50", &prefs_common.autosave_length,
351          P_INT, &compose.entry_autosave_length,
352          prefs_set_data_from_entry, prefs_set_entry},
353 #if USE_ASPELL
354         {"enable_aspell", "TRUE", &prefs_common.enable_aspell, P_BOOL,
355          NULL, NULL, NULL},
356         {"aspell_path", ASPELL_PATH, &prefs_common.aspell_path, P_STRING,
357          NULL, NULL, NULL},
358         {"dictionary",  "", &prefs_common.dictionary, P_STRING,
359          NULL, NULL, NULL},
360         {"aspell_sugmode", "1", &prefs_common.aspell_sugmode, P_INT,
361          NULL, NULL, NULL},
362         {"use_alternate_dict", "FALSE", &prefs_common.use_alternate, P_BOOL,
363          NULL, NULL, NULL},
364         {"check_while_typing", "TRUE", &prefs_common.check_while_typing, P_BOOL,
365          NULL, NULL, NULL},
366         {"misspelled_color", "16711680", &prefs_common.misspelled_col, P_COLOR,
367          NULL, NULL, NULL},
368 #endif
369         {"reply_with_quote", "TRUE", &prefs_common.reply_with_quote, P_BOOL,
370          &compose.checkbtn_reply_with_quote, prefs_set_data_from_toggle, prefs_set_toggle},
371
372         /* Account autoselection */
373         {"reply_account_autoselect", "TRUE",
374          &prefs_common.reply_account_autosel, P_BOOL,
375          &compose.checkbtn_reply_account_autosel,
376          prefs_set_data_from_toggle, prefs_set_toggle},
377         {"forward_account_autoselect", "TRUE",
378          &prefs_common.forward_account_autosel, P_BOOL,
379          &compose.checkbtn_forward_account_autosel,
380          prefs_set_data_from_toggle, prefs_set_toggle},
381         {"reedit_account_autoselect", "TRUE",
382          &prefs_common.reedit_account_autosel, P_BOOL,
383          &compose.checkbtn_reedit_account_autosel,
384          prefs_set_data_from_toggle, prefs_set_toggle},
385
386         {"default_reply_list", "TRUE", &prefs_common.default_reply_list, P_BOOL,
387          &compose.checkbtn_default_reply_list,
388          prefs_set_data_from_toggle, prefs_set_toggle},
389
390         {"show_ruler", "TRUE", &prefs_common.show_ruler, P_BOOL,
391          NULL, NULL, NULL},
392
393         /* Quote */
394         {"reply_quote_mark", "> ", &prefs_common.quotemark, P_STRING,
395          &quote.entry_quotemark, prefs_set_data_from_entry, prefs_set_entry},
396         {"reply_quote_format", "On %d\\n%f wrote:\\n\\n%Q",
397          &prefs_common.quotefmt, P_STRING, &quote.text_quotefmt,
398          prefs_set_data_from_text, prefs_set_text},
399
400         {"forward_quote_mark", "> ", &prefs_common.fw_quotemark, P_STRING,
401          &quote.entry_fw_quotemark,
402          prefs_set_data_from_entry, prefs_set_entry},
403         {"forward_quote_format",
404          "\\n\\nBegin forwarded message:\\n\\n"
405          "?d{Date: %d\\n}?f{From: %f\\n}?t{To: %t\\n}?c{Cc: %c\\n}"
406          "?n{Newsgroups: %n\\n}?s{Subject: %s\\n}\\n\\n%M",
407          &prefs_common.fw_quotefmt, P_STRING, &quote.text_fw_quotefmt,
408          prefs_set_data_from_text, prefs_set_text},
409         {"quote_chars", ">", &prefs_common.quote_chars, P_STRING,
410          &quote.entry_quote_chars, prefs_set_data_from_entry, prefs_set_entry},
411
412         /* Display */
413         {"widget_font", NULL, &prefs_common.widgetfont, P_STRING,
414          NULL, NULL, NULL},
415         {"message_font", "-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*",
416          &prefs_common.textfont, P_STRING, NULL, NULL, NULL},
417         {"small_font",   "-*-helvetica-medium-r-normal--10-*-*-*-*-*-*-*",
418          &prefs_common.smallfont,   P_STRING, NULL, NULL, NULL},
419         {"bold_font",    "-*-helvetica-bold-r-normal--12-*-*-*-*-*-*-*",
420          &prefs_common.boldfont,    P_STRING, NULL, NULL, NULL},
421         {"normal_font",  "-*-helvetica-medium-r-normal--12-*-*-*-*-*-*-*",
422          &prefs_common.normalfont,  P_STRING, NULL, NULL, NULL},
423
424
425         {"display_folder_unread_num", "TRUE",
426          &prefs_common.display_folder_unread, P_BOOL,
427          &display.chkbtn_folder_unread,
428          prefs_set_data_from_toggle, prefs_set_toggle},
429         {"newsgroup_abbrev_len", "16",
430          &prefs_common.ng_abbrev_len, P_INT,
431          &display.spinbtn_ng_abbrev_len,
432          prefs_set_data_from_spinbtn, prefs_set_spinbtn},
433
434         {"translate_header", "TRUE", &prefs_common.trans_hdr, P_BOOL,
435          &display.chkbtn_transhdr,
436          prefs_set_data_from_toggle, prefs_set_toggle},
437
438         /* Display: Summary View */
439         {"enable_swap_from", "FALSE", &prefs_common.swap_from, P_BOOL,
440          &display.chkbtn_swapfrom,
441          prefs_set_data_from_toggle, prefs_set_toggle},
442         {"use_address_book", "TRUE", &prefs_common.use_addr_book, P_BOOL,
443          &display.chkbtn_useaddrbook,
444          prefs_set_data_from_toggle, prefs_set_toggle},
445         {"thread_by_subject", "TRUE", &prefs_common.thread_by_subject, P_BOOL,
446          &display.chkbtn_threadsubj,
447          prefs_set_data_from_toggle, prefs_set_toggle},
448         {"date_format", "%y/%m/%d(%a) %H:%M", &prefs_common.date_format,
449          P_STRING, &display.entry_datefmt,
450          prefs_set_data_from_entry, prefs_set_entry},
451
452         {"enable_hscrollbar", "TRUE", &prefs_common.enable_hscrollbar, P_BOOL,
453          NULL, NULL, NULL},
454         {"bold_unread", "TRUE", &prefs_common.bold_unread, P_BOOL,
455          NULL, NULL, NULL},
456         {"thread_by_subject_max_age", "10", &prefs_common.thread_by_subject_max_age,
457         P_INT, NULL, NULL, NULL },
458
459         {"enable_thread", "TRUE", &prefs_common.enable_thread, P_BOOL,
460          NULL, NULL, NULL},
461         {"toolbar_style", "3", &prefs_common.toolbar_style, P_ENUM,
462          NULL, NULL, NULL},
463         {"show_statusbar", "TRUE", &prefs_common.show_statusbar, P_BOOL,
464          NULL, NULL, NULL},
465         {"show_searchbar", "TRUE", &prefs_common.show_searchbar, P_BOOL,
466          NULL, NULL, NULL},
467
468         {"folderview_vscrollbar_policy", "0",
469          &prefs_common.folderview_vscrollbar_policy, P_ENUM,
470          NULL, NULL, NULL},
471
472         {"summary_col_show_mark", "TRUE",
473          &prefs_common.summary_col_visible[S_COL_MARK], P_BOOL, NULL, NULL, NULL},
474         {"summary_col_show_unread", "TRUE",
475          &prefs_common.summary_col_visible[S_COL_STATUS], P_BOOL, NULL, NULL, NULL},
476         {"summary_col_show_mime", "TRUE",
477          &prefs_common.summary_col_visible[S_COL_MIME], P_BOOL, NULL, NULL, NULL},
478         {"summary_col_show_subject", "TRUE",
479          &prefs_common.summary_col_visible[S_COL_SUBJECT], P_BOOL, NULL, NULL, NULL},
480         {"summary_col_show_from", "TRUE",
481          &prefs_common.summary_col_visible[S_COL_FROM], P_BOOL, NULL, NULL, NULL},
482         {"summary_col_show_date", "TRUE",
483          &prefs_common.summary_col_visible[S_COL_DATE], P_BOOL, NULL, NULL, NULL},
484         {"summary_col_show_size", "TRUE",
485          &prefs_common.summary_col_visible[S_COL_SIZE], P_BOOL, NULL, NULL, NULL},
486         {"summary_col_show_number", "FALSE",
487          &prefs_common.summary_col_visible[S_COL_NUMBER], P_BOOL, NULL, NULL, NULL},
488         {"summary_col_show_score", "FALSE",
489          &prefs_common.summary_col_visible[S_COL_SCORE], P_BOOL, NULL, NULL, NULL},
490         {"summary_col_show_locked", "FALSE",
491          &prefs_common.summary_col_visible[S_COL_LOCKED], P_BOOL, NULL, NULL, NULL},
492
493         {"summary_col_pos_mark", "0",
494           &prefs_common.summary_col_pos[S_COL_MARK], P_INT, NULL, NULL, NULL},
495         {"summary_col_pos_unread", "1",
496           &prefs_common.summary_col_pos[S_COL_STATUS], P_INT, NULL, NULL, NULL},
497         {"summary_col_pos_mime", "2",
498           &prefs_common.summary_col_pos[S_COL_MIME], P_INT, NULL, NULL, NULL},
499         {"summary_col_pos_subject", "3",
500           &prefs_common.summary_col_pos[S_COL_SUBJECT], P_INT, NULL, NULL, NULL},
501         {"summary_col_pos_from", "4",
502           &prefs_common.summary_col_pos[S_COL_FROM], P_INT, NULL, NULL, NULL},
503         {"summary_col_pos_date", "5",
504           &prefs_common.summary_col_pos[S_COL_DATE], P_INT, NULL, NULL, NULL},
505         {"summary_col_pos_size", "6",
506           &prefs_common.summary_col_pos[S_COL_SIZE], P_INT, NULL, NULL, NULL},
507         {"summary_col_pos_number", "7",
508           &prefs_common.summary_col_pos[S_COL_NUMBER], P_INT, NULL, NULL, NULL},
509         {"summary_col_pos_score", "8",
510          &prefs_common.summary_col_pos[S_COL_SCORE], P_INT, NULL, NULL, NULL},
511         {"summary_col_pos_locked", "9",
512          &prefs_common.summary_col_pos[S_COL_LOCKED], P_INT, NULL, NULL, NULL},
513
514         {"summary_col_size_mark", "10",
515          &prefs_common.summary_col_size[S_COL_MARK], P_INT, NULL, NULL, NULL},
516         {"summary_col_size_unread", "13",
517          &prefs_common.summary_col_size[S_COL_STATUS], P_INT, NULL, NULL, NULL},
518         {"summary_col_size_mime", "10",
519          &prefs_common.summary_col_size[S_COL_MIME], P_INT, NULL, NULL, NULL},
520         {"summary_col_size_subject", "200",
521          &prefs_common.summary_col_size[S_COL_SUBJECT], P_INT, NULL, NULL, NULL},
522         {"summary_col_size_from", "120",
523          &prefs_common.summary_col_size[S_COL_FROM], P_INT, NULL, NULL, NULL},
524         {"summary_col_size_date", "118",
525          &prefs_common.summary_col_size[S_COL_DATE], P_INT, NULL, NULL, NULL},
526         {"summary_col_size_size", "45",
527          &prefs_common.summary_col_size[S_COL_SIZE], P_INT, NULL, NULL, NULL},
528         {"summary_col_size_number", "40",
529          &prefs_common.summary_col_size[S_COL_NUMBER], P_INT, NULL, NULL, NULL},
530         {"summary_col_size_score", "40",
531          &prefs_common.summary_col_size[S_COL_SCORE], P_INT, NULL, NULL, NULL},
532         {"summary_col_size_locked", "13",
533          &prefs_common.summary_col_size[S_COL_LOCKED], P_INT, NULL, NULL, NULL},
534
535         /* Widget size */
536         {"folderwin_x", "16", &prefs_common.folderwin_x, P_INT,
537          NULL, NULL, NULL},
538         {"folderwin_y", "16", &prefs_common.folderwin_y, P_INT,
539          NULL, NULL, NULL},
540         {"folderview_width", "179", &prefs_common.folderview_width, P_INT,
541          NULL, NULL, NULL},
542         {"folderview_height", "600", &prefs_common.folderview_height, P_INT,
543          NULL, NULL, NULL},
544         {"folderview_visible", "TRUE", &prefs_common.folderview_visible, P_BOOL,
545          NULL, NULL, NULL},
546
547         {"folder_col_folder", "150", &prefs_common.folder_col_folder, P_INT,
548          NULL, NULL, NULL},
549         {"folder_col_new", "32", &prefs_common.folder_col_new, P_INT,
550          NULL, NULL, NULL},
551         {"folder_col_unread", "32", &prefs_common.folder_col_unread, P_INT,
552          NULL, NULL, NULL},
553         {"folder_col_total", "32", &prefs_common.folder_col_total, P_INT,
554          NULL, NULL, NULL},
555
556         {"summaryview_width", "600", &prefs_common.summaryview_width, P_INT,
557          NULL, NULL, NULL},
558         {"summaryview_height", "173", &prefs_common.summaryview_height, P_INT,
559          NULL, NULL, NULL},
560
561         {"main_messagewin_x", "256", &prefs_common.main_msgwin_x, P_INT,
562          NULL, NULL, NULL},
563         {"main_messagewin_y", "210", &prefs_common.main_msgwin_y, P_INT,
564          NULL, NULL, NULL},
565         {"messageview_width", "600", &prefs_common.msgview_width, P_INT,
566          NULL, NULL, NULL},
567         {"messageview_height", "540", &prefs_common.msgview_height, P_INT,
568          NULL, NULL, NULL},
569         {"messageview_visible", "TRUE", &prefs_common.msgview_visible, P_BOOL,
570          NULL, NULL, NULL},
571
572         {"mainview_x", "64", &prefs_common.mainview_x, P_INT,
573          NULL, NULL, NULL},
574         {"mainview_y", "64", &prefs_common.mainview_y, P_INT,
575          NULL, NULL, NULL},
576         {"mainview_width", "600", &prefs_common.mainview_width, P_INT,
577          NULL, NULL, NULL},
578         {"mainview_height", "600", &prefs_common.mainview_height, P_INT,
579          NULL, NULL, NULL},
580         {"mainwin_x", "64", &prefs_common.mainwin_x, P_INT,
581          NULL, NULL, NULL},
582         {"mainwin_y", "64", &prefs_common.mainwin_y, P_INT,
583          NULL, NULL, NULL},
584         {"mainwin_width", "800", &prefs_common.mainwin_width, P_INT,
585          NULL, NULL, NULL},
586         {"mainwin_height", "600", &prefs_common.mainwin_height, P_INT,
587          NULL, NULL, NULL},
588         {"messagewin_width", "600", &prefs_common.msgwin_width, P_INT,
589          NULL, NULL, NULL},
590         {"messagewin_height", "540", &prefs_common.msgwin_height, P_INT,
591          NULL, NULL, NULL},
592         {"sourcewin_width", "600", &prefs_common.sourcewin_width, P_INT,
593          NULL, NULL, NULL},
594         {"sourcewin_height", "500", &prefs_common.sourcewin_height, P_INT,
595          NULL, NULL, NULL},
596         {"compose_width", "600", &prefs_common.compose_width, P_INT,
597          NULL, NULL, NULL},
598         {"compose_height", "560", &prefs_common.compose_height, P_INT,
599          NULL, NULL, NULL},
600
601         /* Message */
602         {"enable_color", "TRUE", &prefs_common.enable_color, P_BOOL,
603          &message.chkbtn_enablecol,
604          prefs_set_data_from_toggle, prefs_set_toggle},
605
606         {"quote_level1_color", "179", &prefs_common.quote_level1_col, P_COLOR,
607          NULL, NULL, NULL},
608         {"quote_level2_color", "179", &prefs_common.quote_level2_col, P_COLOR,
609          NULL, NULL, NULL},
610         {"quote_level3_color", "179", &prefs_common.quote_level3_col, P_COLOR,
611          NULL, NULL, NULL},
612         {"uri_color", "32512", &prefs_common.uri_col, P_COLOR,
613          NULL, NULL, NULL},
614         {"target_folder_color", "14294218", &prefs_common.tgt_folder_col, P_COLOR,
615          NULL, NULL, NULL},
616         {"signature_color", "7960953", &prefs_common.signature_col, P_COLOR,
617          NULL, NULL, NULL},
618         {"recycle_quote_colors", "FALSE", &prefs_common.recycle_quote_colors,
619          P_BOOL, NULL, NULL, NULL},
620
621         {"convert_mb_alnum", "FALSE", &prefs_common.conv_mb_alnum, P_BOOL,
622          &message.chkbtn_mbalnum,
623          prefs_set_data_from_toggle, prefs_set_toggle},
624         {"display_header_pane", "TRUE", &prefs_common.display_header_pane,
625          P_BOOL, &message.chkbtn_disphdrpane,
626          prefs_set_data_from_toggle, prefs_set_toggle},
627         {"display_header", "TRUE", &prefs_common.display_header, P_BOOL,
628          &message.chkbtn_disphdr,
629          prefs_set_data_from_toggle, prefs_set_toggle},
630         {"line_space", "2", &prefs_common.line_space, P_INT,
631          &message.spinbtn_linespc,
632          prefs_set_data_from_spinbtn, prefs_set_spinbtn},
633         {"enable_head_space", "FALSE", &prefs_common.head_space, P_BOOL,
634          &message.chkbtn_headspc,
635          prefs_set_data_from_toggle, prefs_set_toggle},
636
637         {"enable_smooth_scroll", "FALSE",
638          &prefs_common.enable_smooth_scroll, P_BOOL,
639          &message.chkbtn_smoothscroll,
640          prefs_set_data_from_toggle, prefs_set_toggle},
641         {"scroll_step", "1", &prefs_common.scroll_step, P_INT,
642          &message.spinbtn_scrollstep,
643          prefs_set_data_from_spinbtn, prefs_set_spinbtn},
644         {"scroll_half_page", "FALSE", &prefs_common.scroll_halfpage, P_BOOL,
645          &message.chkbtn_halfpage,
646          prefs_set_data_from_toggle, prefs_set_toggle},
647
648         {"show_other_header", "FALSE", &prefs_common.show_other_header, P_BOOL,
649          NULL, NULL, NULL},
650
651         {"attach_desc", "TRUE", &prefs_common.attach_desc, P_BOOL,
652          &message.chkbtn_attach_desc,
653          prefs_set_data_from_toggle, prefs_set_toggle},
654
655         /* MIME viewer */
656         {"mime_image_viewer", "display '%s'",
657          &prefs_common.mime_image_viewer, P_STRING, NULL, NULL, NULL},
658         {"mime_audio_player", "play '%s'",
659          &prefs_common.mime_audio_player, P_STRING, NULL, NULL, NULL},
660         {"mime_open_command", "gedit '%s'",
661          &prefs_common.mime_open_cmd, P_STRING, NULL, NULL, NULL},
662
663 #if USE_GPGME
664         /* Privacy */
665         {"auto_check_signatures", "TRUE",
666          &prefs_common.auto_check_signatures, P_BOOL,
667          &privacy.checkbtn_auto_check_signatures,
668          prefs_set_data_from_toggle, prefs_set_toggle},
669         {"store_passphrase", "FALSE", &prefs_common.store_passphrase, P_BOOL,
670          &privacy.checkbtn_store_passphrase,
671          prefs_set_data_from_toggle, prefs_set_toggle},
672         {"store_passphrase_timeout", "0",
673          &prefs_common.store_passphrase_timeout, P_INT,
674          &privacy.spinbtn_store_passphrase,
675          prefs_set_data_from_spinbtn, prefs_set_spinbtn},
676 #ifndef __MINGW32__
677         {"passphrase_grab", "FALSE", &prefs_common.passphrase_grab, P_BOOL,
678          &privacy.checkbtn_passphrase_grab,
679          prefs_set_data_from_toggle, prefs_set_toggle},
680 #endif /* __MINGW32__ */
681         {"gpg_warning", "TRUE", &prefs_common.gpg_warning, P_BOOL,
682          &privacy.checkbtn_gpg_warning,
683          prefs_set_data_from_toggle, prefs_set_toggle},
684 #endif /* USE_GPGME */
685
686         /* Interface */
687         {"separate_folder", "FALSE", &prefs_common.sep_folder, P_BOOL,
688          NULL, NULL, NULL},
689         {"separate_message", "FALSE", &prefs_common.sep_msg, P_BOOL,
690          NULL, NULL, NULL},
691
692         /* {"emulate_emacs", "FALSE", &prefs_common.emulate_emacs, P_BOOL,
693          NULL, NULL, NULL}, */
694         {"always_show_message_when_selected", "FALSE",
695          &prefs_common.always_show_msg,
696          P_BOOL, &interface.checkbtn_always_show_msg,
697          prefs_set_data_from_toggle, prefs_set_toggle},
698         {"open_unread_on_enter", "FALSE", &prefs_common.open_unread_on_enter,
699          P_BOOL, &interface.checkbtn_openunread,
700          prefs_set_data_from_toggle, prefs_set_toggle},
701         {"mark_as_read_on_new_window", "FALSE",
702          &prefs_common.mark_as_read_on_new_window,
703          P_BOOL, &interface.checkbtn_mark_as_read_on_newwin,
704          prefs_set_data_from_toggle, prefs_set_toggle},
705         {"open_inbox_on_inc", "FALSE", &prefs_common.open_inbox_on_inc,
706          P_BOOL, &interface.checkbtn_openinbox,
707          prefs_set_data_from_toggle, prefs_set_toggle},
708         {"immediate_execution", "TRUE", &prefs_common.immediate_exec, P_BOOL,
709          &interface.checkbtn_immedexec,
710          prefs_set_data_from_toggle, prefs_set_toggle},
711         {"nextunreadmsg_dialog", NULL, &prefs_common.next_unread_msg_dialog, P_ENUM,
712          &interface.optmenu_nextunreadmsgdialog,
713          prefs_nextunreadmsgdialog_set_data_from_optmenu,
714          prefs_nextunreadmsgdialog_set_optmenu},
715
716         {"pixmap_theme_path", DEFAULT_PIXMAP_THEME, 
717          &prefs_common.pixmap_theme_path, P_STRING,
718          &interface.entry_pixmap_theme, prefs_set_data_from_entry, prefs_set_entry},
719
720         {"hover_timeout", "500", &prefs_common.hover_timeout, P_INT,
721          NULL, NULL, NULL},
722         
723         /* Other */
724         {"uri_open_command", DEFAULT_BROWSER_CMD,
725          &prefs_common.uri_cmd, P_STRING,
726          &other.uri_entry, prefs_set_data_from_entry, prefs_set_entry},
727         {"print_command", "lpr %s", &prefs_common.print_cmd, P_STRING,
728          &other.printcmd_entry, prefs_set_data_from_entry, prefs_set_entry},
729         {"ext_editor_command", "gedit %s",
730          &prefs_common.ext_editor_cmd, P_STRING,
731          &other.exteditor_entry, prefs_set_data_from_entry, prefs_set_entry},
732
733         {"add_address_by_click", "FALSE", &prefs_common.add_address_by_click,
734          P_BOOL, &other.checkbtn_addaddrbyclick,
735          prefs_set_data_from_toggle, prefs_set_toggle},
736
737         {"confirm_on_exit", "TRUE", &prefs_common.confirm_on_exit, P_BOOL,
738          &other.checkbtn_confonexit,
739          prefs_set_data_from_toggle, prefs_set_toggle},
740         {"clean_trash_on_exit", "FALSE", &prefs_common.clean_on_exit, P_BOOL,
741          &other.checkbtn_cleanonexit,
742          prefs_set_data_from_toggle, prefs_set_toggle},
743         {"ask_on_cleaning", "TRUE", &prefs_common.ask_on_clean, P_BOOL,
744          &other.checkbtn_askonclean,
745          prefs_set_data_from_toggle, prefs_set_toggle},
746         {"warn_queued_on_exit", "TRUE", &prefs_common.warn_queued_on_exit,
747          P_BOOL, &other.checkbtn_warnqueued,
748          prefs_set_data_from_toggle, prefs_set_toggle},
749 #if 0
750 #ifdef USE_OPENSSL
751         {"ssl_ask_unknown_valid", "TRUE", &prefs_common.ssl_ask_unknown_valid,
752          P_BOOL, &other.checkbtn_ssl_ask_unknown_valid,
753          prefs_set_data_from_toggle, prefs_set_toggle},
754 #endif
755 #endif
756         {"work_offline", "FALSE", &prefs_common.work_offline, P_BOOL,
757          NULL, NULL, NULL},
758         {"summary_quicksearch_type", "0", &prefs_common.summary_quicksearch_type, P_INT,
759          NULL, NULL, NULL},
760
761         {"io_timeout_secs", "60", &prefs_common.io_timeout_secs,
762          P_INT, &other.spinbtn_iotimeout,
763          prefs_set_data_from_spinbtn, prefs_set_spinbtn},
764         {"hide_score", "-9999", &prefs_common.kill_score, P_INT,
765          NULL, NULL, NULL},
766         {"important_score", "1", &prefs_common.important_score, P_INT,
767          NULL, NULL, NULL},
768         {"clip_log", "TRUE", &prefs_common.cliplog, P_BOOL,
769          &other.checkbtn_cliplog,
770          prefs_set_data_from_toggle, prefs_set_toggle},
771         {"log_length", "500", &prefs_common.loglength, P_INT,
772          &other.loglength_entry,
773          prefs_set_data_from_entry, prefs_set_entry},
774
775         {"cache_max_mem_usage", "4096", &prefs_common.cache_max_mem_usage, P_INT,
776          NULL, NULL, NULL},
777         {"cache_min_keep_time", "15", &prefs_common.cache_min_keep_time, P_INT,
778          NULL, NULL, NULL},
779
780         {"color_new", "179", &prefs_common.color_new, P_COLOR,
781          NULL, NULL, NULL},
782
783         {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
784 };
785
786 /* widget creating functions */
787 static void prefs_common_create         (void);
788 static void prefs_receive_create        (void);
789 static void prefs_send_create           (void);
790 static void prefs_compose_create        (void);
791 static void prefs_quote_create          (void);
792 static void prefs_display_create        (void);
793 static void prefs_message_create        (void);
794 #if USE_GPGME
795 static void prefs_privacy_create        (void);
796 #endif
797 static void prefs_interface_create      (void);
798 static void prefs_other_create          (void);
799
800 static void date_format_ok_btn_clicked          (GtkButton      *button,
801                                                  GtkWidget     **widget);
802 static void date_format_cancel_btn_clicked      (GtkButton      *button,
803                                                  GtkWidget     **widget);
804 static void date_format_key_pressed             (GtkWidget      *keywidget,
805                                                  GdkEventKey    *event,
806                                                  GtkWidget     **widget);
807 static gboolean date_format_on_delete           (GtkWidget      *dialogwidget,
808                                                  GdkEventAny    *event,
809                                                  GtkWidget     **widget);
810 static void date_format_entry_on_change         (GtkEditable    *editable,
811                                                  GtkLabel       *example);
812 static void date_format_select_row              (GtkWidget      *date_format_list,
813                                                  gint            row,
814                                                  gint            column,
815                                                  GdkEventButton *event,
816                                                  GtkWidget      *date_format);
817 static GtkWidget *date_format_create            (GtkButton      *button,
818                                                  void           *data);
819
820 static void prefs_quote_colors_dialog           (void);
821 static void prefs_quote_colors_dialog_create    (void);
822 static void prefs_quote_colors_key_pressed      (GtkWidget      *widget,
823                                                  GdkEventKey    *event,
824                                                  gpointer        data);
825 static void quote_color_set_dialog              (GtkWidget      *widget,
826                                                  gpointer        data);
827 static void quote_colors_set_dialog_ok          (GtkWidget      *widget,
828                                                  gpointer        data);
829 static void quote_colors_set_dialog_cancel      (GtkWidget      *widget,
830                                                  gpointer        data);
831 static void quote_colors_set_dialog_key_pressed (GtkWidget      *widget,
832                                                  GdkEventKey    *event,
833                                                  gpointer        data);
834 static void set_button_bg_color                 (GtkWidget      *widget,
835                                                  gint            color);
836 static void prefs_enable_message_color_toggled  (void);
837 static void prefs_recycle_colors_toggled        (GtkWidget      *widget);
838
839 static void prefs_keybind_select                (void);
840 static gint prefs_keybind_deleted               (GtkWidget      *widget,
841                                                  GdkEventAny    *event,
842                                                  gpointer        data);
843 static void prefs_keybind_key_pressed           (GtkWidget      *widget,
844                                                  GdkEventKey    *event,
845                                                  gpointer        data);
846 static void prefs_keybind_cancel                (void);
847 static void prefs_keybind_apply_clicked         (GtkWidget      *widget);
848
849 static gint prefs_common_deleted        (GtkWidget      *widget,
850                                          GdkEventAny    *event,
851                                          gpointer        data);
852 static void prefs_common_key_pressed    (GtkWidget      *widget,
853                                          GdkEventKey    *event,
854                                          gpointer        data);
855 static void prefs_common_ok             (void);
856 static void prefs_common_apply          (void);
857 static void prefs_common_cancel         (void);
858
859 void prefs_common_init(void) 
860 {
861         prefs_common.disphdr_list = NULL;
862 }
863
864 PrefsCommon *prefs_common_get(void)
865 {
866         return &prefs_common;
867 }
868
869 void prefs_common_read_config(void)
870 {
871         FILE *fp;
872         gchar *path;
873         gchar buf[PREFSBUFSIZE];
874
875         prefs_read_config(param, "Common", COMMON_RC);
876
877         path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMAND_HISTORY,
878                            NULL);
879         if ((fp = fopen(path, "rb")) == NULL) {
880                 if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
881                 g_free(path);
882                 return;
883         }
884         g_free(path);
885         while (fgets(buf, sizeof(buf), fp) != NULL) {
886                 g_strstrip(buf);
887                 if (buf[0] == '\0') continue;
888                 prefs_common.mime_open_cmd_history =
889                         add_history(prefs_common.mime_open_cmd_history, buf);
890         }
891         fclose(fp);
892
893         prefs_common.mime_open_cmd_history =
894                 g_list_reverse(prefs_common.mime_open_cmd_history);
895 }
896
897 void prefs_common_save_config(void)
898 {
899         GList *cur;
900         FILE *fp;
901         gchar *path;
902
903         prefs_save_config(param, "Common", COMMON_RC);
904
905         path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMAND_HISTORY,
906                            NULL);
907         if ((fp = fopen(path, "wb")) == NULL) {
908                 FILE_OP_ERROR(path, "fopen");
909                 g_free(path);
910                 return;
911         }
912
913         for (cur = prefs_common.mime_open_cmd_history;
914              cur != NULL; cur = cur->next) {
915                 fputs((gchar *)cur->data, fp);
916                 fputc('\n', fp);
917         }
918
919         fclose(fp);
920         g_free(path);
921 }
922
923 void prefs_common_open(void)
924 {
925         if (prefs_rc_is_readonly(COMMON_RC))
926                 return;
927
928         inc_lock();
929
930         if (!dialog.window) {
931                 prefs_common_create();
932         }
933
934         manage_window_set_transient(GTK_WINDOW(dialog.window));
935         gtk_notebook_set_page(GTK_NOTEBOOK(dialog.notebook), 0);
936         gtk_widget_grab_focus(dialog.ok_btn);
937
938         prefs_set_dialog(param);
939
940         gtk_widget_show(dialog.window);
941 }
942
943 static void prefs_common_create(void)
944 {
945         gint page = 0;
946
947         debug_print("Creating common preferences window...\n");
948
949         prefs_dialog_create(&dialog);
950         gtk_window_set_title (GTK_WINDOW(dialog.window),
951                               _("Common Preferences"));
952         gtk_signal_connect (GTK_OBJECT(dialog.window), "delete_event",
953                             GTK_SIGNAL_FUNC(prefs_common_deleted), NULL);
954         gtk_signal_connect (GTK_OBJECT(dialog.window), "key_press_event",
955                             GTK_SIGNAL_FUNC(prefs_common_key_pressed), NULL);
956         MANAGE_WINDOW_SIGNALS_CONNECT(dialog.window);
957
958         gtk_signal_connect (GTK_OBJECT(dialog.ok_btn), "clicked",
959                             GTK_SIGNAL_FUNC(prefs_common_ok), NULL);
960         gtk_signal_connect (GTK_OBJECT(dialog.apply_btn), "clicked",
961                             GTK_SIGNAL_FUNC(prefs_common_apply), NULL);
962         gtk_signal_connect_object (GTK_OBJECT(dialog.cancel_btn), "clicked",
963                                    GTK_SIGNAL_FUNC(prefs_common_cancel),
964                                    GTK_OBJECT(dialog.window));
965
966         /* create all widgets on notebook */
967         prefs_receive_create();
968         SET_NOTEBOOK_LABEL(dialog.notebook, _("Receive"),   page++);
969         prefs_send_create();
970         SET_NOTEBOOK_LABEL(dialog.notebook, _("Send"),      page++);
971         prefs_compose_create();
972         SET_NOTEBOOK_LABEL(dialog.notebook, _("Compose"),   page++);
973         prefs_quote_create();
974         SET_NOTEBOOK_LABEL(dialog.notebook, _("Quote"),   page++);
975         prefs_display_create();
976         SET_NOTEBOOK_LABEL(dialog.notebook, _("Display"),   page++);
977         prefs_message_create();
978         SET_NOTEBOOK_LABEL(dialog.notebook, _("Message"),   page++);
979 #if USE_GPGME
980         prefs_privacy_create();
981         SET_NOTEBOOK_LABEL(dialog.notebook, _("Privacy"),   page++);
982 #endif
983         prefs_interface_create();
984         SET_NOTEBOOK_LABEL(dialog.notebook, _("Interface"), page++);
985         prefs_other_create();
986         SET_NOTEBOOK_LABEL(dialog.notebook, _("Other"),     page++);
987
988         gtk_widget_show_all(dialog.window);
989 }
990
991 static void prefs_receive_create(void)
992 {
993         GtkWidget *vbox1;
994         GtkWidget *vbox2;
995         GtkWidget *frame_incext;
996         GtkWidget *checkbtn_incext;
997         GtkWidget *hbox;
998         GtkWidget *label_incext;
999         GtkWidget *entry_incext;
1000         /* GtkWidget *button_incext; */
1001
1002         GtkWidget *hbox_autochk;
1003         GtkWidget *checkbtn_autochk;
1004         GtkWidget *label_autochk1;
1005         GtkObject *spinbtn_autochk_adj;
1006         GtkWidget *spinbtn_autochk;
1007         GtkWidget *label_autochk2;
1008         GtkWidget *checkbtn_chkonstartup;
1009         GtkWidget *checkbtn_scan_after_inc;
1010
1011
1012         GtkWidget *frame_newmail;
1013         GtkWidget *hbox_newmail_notify;
1014         GtkWidget *checkbtn_newmail_auto;
1015         GtkWidget *checkbtn_newmail_manu;
1016         GtkWidget *entry_newmail_notify_cmd;
1017         GtkWidget *label_newmail_notify_cmd;
1018
1019         GtkWidget *hbox_recvdialog;
1020         GtkWidget *label_recvdialog;
1021         GtkWidget *menu;
1022         GtkWidget *menuitem;
1023         GtkWidget *optmenu_recvdialog;
1024         GtkWidget *checkbtn_no_recv_err_panel;
1025         GtkWidget *checkbtn_close_recv_dialog;
1026
1027         vbox1 = gtk_vbox_new (FALSE, VSPACING);
1028         gtk_widget_show (vbox1);
1029         gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
1030         gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
1031
1032         PACK_FRAME(vbox1, frame_incext, _("External program"));
1033
1034         vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW);
1035         gtk_widget_show (vbox2);
1036         gtk_container_add (GTK_CONTAINER (frame_incext), vbox2);
1037         gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
1038
1039         /* Use of external incorporation program */
1040         PACK_CHECK_BUTTON (vbox2, checkbtn_incext,
1041                            _("Use external program for incorporation"));
1042
1043         hbox = gtk_hbox_new (FALSE, 8);
1044         gtk_widget_show (hbox);
1045         gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
1046         SET_TOGGLE_SENSITIVITY (checkbtn_incext, hbox);
1047
1048         label_incext = gtk_label_new (_("Command"));
1049         gtk_widget_show (label_incext);
1050         gtk_box_pack_start (GTK_BOX (hbox), label_incext, FALSE, FALSE, 0);
1051
1052         entry_incext = gtk_entry_new ();
1053         gtk_widget_show (entry_incext);
1054         gtk_box_pack_start (GTK_BOX (hbox), entry_incext, TRUE, TRUE, 0);
1055
1056 #if 0
1057         button_incext = gtk_button_new_with_label ("... ");
1058         gtk_widget_show (button_incext);
1059         gtk_box_pack_start (GTK_BOX (hbox), button_incext, FALSE, FALSE, 0);
1060 #endif
1061
1062         vbox2 = gtk_vbox_new (FALSE, 0);
1063         gtk_widget_show (vbox2);
1064         gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
1065
1066         /* Auto-checking */
1067         hbox_autochk = gtk_hbox_new (FALSE, 8);
1068         gtk_widget_show (hbox_autochk);
1069         gtk_box_pack_start (GTK_BOX (vbox2), hbox_autochk, FALSE, FALSE, 0);
1070
1071         PACK_CHECK_BUTTON (hbox_autochk, checkbtn_autochk,
1072                            _("Auto-check new mail"));
1073
1074         label_autochk1 = gtk_label_new (_("every"));
1075         gtk_widget_show (label_autochk1);
1076         gtk_box_pack_start (GTK_BOX (hbox_autochk), label_autochk1, FALSE, FALSE, 0);
1077
1078         spinbtn_autochk_adj = gtk_adjustment_new (5, 1, 100, 1, 10, 10);
1079         spinbtn_autochk = gtk_spin_button_new
1080                 (GTK_ADJUSTMENT (spinbtn_autochk_adj), 1, 0);
1081         gtk_widget_show (spinbtn_autochk);
1082         gtk_box_pack_start (GTK_BOX (hbox_autochk), spinbtn_autochk, FALSE, FALSE, 0);
1083         gtk_widget_set_usize (spinbtn_autochk, 64, -1);
1084         gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_autochk), TRUE);
1085
1086         label_autochk2 = gtk_label_new (_("minute(s)"));
1087         gtk_widget_show (label_autochk2);
1088         gtk_box_pack_start (GTK_BOX (hbox_autochk), label_autochk2, FALSE, FALSE, 0);
1089
1090         SET_TOGGLE_SENSITIVITY(checkbtn_autochk, label_autochk1);
1091         SET_TOGGLE_SENSITIVITY(checkbtn_autochk, spinbtn_autochk);
1092         SET_TOGGLE_SENSITIVITY(checkbtn_autochk, label_autochk2);
1093
1094         PACK_CHECK_BUTTON (vbox2, checkbtn_chkonstartup,
1095                            _("Check new mail on startup"));
1096         PACK_CHECK_BUTTON (vbox2, checkbtn_scan_after_inc,
1097                            _("Update all local folders after incorporation"));
1098
1099
1100         /* receive dialog */
1101         hbox_recvdialog = gtk_hbox_new (FALSE, 8);
1102         gtk_widget_show (hbox_recvdialog);
1103         gtk_box_pack_start (GTK_BOX (vbox2), hbox_recvdialog, FALSE, FALSE, 0);
1104
1105         label_recvdialog = gtk_label_new (_("Show receive dialog"));
1106         gtk_misc_set_alignment(GTK_MISC(label_recvdialog), 0, 0.5);
1107         gtk_widget_show (label_recvdialog);
1108         gtk_box_pack_start (GTK_BOX (hbox_recvdialog), label_recvdialog, FALSE, FALSE, 0);
1109
1110         optmenu_recvdialog = gtk_option_menu_new ();
1111         gtk_widget_show (optmenu_recvdialog);
1112         gtk_box_pack_start (GTK_BOX (hbox_recvdialog), optmenu_recvdialog, FALSE, FALSE, 0);
1113
1114         menu = gtk_menu_new ();
1115         MENUITEM_ADD (menu, menuitem, _("Always"), RECV_DIALOG_ALWAYS);
1116         MENUITEM_ADD (menu, menuitem, _("Only on manual receiving"),
1117                       RECV_DIALOG_MANUAL);
1118         MENUITEM_ADD (menu, menuitem, _("Never"), RECV_DIALOG_NEVER);
1119
1120         gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_recvdialog), menu);
1121
1122         PACK_CHECK_BUTTON (vbox2, checkbtn_no_recv_err_panel,
1123                            _("Don't popup error dialog on receive error"));
1124
1125         PACK_CHECK_BUTTON (vbox2, checkbtn_close_recv_dialog,
1126                            _("Close receive dialog when finished"));
1127         
1128         PACK_FRAME(vbox1, frame_newmail, _("Run command when new mail "
1129                                            "arrives"));
1130         vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW);
1131         gtk_widget_show (vbox2);
1132         gtk_container_add (GTK_CONTAINER (frame_newmail), vbox2);
1133         gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
1134
1135         hbox = gtk_hbox_new (TRUE, 8);
1136         gtk_widget_show (hbox);
1137         PACK_CHECK_BUTTON (hbox, checkbtn_newmail_auto,
1138                            _("after autochecking"));
1139         PACK_CHECK_BUTTON (hbox, checkbtn_newmail_manu,
1140                            _("after manual checking"));
1141         gtk_box_pack_start (GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
1142         gtk_signal_connect(GTK_OBJECT(checkbtn_newmail_auto), "toggled",
1143                            GTK_SIGNAL_FUNC(prefs_common_recv_dialog_newmail_notify_toggle_cb),
1144                            NULL);
1145         gtk_signal_connect(GTK_OBJECT(checkbtn_newmail_manu), "toggled",
1146                            GTK_SIGNAL_FUNC(prefs_common_recv_dialog_newmail_notify_toggle_cb),
1147                            NULL);
1148
1149         hbox_newmail_notify = gtk_hbox_new (FALSE, 8);
1150         gtk_widget_show (hbox);
1151         gtk_box_pack_start (GTK_BOX (vbox2), hbox_newmail_notify, FALSE, 
1152                             FALSE, 0);
1153
1154         label_newmail_notify_cmd = gtk_label_new (_("Command to execute:\n"
1155                                                     "(use %d as number of new "
1156                                                     "mails)"));
1157         gtk_label_set_justify(GTK_LABEL(label_newmail_notify_cmd), 
1158                               GTK_JUSTIFY_RIGHT);
1159         gtk_widget_show (label_newmail_notify_cmd);
1160         gtk_box_pack_start (GTK_BOX (hbox_newmail_notify), 
1161                             label_newmail_notify_cmd, FALSE, FALSE, 0);
1162
1163         entry_newmail_notify_cmd = gtk_entry_new ();
1164         gtk_widget_show (entry_newmail_notify_cmd);
1165         gtk_box_pack_start (GTK_BOX (hbox_newmail_notify), 
1166                             entry_newmail_notify_cmd, TRUE, TRUE, 0);
1167
1168         gtk_widget_set_sensitive(hbox_newmail_notify, 
1169                                  prefs_common.newmail_notify_auto || 
1170                                  prefs_common.newmail_notify_manu);
1171
1172         receive.checkbtn_incext = checkbtn_incext;
1173         receive.entry_incext    = entry_incext;
1174         /* receive.button_incext   = button_incext; */
1175
1176         receive.checkbtn_autochk    = checkbtn_autochk;
1177         receive.spinbtn_autochk     = spinbtn_autochk;
1178         receive.spinbtn_autochk_adj = spinbtn_autochk_adj;
1179
1180         receive.checkbtn_chkonstartup = checkbtn_chkonstartup;
1181         receive.checkbtn_scan_after_inc = checkbtn_scan_after_inc;
1182
1183
1184         receive.checkbtn_newmail_auto  = checkbtn_newmail_auto;
1185         receive.checkbtn_newmail_manu  = checkbtn_newmail_manu;
1186         receive.hbox_newmail_notify    = hbox_newmail_notify;
1187         receive.entry_newmail_notify_cmd = entry_newmail_notify_cmd;
1188         receive.optmenu_recvdialog          = optmenu_recvdialog;
1189         receive.checkbtn_no_recv_err_panel  = checkbtn_no_recv_err_panel;
1190         receive.checkbtn_close_recv_dialog  = checkbtn_close_recv_dialog;
1191 }
1192
1193 static void prefs_send_create(void)
1194 {
1195         GtkWidget *vbox1;
1196         GtkWidget *vbox2;
1197         GtkWidget *hbox1;
1198         GtkWidget *checkbtn_savemsg;
1199         GtkWidget *checkbtn_queuemsg;
1200         GtkWidget *label_outcharset;
1201         GtkWidget *optmenu_charset;
1202         GtkWidget *optmenu_menu;
1203         GtkWidget *menuitem;
1204         GtkTooltips *charset_tooltip;
1205         GtkWidget *optmenu_encoding;
1206         GtkWidget *label_encoding;
1207         GtkTooltips *encoding_tooltip;
1208         GtkWidget *label_senddialog;
1209         GtkWidget *menu;
1210         GtkWidget *optmenu_senddialog;
1211         GtkWidget *hbox_senddialog;
1212
1213         vbox1 = gtk_vbox_new (FALSE, VSPACING);
1214         gtk_widget_show (vbox1);
1215         gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
1216         gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
1217
1218         vbox2 = gtk_vbox_new (FALSE, 0);
1219         gtk_widget_show (vbox2);
1220         gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
1221
1222         PACK_CHECK_BUTTON (vbox2, checkbtn_savemsg,
1223                            _("Save sent messages to Sent folder"));
1224         PACK_CHECK_BUTTON (vbox2, checkbtn_queuemsg,
1225                            _("Queue messages that fail to send"));
1226
1227         hbox_senddialog = gtk_hbox_new (FALSE, 8);
1228         gtk_box_pack_start (GTK_BOX (vbox1), hbox_senddialog, FALSE, FALSE, 0);
1229
1230         label_senddialog = gtk_label_new (_("Show send dialog"));
1231         gtk_widget_show (label_senddialog);
1232         gtk_box_pack_start (GTK_BOX (hbox_senddialog), label_senddialog, FALSE, FALSE, 0);
1233
1234         optmenu_senddialog = gtk_option_menu_new ();
1235         gtk_widget_show (optmenu_senddialog);
1236         gtk_box_pack_start (GTK_BOX (hbox_senddialog), optmenu_senddialog, FALSE, FALSE, 0);
1237         
1238         menu = gtk_menu_new ();
1239         MENUITEM_ADD (menu, menuitem, _("Always"), SEND_DIALOG_ALWAYS);
1240         MENUITEM_ADD (menu, menuitem, _("Never"), SEND_DIALOG_NEVER);
1241
1242         gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_senddialog), menu);
1243
1244         hbox1 = gtk_hbox_new (FALSE, 8);
1245         gtk_widget_show (hbox1);
1246         gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
1247
1248         label_outcharset = gtk_label_new (_("Outgoing codeset"));
1249         gtk_widget_show (label_outcharset);
1250         gtk_box_pack_start (GTK_BOX (hbox1), label_outcharset, FALSE, FALSE, 0);
1251
1252         charset_tooltip = gtk_tooltips_new();
1253
1254         optmenu_charset = gtk_option_menu_new ();
1255         gtk_widget_show (optmenu_charset);
1256         gtk_tooltips_set_tip(GTK_TOOLTIPS(charset_tooltip), optmenu_charset,
1257                              _("If `Automatic' is selected, the optimal encoding"
1258                                " for the current locale will be used"),
1259                              NULL);
1260         gtk_box_pack_start (GTK_BOX (hbox1), optmenu_charset, FALSE, FALSE, 0);
1261
1262         optmenu_menu = gtk_menu_new ();
1263
1264 #define SET_MENUITEM(str, data) \
1265 { \
1266         MENUITEM_ADD(optmenu_menu, menuitem, str, data); \
1267 }
1268
1269         SET_MENUITEM(_("Automatic (Recommended)"),       CS_AUTO);
1270         SET_MENUITEM(_("7bit ascii (US-ASCII)"),         CS_US_ASCII);
1271 #if HAVE_ICONV
1272         SET_MENUITEM(_("Unicode (UTF-8)"),               CS_UTF_8);
1273 #endif
1274         SET_MENUITEM(_("Western European (ISO-8859-1)"),  CS_ISO_8859_1);
1275         SET_MENUITEM(_("Western European (ISO-8859-15)"), CS_ISO_8859_15);
1276         SET_MENUITEM(_("Central European (ISO-8859-2)"),  CS_ISO_8859_2);
1277         SET_MENUITEM(_("Baltic (ISO-8859-13)"),           CS_ISO_8859_13);
1278         SET_MENUITEM(_("Baltic (ISO-8859-4)"),            CS_ISO_8859_4);
1279         SET_MENUITEM(_("Greek (ISO-8859-7)"),             CS_ISO_8859_7);
1280         SET_MENUITEM(_("Turkish (ISO-8859-9)"),           CS_ISO_8859_9);
1281 #if HAVE_ICONV
1282         SET_MENUITEM(_("Cyrillic (ISO-8859-5)"),          CS_ISO_8859_5);
1283 #endif
1284         SET_MENUITEM(_("Cyrillic (KOI8-R)"),             CS_KOI8_R);
1285 #if HAVE_ICONV
1286         SET_MENUITEM(_("Cyrillic (Windows-1251)"),       CS_WINDOWS_1251);
1287         SET_MENUITEM(_("Cyrillic (KOI8-U)"),             CS_KOI8_U);
1288 #endif
1289         SET_MENUITEM(_("Japanese (ISO-2022-JP)"),        CS_ISO_2022_JP);
1290 #if 0
1291         SET_MENUITEM(_("Japanese (EUC-JP)"),             CS_EUC_JP);
1292         SET_MENUITEM(_("Japanese (Shift_JIS)"),          CS_SHIFT_JIS);
1293 #endif /* 0 */
1294         SET_MENUITEM(_("Simplified Chinese (GB2312)"),   CS_GB2312);
1295         SET_MENUITEM(_("Traditional Chinese (Big5)"),    CS_BIG5);
1296 #if 0
1297         SET_MENUITEM(_("Traditional Chinese (EUC-TW)"),  CS_EUC_TW);
1298         SET_MENUITEM(_("Chinese (ISO-2022-CN)"),         CS_ISO_2022_CN);
1299 #endif /* 0 */
1300         SET_MENUITEM(_("Korean (EUC-KR)"),               CS_EUC_KR);
1301         SET_MENUITEM(_("Thai (TIS-620)"),                CS_TIS_620);
1302         SET_MENUITEM(_("Thai (Windows-874)"),            CS_WINDOWS_874);
1303
1304         gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_charset),
1305                                   optmenu_menu);
1306
1307         hbox1 = gtk_hbox_new (FALSE, 8);
1308         gtk_widget_show (hbox1);
1309         gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
1310
1311         hbox1 = gtk_hbox_new (FALSE, 8);
1312         gtk_widget_show (hbox1);
1313         gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
1314
1315         label_encoding = gtk_label_new (_("Transfer encoding"));
1316         gtk_widget_show (label_encoding);
1317         gtk_box_pack_start (GTK_BOX (hbox1), label_encoding, FALSE, FALSE, 0);
1318
1319         encoding_tooltip = gtk_tooltips_new();
1320
1321         optmenu_encoding = gtk_option_menu_new ();
1322         gtk_widget_show (optmenu_encoding);
1323         gtk_tooltips_set_tip(GTK_TOOLTIPS(encoding_tooltip), optmenu_encoding,
1324                              _("Specify Content-Transfer-Encoding used when"
1325                                " message body contains non-ASCII characters"),
1326                              NULL);
1327         gtk_box_pack_start (GTK_BOX (hbox1), optmenu_encoding, FALSE, FALSE, 0);
1328
1329         optmenu_menu = gtk_menu_new ();
1330
1331         SET_MENUITEM(_("Automatic"),     CTE_AUTO);
1332         SET_MENUITEM("base64",           CTE_BASE64);
1333         SET_MENUITEM("quoted-printable", CTE_QUOTED_PRINTABLE);
1334         SET_MENUITEM("8bit",             CTE_8BIT);
1335
1336         gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_encoding),
1337                                   optmenu_menu);
1338
1339         hbox1 = gtk_hbox_new (FALSE, 8);
1340         gtk_widget_show (hbox1);
1341         gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
1342
1343         p_send.checkbtn_savemsg  = checkbtn_savemsg;
1344         p_send.checkbtn_queuemsg = checkbtn_queuemsg;
1345         p_send.optmenu_senddialog = optmenu_senddialog;
1346
1347         p_send.optmenu_charset = optmenu_charset;
1348         p_send.optmenu_encoding_method = optmenu_encoding;
1349 }
1350
1351 static void prefs_common_recv_dialog_newmail_notify_toggle_cb(GtkWidget *w, gpointer data)
1352 {
1353         gboolean toggled;
1354
1355         toggled = gtk_toggle_button_get_active
1356                         (GTK_TOGGLE_BUTTON(receive.checkbtn_newmail_manu)) ||
1357                   gtk_toggle_button_get_active
1358                         (GTK_TOGGLE_BUTTON(receive.checkbtn_newmail_auto));
1359         gtk_widget_set_sensitive(receive.hbox_newmail_notify, toggled);
1360 }
1361
1362 static void prefs_compose_create(void)
1363 {
1364         GtkWidget *vbox1;
1365         GtkWidget *vbox2;
1366
1367         GtkWidget *checkbtn_autoextedit;
1368
1369         GtkWidget *frame_autosel;
1370         GtkWidget *hbox_autosel;
1371         GtkWidget *checkbtn_reply_account_autosel;
1372         GtkWidget *checkbtn_forward_account_autosel;
1373         GtkWidget *checkbtn_reedit_account_autosel;
1374
1375         GtkWidget *hbox_undolevel;
1376         GtkWidget *label_undolevel;
1377         GtkObject *spinbtn_undolevel_adj;
1378         GtkWidget *spinbtn_undolevel;
1379
1380         GtkWidget *vbox_linewrap;
1381
1382         GtkWidget *hbox3;
1383         GtkWidget *hbox4;
1384         GtkWidget *hbox5;
1385         GtkWidget *label_linewrap;
1386         GtkObject *spinbtn_linewrap_adj;
1387         GtkWidget *spinbtn_linewrap;
1388         GtkWidget *checkbtn_wrapquote;
1389         GtkWidget *checkbtn_autowrap;
1390         GtkWidget *checkbtn_wrapatsend;
1391
1392         GtkWidget *checkbtn_default_reply_list;
1393
1394         GtkWidget *checkbtn_forward_as_attachment;
1395         GtkWidget *checkbtn_redirect_keep_from;
1396         GtkWidget *checkbtn_smart_wrapping;
1397         GtkWidget *checkbtn_block_cursor;
1398         GtkWidget *frame_msgwrap;
1399
1400         GtkWidget *hbox_autosave;
1401         GtkWidget *checkbtn_autosave;
1402         GtkWidget *entry_autosave_length;
1403         GtkWidget *label_autosave_length;
1404         
1405         vbox1 = gtk_vbox_new (FALSE, VSPACING);
1406         gtk_widget_show (vbox1);
1407         gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
1408         gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
1409
1410         /* Account autoselection */
1411         PACK_FRAME(vbox1, frame_autosel, _("Automatic account selection"));
1412
1413         hbox_autosel = gtk_hbox_new (FALSE, VSPACING_NARROW);
1414         gtk_widget_show (hbox_autosel);
1415         gtk_container_add (GTK_CONTAINER (frame_autosel), hbox_autosel);
1416         gtk_container_set_border_width (GTK_CONTAINER (hbox_autosel), 8);
1417
1418         PACK_CHECK_BUTTON (hbox_autosel, checkbtn_reply_account_autosel,
1419                            _("when replying"));
1420         PACK_CHECK_BUTTON (hbox_autosel, checkbtn_forward_account_autosel,
1421                            _("when forwarding"));
1422         PACK_CHECK_BUTTON (hbox_autosel, checkbtn_reedit_account_autosel,
1423                            _("when re-editing"));
1424
1425         vbox2 = gtk_vbox_new (FALSE, 0);
1426         gtk_widget_show (vbox2);
1427         gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
1428
1429         PACK_CHECK_BUTTON (vbox2, checkbtn_default_reply_list,
1430                            _("Reply button invokes mailing list reply"));
1431
1432         PACK_CHECK_BUTTON (vbox2, checkbtn_autoextedit,
1433                            _("Automatically launch the external editor"));
1434
1435         hbox5 = gtk_hbox_new (FALSE, 8);
1436         gtk_widget_show (hbox5);
1437         gtk_box_pack_start (GTK_BOX (vbox2), hbox5, FALSE, FALSE, 0);
1438
1439         PACK_CHECK_BUTTON (hbox5, checkbtn_forward_as_attachment,
1440                            _("Forward as attachment"));
1441
1442         PACK_CHECK_BUTTON (hbox5, checkbtn_block_cursor,
1443                           _("Block cursor"));
1444
1445         PACK_CHECK_BUTTON (vbox2, checkbtn_redirect_keep_from,
1446                            _("Keep the original 'From' header when redirecting"));
1447
1448         
1449         hbox_autosave = gtk_hbox_new (FALSE, 8);
1450         gtk_widget_show (hbox_autosave);
1451         gtk_box_pack_start (GTK_BOX (vbox1), hbox_autosave, FALSE, FALSE, 0);
1452         
1453         PACK_CHECK_BUTTON (hbox_autosave, checkbtn_autosave,
1454                            _("Autosave to Drafts folder every "));
1455
1456         entry_autosave_length = gtk_entry_new();
1457         gtk_widget_set_usize (entry_autosave_length, 64, -1);   
1458         gtk_widget_show (entry_autosave_length);
1459         gtk_box_pack_start (GTK_BOX (hbox_autosave), entry_autosave_length, FALSE, FALSE, 0);
1460         
1461         label_autosave_length = gtk_label_new(_("characters"));
1462         gtk_widget_show (label_autosave_length);
1463         gtk_box_pack_start (GTK_BOX (hbox_autosave), label_autosave_length, FALSE, FALSE, 0);
1464         
1465         hbox_undolevel = gtk_hbox_new (FALSE, 8);
1466         gtk_widget_show (hbox_undolevel);
1467         gtk_box_pack_start (GTK_BOX (vbox1), hbox_undolevel, FALSE, FALSE, 0);
1468
1469         label_undolevel = gtk_label_new (_("Undo level"));
1470         gtk_widget_show (label_undolevel);
1471         gtk_box_pack_start (GTK_BOX (hbox_undolevel), label_undolevel, FALSE, FALSE, 0);
1472
1473         spinbtn_undolevel_adj = gtk_adjustment_new (50, 0, 100, 1, 10, 10);
1474         spinbtn_undolevel = gtk_spin_button_new
1475                 (GTK_ADJUSTMENT (spinbtn_undolevel_adj), 1, 0);
1476         gtk_widget_show (spinbtn_undolevel);
1477         gtk_box_pack_start (GTK_BOX (hbox_undolevel), spinbtn_undolevel, FALSE, FALSE, 0);
1478         gtk_widget_set_usize (spinbtn_undolevel, 64, -1);
1479         gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_undolevel), TRUE);
1480
1481         /* line-wrapping */
1482         PACK_FRAME(vbox1, frame_msgwrap, _("Message wrapping"));
1483
1484         vbox_linewrap = gtk_vbox_new (FALSE, VSPACING_NARROW);
1485         gtk_widget_show (vbox_linewrap);
1486         gtk_container_add (GTK_CONTAINER (frame_msgwrap), vbox_linewrap);
1487         gtk_container_set_border_width (GTK_CONTAINER (vbox_linewrap), 8);
1488
1489         hbox3 = gtk_hbox_new (FALSE, 8);
1490         gtk_widget_show (hbox3);
1491         gtk_box_pack_start (GTK_BOX (vbox_linewrap), hbox3, FALSE, FALSE, 0);
1492
1493
1494         label_linewrap = gtk_label_new (_("Wrap messages at"));
1495         gtk_widget_show (label_linewrap);
1496         gtk_box_pack_start (GTK_BOX (hbox3), label_linewrap, FALSE, FALSE, 0);
1497
1498         spinbtn_linewrap_adj = gtk_adjustment_new (72, 20, 1024, 1, 10, 10);
1499         spinbtn_linewrap = gtk_spin_button_new
1500                 (GTK_ADJUSTMENT (spinbtn_linewrap_adj), 1, 0);
1501         gtk_widget_show (spinbtn_linewrap);
1502         gtk_box_pack_start (GTK_BOX (hbox3), spinbtn_linewrap, FALSE, FALSE, 0);
1503         gtk_widget_set_usize (spinbtn_linewrap, 64, -1);
1504         gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_linewrap), TRUE);
1505
1506         label_linewrap = gtk_label_new (_("characters"));
1507         gtk_widget_show (label_linewrap);
1508         gtk_box_pack_start (GTK_BOX (hbox3), label_linewrap, FALSE, FALSE, 0);
1509
1510         hbox4 = gtk_hbox_new (FALSE, VSPACING);
1511         gtk_widget_show (hbox4);
1512         gtk_box_pack_start (GTK_BOX (vbox_linewrap), hbox4, FALSE, FALSE, 0);
1513
1514         PACK_CHECK_BUTTON (hbox4, checkbtn_wrapquote, _("Wrap quotation"));
1515
1516         PACK_CHECK_BUTTON (hbox4, checkbtn_autowrap, _("Wrap on input"));
1517
1518         PACK_CHECK_BUTTON
1519                 (hbox4, checkbtn_wrapatsend, _("Wrap before sending"));
1520
1521         PACK_CHECK_BUTTON (vbox_linewrap, checkbtn_smart_wrapping,
1522                            _("Smart wrapping (EXPERIMENTAL)"));
1523         
1524        /*
1525         compose.checkbtn_quote   = checkbtn_quote;
1526         compose.entry_quotemark  = entry_quotemark;
1527         compose.text_quotefmt    = text_quotefmt;
1528         */
1529
1530         compose.checkbtn_autoextedit = checkbtn_autoextedit;
1531
1532         compose.checkbtn_reply_account_autosel   = checkbtn_reply_account_autosel;
1533         compose.checkbtn_forward_account_autosel = checkbtn_forward_account_autosel;
1534         compose.checkbtn_reedit_account_autosel  = checkbtn_reedit_account_autosel;
1535
1536         compose.spinbtn_undolevel     = spinbtn_undolevel;
1537         compose.spinbtn_undolevel_adj = spinbtn_undolevel_adj;
1538
1539         compose.spinbtn_linewrap      = spinbtn_linewrap;
1540         compose.spinbtn_linewrap_adj  = spinbtn_linewrap_adj;
1541         compose.checkbtn_wrapquote    = checkbtn_wrapquote;
1542         compose.checkbtn_autowrap     = checkbtn_autowrap;
1543         compose.checkbtn_wrapatsend   = checkbtn_wrapatsend;
1544
1545         compose.checkbtn_autosave     = checkbtn_autosave;
1546         compose.entry_autosave_length = entry_autosave_length;
1547         
1548         compose.checkbtn_forward_as_attachment =
1549                 checkbtn_forward_as_attachment;
1550         compose.checkbtn_redirect_keep_from =
1551                 checkbtn_redirect_keep_from;
1552         compose.checkbtn_smart_wrapping = 
1553                 checkbtn_smart_wrapping;
1554         compose.checkbtn_block_cursor   =
1555                 checkbtn_block_cursor;
1556         compose.checkbtn_default_reply_list = checkbtn_default_reply_list;
1557 }
1558
1559 static void prefs_quote_create(void)
1560 {
1561         GtkWidget *vbox1;
1562         GtkWidget *frame_quote;
1563         GtkWidget *vbox_quote;
1564         GtkWidget *hbox1;
1565         GtkWidget *hbox2;
1566         GtkWidget *label_quotemark;
1567         GtkWidget *entry_quotemark;
1568         GtkWidget *scrolledwin_quotefmt;
1569         GtkWidget *text_quotefmt;
1570
1571         GtkWidget *entry_fw_quotemark;
1572         GtkWidget *text_fw_quotefmt;
1573
1574         GtkWidget *entry_quote_chars;
1575         GtkWidget *label_quote_chars;
1576         
1577         GtkWidget *btn_quotedesc;
1578
1579         GtkWidget *checkbtn_reply_with_quote;
1580
1581         vbox1 = gtk_vbox_new (FALSE, VSPACING);
1582         gtk_widget_show (vbox1);
1583         gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
1584         gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
1585
1586         /* reply */
1587
1588         PACK_CHECK_BUTTON (vbox1, checkbtn_reply_with_quote, _("Reply will quote by default"));
1589
1590         PACK_FRAME (vbox1, frame_quote, _("Reply format"));
1591
1592         vbox_quote = gtk_vbox_new (FALSE, VSPACING_NARROW);
1593         gtk_widget_show (vbox_quote);
1594         gtk_container_add (GTK_CONTAINER (frame_quote), vbox_quote);
1595         gtk_container_set_border_width (GTK_CONTAINER (vbox_quote), 8);
1596
1597         hbox1 = gtk_hbox_new (FALSE, 32);
1598         gtk_widget_show (hbox1);
1599         gtk_box_pack_start (GTK_BOX (vbox_quote), hbox1, FALSE, FALSE, 0);
1600
1601         hbox2 = gtk_hbox_new (FALSE, 8);
1602         gtk_widget_show (hbox2);
1603         gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0);
1604
1605         label_quotemark = gtk_label_new (_("Quotation mark"));
1606         gtk_widget_show (label_quotemark);
1607         gtk_box_pack_start (GTK_BOX (hbox2), label_quotemark, FALSE, FALSE, 0);
1608
1609         entry_quotemark = gtk_entry_new ();
1610         gtk_widget_show (entry_quotemark);
1611         gtk_box_pack_start (GTK_BOX (hbox2), entry_quotemark, FALSE, FALSE, 0);
1612         gtk_widget_set_usize (entry_quotemark, 64, -1);
1613
1614         scrolledwin_quotefmt = gtk_scrolled_window_new (NULL, NULL);
1615         gtk_widget_show (scrolledwin_quotefmt);
1616         gtk_box_pack_start (GTK_BOX (vbox_quote), scrolledwin_quotefmt, TRUE, TRUE, 0);
1617         gtk_scrolled_window_set_policy
1618                 (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt),
1619                  GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
1620
1621         text_quotefmt = gtk_text_new (NULL, NULL);
1622         gtk_widget_show (text_quotefmt);
1623         gtk_container_add(GTK_CONTAINER(scrolledwin_quotefmt), text_quotefmt);
1624         gtk_text_set_editable (GTK_TEXT (text_quotefmt), TRUE);
1625         gtk_widget_set_usize(text_quotefmt, -1, 60);
1626
1627         /* forward */
1628
1629         PACK_FRAME (vbox1, frame_quote, _("Forward format"));
1630
1631         vbox_quote = gtk_vbox_new (FALSE, VSPACING_NARROW);
1632         gtk_widget_show (vbox_quote);
1633         gtk_container_add (GTK_CONTAINER (frame_quote), vbox_quote);
1634         gtk_container_set_border_width (GTK_CONTAINER (vbox_quote), 8);
1635
1636         hbox1 = gtk_hbox_new (FALSE, 32);
1637         gtk_widget_show (hbox1);
1638         gtk_box_pack_start (GTK_BOX (vbox_quote), hbox1, FALSE, FALSE, 0);
1639
1640         hbox2 = gtk_hbox_new (FALSE, 8);
1641         gtk_widget_show (hbox2);
1642         gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0);
1643
1644         label_quotemark = gtk_label_new (_("Quotation mark"));
1645         gtk_widget_show (label_quotemark);
1646         gtk_box_pack_start (GTK_BOX (hbox2), label_quotemark, FALSE, FALSE, 0);
1647
1648         entry_fw_quotemark = gtk_entry_new ();
1649         gtk_widget_show (entry_fw_quotemark);
1650         gtk_box_pack_start (GTK_BOX (hbox2), entry_fw_quotemark,
1651                             FALSE, FALSE, 0);
1652         gtk_widget_set_usize (entry_fw_quotemark, 64, -1);
1653
1654         scrolledwin_quotefmt = gtk_scrolled_window_new (NULL, NULL);
1655         gtk_widget_show (scrolledwin_quotefmt);
1656         gtk_box_pack_start (GTK_BOX (vbox_quote), scrolledwin_quotefmt, TRUE, TRUE, 0);
1657         gtk_scrolled_window_set_policy
1658                 (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt),
1659                  GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
1660
1661         text_fw_quotefmt = gtk_text_new (NULL, NULL);
1662         gtk_widget_show (text_fw_quotefmt);
1663         gtk_container_add(GTK_CONTAINER(scrolledwin_quotefmt),
1664                           text_fw_quotefmt);
1665         gtk_text_set_editable (GTK_TEXT (text_fw_quotefmt), TRUE);
1666         gtk_widget_set_usize(text_fw_quotefmt, -1, 60);
1667
1668         hbox1 = gtk_hbox_new (FALSE, 32);
1669         gtk_widget_show (hbox1);
1670         gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
1671
1672         btn_quotedesc =
1673                 gtk_button_new_with_label (_(" Description of symbols "));
1674         gtk_widget_show (btn_quotedesc);
1675         gtk_box_pack_start (GTK_BOX (hbox1), btn_quotedesc, FALSE, FALSE, 0);
1676         gtk_signal_connect(GTK_OBJECT(btn_quotedesc), "clicked",
1677                            GTK_SIGNAL_FUNC(quote_fmt_quote_description), NULL);
1678
1679         /* quote chars */
1680
1681         PACK_FRAME (vbox1, frame_quote, _("Quotation characters"));
1682
1683         vbox_quote = gtk_vbox_new (FALSE, VSPACING_NARROW);
1684         gtk_widget_show (vbox_quote);
1685         gtk_container_add (GTK_CONTAINER (frame_quote), vbox_quote);
1686         gtk_container_set_border_width (GTK_CONTAINER (vbox_quote), 8);
1687
1688         hbox1 = gtk_hbox_new (FALSE, 32);
1689         gtk_widget_show (hbox1);
1690         gtk_box_pack_start (GTK_BOX (vbox_quote), hbox1, FALSE, FALSE, 0);
1691
1692         hbox2 = gtk_hbox_new (FALSE, 8);
1693         gtk_widget_show (hbox2);
1694         gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0);
1695
1696         label_quote_chars = gtk_label_new (_("Treat these characters as quotation marks: "));
1697         gtk_widget_show (label_quote_chars);
1698         gtk_box_pack_start (GTK_BOX (hbox2), label_quote_chars, FALSE, FALSE, 0);
1699
1700         entry_quote_chars = gtk_entry_new ();
1701         gtk_widget_show (entry_quote_chars);
1702         gtk_box_pack_start (GTK_BOX (hbox2), entry_quote_chars,
1703                             FALSE, FALSE, 0);
1704         gtk_widget_set_usize (entry_quote_chars, 64, -1);
1705
1706
1707         compose.checkbtn_reply_with_quote= checkbtn_reply_with_quote;
1708         quote.entry_quotemark    = entry_quotemark;
1709         quote.text_quotefmt      = text_quotefmt;
1710         quote.entry_fw_quotemark = entry_fw_quotemark;
1711         quote.text_fw_quotefmt   = text_fw_quotefmt;
1712         quote.entry_quote_chars  = entry_quote_chars;
1713 }
1714
1715 static void prefs_display_create(void)
1716 {
1717         GtkWidget *vbox1;
1718         GtkWidget *chkbtn_transhdr;
1719         GtkWidget *chkbtn_folder_unread;
1720         GtkWidget *hbox1;
1721         GtkWidget *label_ng_abbrev;
1722         GtkWidget *spinbtn_ng_abbrev_len;
1723         GtkObject *spinbtn_ng_abbrev_len_adj;
1724         GtkWidget *frame_summary;
1725         GtkWidget *vbox2;
1726         GtkWidget *chkbtn_swapfrom;
1727         GtkWidget *chkbtn_useaddrbook;
1728         GtkWidget *chkbtn_threadsubj;
1729         GtkWidget *vbox3;
1730         GtkWidget *label_datefmt;
1731         GtkWidget *button_datefmt;
1732         GtkWidget *entry_datefmt;
1733         GtkWidget *button_dispitem;
1734
1735         vbox1 = gtk_vbox_new (FALSE, VSPACING);
1736         gtk_widget_show (vbox1);
1737         gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
1738         gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
1739
1740         vbox2 = gtk_vbox_new (FALSE, 0);
1741         gtk_widget_show (vbox2);
1742         gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, TRUE, 0);
1743
1744         PACK_CHECK_BUTTON
1745                 (vbox2, chkbtn_transhdr,
1746                  _("Translate header name (such as `From:', `Subject:')"));
1747
1748         PACK_CHECK_BUTTON (vbox2, chkbtn_folder_unread,
1749                            _("Display unread number next to folder name"));
1750
1751         PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2);
1752
1753         hbox1 = gtk_hbox_new (FALSE, 8);
1754         gtk_widget_show (hbox1);
1755         gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
1756
1757         label_ng_abbrev = gtk_label_new
1758                 (_("Abbreviate newsgroup names longer than"));
1759         gtk_widget_show (label_ng_abbrev);
1760         gtk_box_pack_start (GTK_BOX (hbox1), label_ng_abbrev, FALSE, FALSE, 0);
1761
1762         spinbtn_ng_abbrev_len_adj = gtk_adjustment_new (16, 0, 999, 1, 10, 10);
1763         spinbtn_ng_abbrev_len = gtk_spin_button_new
1764                 (GTK_ADJUSTMENT (spinbtn_ng_abbrev_len_adj), 1, 0);
1765         gtk_widget_show (spinbtn_ng_abbrev_len);
1766         gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_ng_abbrev_len,
1767                             FALSE, FALSE, 0);
1768         gtk_widget_set_usize (spinbtn_ng_abbrev_len, 56, -1);
1769         gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_ng_abbrev_len),
1770                                      TRUE);
1771
1772         label_ng_abbrev = gtk_label_new
1773                 (_("letters"));
1774         gtk_widget_show (label_ng_abbrev);
1775         gtk_box_pack_start (GTK_BOX (hbox1), label_ng_abbrev, FALSE, FALSE, 0);
1776
1777         /* ---- Summary ---- */
1778
1779         PACK_FRAME(vbox1, frame_summary, _("Summary View"));
1780
1781         vbox2 = gtk_vbox_new (FALSE, 0);
1782         gtk_widget_show (vbox2);
1783         gtk_container_add (GTK_CONTAINER (frame_summary), vbox2);
1784         gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
1785
1786         PACK_CHECK_BUTTON
1787                 (vbox2, chkbtn_swapfrom,
1788                  _("Display recipient in `From' column if sender is yourself"));
1789         PACK_CHECK_BUTTON
1790                 (vbox2, chkbtn_useaddrbook,
1791                  _("Display sender using address book"));
1792         PACK_CHECK_BUTTON
1793                 (vbox2, chkbtn_threadsubj,
1794                  _("Thread using subject in addition to standard headers"));
1795
1796         PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2);
1797
1798         hbox1 = gtk_hbox_new (FALSE, 8);
1799         gtk_widget_show (hbox1);
1800         gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
1801
1802         label_datefmt = gtk_label_new (_("Date format"));
1803         gtk_widget_show (label_datefmt);
1804         gtk_box_pack_start (GTK_BOX (hbox1), label_datefmt, FALSE, FALSE, 0);
1805
1806         entry_datefmt = gtk_entry_new ();
1807         gtk_widget_show (entry_datefmt);
1808         gtk_box_pack_start (GTK_BOX (hbox1), entry_datefmt, TRUE, TRUE, 0);
1809
1810         button_datefmt = gtk_button_new_with_label (" ... ");
1811
1812         gtk_widget_show (button_datefmt);
1813         gtk_box_pack_start (GTK_BOX (hbox1), button_datefmt, FALSE, FALSE, 0);
1814         gtk_signal_connect (GTK_OBJECT (button_datefmt), "clicked",
1815                             GTK_SIGNAL_FUNC (date_format_create), NULL);
1816
1817         PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW);
1818
1819         hbox1 = gtk_hbox_new (FALSE, 8);
1820         gtk_widget_show (hbox1);
1821         gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
1822
1823         button_dispitem = gtk_button_new_with_label
1824                 (_(" Set displayed items in summary... "));
1825         gtk_widget_show (button_dispitem);
1826         gtk_box_pack_start (GTK_BOX (hbox1), button_dispitem, FALSE, TRUE, 0);
1827         gtk_signal_connect (GTK_OBJECT (button_dispitem), "clicked",
1828                             GTK_SIGNAL_FUNC (prefs_summary_column_open),
1829                             NULL);
1830
1831         display.chkbtn_transhdr           = chkbtn_transhdr;
1832         display.chkbtn_folder_unread      = chkbtn_folder_unread;
1833         display.spinbtn_ng_abbrev_len     = spinbtn_ng_abbrev_len;
1834         display.spinbtn_ng_abbrev_len_adj = spinbtn_ng_abbrev_len_adj;
1835
1836         display.chkbtn_swapfrom      = chkbtn_swapfrom;
1837         display.chkbtn_useaddrbook   = chkbtn_useaddrbook;
1838         display.chkbtn_threadsubj    = chkbtn_threadsubj;
1839         display.entry_datefmt        = entry_datefmt;
1840 }
1841
1842 static void prefs_message_create(void)
1843 {
1844         GtkWidget *vbox1;
1845         GtkWidget *vbox2;
1846         GtkWidget *vbox3;
1847         GtkWidget *hbox1;
1848         GtkWidget *chkbtn_enablecol;
1849         GtkWidget *button_edit_col;
1850         GtkWidget *chkbtn_mbalnum;
1851         GtkWidget *chkbtn_disphdrpane;
1852         GtkWidget *chkbtn_disphdr;
1853         GtkWidget *button_edit_disphdr;
1854         GtkWidget *hbox_linespc;
1855         GtkWidget *label_linespc;
1856         GtkObject *spinbtn_linespc_adj;
1857         GtkWidget *spinbtn_linespc;
1858         GtkWidget *chkbtn_headspc;
1859
1860         GtkWidget *frame_scr;
1861         GtkWidget *vbox_scr;
1862         GtkWidget *chkbtn_smoothscroll;
1863         GtkWidget *hbox_scr;
1864         GtkWidget *label_scr;
1865         GtkObject *spinbtn_scrollstep_adj;
1866         GtkWidget *spinbtn_scrollstep;
1867         GtkWidget *chkbtn_halfpage;
1868
1869         GtkWidget *chkbtn_attach_desc;
1870
1871         vbox1 = gtk_vbox_new (FALSE, VSPACING);
1872         gtk_widget_show (vbox1);
1873         gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
1874         gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
1875
1876         vbox2 = gtk_vbox_new (FALSE, 0);
1877         gtk_widget_show (vbox2);
1878         gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
1879
1880         hbox1 = gtk_hbox_new (FALSE, 8);
1881         gtk_widget_show (hbox1);
1882         gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
1883
1884         PACK_CHECK_BUTTON (hbox1, chkbtn_enablecol,
1885                            _("Enable coloration of message"));
1886         gtk_signal_connect(GTK_OBJECT(chkbtn_enablecol), "toggled",
1887                            GTK_SIGNAL_FUNC(prefs_enable_message_color_toggled),
1888                            NULL);
1889
1890         button_edit_col = gtk_button_new_with_label (_(" Edit... "));
1891         gtk_widget_show (button_edit_col);
1892         gtk_box_pack_end (GTK_BOX (hbox1), button_edit_col, FALSE, TRUE, 0);
1893         gtk_signal_connect (GTK_OBJECT (button_edit_col), "clicked",
1894                             GTK_SIGNAL_FUNC (prefs_quote_colors_dialog), NULL);
1895
1896         SET_TOGGLE_SENSITIVITY(chkbtn_enablecol, button_edit_col);
1897
1898         PACK_CHECK_BUTTON
1899                 (vbox2, chkbtn_mbalnum,
1900                  _("Display multi-byte alphanumeric as\n"
1901                    "ASCII character (Japanese only)"));
1902         gtk_label_set_justify (GTK_LABEL (GTK_BIN(chkbtn_mbalnum)->child),
1903                                GTK_JUSTIFY_LEFT);
1904
1905         PACK_CHECK_BUTTON(vbox2, chkbtn_disphdrpane,
1906                           _("Display header pane above message view"));
1907
1908         hbox1 = gtk_hbox_new (FALSE, 8);
1909         gtk_widget_show (hbox1);
1910         gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
1911
1912         PACK_CHECK_BUTTON(hbox1, chkbtn_disphdr,
1913                           _("Display short headers on message view"));
1914
1915         button_edit_disphdr = gtk_button_new_with_label (_(" Edit... "));
1916         gtk_widget_show (button_edit_disphdr);
1917         gtk_box_pack_end (GTK_BOX (hbox1), button_edit_disphdr,
1918                           FALSE, TRUE, 0);
1919         gtk_signal_connect (GTK_OBJECT (button_edit_disphdr), "clicked",
1920                             GTK_SIGNAL_FUNC (prefs_display_header_open),
1921                             NULL);
1922
1923         SET_TOGGLE_SENSITIVITY(chkbtn_disphdr, button_edit_disphdr);
1924
1925         PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2);
1926
1927         hbox1 = gtk_hbox_new (FALSE, 32);
1928         gtk_widget_show (hbox1);
1929         gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
1930
1931         hbox_linespc = gtk_hbox_new (FALSE, 8);
1932         gtk_widget_show (hbox1);
1933         gtk_box_pack_start (GTK_BOX (hbox1), hbox_linespc, FALSE, TRUE, 0);
1934
1935         label_linespc = gtk_label_new (_("Line space"));
1936         gtk_widget_show (label_linespc);
1937         gtk_box_pack_start (GTK_BOX (hbox_linespc), label_linespc,
1938                             FALSE, FALSE, 0);
1939
1940         spinbtn_linespc_adj = gtk_adjustment_new (2, 0, 16, 1, 1, 16);
1941         spinbtn_linespc = gtk_spin_button_new
1942                 (GTK_ADJUSTMENT (spinbtn_linespc_adj), 1, 0);
1943         gtk_widget_show (spinbtn_linespc);
1944         gtk_box_pack_start (GTK_BOX (hbox_linespc), spinbtn_linespc,
1945                             FALSE, FALSE, 0);
1946         gtk_widget_set_usize (spinbtn_linespc, 64, -1);
1947         gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_linespc), TRUE);
1948
1949         label_linespc = gtk_label_new (_("pixel(s)"));
1950         gtk_widget_show (label_linespc);
1951         gtk_box_pack_start (GTK_BOX (hbox_linespc), label_linespc,
1952                             FALSE, FALSE, 0);
1953
1954         PACK_CHECK_BUTTON(hbox1, chkbtn_headspc, _("Leave space on head"));
1955
1956         PACK_FRAME(vbox1, frame_scr, _("Scroll"));
1957
1958         vbox_scr = gtk_vbox_new (FALSE, 0);
1959         gtk_widget_show (vbox_scr);
1960         gtk_container_add (GTK_CONTAINER (frame_scr), vbox_scr);
1961         gtk_container_set_border_width (GTK_CONTAINER (vbox_scr), 8);
1962
1963         PACK_CHECK_BUTTON(vbox_scr, chkbtn_halfpage, _("Half page"));
1964
1965         hbox1 = gtk_hbox_new (FALSE, 32);
1966         gtk_widget_show (hbox1);
1967         gtk_box_pack_start (GTK_BOX (vbox_scr), hbox1, FALSE, TRUE, 0);
1968
1969         PACK_CHECK_BUTTON(hbox1, chkbtn_smoothscroll, _("Smooth scroll"));
1970
1971         hbox_scr = gtk_hbox_new (FALSE, 8);
1972         gtk_widget_show (hbox_scr);
1973         gtk_box_pack_start (GTK_BOX (hbox1), hbox_scr, FALSE, FALSE, 0);
1974
1975         label_scr = gtk_label_new (_("Step"));
1976         gtk_widget_show (label_scr);
1977         gtk_box_pack_start (GTK_BOX (hbox_scr), label_scr, FALSE, FALSE, 0);
1978
1979         spinbtn_scrollstep_adj = gtk_adjustment_new (1, 1, 100, 1, 10, 10);
1980         spinbtn_scrollstep = gtk_spin_button_new
1981                 (GTK_ADJUSTMENT (spinbtn_scrollstep_adj), 1, 0);
1982         gtk_widget_show (spinbtn_scrollstep);
1983         gtk_box_pack_start (GTK_BOX (hbox_scr), spinbtn_scrollstep,
1984                             FALSE, FALSE, 0);
1985         gtk_widget_set_usize (spinbtn_scrollstep, 64, -1);
1986         gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_scrollstep),
1987                                      TRUE);
1988
1989         label_scr = gtk_label_new (_("pixel(s)"));
1990         gtk_widget_show (label_scr);
1991         gtk_box_pack_start (GTK_BOX (hbox_scr), label_scr, FALSE, FALSE, 0);
1992
1993         SET_TOGGLE_SENSITIVITY (chkbtn_smoothscroll, hbox_scr)
1994
1995         vbox3 = gtk_vbox_new (FALSE, 0);
1996         gtk_widget_show (vbox3);
1997         gtk_box_pack_start (GTK_BOX (vbox1), vbox3, FALSE, FALSE, 0);
1998
1999         PACK_CHECK_BUTTON(vbox3, chkbtn_attach_desc,
2000                           _("Show attachment descriptions (rather than names)"));
2001
2002
2003         message.chkbtn_enablecol   = chkbtn_enablecol;
2004         message.button_edit_col    = button_edit_col;
2005         message.chkbtn_mbalnum     = chkbtn_mbalnum;
2006         message.chkbtn_disphdrpane = chkbtn_disphdrpane;
2007         message.chkbtn_disphdr     = chkbtn_disphdr;
2008         message.spinbtn_linespc    = spinbtn_linespc;
2009         message.chkbtn_headspc     = chkbtn_headspc;
2010
2011         message.chkbtn_smoothscroll    = chkbtn_smoothscroll;
2012         message.spinbtn_scrollstep     = spinbtn_scrollstep;
2013         message.spinbtn_scrollstep_adj = spinbtn_scrollstep_adj;
2014         message.chkbtn_halfpage        = chkbtn_halfpage;
2015
2016         message.chkbtn_attach_desc  = chkbtn_attach_desc;
2017 }
2018
2019 #if USE_GPGME
2020 static void prefs_privacy_create(void)
2021 {
2022         GtkWidget *vbox1;
2023         GtkWidget *vbox2;
2024         GtkWidget *vbox3;
2025         GtkWidget *hbox1;
2026         GtkWidget *hbox_spc;
2027         GtkWidget *label;
2028         GtkWidget *checkbtn_auto_check_signatures;
2029         GtkWidget *checkbtn_store_passphrase;
2030         GtkObject *spinbtn_store_passphrase_adj;
2031         GtkWidget *spinbtn_store_passphrase;
2032         GtkTooltips *store_tooltip;
2033         GtkWidget *checkbtn_passphrase_grab;
2034         GtkWidget *checkbtn_gpg_warning;
2035
2036         vbox1 = gtk_vbox_new (FALSE, VSPACING);
2037         gtk_widget_show (vbox1);
2038         gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
2039         gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
2040
2041         vbox2 = gtk_vbox_new (FALSE, 0);
2042         gtk_widget_show (vbox2);
2043         gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
2044
2045         PACK_CHECK_BUTTON (vbox2, checkbtn_auto_check_signatures,
2046                            _("Automatically check signatures"));
2047
2048         PACK_CHECK_BUTTON (vbox2, checkbtn_store_passphrase,
2049                            _("Store passphrase in memory temporarily"));
2050
2051         vbox3 = gtk_vbox_new (FALSE, 0);
2052         gtk_widget_show (vbox3);
2053         gtk_box_pack_start (GTK_BOX (vbox2), vbox3, FALSE, FALSE, 0);
2054
2055         hbox1 = gtk_hbox_new (FALSE, 8);
2056         gtk_widget_show (hbox1);
2057         gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0);
2058
2059         hbox_spc = gtk_hbox_new (FALSE, 0);
2060         gtk_widget_show (hbox_spc);
2061         gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0);
2062         gtk_widget_set_usize (hbox_spc, 12, -1);
2063
2064         label = gtk_label_new (_("Expire after"));
2065         gtk_widget_show (label);
2066         gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
2067
2068         store_tooltip = gtk_tooltips_new();
2069
2070         spinbtn_store_passphrase_adj = gtk_adjustment_new (0, 0, 1440, 1, 5, 5);
2071         spinbtn_store_passphrase = gtk_spin_button_new
2072                 (GTK_ADJUSTMENT (spinbtn_store_passphrase_adj), 1, 0);
2073         gtk_widget_show (spinbtn_store_passphrase);
2074         gtk_tooltips_set_tip(GTK_TOOLTIPS(store_tooltip), spinbtn_store_passphrase,
2075                              _("Setting to '0' will store the passphrase"
2076                                " for the whole session"),
2077                              NULL);
2078         gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_store_passphrase, FALSE, FALSE, 0);
2079         gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_store_passphrase),
2080                                      TRUE);
2081         gtk_widget_set_usize (spinbtn_store_passphrase, 64, -1);
2082
2083         label = gtk_label_new (_("minute(s) "));
2084         gtk_widget_show (label);
2085         gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
2086
2087         hbox1 = gtk_hbox_new (FALSE, 8);
2088         gtk_widget_show (hbox1);
2089         gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0);
2090
2091         hbox_spc = gtk_hbox_new (FALSE, 0);
2092         gtk_widget_show (hbox_spc);
2093         gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0);
2094         gtk_widget_set_usize (hbox_spc, 12, -1);
2095
2096         SET_TOGGLE_SENSITIVITY (checkbtn_store_passphrase, vbox3);
2097
2098 #ifndef __MINGW32__
2099         PACK_CHECK_BUTTON (vbox2, checkbtn_passphrase_grab,
2100                            _("Grab input while entering a passphrase"));
2101 #endif
2102
2103         PACK_CHECK_BUTTON
2104                 (vbox2, checkbtn_gpg_warning,
2105                  _("Display warning on startup if GnuPG doesn't work"));
2106
2107         hbox1 = gtk_hbox_new (FALSE, 8);
2108         gtk_widget_show (hbox1);
2109         gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
2110
2111         privacy.checkbtn_auto_check_signatures
2112                                              = checkbtn_auto_check_signatures;
2113         privacy.checkbtn_store_passphrase    = checkbtn_store_passphrase;
2114         privacy.spinbtn_store_passphrase     = spinbtn_store_passphrase;
2115         privacy.spinbtn_store_passphrase_adj = spinbtn_store_passphrase_adj;
2116         privacy.checkbtn_passphrase_grab     = checkbtn_passphrase_grab;
2117         privacy.checkbtn_gpg_warning         = checkbtn_gpg_warning;
2118 }
2119 #endif /* USE_GPGME */
2120
2121 static void prefs_interface_create(void)
2122 {
2123         GtkWidget *vbox1;
2124         GtkWidget *vbox2;
2125         GtkWidget *vbox3;
2126         /* GtkWidget *checkbtn_emacs; */
2127         GtkWidget *checkbtn_always_show_msg;
2128         GtkWidget *checkbtn_openunread;
2129         GtkWidget *checkbtn_mark_as_read_on_newwin;
2130         GtkWidget *checkbtn_openinbox;
2131         GtkWidget *checkbtn_immedexec;
2132         GtkTooltips *immedexec_tooltip;
2133         GtkWidget *hbox1;
2134         GtkWidget *label;
2135         GtkWidget *menu;
2136         GtkWidget *menuitem;
2137
2138         GtkWidget *button_keybind;
2139
2140         GtkWidget *hbox_nextunreadmsgdialog;
2141         GtkWidget *optmenu_nextunreadmsgdialog;
2142
2143         GtkWidget *frame_pixmap_theme;
2144         GtkWidget *vbox_pixmap_theme;
2145         GtkWidget *entry_pixmap_theme;
2146         GtkWidget *combo_pixmap_theme;
2147         GList *avail_pixmap_themes = NULL;
2148
2149         vbox1 = gtk_vbox_new (FALSE, VSPACING);
2150         gtk_widget_show (vbox1);
2151         gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
2152         gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
2153
2154         vbox2 = gtk_vbox_new (FALSE, 0);
2155         gtk_widget_show (vbox2);
2156         gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
2157
2158         /* PACK_CHECK_BUTTON (vbox2, checkbtn_emacs,
2159                            _("Emulate the behavior of mouse operation of\n"
2160                              "Emacs-based mailer"));
2161         gtk_label_set_justify (GTK_LABEL (GTK_BIN (checkbtn_emacs)->child),
2162                                GTK_JUSTIFY_LEFT);   */
2163
2164         PACK_CHECK_BUTTON
2165                 (vbox2, checkbtn_always_show_msg,
2166                  _("Always open messages in summary when selected"));
2167
2168         PACK_CHECK_BUTTON
2169                 (vbox2, checkbtn_openunread,
2170                  _("Open first unread message when entering a folder"));
2171
2172         PACK_CHECK_BUTTON
2173                 (vbox2, checkbtn_mark_as_read_on_newwin,
2174                  _("Only mark message as read when opened in new window"));
2175
2176         PACK_CHECK_BUTTON
2177                 (vbox2, checkbtn_openinbox,
2178                  _("Go to inbox after receiving new mail"));
2179
2180         vbox3 = gtk_vbox_new (FALSE, 0);
2181         gtk_widget_show (vbox3);
2182         gtk_box_pack_start (GTK_BOX (vbox2), vbox3, FALSE, FALSE, 0);
2183
2184         immedexec_tooltip = gtk_tooltips_new();
2185
2186         PACK_CHECK_BUTTON
2187                 (vbox3, checkbtn_immedexec,
2188                  _("Execute immediately when moving or deleting messages"));
2189         gtk_tooltips_set_tip(GTK_TOOLTIPS(immedexec_tooltip), checkbtn_immedexec,
2190                              _("Messages will be marked until execution"
2191                                " if this is turned off"),
2192                              NULL);
2193
2194         hbox1 = gtk_hbox_new (FALSE, 0);
2195         gtk_widget_show (hbox1);
2196         gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0);
2197
2198         /* Next Unread Message Dialog */
2199         hbox_nextunreadmsgdialog = gtk_hbox_new (FALSE, 8);
2200         gtk_widget_show (hbox1);
2201         gtk_box_pack_start (GTK_BOX (vbox1), hbox_nextunreadmsgdialog, FALSE, FALSE, 0);
2202
2203         label = gtk_label_new (_("Show no-unread-message dialog"));
2204         gtk_widget_show (label);
2205         gtk_box_pack_start (GTK_BOX (hbox_nextunreadmsgdialog), label, FALSE, FALSE, 8);
2206
2207         optmenu_nextunreadmsgdialog = gtk_option_menu_new ();
2208         gtk_widget_show (optmenu_nextunreadmsgdialog);
2209         gtk_box_pack_start (GTK_BOX (hbox_nextunreadmsgdialog), optmenu_nextunreadmsgdialog, FALSE, FALSE, 8);
2210         
2211         menu = gtk_menu_new ();
2212         MENUITEM_ADD (menu, menuitem, _("Always"), NEXTUNREADMSGDIALOG_ALWAYS);
2213         MENUITEM_ADD (menu, menuitem, _("Assume 'Yes'"), 
2214                       NEXTUNREADMSGDIALOG_ASSUME_YES);
2215         MENUITEM_ADD (menu, menuitem, _("Assume 'No'"), 
2216                       NEXTUNREADMSGDIALOG_ASSUME_NO);
2217
2218         gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_nextunreadmsgdialog), menu);
2219
2220         hbox1 = gtk_hbox_new (FALSE, 8);
2221         gtk_widget_show (hbox1);
2222         gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
2223
2224         button_keybind = gtk_button_new_with_label (_(" Set key bindings... "));
2225         gtk_widget_show (button_keybind);
2226         gtk_box_pack_start (GTK_BOX (hbox1), button_keybind, FALSE, FALSE, 0);
2227         gtk_signal_connect (GTK_OBJECT (button_keybind), "clicked",
2228                             GTK_SIGNAL_FUNC (prefs_keybind_select), NULL);
2229
2230         PACK_FRAME(vbox1, frame_pixmap_theme, _("Icon theme"));
2231         
2232         vbox_pixmap_theme = gtk_vbox_new(FALSE, 0);
2233         gtk_widget_show(vbox_pixmap_theme);
2234         gtk_container_add(GTK_CONTAINER(frame_pixmap_theme), vbox_pixmap_theme);
2235         gtk_container_set_border_width(GTK_CONTAINER(vbox_pixmap_theme), 8);
2236  
2237         avail_pixmap_themes = stock_pixmap_themes_list_new(); 
2238  
2239         combo_pixmap_theme = gtk_combo_new ();
2240         gtk_widget_show (combo_pixmap_theme);
2241         gtk_box_pack_start (GTK_BOX (vbox_pixmap_theme), combo_pixmap_theme, TRUE, TRUE, 0);
2242         gtk_combo_set_popdown_strings(GTK_COMBO(combo_pixmap_theme), avail_pixmap_themes);
2243         entry_pixmap_theme = GTK_COMBO (combo_pixmap_theme)->entry;
2244
2245         stock_pixmap_themes_list_free(avail_pixmap_themes);
2246
2247         /* interface.checkbtn_emacs          = checkbtn_emacs; */
2248         interface.checkbtn_always_show_msg    = checkbtn_always_show_msg;
2249         interface.checkbtn_openunread         = checkbtn_openunread;
2250         interface.checkbtn_mark_as_read_on_newwin
2251                                               = checkbtn_mark_as_read_on_newwin;
2252         interface.checkbtn_openinbox          = checkbtn_openinbox;
2253         interface.checkbtn_immedexec          = checkbtn_immedexec;
2254         interface.optmenu_nextunreadmsgdialog = optmenu_nextunreadmsgdialog;
2255         interface.combo_pixmap_theme          = combo_pixmap_theme;
2256         interface.entry_pixmap_theme          = entry_pixmap_theme;
2257 }
2258
2259 static void prefs_other_create(void)
2260 {
2261         GtkWidget *vbox1;
2262         GtkWidget *ext_frame;
2263         GtkWidget *ext_table;
2264         GtkWidget *hbox1;
2265
2266         GtkWidget *uri_label;
2267         GtkWidget *uri_combo;
2268         GtkWidget *uri_entry;
2269
2270         GtkWidget *printcmd_label;
2271         GtkWidget *printcmd_entry;
2272
2273         GtkWidget *exteditor_label;
2274         GtkWidget *exteditor_combo;
2275         GtkWidget *exteditor_entry;
2276
2277         GtkWidget *frame_addr;
2278         GtkWidget *vbox_addr;
2279         GtkWidget *checkbtn_addaddrbyclick;
2280         
2281         GtkWidget *frame_cliplog;
2282         GtkWidget *vbox_cliplog;
2283         GtkWidget *hbox_cliplog;
2284         GtkWidget *checkbtn_cliplog;
2285         GtkWidget *loglength_label;
2286         GtkWidget *loglength_entry;
2287         GtkTooltips *loglength_tooltip;
2288
2289         GtkWidget *frame_exit;
2290         GtkWidget *vbox_exit;
2291         GtkWidget *checkbtn_confonexit;
2292         GtkWidget *checkbtn_cleanonexit;
2293         GtkWidget *checkbtn_askonclean;
2294         GtkWidget *checkbtn_warnqueued;
2295
2296         GtkWidget *label_iotimeout;
2297         GtkWidget *spinbtn_iotimeout;
2298         GtkObject *spinbtn_iotimeout_adj;
2299
2300 #if 0
2301 #ifdef USE_OPENSSL
2302         GtkWidget *frame_ssl;
2303         GtkWidget *vbox_ssl;
2304         GtkWidget *hbox_ssl;
2305         GtkWidget *checkbtn_ssl_ask_unknown_valid;
2306 #endif
2307 #endif
2308         vbox1 = gtk_vbox_new (FALSE, VSPACING);
2309         gtk_widget_show (vbox1);
2310         gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
2311         gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
2312
2313         PACK_FRAME(vbox1, ext_frame,
2314                    _("External commands (%s will be replaced with file name / URI)"));
2315
2316         ext_table = gtk_table_new (3, 2, FALSE);
2317         gtk_widget_show (ext_table);
2318         gtk_container_add (GTK_CONTAINER (ext_frame), ext_table);
2319         gtk_container_set_border_width (GTK_CONTAINER (ext_table), 8);
2320         gtk_table_set_row_spacings (GTK_TABLE (ext_table), VSPACING_NARROW);
2321         gtk_table_set_col_spacings (GTK_TABLE (ext_table), 8);
2322
2323         uri_label = gtk_label_new (_("Web browser"));
2324         gtk_widget_show(uri_label);
2325         gtk_table_attach (GTK_TABLE (ext_table), uri_label, 0, 1, 0, 1,
2326                           GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
2327         gtk_misc_set_alignment (GTK_MISC (uri_label), 1, 0.5);
2328
2329         uri_combo = gtk_combo_new ();
2330         gtk_widget_show (uri_combo);
2331         gtk_table_attach (GTK_TABLE (ext_table), uri_combo, 1, 2, 0, 1,
2332                           GTK_EXPAND | GTK_FILL, 0, 0, 0);
2333         gtkut_combo_set_items (GTK_COMBO (uri_combo),
2334                                DEFAULT_BROWSER_CMD,
2335                                "galeon --new-tab '%s'",
2336                                "galeon '%s'",
2337                                "mozilla -remote 'openurl(%s,new-window)'",
2338                                "netscape -remote 'openURL(%s, new-window)'",
2339                                "netscape '%s'",
2340                                "gnome-moz-remote --newwin '%s'",
2341                                "kfmclient openURL '%s'",
2342                                "opera -newwindow '%s'",
2343                                "kterm -e w3m '%s'",
2344                                "kterm -e lynx '%s'",
2345                                NULL);
2346         uri_entry = GTK_COMBO (uri_combo)->entry;
2347
2348         printcmd_label = gtk_label_new (_("Print"));
2349         gtk_widget_show (printcmd_label);
2350         gtk_table_attach (GTK_TABLE (ext_table), printcmd_label, 0, 1, 1, 2,
2351                           GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
2352         gtk_misc_set_alignment (GTK_MISC (printcmd_label), 1, 0.5);
2353
2354         printcmd_entry = gtk_entry_new ();
2355         gtk_widget_show (printcmd_entry);
2356         gtk_table_attach (GTK_TABLE (ext_table), printcmd_entry, 1, 2, 1, 2,
2357                           GTK_EXPAND | GTK_FILL, 0, 0, 0);
2358
2359         exteditor_label = gtk_label_new (_("Editor"));
2360         gtk_widget_show (exteditor_label);
2361         gtk_table_attach (GTK_TABLE (ext_table), exteditor_label, 0, 1, 2, 3,
2362                           GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
2363         gtk_misc_set_alignment (GTK_MISC (exteditor_label), 1, 0.5);
2364
2365         exteditor_combo = gtk_combo_new ();
2366         gtk_widget_show (exteditor_combo);
2367         gtk_table_attach (GTK_TABLE (ext_table), exteditor_combo, 1, 2, 2, 3,
2368                           GTK_EXPAND | GTK_FILL, 0, 0, 0);
2369         gtkut_combo_set_items (GTK_COMBO (exteditor_combo),
2370                                "gedit %s",
2371                                "kedit %s",
2372                                "mgedit --no-fork %s",
2373                                "emacs %s",
2374                                "xemacs %s",
2375                                "kterm -e jed %s",
2376                                "kterm -e vi %s",
2377                                NULL);
2378         exteditor_entry = GTK_COMBO (exteditor_combo)->entry;
2379
2380         PACK_FRAME (vbox1, frame_addr, _("Address book"));
2381
2382         vbox_addr = gtk_vbox_new (FALSE, 0);
2383         gtk_widget_show (vbox_addr);
2384         gtk_container_add (GTK_CONTAINER (frame_addr), vbox_addr);
2385         gtk_container_set_border_width (GTK_CONTAINER (vbox_addr), 8);
2386
2387         PACK_CHECK_BUTTON
2388                 (vbox_addr, checkbtn_addaddrbyclick,
2389                  _("Add address to destination when double-clicked"));
2390
2391         /* Clip Log */
2392         PACK_FRAME (vbox1, frame_cliplog, _("Log Size"));
2393
2394         vbox_cliplog = gtk_vbox_new (FALSE, 0);
2395         gtk_widget_show (vbox_cliplog);
2396         gtk_container_add (GTK_CONTAINER (frame_cliplog), vbox_cliplog);
2397         gtk_container_set_border_width (GTK_CONTAINER (vbox_cliplog), 8);
2398         PACK_CHECK_BUTTON (vbox_cliplog, checkbtn_cliplog,
2399                            _("Clip the log size"));
2400         hbox_cliplog = gtk_hbox_new (FALSE, 3);
2401         gtk_container_add (GTK_CONTAINER (vbox_cliplog), hbox_cliplog);
2402         gtk_widget_show (hbox_cliplog);
2403         
2404         loglength_label = gtk_label_new (_("Log window length"));
2405         gtk_box_pack_start (GTK_BOX (hbox_cliplog), loglength_label,
2406                             FALSE, TRUE, 0);
2407         gtk_widget_show (GTK_WIDGET (loglength_label));
2408         
2409         loglength_tooltip = gtk_tooltips_new();
2410         
2411         loglength_entry = gtk_entry_new ();
2412         gtk_widget_set_usize (GTK_WIDGET (loglength_entry), 64, -1);
2413         gtk_box_pack_start (GTK_BOX (hbox_cliplog), loglength_entry,
2414                             FALSE, TRUE, 0);
2415         gtk_widget_show (GTK_WIDGET (loglength_entry));
2416         gtk_tooltips_set_tip(GTK_TOOLTIPS(loglength_tooltip), loglength_entry,
2417                              _("0 to stop logging in the log window"),
2418                              NULL);
2419         gtk_box_pack_start (GTK_BOX (hbox_cliplog), loglength_label,
2420                             FALSE, TRUE, 0);
2421         SET_TOGGLE_SENSITIVITY(checkbtn_cliplog, loglength_entry);
2422
2423 #if 0
2424 #ifdef USE_OPENSSL
2425         /* SSL */
2426         PACK_FRAME (vbox1, frame_ssl, _("Security"));
2427
2428         vbox_ssl = gtk_vbox_new (FALSE, 0);
2429         gtk_widget_show (vbox_ssl);
2430         gtk_container_add (GTK_CONTAINER (frame_ssl), vbox_ssl);
2431         gtk_container_set_border_width (GTK_CONTAINER (vbox_ssl), 8);
2432         PACK_CHECK_BUTTON (vbox_ssl, checkbtn_ssl_ask_unknown_valid, 
2433                            _("Ask before accepting SSL certificates"));
2434         hbox_ssl = gtk_hbox_new (FALSE, 3);
2435         gtk_container_add (GTK_CONTAINER (vbox_ssl), hbox_ssl);
2436         gtk_widget_show (hbox_ssl);
2437 #endif
2438 #endif
2439         
2440         /* On Exit */
2441         PACK_FRAME (vbox1, frame_exit, _("On exit"));
2442
2443         vbox_exit = gtk_vbox_new (FALSE, 0);
2444         gtk_widget_show (vbox_exit);
2445         gtk_container_add (GTK_CONTAINER (frame_exit), vbox_exit);
2446         gtk_container_set_border_width (GTK_CONTAINER (vbox_exit), 8);
2447
2448         PACK_CHECK_BUTTON (vbox_exit, checkbtn_confonexit,
2449                            _("Confirm on exit"));
2450
2451         hbox1 = gtk_hbox_new (FALSE, 32);
2452         gtk_widget_show (hbox1);
2453         gtk_box_pack_start (GTK_BOX (vbox_exit), hbox1, FALSE, FALSE, 0);
2454
2455         PACK_CHECK_BUTTON (hbox1, checkbtn_cleanonexit,
2456                            _("Empty trash on exit"));
2457         PACK_CHECK_BUTTON (hbox1, checkbtn_askonclean,
2458                            _("Ask before emptying"));
2459         SET_TOGGLE_SENSITIVITY (checkbtn_cleanonexit, checkbtn_askonclean);
2460
2461         PACK_CHECK_BUTTON (vbox_exit, checkbtn_warnqueued,
2462                            _("Warn if there are queued messages"));
2463
2464         hbox1 = gtk_hbox_new (FALSE, 8);
2465         gtk_widget_show (hbox1);
2466         gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
2467
2468         label_iotimeout = gtk_label_new (_("Socket I/O timeout:"));
2469         gtk_widget_show (label_iotimeout);
2470         gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
2471
2472         spinbtn_iotimeout_adj = gtk_adjustment_new (60, 0, 1000, 1, 10, 10);
2473         spinbtn_iotimeout = gtk_spin_button_new
2474                 (GTK_ADJUSTMENT (spinbtn_iotimeout_adj), 1, 0);
2475         gtk_widget_show (spinbtn_iotimeout);
2476         gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_iotimeout,
2477                             FALSE, FALSE, 0);
2478         gtk_widget_set_usize (spinbtn_iotimeout, 64, -1);
2479         gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_iotimeout), TRUE);
2480
2481         label_iotimeout = gtk_label_new (_("seconds"));
2482         gtk_widget_show (label_iotimeout);
2483         gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
2484
2485         other.uri_combo = uri_combo;
2486         other.uri_entry = uri_entry;
2487         other.printcmd_entry = printcmd_entry;
2488
2489         other.exteditor_combo = exteditor_combo;
2490         other.exteditor_entry = exteditor_entry;
2491
2492         other.checkbtn_addaddrbyclick = checkbtn_addaddrbyclick;
2493         
2494         other.checkbtn_cliplog     = checkbtn_cliplog;
2495         other.loglength_entry      = loglength_entry;
2496
2497         other.checkbtn_confonexit  = checkbtn_confonexit;
2498         other.checkbtn_cleanonexit = checkbtn_cleanonexit;
2499         other.checkbtn_askonclean  = checkbtn_askonclean;
2500         other.checkbtn_warnqueued  = checkbtn_warnqueued;
2501
2502         other.spinbtn_iotimeout     = spinbtn_iotimeout;
2503         other.spinbtn_iotimeout_adj = spinbtn_iotimeout_adj;
2504         
2505 #if 0
2506 #ifdef USE_OPENSSL
2507         other.checkbtn_ssl_ask_unknown_valid = checkbtn_ssl_ask_unknown_valid;
2508 #endif
2509 #endif
2510 }
2511
2512 static void date_format_ok_btn_clicked(GtkButton *button, GtkWidget **widget)
2513 {
2514         GtkWidget *datefmt_sample = NULL;
2515         gchar *text;
2516
2517         g_return_if_fail(widget != NULL);
2518         g_return_if_fail(*widget != NULL);
2519         g_return_if_fail(display.entry_datefmt != NULL);
2520
2521         datefmt_sample = GTK_WIDGET(gtk_object_get_data
2522                                     (GTK_OBJECT(*widget), "datefmt_sample"));
2523         g_return_if_fail(datefmt_sample != NULL);
2524
2525         text = gtk_editable_get_chars(GTK_EDITABLE(datefmt_sample), 0, -1);
2526         g_free(prefs_common.date_format);
2527         prefs_common.date_format = text;
2528         gtk_entry_set_text(GTK_ENTRY(display.entry_datefmt), text);
2529
2530         gtk_widget_destroy(*widget);
2531         *widget = NULL;
2532 }
2533
2534 static void date_format_cancel_btn_clicked(GtkButton *button,
2535                                            GtkWidget **widget)
2536 {
2537         g_return_if_fail(widget != NULL);
2538         g_return_if_fail(*widget != NULL);
2539
2540         gtk_widget_destroy(*widget);
2541         *widget = NULL;
2542 }
2543
2544 static void date_format_key_pressed(GtkWidget *keywidget, GdkEventKey *event,
2545                                     GtkWidget **widget)
2546 {
2547         if (event && event->keyval == GDK_Escape)
2548                 date_format_cancel_btn_clicked(NULL, widget);
2549 }
2550
2551 static gboolean date_format_on_delete(GtkWidget *dialogwidget,
2552                                       GdkEventAny *event, GtkWidget **widget)
2553 {
2554         g_return_val_if_fail(widget != NULL, FALSE);
2555         g_return_val_if_fail(*widget != NULL, FALSE);
2556
2557         *widget = NULL;
2558         return FALSE;
2559 }
2560
2561 static void date_format_entry_on_change(GtkEditable *editable,
2562                                         GtkLabel *example)
2563 {
2564         time_t cur_time;
2565         struct tm *cal_time;
2566         gchar buffer[100];
2567         gchar *text;
2568
2569         cur_time = time(NULL);
2570         cal_time = localtime(&cur_time);
2571         buffer[0] = 0;
2572         text = gtk_editable_get_chars(editable, 0, -1);
2573         if (text)
2574                 strftime(buffer, sizeof buffer, text, cal_time); 
2575         g_free(text);
2576         gtk_label_set_text(example, buffer);
2577 }
2578
2579 static void date_format_select_row(GtkWidget *date_format_list, gint row,
2580                                    gint column, GdkEventButton *event,
2581                                    GtkWidget *date_format)
2582 {
2583         gint cur_pos;
2584         gchar *format;
2585         gchar *old_format;
2586         gchar *new_format;
2587         GtkWidget *datefmt_sample;
2588
2589         /* only on double click */
2590         if (!event || event->type != GDK_2BUTTON_PRESS) return;
2591
2592
2593         datefmt_sample = GTK_WIDGET(gtk_object_get_data
2594                                     (GTK_OBJECT(date_format), "datefmt_sample"));
2595
2596         g_return_if_fail(date_format_list != NULL);
2597         g_return_if_fail(date_format != NULL);
2598         g_return_if_fail(datefmt_sample != NULL);
2599
2600         /* get format from clist */
2601         gtk_clist_get_text(GTK_CLIST(date_format_list), row, 0, &format);
2602
2603         cur_pos = gtk_editable_get_position(GTK_EDITABLE(datefmt_sample));
2604         old_format = gtk_entry_get_text(GTK_ENTRY(datefmt_sample));
2605
2606         /* insert the format into the text entry */
2607         new_format = g_malloc(strlen(old_format) + 3);
2608
2609         strncpy(new_format, old_format, cur_pos);
2610         new_format[cur_pos] = '\0';
2611         strcat(new_format, format);
2612         strcat(new_format, &old_format[cur_pos]);
2613
2614         gtk_entry_set_text(GTK_ENTRY(datefmt_sample), new_format);
2615         gtk_editable_set_position(GTK_EDITABLE(datefmt_sample), cur_pos + 2);
2616
2617         g_free(new_format);
2618 }
2619
2620 static GtkWidget *date_format_create(GtkButton *button, void *data)
2621 {
2622         static GtkWidget *datefmt_win = NULL;
2623         GtkWidget *vbox1;
2624         GtkWidget *scrolledwindow1;
2625         GtkWidget *datefmt_clist;
2626         GtkWidget *table;
2627         GtkWidget *label1;
2628         GtkWidget *label2;
2629         GtkWidget *label3;
2630         GtkWidget *confirm_area;
2631         GtkWidget *ok_btn;
2632         GtkWidget *cancel_btn;
2633         GtkWidget *datefmt_entry;
2634
2635         struct {
2636                 gchar *fmt;
2637                 gchar *txt;
2638         } time_format[] = {
2639                 { "%a", NULL },
2640                 { "%A", NULL },
2641                 { "%b", NULL },
2642                 { "%B", NULL },
2643                 { "%c", NULL },
2644                 { "%C", NULL },
2645                 { "%d", NULL },
2646                 { "%H", NULL },
2647                 { "%I", NULL },
2648                 { "%j", NULL },
2649                 { "%m", NULL },
2650                 { "%M", NULL },
2651                 { "%p", NULL },
2652                 { "%S", NULL },
2653                 { "%w", NULL },
2654                 { "%x", NULL },
2655                 { "%y", NULL },
2656                 { "%Y", NULL },
2657                 { "%Z", NULL }
2658         };
2659
2660         gchar *titles[2];
2661         gint i;
2662         const gint TIME_FORMAT_ELEMS =
2663                 sizeof time_format / sizeof time_format[0];
2664
2665         time_format[0].txt  = _("the full abbreviated weekday name");
2666         time_format[1].txt  = _("the full weekday name");
2667         time_format[2].txt  = _("the abbreviated month name");
2668         time_format[3].txt  = _("the full month name");
2669         time_format[4].txt  = _("the preferred date and time for the current locale");
2670         time_format[5].txt  = _("the century number (year/100)");
2671         time_format[6].txt  = _("the day of the month as a decimal number");
2672         time_format[7].txt  = _("the hour as a decimal number using a 24-hour clock");
2673         time_format[8].txt  = _("the hour as a decimal number using a 12-hour clock");
2674         time_format[9].txt  = _("the day of the year as a decimal number");
2675         time_format[10].txt = _("the month as a decimal number");
2676         time_format[11].txt = _("the minute as a decimal number");
2677         time_format[12].txt = _("either AM or PM");
2678         time_format[13].txt = _("the second as a decimal number");
2679         time_format[14].txt = _("the day of the week as a decimal number");
2680         time_format[15].txt = _("the preferred date for the current locale");
2681         time_format[16].txt = _("the last two digits of a year");
2682         time_format[17].txt = _("the year as a decimal number");
2683         time_format[18].txt = _("the time zone or name or abbreviation");
2684
2685         if (datefmt_win) return datefmt_win;
2686
2687         datefmt_win = gtk_window_new(GTK_WINDOW_DIALOG);
2688         gtk_container_set_border_width(GTK_CONTAINER(datefmt_win), 8);
2689         gtk_window_set_title(GTK_WINDOW(datefmt_win), _("Date format"));
2690         gtk_window_set_position(GTK_WINDOW(datefmt_win), GTK_WIN_POS_CENTER);
2691         gtk_widget_set_usize(datefmt_win, 440, 280);
2692
2693         vbox1 = gtk_vbox_new(FALSE, 10);
2694         gtk_widget_show(vbox1);
2695         gtk_container_add(GTK_CONTAINER(datefmt_win), vbox1);
2696
2697         scrolledwindow1 = gtk_scrolled_window_new(NULL, NULL);
2698         gtk_scrolled_window_set_policy
2699                 (GTK_SCROLLED_WINDOW(scrolledwindow1),
2700                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
2701         gtk_widget_show(scrolledwindow1);
2702         gtk_box_pack_start(GTK_BOX(vbox1), scrolledwindow1, TRUE, TRUE, 0);
2703
2704         titles[0] = _("Specifier");
2705         titles[1] = _("Description");
2706         datefmt_clist = gtk_clist_new_with_titles(2, titles);
2707         gtk_widget_show(datefmt_clist);
2708         gtk_container_add(GTK_CONTAINER(scrolledwindow1), datefmt_clist);
2709         /* gtk_clist_set_column_width(GTK_CLIST(datefmt_clist), 0, 80); */
2710         gtk_clist_set_selection_mode(GTK_CLIST(datefmt_clist),
2711                                      GTK_SELECTION_BROWSE);
2712
2713         for (i = 0; i < TIME_FORMAT_ELEMS; i++) {
2714                 gchar *text[2];
2715                 /* phoney casting necessary because of gtk... */
2716                 text[0] = (gchar *)time_format[i].fmt;
2717                 text[1] = (gchar *)time_format[i].txt;
2718                 gtk_clist_append(GTK_CLIST(datefmt_clist), text);
2719         }
2720
2721         table = gtk_table_new(2, 2, FALSE);
2722         gtk_widget_show(table);
2723         gtk_box_pack_start(GTK_BOX(vbox1), table, FALSE, FALSE, 0);
2724         gtk_table_set_row_spacings(GTK_TABLE(table), 4);
2725         gtk_table_set_col_spacings(GTK_TABLE(table), 8);
2726
2727         label1 = gtk_label_new(_("Date format"));
2728         gtk_widget_show(label1);
2729         gtk_table_attach(GTK_TABLE(table), label1, 0, 1, 0, 1,
2730                          GTK_FILL, 0, 0, 0);
2731         gtk_label_set_justify(GTK_LABEL(label1), GTK_JUSTIFY_LEFT);
2732         gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5);
2733
2734         datefmt_entry = gtk_entry_new_with_max_length(256);
2735         gtk_widget_show(datefmt_entry);
2736         gtk_table_attach(GTK_TABLE(table), datefmt_entry, 1, 2, 0, 1,
2737                          (GTK_EXPAND | GTK_FILL), 0, 0, 0);
2738
2739         /* we need the "sample" entry box; add it as data so callbacks can
2740          * get the entry box */
2741         gtk_object_set_data(GTK_OBJECT(datefmt_win), "datefmt_sample",
2742                             datefmt_entry);
2743
2744         label2 = gtk_label_new(_("Example"));
2745         gtk_widget_show(label2);
2746         gtk_table_attach(GTK_TABLE(table), label2, 0, 1, 1, 2,
2747                          GTK_FILL, 0, 0, 0);
2748         gtk_label_set_justify(GTK_LABEL(label2), GTK_JUSTIFY_LEFT);
2749         gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5);
2750
2751         label3 = gtk_label_new("");
2752         gtk_widget_show(label3);
2753         gtk_table_attach(GTK_TABLE(table), label3, 1, 2, 1, 2,
2754                          (GTK_EXPAND | GTK_FILL), 0, 0, 0);
2755         gtk_label_set_justify(GTK_LABEL(label3), GTK_JUSTIFY_LEFT);
2756         gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5);
2757
2758         gtkut_button_set_create(&confirm_area, &ok_btn, _("OK"),
2759                                 &cancel_btn, _("Cancel"), NULL, NULL);
2760         gtk_widget_grab_default(ok_btn);
2761         gtk_widget_show(confirm_area);
2762
2763         gtk_box_pack_start(GTK_BOX(vbox1), confirm_area, FALSE, FALSE, 0);
2764
2765         /* set the current format */
2766         gtk_entry_set_text(GTK_ENTRY(datefmt_entry), prefs_common.date_format);
2767         date_format_entry_on_change(GTK_EDITABLE(datefmt_entry),
2768                                     GTK_LABEL(label3));
2769
2770         gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
2771                            GTK_SIGNAL_FUNC(date_format_ok_btn_clicked),
2772                            &datefmt_win);
2773         gtk_signal_connect(GTK_OBJECT(cancel_btn), "clicked",
2774                            GTK_SIGNAL_FUNC(date_format_cancel_btn_clicked),
2775                            &datefmt_win);
2776         gtk_signal_connect(GTK_OBJECT(datefmt_win), "key_press_event",
2777                            GTK_SIGNAL_FUNC(date_format_key_pressed),
2778                            &datefmt_win);
2779         gtk_signal_connect(GTK_OBJECT(datefmt_win), "delete_event",
2780                            GTK_SIGNAL_FUNC(date_format_on_delete),
2781                            &datefmt_win);
2782         gtk_signal_connect(GTK_OBJECT(datefmt_entry), "changed",
2783                            GTK_SIGNAL_FUNC(date_format_entry_on_change),
2784                            label3);
2785
2786         gtk_signal_connect(GTK_OBJECT(datefmt_clist), "select_row",
2787                            GTK_SIGNAL_FUNC(date_format_select_row),
2788                            datefmt_win);
2789
2790         gtk_window_set_position(GTK_WINDOW(datefmt_win), GTK_WIN_POS_CENTER);
2791         gtk_window_set_modal(GTK_WINDOW(datefmt_win), TRUE);
2792
2793         gtk_widget_show(datefmt_win);
2794         manage_window_set_transient(GTK_WINDOW(datefmt_win));
2795
2796         gtk_widget_grab_focus(ok_btn);
2797
2798         return datefmt_win;
2799 }
2800
2801 void prefs_quote_colors_dialog(void)
2802 {
2803         if (!quote_color_win)
2804                 prefs_quote_colors_dialog_create();
2805         gtk_widget_show(quote_color_win);
2806         manage_window_set_transient(GTK_WINDOW(quote_color_win));
2807
2808         gtk_main();
2809         gtk_widget_hide(quote_color_win);
2810
2811         textview_update_message_colors();
2812         main_window_reflect_prefs_all();
2813 }
2814
2815 static void prefs_quote_colors_dialog_create(void)
2816 {
2817         GtkWidget *window;
2818         GtkWidget *vbox;
2819         GtkWidget *table;
2820         GtkWidget *quotelevel1_label;
2821         GtkWidget *quotelevel2_label;
2822         GtkWidget *quotelevel3_label;
2823         GtkWidget *uri_label;
2824         GtkWidget *signature_label;
2825         GtkWidget *tgt_folder_label;
2826         GtkWidget *hbbox;
2827         GtkWidget *ok_btn;
2828         GtkWidget *recycle_colors_btn;
2829         GtkWidget *frame_colors;
2830
2831         window = gtk_window_new(GTK_WINDOW_DIALOG);
2832         gtk_container_set_border_width(GTK_CONTAINER(window), 2);
2833         gtk_window_set_title(GTK_WINDOW(window), _("Set message colors"));
2834         gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
2835         gtk_window_set_modal(GTK_WINDOW(window), TRUE);
2836         gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
2837
2838         vbox = gtk_vbox_new (FALSE, VSPACING);
2839         gtk_container_add (GTK_CONTAINER (window), vbox);
2840         gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
2841         PACK_FRAME(vbox, frame_colors, _("Colors"));
2842
2843         table = gtk_table_new (5, 2, FALSE);
2844         gtk_container_add (GTK_CONTAINER (frame_colors), table);
2845         gtk_container_set_border_width (GTK_CONTAINER (table), 8);
2846         gtk_table_set_row_spacings (GTK_TABLE (table), 2);
2847         gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2848
2849
2850         color_buttons.quote_level1_btn = gtk_button_new();
2851         gtk_table_attach (GTK_TABLE (table), color_buttons.quote_level1_btn,
2852                           0, 1, 0, 1, 0, 0, 0, 0);
2853         gtk_widget_set_usize (color_buttons.quote_level1_btn, 40, 30);
2854         gtk_container_set_border_width
2855                 (GTK_CONTAINER (color_buttons.quote_level1_btn), 5);
2856
2857         color_buttons.quote_level2_btn = gtk_button_new();
2858         gtk_table_attach (GTK_TABLE (table), color_buttons.quote_level2_btn,
2859                           0, 1, 1, 2, 0, 0, 0, 0);
2860         gtk_widget_set_usize (color_buttons.quote_level2_btn, 40, 30);
2861         gtk_container_set_border_width (GTK_CONTAINER (color_buttons.quote_level2_btn), 5);
2862
2863         color_buttons.quote_level3_btn = gtk_button_new_with_label ("");
2864         gtk_table_attach (GTK_TABLE (table), color_buttons.quote_level3_btn,
2865                           0, 1, 2, 3, 0, 0, 0, 0);
2866         gtk_widget_set_usize (color_buttons.quote_level3_btn, 40, 30);
2867         gtk_container_set_border_width
2868                 (GTK_CONTAINER (color_buttons.quote_level3_btn), 5);
2869
2870         color_buttons.uri_btn = gtk_button_new_with_label ("");
2871         gtk_table_attach (GTK_TABLE (table), color_buttons.uri_btn,
2872                           0, 1, 3, 4, 0, 0, 0, 0);
2873         gtk_widget_set_usize (color_buttons.uri_btn, 40, 30);
2874         gtk_container_set_border_width (GTK_CONTAINER (color_buttons.uri_btn), 5);
2875
2876         color_buttons.tgt_folder_btn = gtk_button_new_with_label ("");
2877         gtk_table_attach (GTK_TABLE (table), color_buttons.tgt_folder_btn,
2878                           0, 1, 4, 5, 0, 0, 0, 0);
2879         gtk_widget_set_usize (color_buttons.tgt_folder_btn, 40, 30);
2880         gtk_container_set_border_width (GTK_CONTAINER (color_buttons.tgt_folder_btn), 5);
2881
2882         color_buttons.signature_btn = gtk_button_new_with_label ("");
2883         gtk_table_attach (GTK_TABLE (table), color_buttons.signature_btn,
2884                           0, 1, 5, 6, 0, 0, 0, 0);
2885         gtk_widget_set_usize (color_buttons.signature_btn, 40, 30);
2886         gtk_container_set_border_width (GTK_CONTAINER (color_buttons.signature_btn), 5);
2887
2888         quotelevel1_label = gtk_label_new (_("Quoted Text - First Level"));
2889         gtk_table_attach (GTK_TABLE (table), quotelevel1_label, 1, 2, 0, 1,
2890                           (GTK_EXPAND | GTK_FILL), 0, 0, 0);
2891         gtk_label_set_justify (GTK_LABEL (quotelevel1_label), GTK_JUSTIFY_LEFT);
2892         gtk_misc_set_alignment (GTK_MISC (quotelevel1_label), 0, 0.5);
2893
2894         quotelevel2_label = gtk_label_new (_("Quoted Text - Second Level"));
2895         gtk_table_attach (GTK_TABLE (table), quotelevel2_label, 1, 2, 1, 2,
2896                           (GTK_EXPAND | GTK_FILL), 0, 0, 0);
2897         gtk_label_set_justify (GTK_LABEL (quotelevel2_label), GTK_JUSTIFY_LEFT);
2898         gtk_misc_set_alignment (GTK_MISC (quotelevel2_label), 0, 0.5);
2899
2900         quotelevel3_label = gtk_label_new (_("Quoted Text - Third Level"));
2901         gtk_table_attach (GTK_TABLE (table), quotelevel3_label, 1, 2, 2, 3,
2902                           (GTK_EXPAND | GTK_FILL), 0, 0, 0);
2903         gtk_label_set_justify (GTK_LABEL (quotelevel3_label), GTK_JUSTIFY_LEFT);
2904         gtk_misc_set_alignment (GTK_MISC (quotelevel3_label), 0, 0.5);
2905
2906         uri_label = gtk_label_new (_("URI link"));
2907         gtk_table_attach (GTK_TABLE (table), uri_label, 1, 2, 3, 4,
2908                           (GTK_EXPAND | GTK_FILL), 0, 0, 0);
2909         gtk_label_set_justify (GTK_LABEL (uri_label), GTK_JUSTIFY_LEFT);
2910         gtk_misc_set_alignment (GTK_MISC (uri_label), 0, 0.5);
2911
2912         tgt_folder_label = gtk_label_new (_("Target folder"));
2913         gtk_table_attach (GTK_TABLE (table), tgt_folder_label, 1, 2, 4, 5,
2914                           (GTK_EXPAND | GTK_FILL), 0, 0, 0);
2915         gtk_label_set_justify (GTK_LABEL (tgt_folder_label), GTK_JUSTIFY_LEFT);
2916         gtk_misc_set_alignment (GTK_MISC (tgt_folder_label), 0, 0.5);
2917
2918         signature_label = gtk_label_new (_("Signatures"));
2919         gtk_table_attach (GTK_TABLE (table), signature_label, 1, 2, 5, 6,
2920                           (GTK_EXPAND | GTK_FILL), 0, 0, 0);
2921         gtk_label_set_justify (GTK_LABEL (signature_label), GTK_JUSTIFY_LEFT);
2922         gtk_misc_set_alignment (GTK_MISC (signature_label), 0, 0.5);
2923
2924         PACK_CHECK_BUTTON (vbox, recycle_colors_btn,
2925                            _("Recycle quote colors"));
2926
2927         gtkut_button_set_create(&hbbox, &ok_btn, _("OK"),
2928                                 NULL, NULL, NULL, NULL);
2929         gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0);
2930
2931         gtk_widget_grab_default(ok_btn);
2932         MANAGE_WINDOW_SIGNALS_CONNECT(window);
2933         gtk_signal_connect(GTK_OBJECT(window), "delete_event",
2934                            GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
2935         gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
2936                            GTK_SIGNAL_FUNC(prefs_quote_colors_key_pressed),
2937                            NULL);
2938
2939         gtk_signal_connect(GTK_OBJECT(color_buttons.quote_level1_btn), "clicked",
2940                            GTK_SIGNAL_FUNC(quote_color_set_dialog), "LEVEL1");
2941         gtk_signal_connect(GTK_OBJECT(color_buttons.quote_level2_btn), "clicked",
2942                            GTK_SIGNAL_FUNC(quote_color_set_dialog), "LEVEL2");
2943         gtk_signal_connect(GTK_OBJECT(color_buttons.quote_level3_btn), "clicked",
2944                            GTK_SIGNAL_FUNC(quote_color_set_dialog), "LEVEL3");
2945         gtk_signal_connect(GTK_OBJECT(color_buttons.uri_btn), "clicked",
2946                            GTK_SIGNAL_FUNC(quote_color_set_dialog), "URI");
2947         gtk_signal_connect(GTK_OBJECT(color_buttons.tgt_folder_btn), "clicked",
2948                            GTK_SIGNAL_FUNC(quote_color_set_dialog), "TGTFLD");
2949         gtk_signal_connect(GTK_OBJECT(color_buttons.signature_btn), "clicked",
2950                            GTK_SIGNAL_FUNC(quote_color_set_dialog), "SIGNATURE");
2951         gtk_signal_connect(GTK_OBJECT(recycle_colors_btn), "toggled",
2952                            GTK_SIGNAL_FUNC(prefs_recycle_colors_toggled), NULL);
2953         gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
2954                            GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
2955
2956         /* show message button colors and recycle options */
2957         set_button_bg_color(color_buttons.quote_level1_btn,
2958                             prefs_common.quote_level1_col);
2959         set_button_bg_color(color_buttons.quote_level2_btn,
2960                             prefs_common.quote_level2_col);
2961         set_button_bg_color(color_buttons.quote_level3_btn,
2962                             prefs_common.quote_level3_col);
2963         set_button_bg_color(color_buttons.uri_btn,
2964                             prefs_common.uri_col);
2965         set_button_bg_color(color_buttons.tgt_folder_btn,
2966                             prefs_common.tgt_folder_col);
2967         set_button_bg_color(color_buttons.signature_btn,
2968                             prefs_common.signature_col);
2969         gtk_toggle_button_set_active((GtkToggleButton *)recycle_colors_btn,
2970                                      prefs_common.recycle_quote_colors);
2971
2972         gtk_widget_show_all(vbox);
2973         quote_color_win = window;
2974 }
2975
2976 static void prefs_quote_colors_key_pressed(GtkWidget *widget,
2977                                            GdkEventKey *event, gpointer data)
2978 {
2979         if (event && event->keyval == GDK_Escape)
2980                 gtk_main_quit();
2981 }
2982
2983 static void quote_color_set_dialog(GtkWidget *widget, gpointer data)
2984 {
2985         gchar *type = (gchar *)data;
2986         gchar *title = NULL;
2987         gdouble color[4] = {0.0, 0.0, 0.0, 0.0};
2988         gint rgbvalue = 0;
2989         GtkColorSelectionDialog *dialog;
2990
2991         if(g_strcasecmp(type, "LEVEL1") == 0) {
2992                 title = _("Pick color for quotation level 1");
2993                 rgbvalue = prefs_common.quote_level1_col;
2994         } else if(g_strcasecmp(type, "LEVEL2") == 0) {
2995                 title = _("Pick color for quotation level 2");
2996                 rgbvalue = prefs_common.quote_level2_col;
2997         } else if(g_strcasecmp(type, "LEVEL3") == 0) {
2998                 title = _("Pick color for quotation level 3");
2999                 rgbvalue = prefs_common.quote_level3_col;
3000         } else if(g_strcasecmp(type, "URI") == 0) {
3001                 title = _("Pick color for URI");
3002                 rgbvalue = prefs_common.uri_col;
3003         } else if(g_strcasecmp(type, "TGTFLD") == 0) {
3004                 title = _("Pick color for target folder");
3005                 rgbvalue = prefs_common.tgt_folder_col;
3006         } else if(g_strcasecmp(type, "SIGNATURE") == 0) {
3007                 title = _("Pick color for signatures");
3008                 rgbvalue = prefs_common.signature_col;
3009         } else {   /* Should never be called */
3010                 g_warning("Unrecognized datatype '%s' in quote_color_set_dialog\n", type);
3011                 return;
3012         }
3013
3014         color_dialog = gtk_color_selection_dialog_new(title);
3015         gtk_window_set_position(GTK_WINDOW(color_dialog), GTK_WIN_POS_CENTER);
3016         gtk_window_set_modal(GTK_WINDOW(color_dialog), TRUE);
3017         gtk_window_set_policy(GTK_WINDOW(color_dialog), FALSE, FALSE, FALSE);
3018         manage_window_set_transient(GTK_WINDOW(color_dialog));
3019
3020         gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(color_dialog)->ok_button),
3021                            "clicked", GTK_SIGNAL_FUNC(quote_colors_set_dialog_ok), data);
3022         gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(color_dialog)->cancel_button),
3023                            "clicked", GTK_SIGNAL_FUNC(quote_colors_set_dialog_cancel), data);
3024         gtk_signal_connect(GTK_OBJECT(color_dialog), "key_press_event",
3025                            GTK_SIGNAL_FUNC(quote_colors_set_dialog_key_pressed),
3026                            data);
3027
3028         /* preselect the previous color in the color selection dialog */
3029         color[0] = (gdouble) ((rgbvalue & 0xff0000) >> 16) / 255.0;
3030         color[1] = (gdouble) ((rgbvalue & 0x00ff00) >>  8) / 255.0;
3031         color[2] = (gdouble)  (rgbvalue & 0x0000ff)        / 255.0;
3032         dialog = GTK_COLOR_SELECTION_DIALOG(color_dialog);
3033         gtk_color_selection_set_color
3034                 (GTK_COLOR_SELECTION(dialog->colorsel), color);
3035
3036         gtk_widget_show(color_dialog);
3037 }
3038
3039 static void quote_colors_set_dialog_ok(GtkWidget *widget, gpointer data)
3040 {
3041         GtkColorSelection *colorsel = (GtkColorSelection *)
3042                                                 ((GtkColorSelectionDialog *)color_dialog)->colorsel;
3043         gdouble color[4];
3044         gint red, green, blue, rgbvalue;
3045         gchar *type = (gchar *)data;
3046
3047         gtk_color_selection_get_color(colorsel, color);
3048
3049         red      = (gint) (color[0] * 255.0);
3050         green    = (gint) (color[1] * 255.0);
3051         blue     = (gint) (color[2] * 255.0);
3052         rgbvalue = (gint) ((red * 0x10000) | (green * 0x100) | blue);
3053
3054 #if 0
3055         fprintf(stderr, "redc = %f, greenc = %f, bluec = %f\n", color[0], color[1], color[2]);
3056         fprintf(stderr, "red = %d, green = %d, blue = %d\n", red, green, blue);
3057         fprintf(stderr, "Color is %x\n", rgbvalue);
3058 #endif
3059
3060         if (g_strcasecmp(type, "LEVEL1") == 0) {
3061                 prefs_common.quote_level1_col = rgbvalue;
3062                 set_button_bg_color(color_buttons.quote_level1_btn, rgbvalue);
3063         } else if (g_strcasecmp(type, "LEVEL2") == 0) {
3064                 prefs_common.quote_level2_col = rgbvalue;
3065                 set_button_bg_color(color_buttons.quote_level2_btn, rgbvalue);
3066         } else if (g_strcasecmp(type, "LEVEL3") == 0) {
3067                 prefs_common.quote_level3_col = rgbvalue;
3068                 set_button_bg_color(color_buttons.quote_level3_btn, rgbvalue);
3069         } else if (g_strcasecmp(type, "URI") == 0) {
3070                 prefs_common.uri_col = rgbvalue;
3071                 set_button_bg_color(color_buttons.uri_btn, rgbvalue);
3072         } else if (g_strcasecmp(type, "TGTFLD") == 0) {
3073                 prefs_common.tgt_folder_col = rgbvalue;
3074                 set_button_bg_color(color_buttons.tgt_folder_btn, rgbvalue);
3075                 folderview_set_target_folder_color(prefs_common.tgt_folder_col);
3076         } else if (g_strcasecmp(type, "SIGNATURE") == 0) {
3077                 prefs_common.signature_col = rgbvalue;
3078                 set_button_bg_color(color_buttons.signature_btn, rgbvalue);
3079         } else
3080                 fprintf( stderr, "Unrecognized datatype '%s' in quote_color_set_dialog_ok\n", type );
3081
3082         gtk_widget_destroy(color_dialog);
3083 }
3084
3085 static void quote_colors_set_dialog_cancel(GtkWidget *widget, gpointer data)
3086 {
3087         gtk_widget_destroy(color_dialog);
3088 }
3089
3090 static void quote_colors_set_dialog_key_pressed(GtkWidget *widget,
3091                                                 GdkEventKey *event,
3092                                                 gpointer data)
3093 {
3094         gtk_widget_destroy(color_dialog);
3095 }
3096
3097 static void set_button_bg_color(GtkWidget *widget, gint rgbvalue)
3098 {
3099         GtkStyle *newstyle;
3100         GdkColor color;
3101
3102         gtkut_convert_int_to_gdk_color(rgbvalue, &color);
3103         newstyle = gtk_style_copy(gtk_widget_get_default_style());
3104         newstyle->bg[GTK_STATE_NORMAL]   = color;
3105         newstyle->bg[GTK_STATE_PRELIGHT] = color;
3106         newstyle->bg[GTK_STATE_ACTIVE]   = color;
3107
3108         gtk_widget_set_style(GTK_WIDGET(widget), newstyle);
3109 }
3110
3111 static void prefs_enable_message_color_toggled(void)
3112 {
3113         gboolean is_active;
3114
3115         is_active = gtk_toggle_button_get_active
3116                 (GTK_TOGGLE_BUTTON(message.chkbtn_enablecol));
3117         gtk_widget_set_sensitive(message.button_edit_col, is_active);
3118         prefs_common.enable_color = is_active;
3119 }
3120
3121 static void prefs_recycle_colors_toggled(GtkWidget *widget)
3122 {
3123         gboolean is_active;
3124
3125         is_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
3126         prefs_common.recycle_quote_colors = is_active;
3127 }
3128
3129 static void prefs_keybind_select(void)
3130 {
3131         GtkWidget *window;
3132         GtkWidget *vbox1;
3133         GtkWidget *hbox1;
3134         GtkWidget *label;
3135         GtkWidget *combo;
3136         GtkWidget *confirm_area;
3137         GtkWidget *ok_btn;
3138         GtkWidget *cancel_btn;
3139
3140         window = gtk_window_new (GTK_WINDOW_DIALOG);
3141         gtk_container_set_border_width (GTK_CONTAINER (window), 8);
3142         gtk_window_set_title (GTK_WINDOW (window), _("Key bindings"));
3143         gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
3144         gtk_window_set_modal (GTK_WINDOW (window), TRUE);
3145         gtk_window_set_policy (GTK_WINDOW (window), FALSE, FALSE, FALSE);
3146         manage_window_set_transient (GTK_WINDOW (window));
3147
3148         vbox1 = gtk_vbox_new (FALSE, VSPACING);
3149         gtk_container_add (GTK_CONTAINER (window), vbox1);
3150         gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2);
3151
3152         hbox1 = gtk_hbox_new (FALSE, 8);
3153         gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
3154
3155         label = gtk_label_new
3156                 (_("Select preset:"));
3157         gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
3158         gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
3159
3160         hbox1 = gtk_hbox_new (FALSE, 8);
3161         gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
3162
3163         combo = gtk_combo_new ();
3164         gtk_box_pack_start (GTK_BOX (hbox1), combo, TRUE, TRUE, 0);
3165         gtkut_combo_set_items (GTK_COMBO (combo),
3166                                _("Default"),
3167                                "Mew / Wanderlust",
3168                                "Mutt",
3169                                _("Old Sylpheed"),
3170                                NULL);
3171         gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
3172
3173         hbox1 = gtk_hbox_new (FALSE, 8);
3174         gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
3175
3176         label = gtk_label_new
3177                 (_("You can also modify each menu shortcut by pressing\n"
3178                    "any key(s) when placing the mouse pointer on the item."));
3179         gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
3180         gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
3181
3182         hbox1 = gtk_hbox_new (FALSE, 8);
3183         gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
3184
3185         gtkut_button_set_create (&confirm_area, &ok_btn, _("OK"),
3186                                  &cancel_btn, _("Cancel"), NULL, NULL);
3187         gtk_box_pack_end (GTK_BOX (hbox1), confirm_area, FALSE, FALSE, 0);
3188         gtk_widget_grab_default (ok_btn);
3189
3190         MANAGE_WINDOW_SIGNALS_CONNECT(window);
3191         gtk_signal_connect (GTK_OBJECT (window), "delete_event",
3192                             GTK_SIGNAL_FUNC (prefs_keybind_deleted), NULL);
3193         gtk_signal_connect (GTK_OBJECT (window), "key_press_event",
3194                             GTK_SIGNAL_FUNC (prefs_keybind_key_pressed), NULL);
3195         gtk_signal_connect (GTK_OBJECT (ok_btn), "clicked",
3196                             GTK_SIGNAL_FUNC (prefs_keybind_apply_clicked),
3197                             NULL);
3198         gtk_signal_connect (GTK_OBJECT (cancel_btn), "clicked",
3199                             GTK_SIGNAL_FUNC (prefs_keybind_cancel),
3200                             NULL);
3201
3202         gtk_widget_show_all(window);
3203
3204         keybind.window = window;
3205         keybind.combo = combo;
3206 }
3207
3208 static void prefs_keybind_key_pressed(GtkWidget *widget, GdkEventKey *event,
3209                                       gpointer data)
3210 {
3211         if (event && event->keyval == GDK_Escape)
3212                 prefs_keybind_cancel();
3213 }
3214
3215 static gint prefs_keybind_deleted(GtkWidget *widget, GdkEventAny *event,
3216                                   gpointer data)
3217 {
3218         prefs_keybind_cancel();
3219         return TRUE;
3220 }
3221
3222 static void prefs_keybind_cancel(void)
3223 {
3224         gtk_widget_destroy(keybind.window);
3225         keybind.window = NULL;
3226         keybind.combo = NULL;
3227 }
3228
3229 static void prefs_keybind_apply_clicked(GtkWidget *widget)
3230 {
3231         GtkEntry *entry = GTK_ENTRY(GTK_COMBO(keybind.combo)->entry);
3232         gchar *text;
3233         gchar *rc_str;
3234
3235         static gchar *default_menurc =
3236                 "(menu-path \"<Main>/File/Empty trash\" \"\")\n"
3237                 "(menu-path \"<Main>/File/Save as...\" \"<control>S\")\n"
3238                 "(menu-path \"<Main>/File/Print...\" \"\")\n"
3239                 "(menu-path \"<Main>/File/Exit\" \"<control>Q\")\n"
3240
3241                 "(menu-path \"<Main>/Edit/Copy\" \"<control>C\")\n"
3242                 "(menu-path \"<Main>/Edit/Select all\" \"<control>A\")\n"
3243                 "(menu-path \"<Main>/Edit/Find in current message...\" \"<control>F\")\n"
3244                 "(menu-path \"<Main>/Edit/Search folder...\" \"<shift><control>F\")\n"
3245
3246                 "(menu-path \"<Main>/View/Expand Summary View\" \"V\")\n"
3247                 "(menu-path \"<Main>/View/Expand Message View\" \"<shift>V\")\n"
3248                 "(menu-path \"<Main>/View/Thread view\" \"<control>T\")\n"
3249                 "(menu-path \"<Main>/View/Go to/Prev message\" \"P\")\n"
3250                 "(menu-path \"<Main>/View/Go to/Next message\" \"N\")\n"
3251                 "(menu-path \"<Main>/View/Go to/Prev unread message\" \"<shift>P\")\n"
3252                 "(menu-path \"<Main>/View/Go to/Next unread message\" \"<shift>N\")\n"
3253                 "(menu-path \"<Main>/View/Go to/Other folder...\" \"G\")\n"
3254                 "(menu-path \"<Main>/View/Open in new window\" \"<control><alt>N\")\n"
3255                 "(menu-path \"<Main>/View/View source\" \"<control>U\")\n"
3256                 "(menu-path \"<Main>/View/Show all headers\" \"<control>H\")\n"
3257                 "(menu-path \"<Main>/View/Update\" \"<control><alt>U\")\n"
3258
3259                 "(menu-path \"<Main>/Message/Get new mail\" \"<control>I\")\n"
3260                 "(menu-path \"<Main>/Message/Get from all accounts\" \"<shift><control>I\")\n"
3261                 "(menu-path \"<Main>/Message/Compose an email message\" \"<control>M\")\n"
3262                 "(menu-path \"<Main>/Message/Reply\" \"<control>R\")\n"
3263                 "(menu-path \"<Main>/Message/Reply to/all\" \"<shift><control>R\")\n"
3264                 "(menu-path \"<Main>/Message/Reply to/sender\" \"\")\n"
3265                 "(menu-path \"<Main>/Message/Reply to/mailing list\" \"<control>L\")\n"
3266                 "(menu-path \"<Main>/Message/Forward\" \"<control><alt>F\")\n"
3267                 /* "(menu-path \"<Main>/Message/Forward as attachment\" \"\")\n" */
3268                 "(menu-path \"<Main>/Message/Move...\" \"<control>O\")\n"
3269                 "(menu-path \"<Main>/Message/Copy...\" \"<shift><control>O\")\n"
3270                 "(menu-path \"<Main>/Message/Delete\" \"<control>D\")\n"
3271                 "(menu-path \"<Main>/Message/Mark/Mark\" \"<shift>asterisk\")\n"
3272                 "(menu-path \"<Main>/Message/Mark/Unmark\" \"U\")\n"
3273                 "(menu-path \"<Main>/Message/Mark/Mark as unread\" \"<shift>exclam\")\n"
3274                 "(menu-path \"<Main>/Message/Mark/Mark as read\" \"\")\n"
3275
3276                 "(menu-path \"<Main>/Tools/Address book\" \"<shift><control>A\")\n"
3277                 "(menu-path \"<Main>/Tools/Execute\" \"X\")\n"
3278                 "(menu-path \"<Main>/Tools/Log window\" \"<shift><control>L\")\n"
3279
3280                 "(menu-path \"<Compose>/File/Close\" \"<control>W\")\n"
3281                 "(menu-path \"<Compose>/Edit/Select all\" \"<control>A\")\n"
3282                 "(menu-path \"<Compose>/Edit/Advanced/Move a word backward\" \"\")\n"
3283                 "(menu-path \"<Compose>/Edit/Advanced/Move a word forward\" \"\")\n"
3284                 "(menu-path \"<Compose>/Edit/Advanced/Move to beginning of line\" \"\")\n"
3285                 "(menu-path \"<Compose>/Edit/Advanced/Delete a word backward\" \"\")\n"
3286                 "(menu-path \"<Compose>/Edit/Advanced/Delete a word forward\" \"\")";
3287
3288         static gchar *mew_wl_menurc =
3289                 "(menu-path \"<Main>/File/Empty trash\" \"<shift>D\")\n"
3290                 "(menu-path \"<Main>/File/Save as...\" \"Y\")\n"
3291                 "(menu-path \"<Main>/File/Print...\" \"<shift>numbersign\")\n"
3292                 "(menu-path \"<Main>/File/Exit\" \"<shift>Q\")\n"
3293
3294                 "(menu-path \"<Main>/Edit/Copy\" \"<control>C\")\n"
3295                 "(menu-path \"<Main>/Edit/Select all\" \"<control>A\")\n"
3296                 "(menu-path \"<Main>/Edit/Find in current message...\" \"<control>F\")\n"
3297                 "(menu-path \"<Main>/Edit/Search folder...\" \"<control>S\")\n"
3298
3299                 "(menu-path \"<Main>/View/Expand Summary View\" \"\")\n"
3300                 "(menu-path \"<Main>/View/Expand Message View\" \"\")\n"
3301                 "(menu-path \"<Main>/View/Thread view\" \"<shift>T\")\n"
3302                 "(menu-path \"<Main>/View/Go to/Prev message\" \"P\")\n"
3303                 "(menu-path \"<Main>/View/Go to/Next message\" \"N\")\n"
3304                 "(menu-path \"<Main>/View/Go to/Prev unread message\" \"<shift>P\")\n"
3305                 "(menu-path \"<Main>/View/Go to/Next unread message\" \"<shift>N\")\n"
3306                 "(menu-path \"<Main>/View/Go to/Other folder...\" \"G\")\n"
3307                 "(menu-path \"<Main>/View/Open in new window\" \"<control><alt>N\")\n"
3308                 "(menu-path \"<Main>/View/View source\" \"<control>U\")\n"
3309                 "(menu-path \"<Main>/View/Show all headers\" \"<shift>H\")\n"
3310                 "(menu-path \"<Main>/View/Update\" \"<shift>S\")\n"
3311
3312                 "(menu-path \"<Main>/Message/Get new mail\" \"<control>I\")\n"
3313                 "(menu-path \"<Main>/Message/Get from all accounts\" \"<shift><control>I\")\n"
3314                 "(menu-path \"<Main>/Message/Compose an email message\" \"W\")\n"
3315                 "(menu-path \"<Main>/Message/Reply\" \"<control>R\")\n"
3316                 "(menu-path \"<Main>/Message/Reply to/all\" \"<shift>A\")\n"
3317                 "(menu-path \"<Main>/Message/Reply to/sender\" \"\")\n"
3318                 "(menu-path \"<Main>/Message/Reply to/mailing list\" \"<control>L\")\n"
3319                 "(menu-path \"<Main>/Message/Forward\" \"F\")\n"
3320                 /* "(menu-path \"<Main>/Message/Forward as attachment\" \"<shift>F\")\n" */
3321                 "(menu-path \"<Main>/Message/Move...\" \"O\")\n"
3322                 "(menu-path \"<Main>/Message/Copy...\" \"<shift>O\")\n"
3323                 "(menu-path \"<Main>/Message/Delete\" \"D\")\n"
3324                 "(menu-path \"<Main>/Message/Mark/Mark\" \"<shift>asterisk\")\n"
3325                 "(menu-path \"<Main>/Message/Mark/Unmark\" \"U\")\n"
3326                 "(menu-path \"<Main>/Message/Mark/Mark as unread\" \"<shift>exclam\")\n"
3327                 "(menu-path \"<Main>/Message/Mark/Mark as read\" \"<shift>R\")\n"
3328
3329                 "(menu-path \"<Main>/Tools/Address book\" \"<shift><control>A\")\n"
3330                 "(menu-path \"<Main>/Tools/Execute\" \"X\")\n"
3331                 "(menu-path \"<Main>/Tools/Log window\" \"<shift><control>L\")\n"
3332
3333                 "(menu-path \"<Compose>/File/Close\" \"<alt>W\")\n"
3334                 "(menu-path \"<Compose>/Edit/Select all\" \"\")\n"
3335                 "(menu-path \"<Compose>/Edit/Advanced/Move a word backward\" \"<alt>B\")\n"
3336                 "(menu-path \"<Compose>/Edit/Advanced/Move a word forward\" \"<alt>F\")\n"
3337                 "(menu-path \"<Compose>/Edit/Advanced/Move to beginning of line\" \"<control>A\")\n"
3338                 "(menu-path \"<Compose>/Edit/Advanced/Delete a word backward\" \"<control>W\")\n"
3339                 "(menu-path \"<Compose>/Edit/Advanced/Delete a word forward\" \"<alt>D\")";
3340
3341         static gchar *mutt_menurc =
3342                 "(menu-path \"<Main>/File/Empty trash\" \"\")\n"
3343                 "(menu-path \"<Main>/File/Save as...\" \"S\")\n"
3344                 "(menu-path \"<Main>/File/Print...\" \"P\")\n"
3345                 "(menu-path \"<Main>/File/Exit\" \"Q\")\n"
3346
3347                 "(menu-path \"<Main>/Edit/Copy\" \"<control>C\")\n"
3348                 "(menu-path \"<Main>/Edit/Select all\" \"<control>A\")\n"
3349                 "(menu-path \"<Main>/Edit/Find in current message...\" \"<control>F\")\n"
3350                 "(menu-path \"<Main>/Edit/Search messages...\" \"slash\")\n"
3351
3352                 "(menu-path \"<Main>/View/Toggle summary view\" \"V\")\n"
3353                 "(menu-path \"<Main>/View/Thread view\" \"<control>T\")\n"
3354                 "(menu-path \"<Main>/View/Go to/Prev message\" \"\")\n"
3355                 "(menu-path \"<Main>/View/Go to/Next message\" \"\")\n"
3356                 "(menu-path \"<Main>/View/Go to/Prev unread message\" \"\")\n"
3357                 "(menu-path \"<Main>/View/Go to/Next unread message\" \"\")\n"
3358                 "(menu-path \"<Main>/View/Go to/Other folder...\" \"C\")\n"
3359                 "(menu-path \"<Main>/View/Open in new window\" \"<control><alt>N\")\n"
3360                 "(menu-path \"<Main>/View/View source\" \"<control>U\")\n"
3361                 "(menu-path \"<Main>/View/Show all headers\" \"<control>H\")\n"
3362                 "(menu-path \"<Main>/View/Update\" \"<control><alt>U\")\n"
3363
3364                 "(menu-path \"<Main>/Message/Get new mail\" \"<control>I\")\n"
3365                 "(menu-path \"<Main>/Message/Get from all accounts\" \"<shift><control>I\")\n"
3366                 "(menu-path \"<Main>/Message/Compose new message\" \"M\")\n"
3367                 "(menu-path \"<Main>/Message/Reply\" \"R\")\n"
3368                 "(menu-path \"<Main>/Message/Reply to/all\" \"G\")\n"
3369                 "(menu-path \"<Main>/Message/Reply to/sender\" \"\")\n"
3370                 "(menu-path \"<Main>/Message/Reply to/mailing list\" \"<control>L\")\n"
3371                 "(menu-path \"<Main>/Message/Forward\" \"F\")\n"
3372                 "(menu-path \"<Main>/Message/Forward as attachment\" \"\")\n"
3373                 "(menu-path \"<Main>/Message/Move...\" \"<control>O\")\n"
3374                 "(menu-path \"<Main>/Message/Copy...\" \"<shift>C\")\n"
3375                 "(menu-path \"<Main>/Message/Delete\" \"D\")\n"
3376                 "(menu-path \"<Main>/Message/Mark/Mark\" \"<shift>F\")\n"
3377                 "(menu-path \"<Main>/Message/Mark/Unmark\" \"U\")\n"
3378                 "(menu-path \"<Main>/Message/Mark/Mark as unread\" \"<shift>N\")\n"
3379                 "(menu-path \"<Main>/Message/Mark/Mark as read\" \"\")\n"
3380
3381                 "(menu-path \"<Main>/Tools/Address book\" \"<shift><control>A\")\n"
3382                 "(menu-path \"<Main>/Tools/Execute\" \"X\")\n"
3383                 "(menu-path \"<Main>/Tools/Log window\" \"<shift><control>L\")\n"
3384
3385                 "(menu-path \"<Compose>/File/Close\" \"<alt>W\")\n"
3386                 "(menu-path \"<Compose>/Edit/Select all\" \"\")\n"
3387                 "(menu-path \"<Compose>/Edit/Advanced/Move a word backward\" \"<alt>B\")\n"
3388                 "(menu-path \"<Compose>/Edit/Advanced/Move a word forward\" \"<alt>F\")\n"
3389                 "(menu-path \"<Compose>/Edit/Advanced/Move to beginning of line\" \"<control>A\")\n"
3390                 "(menu-path \"<Compose>/Edit/Advanced/Delete a word backward\" \"<control>W\")\n"
3391                 "(menu-path \"<Compose>/Edit/Advanced/Delete a word forward\" \"<alt>D\")";
3392
3393         static gchar *old_sylpheed_menurc =
3394                 "(menu-path \"<Main>/File/Empty trash\" \"\")\n"
3395                 "(menu-path \"<Main>/File/Save as...\" \"\")\n"
3396                 "(menu-path \"<Main>/File/Print...\" \"<alt>P\")\n"
3397                 "(menu-path \"<Main>/File/Exit\" \"<alt>Q\")\n"
3398
3399                 "(menu-path \"<Main>/Edit/Copy\" \"<control>C\")\n"
3400                 "(menu-path \"<Main>/Edit/Select all\" \"<control>A\")\n"
3401                 "(menu-path \"<Main>/Edit/Find in current message...\" \"<control>F\")\n"
3402                 "(menu-path \"<Main>/Edit/Search folder...\" \"<control>S\")\n"
3403
3404                 "(menu-path \"<Main>/View/Expand Summary View\" \"\")\n"
3405                 "(menu-path \"<Main>/View/Expand Message View\" \"\")\n"
3406                 "(menu-path \"<Main>/View/Thread view\" \"<control>T\")\n"
3407                 "(menu-path \"<Main>/View/Go to/Prev message\" \"P\")\n"
3408                 "(menu-path \"<Main>/View/Go to/Next message\" \"N\")\n"
3409                 "(menu-path \"<Main>/View/Go to/Prev unread message\" \"<shift>P\")\n"
3410                 "(menu-path \"<Main>/View/Go to/Next unread message\" \"<shift>N\")\n"
3411                 "(menu-path \"<Main>/View/Go to/Other folder...\" \"<alt>G\")\n"
3412                 "(menu-path \"<Main>/View/Open in new window\" \"<shift><control>N\")\n"
3413                 "(menu-path \"<Main>/View/View source\" \"<control>U\")\n"
3414                 "(menu-path \"<Main>/View/Show all headers\" \"<control>H\")\n"
3415                 "(menu-path \"<Main>/View/Update\" \"<alt>U\")\n"
3416
3417                 "(menu-path \"<Main>/Message/Get new mail\" \"<alt>I\")\n"
3418                 "(menu-path \"<Main>/Message/Get from all accounts\" \"<shift><alt>I\")\n"
3419                 "(menu-path \"<Main>/Message/Compose an email message\" \"<alt>N\")\n"
3420                 "(menu-path \"<Main>/Message/Reply\" \"<alt>R\")\n"
3421                 "(menu-path \"<Main>/Message/Reply to/all\" \"<shift><alt>R\")\n"
3422                 "(menu-path \"<Main>/Message/Reply to/sender\" \"<control><alt>R\")\n"
3423                 "(menu-path \"<Main>/Message/Reply to/mailing list\" \"<control>L\")\n"
3424                 "(menu-path \"<Main>/Message/Forward\" \"<shift><alt>F\")\n"
3425                 /* "(menu-path \"<Main>/Message/Forward as attachment\" \"<shift><control>F\")\n" */
3426                 "(menu-path \"<Main>/Message/Move...\" \"<alt>O\")\n"
3427                 "(menu-path \"<Main>/Message/Copy...\" \"\")\n"
3428