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