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