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