2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2003 Hiroyuki Yamamoto
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.
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.
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.
28 #include <gdk/gdkkeysyms.h>
33 #include <sys/types.h>
39 #include "prefs_gtk.h"
40 #include "prefs_common.h"
41 #include "prefs_display_header.h"
42 #include "prefs_summary_column.h"
43 #include "mainwindow.h"
44 #include "summaryview.h"
45 #include "messageview.h"
46 #include "manage_window.h"
52 #include "alertpanel.h"
55 #include "folderview.h"
56 #include "stock_pixmap.h"
57 #include "quote_fmt.h"
60 #include "gtkaspell.h"
63 PrefsCommon prefs_common;
65 static PrefsDialog dialog;
67 static struct Receive {
68 GtkWidget *checkbtn_incext;
69 GtkWidget *entry_incext;
70 GtkWidget *button_incext;
72 GtkWidget *checkbtn_local;
73 GtkWidget *checkbtn_filter_on_inc;
74 GtkWidget *entry_spool;
76 GtkWidget *checkbtn_autochk;
77 GtkWidget *spinbtn_autochk;
78 GtkObject *spinbtn_autochk_adj;
80 GtkWidget *checkbtn_chkonstartup;
81 GtkWidget *checkbtn_scan_after_inc;
84 GtkWidget *checkbtn_newmail_auto;
85 GtkWidget *checkbtn_newmail_manu;
86 GtkWidget *entry_newmail_notify_cmd;
87 GtkWidget *hbox_newmail_notify;
91 GtkWidget *checkbtn_extsend;
92 GtkWidget *entry_extsend;
93 GtkWidget *button_extsend;
95 GtkWidget *checkbtn_savemsg;
96 GtkWidget *checkbtn_queuemsg;
98 GtkWidget *optmenu_charset;
99 GtkWidget *optmenu_encoding_method;
102 static struct Compose {
103 GtkWidget *entry_fw_quotemark;
104 GtkWidget *text_fw_quotefmt;
106 GtkWidget *checkbtn_autoextedit;
107 GtkWidget *spinbtn_undolevel;
108 GtkObject *spinbtn_undolevel_adj;
109 GtkWidget *spinbtn_linewrap;
110 GtkObject *spinbtn_linewrap_adj;
111 GtkWidget *checkbtn_wrapquote;
112 GtkWidget *checkbtn_autowrap;
113 GtkWidget *checkbtn_wrapatsend;
115 GtkWidget *checkbtn_reply_account_autosel;
116 GtkWidget *checkbtn_forward_account_autosel;
117 GtkWidget *checkbtn_reedit_account_autosel;
118 GtkWidget *checkbtn_quote;
119 GtkWidget *checkbtn_default_reply_list;
120 GtkWidget *checkbtn_forward_as_attachment;
121 GtkWidget *checkbtn_redirect_keep_from;
122 GtkWidget *checkbtn_smart_wrapping;
123 GtkWidget *checkbtn_block_cursor;
124 GtkWidget *checkbtn_reply_with_quote;
126 GtkWidget *checkbtn_autosave;
127 GtkWidget *entry_autosave_length;
132 static struct Spelling {
133 GtkWidget *checkbtn_enable_aspell;
134 GtkWidget *entry_aspell_path;
135 GtkWidget *btn_aspell_path;
136 GtkWidget *optmenu_dictionary;
137 GtkWidget *optmenu_sugmode;
138 GtkWidget *misspelled_btn;
139 GtkWidget *checkbtn_use_alternate;
140 GtkWidget *checkbtn_check_while_typing;
144 static struct Quote {
145 GtkWidget *entry_quotemark;
146 GtkWidget *text_quotefmt;
148 GtkWidget *entry_fw_quotemark;
149 GtkWidget *text_fw_quotefmt;
151 GtkWidget *entry_quote_chars;
154 static struct Display {
155 GtkWidget *entry_textfont;
156 GtkWidget *button_textfont;
158 GtkWidget *entry_smallfont;
159 GtkWidget *entry_normalfont;
160 GtkWidget *entry_boldfont;
162 GtkWidget *chkbtn_folder_unread;
163 GtkWidget *entry_ng_abbrev_len;
164 GtkWidget *spinbtn_ng_abbrev_len;
165 GtkObject *spinbtn_ng_abbrev_len_adj;
167 GtkWidget *chkbtn_transhdr;
169 GtkWidget *chkbtn_swapfrom;
170 GtkWidget *chkbtn_useaddrbook;
171 GtkWidget *chkbtn_threadsubj;
172 GtkWidget *entry_datefmt;
175 static struct Message {
176 GtkWidget *chkbtn_enablecol;
177 GtkWidget *button_edit_col;
178 GtkWidget *chkbtn_mbalnum;
179 GtkWidget *chkbtn_disphdrpane;
180 GtkWidget *chkbtn_disphdr;
181 GtkWidget *spinbtn_linespc;
182 GtkObject *spinbtn_linespc_adj;
183 GtkWidget *chkbtn_headspc;
185 GtkWidget *chkbtn_smoothscroll;
186 GtkWidget *spinbtn_scrollstep;
187 GtkObject *spinbtn_scrollstep_adj;
188 GtkWidget *chkbtn_halfpage;
190 GtkWidget *chkbtn_attach_desc;
194 static struct Privacy {
195 GtkWidget *checkbtn_auto_check_signatures;
196 GtkWidget *checkbtn_gpg_signature_popup;
197 GtkWidget *checkbtn_store_passphrase;
198 GtkWidget *spinbtn_store_passphrase;
199 GtkObject *spinbtn_store_passphrase_adj;
200 GtkWidget *checkbtn_passphrase_grab;
201 GtkWidget *checkbtn_gpg_warning;
205 static struct Interface {
206 /* GtkWidget *checkbtn_emacs; */
207 GtkWidget *checkbtn_show_msg_with_cursor;
208 GtkWidget *checkbtn_openunread;
209 GtkWidget *checkbtn_mark_as_read_on_newwin;
210 GtkWidget *checkbtn_openinbox;
211 GtkWidget *checkbtn_immedexec;
212 GtkWidget *optmenu_recvdialog;
213 GtkWidget *optmenu_senddialog;
214 GtkWidget *checkbtn_no_recv_err_panel;
215 GtkWidget *checkbtn_close_recv_dialog;
216 GtkWidget *optmenu_nextunreadmsgdialog;
217 GtkWidget *entry_pixmap_theme;
218 GtkWidget *combo_pixmap_theme;
221 static struct Other {
222 GtkWidget *uri_combo;
223 GtkWidget *uri_entry;
224 GtkWidget *printcmd_entry;
225 GtkWidget *exteditor_combo;
226 GtkWidget *exteditor_entry;
227 GtkWidget *checkbtn_addaddrbyclick;
228 GtkWidget *checkbtn_confonexit;
229 GtkWidget *checkbtn_cleanonexit;
230 GtkWidget *checkbtn_askonclean;
231 GtkWidget *checkbtn_warnqueued;
232 GtkWidget *checkbtn_cliplog;
233 GtkWidget *loglength_entry;
236 GtkWidget *checkbtn_ssl_ask_unknown_valid;
242 static struct MessageColorButtons {
243 GtkWidget *quote_level1_btn;
244 GtkWidget *quote_level2_btn;
245 GtkWidget *quote_level3_btn;
247 GtkWidget *tgt_folder_btn;
248 GtkWidget *signature_btn;
251 static struct KeybindDialog {
256 static GtkWidget *font_sel_win;
257 static guint font_sel_conn_id;
258 static GtkWidget *quote_color_win;
259 static GtkWidget *color_dialog;
261 static void prefs_common_charset_set_data_from_optmenu (PrefParam *pparam);
262 static void prefs_common_charset_set_optmenu (PrefParam *pparam);
263 static void prefs_common_encoding_set_data_from_optmenu (PrefParam *pparam);
264 static void prefs_common_encoding_set_optmenu (PrefParam *pparam);
265 static void prefs_common_recv_dialog_set_data_from_optmenu (PrefParam *pparam);
266 static void prefs_common_recv_dialog_set_optmenu (PrefParam *pparam);
267 static void prefs_common_recv_dialog_newmail_notify_toggle_cb (GtkWidget *w,
269 static void prefs_common_recv_dialog_set_data_from_optmenu(PrefParam *pparam);
270 static void prefs_common_recv_dialog_set_optmenu(PrefParam *pparam);
271 static void prefs_common_send_dialog_set_data_from_optmenu(PrefParam *pparam);
272 static void prefs_common_send_dialog_set_optmenu(PrefParam *pparam);
273 static void prefs_nextunreadmsgdialog_set_data_from_optmenu(PrefParam *pparam);
274 static void prefs_nextunreadmsgdialog_set_optmenu(PrefParam *pparam);
277 static void prefs_dictionary_set_data_from_optmenu (PrefParam *param);
278 static void prefs_dictionary_set_optmenu (PrefParam *pparam);
279 static void prefs_speller_sugmode_set_data_from_optmenu (PrefParam *pparam);
280 static void prefs_speller_sugmode_set_optmenu (PrefParam *pparam);
285 parameter name, default value, pointer to the prefs variable, data type,
286 pointer to the widget pointer,
287 pointer to the function for data setting,
288 pointer to the function for widget setting
291 static PrefParam param[] = {
293 {"use_ext_inc", "FALSE", &prefs_common.use_extinc, P_BOOL,
294 &receive.checkbtn_incext,
295 prefs_set_data_from_toggle, prefs_set_toggle},
296 {"ext_inc_path", DEFAULT_INC_PATH, &prefs_common.extinc_cmd, P_STRING,
297 &receive.entry_incext,
298 prefs_set_data_from_entry, prefs_set_entry},
300 {"inc_local", "TRUE", &prefs_common.inc_local, P_BOOL,
301 &receive.checkbtn_local,
302 prefs_set_data_from_toggle, prefs_set_toggle},
303 {"filter_on_inc_local", "TRUE", &prefs_common.filter_on_inc, P_BOOL,
304 &receive.checkbtn_filter_on_inc,
305 prefs_set_data_from_toggle, prefs_set_toggle},
306 {"spool_path", DEFAULT_SPOOL_PATH, &prefs_common.spool_path, P_STRING,
307 &receive.entry_spool,
308 prefs_set_data_from_entry, prefs_set_entry},
310 {"autochk_newmail", "FALSE", &prefs_common.autochk_newmail, P_BOOL,
311 &receive.checkbtn_autochk,
312 prefs_set_data_from_toggle, prefs_set_toggle},
313 {"autochk_interval", "10", &prefs_common.autochk_itv, P_INT,
314 &receive.spinbtn_autochk,
315 prefs_set_data_from_spinbtn, prefs_set_spinbtn},
316 {"check_on_startup", "FALSE", &prefs_common.chk_on_startup, P_BOOL,
317 &receive.checkbtn_chkonstartup,
318 prefs_set_data_from_toggle, prefs_set_toggle},
319 {"scan_all_after_inc", "FALSE", &prefs_common.scan_all_after_inc,
320 P_BOOL, &receive.checkbtn_scan_after_inc,
321 prefs_set_data_from_toggle, prefs_set_toggle},
322 {"newmail_notify_manu", "FALSE", &prefs_common.newmail_notify_manu,
323 P_BOOL, &receive.checkbtn_newmail_manu,
324 prefs_set_data_from_toggle, prefs_set_toggle},
325 {"newmail_notify_auto", "FALSE", &prefs_common.newmail_notify_auto,
326 P_BOOL, &receive.checkbtn_newmail_auto,
327 prefs_set_data_from_toggle, prefs_set_toggle},
328 {"newmail_notify_cmd", "", &prefs_common.newmail_notify_cmd, P_STRING,
329 &receive.entry_newmail_notify_cmd,
330 prefs_set_data_from_entry, prefs_set_entry},
333 {"use_ext_sendmail", "FALSE", &prefs_common.use_extsend, P_BOOL,
334 &p_send.checkbtn_extsend,
335 prefs_set_data_from_toggle, prefs_set_toggle},
336 {"ext_sendmail_cmd", DEFAULT_SENDMAIL_CMD,
337 &prefs_common.extsend_cmd, P_STRING,
338 &p_send.entry_extsend, prefs_set_data_from_entry, prefs_set_entry},
339 {"save_message", "TRUE", &prefs_common.savemsg, P_BOOL,
340 &p_send.checkbtn_savemsg,
341 prefs_set_data_from_toggle, prefs_set_toggle},
342 {"queue_message", "FALSE", &prefs_common.queue_msg, P_BOOL,
343 &p_send.checkbtn_queuemsg,
344 prefs_set_data_from_toggle, prefs_set_toggle},
346 {"outgoing_charset", CS_AUTO, &prefs_common.outgoing_charset, P_STRING,
347 &p_send.optmenu_charset,
348 prefs_common_charset_set_data_from_optmenu,
349 prefs_common_charset_set_optmenu},
350 {"encoding_method", "0", &prefs_common.encoding_method, P_ENUM,
351 &p_send.optmenu_encoding_method,
352 prefs_common_encoding_set_data_from_optmenu,
353 prefs_common_encoding_set_optmenu},
356 {"auto_ext_editor", "FALSE", &prefs_common.auto_exteditor, P_BOOL,
357 &compose.checkbtn_autoextedit,
358 prefs_set_data_from_toggle, prefs_set_toggle},
359 {"forward_as_attachment", "FALSE", &prefs_common.forward_as_attachment,
360 P_BOOL, &compose.checkbtn_forward_as_attachment,
361 prefs_set_data_from_toggle, prefs_set_toggle},
362 {"redirect_keep_from", "FALSE",
363 &prefs_common.redirect_keep_from, P_BOOL,
364 &compose.checkbtn_redirect_keep_from,
365 prefs_set_data_from_toggle, prefs_set_toggle},
366 {"undo_level", "50", &prefs_common.undolevels, P_INT,
367 &compose.spinbtn_undolevel,
368 prefs_set_data_from_spinbtn, prefs_set_spinbtn},
369 {"block_cursor", "FALSE", &prefs_common.block_cursor,
370 P_BOOL, &compose.checkbtn_block_cursor,
371 prefs_set_data_from_toggle, prefs_set_toggle},
373 {"linewrap_length", "72", &prefs_common.linewrap_len, P_INT,
374 &compose.spinbtn_linewrap,
375 prefs_set_data_from_spinbtn, prefs_set_spinbtn},
376 {"linewrap_quotation", "FALSE", &prefs_common.linewrap_quote, P_BOOL,
377 &compose.checkbtn_wrapquote,
378 prefs_set_data_from_toggle, prefs_set_toggle},
379 {"linewrap_auto", "FALSE", &prefs_common.autowrap, P_BOOL,
380 &compose.checkbtn_autowrap,
381 prefs_set_data_from_toggle, prefs_set_toggle},
382 {"linewrap_before_sending", "FALSE",
383 &prefs_common.linewrap_at_send, P_BOOL,
384 &compose.checkbtn_wrapatsend,
385 prefs_set_data_from_toggle, prefs_set_toggle},
386 {"smart_wrapping", "TRUE", &prefs_common.smart_wrapping,
387 P_BOOL, &compose.checkbtn_smart_wrapping,
388 prefs_set_data_from_toggle, prefs_set_toggle},
389 {"autosave", "FALSE", &prefs_common.autosave,
390 P_BOOL, &compose.checkbtn_autosave,
391 prefs_set_data_from_toggle, prefs_set_toggle},
392 {"autosave_length", "50", &prefs_common.autosave_length,
393 P_INT, &compose.entry_autosave_length,
394 prefs_set_data_from_entry, prefs_set_entry},
396 {"enable_aspell", "TRUE", &prefs_common.enable_aspell,
397 P_BOOL, &spelling.checkbtn_enable_aspell,
398 prefs_set_data_from_toggle, prefs_set_toggle},
399 {"aspell_path", ASPELL_PATH, &prefs_common.aspell_path,
400 P_STRING, &spelling.entry_aspell_path,
401 prefs_set_data_from_entry, prefs_set_entry},
402 {"dictionary", "", &prefs_common.dictionary,
403 P_STRING, &spelling.optmenu_dictionary,
404 prefs_dictionary_set_data_from_optmenu, prefs_dictionary_set_optmenu },
405 {"aspell_sugmode", "1", &prefs_common.aspell_sugmode,
406 P_INT, &spelling.optmenu_sugmode,
407 prefs_speller_sugmode_set_data_from_optmenu, prefs_speller_sugmode_set_optmenu },
408 {"use_alternate_dict", "FALSE", &prefs_common.use_alternate,
409 P_BOOL, &spelling.checkbtn_use_alternate,
410 prefs_set_data_from_toggle, prefs_set_toggle},
411 {"check_while_typing", "TRUE", &prefs_common.check_while_typing,
412 P_BOOL, &spelling.checkbtn_check_while_typing,
413 prefs_set_data_from_toggle, prefs_set_toggle},
414 {"misspelled_color", "16711680", &prefs_common.misspelled_col, P_COLOR,
417 {"reply_with_quote", "TRUE", &prefs_common.reply_with_quote, P_BOOL,
418 &compose.checkbtn_reply_with_quote, prefs_set_data_from_toggle, prefs_set_toggle},
420 /* Account autoselection */
421 {"reply_account_autoselect", "TRUE",
422 &prefs_common.reply_account_autosel, P_BOOL,
423 &compose.checkbtn_reply_account_autosel,
424 prefs_set_data_from_toggle, prefs_set_toggle},
425 {"forward_account_autoselect", "TRUE",
426 &prefs_common.forward_account_autosel, P_BOOL,
427 &compose.checkbtn_forward_account_autosel,
428 prefs_set_data_from_toggle, prefs_set_toggle},
429 {"reedit_account_autoselect", "TRUE",
430 &prefs_common.reedit_account_autosel, P_BOOL,
431 &compose.checkbtn_reedit_account_autosel,
432 prefs_set_data_from_toggle, prefs_set_toggle},
434 {"default_reply_list", "TRUE", &prefs_common.default_reply_list, P_BOOL,
435 &compose.checkbtn_default_reply_list,
436 prefs_set_data_from_toggle, prefs_set_toggle},
438 {"show_ruler", "TRUE", &prefs_common.show_ruler, P_BOOL,
442 {"reply_quote_mark", "> ", &prefs_common.quotemark, P_STRING,
443 "e.entry_quotemark, prefs_set_data_from_entry, prefs_set_entry},
444 {"reply_quote_format", "On %d\\n%f wrote:\\n\\n%Q",
445 &prefs_common.quotefmt, P_STRING, "e.text_quotefmt,
446 prefs_set_data_from_text, prefs_set_text},
448 {"forward_quote_mark", "> ", &prefs_common.fw_quotemark, P_STRING,
449 "e.entry_fw_quotemark,
450 prefs_set_data_from_entry, prefs_set_entry},
451 {"forward_quote_format",
452 "\\n\\nBegin forwarded message:\\n\\n"
453 "?d{Date: %d\\n}?f{From: %f\\n}?t{To: %t\\n}?c{Cc: %c\\n}"
454 "?n{Newsgroups: %n\\n}?s{Subject: %s\\n}\\n\\n%M",
455 &prefs_common.fw_quotefmt, P_STRING, "e.text_fw_quotefmt,
456 prefs_set_data_from_text, prefs_set_text},
457 {"quote_chars", ">", &prefs_common.quote_chars, P_STRING,
458 "e.entry_quote_chars, prefs_set_data_from_entry, prefs_set_entry},
461 {"widget_font", NULL, &prefs_common.widgetfont, P_STRING,
463 {"message_font", "-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*",
464 &prefs_common.textfont, P_STRING,
465 &display.entry_textfont,
466 prefs_set_data_from_entry, prefs_set_entry},
467 {"small_font", "-*-helvetica-medium-r-normal--10-*-*-*-*-*-*-*",
468 &prefs_common.smallfont, P_STRING,
469 &display.entry_smallfont,
470 prefs_set_data_from_entry, prefs_set_entry},
471 {"bold_font", "-*-helvetica-bold-r-normal--12-*-*-*-*-*-*-*",
472 &prefs_common.boldfont, P_STRING,
473 &display.entry_boldfont,
474 prefs_set_data_from_entry, prefs_set_entry},
475 {"normal_font", "-*-helvetica-medium-r-normal--12-*-*-*-*-*-*-*",
476 &prefs_common.normalfont, P_STRING,
477 &display.entry_normalfont,
478 prefs_set_data_from_entry, prefs_set_entry},
481 {"display_folder_unread_num", "TRUE",
482 &prefs_common.display_folder_unread, P_BOOL,
483 &display.chkbtn_folder_unread,
484 prefs_set_data_from_toggle, prefs_set_toggle},
485 {"newsgroup_abbrev_len", "16",
486 &prefs_common.ng_abbrev_len, P_INT,
487 &display.spinbtn_ng_abbrev_len,
488 prefs_set_data_from_spinbtn, prefs_set_spinbtn},
490 {"translate_header", "TRUE", &prefs_common.trans_hdr, P_BOOL,
491 &display.chkbtn_transhdr,
492 prefs_set_data_from_toggle, prefs_set_toggle},
494 /* Display: Summary View */
495 {"enable_swap_from", "FALSE", &prefs_common.swap_from, P_BOOL,
496 &display.chkbtn_swapfrom,
497 prefs_set_data_from_toggle, prefs_set_toggle},
498 {"use_address_book", "TRUE", &prefs_common.use_addr_book, P_BOOL,
499 &display.chkbtn_useaddrbook,
500 prefs_set_data_from_toggle, prefs_set_toggle},
501 {"thread_by_subject", "TRUE", &prefs_common.thread_by_subject, P_BOOL,
502 &display.chkbtn_threadsubj,
503 prefs_set_data_from_toggle, prefs_set_toggle},
504 {"date_format", "%y/%m/%d(%a) %H:%M", &prefs_common.date_format,
505 P_STRING, &display.entry_datefmt,
506 prefs_set_data_from_entry, prefs_set_entry},
508 {"enable_hscrollbar", "TRUE", &prefs_common.enable_hscrollbar, P_BOOL,
510 {"bold_unread", "TRUE", &prefs_common.bold_unread, P_BOOL,
513 {"enable_thread", "TRUE", &prefs_common.enable_thread, P_BOOL,
515 {"toolbar_style", "3", &prefs_common.toolbar_style, P_ENUM,
517 {"show_statusbar", "TRUE", &prefs_common.show_statusbar, P_BOOL,
519 {"show_searchbar", "TRUE", &prefs_common.show_searchbar, P_BOOL,
522 {"folderview_vscrollbar_policy", "0",
523 &prefs_common.folderview_vscrollbar_policy, P_ENUM,
526 {"summary_col_show_mark", "TRUE",
527 &prefs_common.summary_col_visible[S_COL_MARK], P_BOOL, NULL, NULL, NULL},
528 {"summary_col_show_unread", "TRUE",
529 &prefs_common.summary_col_visible[S_COL_STATUS], P_BOOL, NULL, NULL, NULL},
530 {"summary_col_show_mime", "TRUE",
531 &prefs_common.summary_col_visible[S_COL_MIME], P_BOOL, NULL, NULL, NULL},
532 {"summary_col_show_subject", "TRUE",
533 &prefs_common.summary_col_visible[S_COL_SUBJECT], P_BOOL, NULL, NULL, NULL},
534 {"summary_col_show_from", "TRUE",
535 &prefs_common.summary_col_visible[S_COL_FROM], P_BOOL, NULL, NULL, NULL},
536 {"summary_col_show_date", "TRUE",
537 &prefs_common.summary_col_visible[S_COL_DATE], P_BOOL, NULL, NULL, NULL},
538 {"summary_col_show_size", "TRUE",
539 &prefs_common.summary_col_visible[S_COL_SIZE], P_BOOL, NULL, NULL, NULL},
540 {"summary_col_show_number", "FALSE",
541 &prefs_common.summary_col_visible[S_COL_NUMBER], P_BOOL, NULL, NULL, NULL},
542 {"summary_col_show_score", "FALSE",
543 &prefs_common.summary_col_visible[S_COL_SCORE], P_BOOL, NULL, NULL, NULL},
544 {"summary_col_show_locked", "FALSE",
545 &prefs_common.summary_col_visible[S_COL_LOCKED], P_BOOL, NULL, NULL, NULL},
547 {"summary_col_pos_mark", "0",
548 &prefs_common.summary_col_pos[S_COL_MARK], P_INT, NULL, NULL, NULL},
549 {"summary_col_pos_unread", "1",
550 &prefs_common.summary_col_pos[S_COL_STATUS], P_INT, NULL, NULL, NULL},
551 {"summary_col_pos_mime", "2",
552 &prefs_common.summary_col_pos[S_COL_MIME], P_INT, NULL, NULL, NULL},
553 {"summary_col_pos_subject", "3",
554 &prefs_common.summary_col_pos[S_COL_SUBJECT], P_INT, NULL, NULL, NULL},
555 {"summary_col_pos_from", "4",
556 &prefs_common.summary_col_pos[S_COL_FROM], P_INT, NULL, NULL, NULL},
557 {"summary_col_pos_date", "5",
558 &prefs_common.summary_col_pos[S_COL_DATE], P_INT, NULL, NULL, NULL},
559 {"summary_col_pos_size", "6",
560 &prefs_common.summary_col_pos[S_COL_SIZE], P_INT, NULL, NULL, NULL},
561 {"summary_col_pos_number", "7",
562 &prefs_common.summary_col_pos[S_COL_NUMBER], P_INT, NULL, NULL, NULL},
563 {"summary_col_pos_score", "8",
564 &prefs_common.summary_col_pos[S_COL_SCORE], P_INT, NULL, NULL, NULL},
565 {"summary_col_pos_locked", "9",
566 &prefs_common.summary_col_pos[S_COL_LOCKED], P_INT, NULL, NULL, NULL},
568 {"summary_col_size_mark", "10",
569 &prefs_common.summary_col_size[S_COL_MARK], P_INT, NULL, NULL, NULL},
570 {"summary_col_size_unread", "13",
571 &prefs_common.summary_col_size[S_COL_STATUS], P_INT, NULL, NULL, NULL},
572 {"summary_col_size_mime", "10",
573 &prefs_common.summary_col_size[S_COL_MIME], P_INT, NULL, NULL, NULL},
574 {"summary_col_size_subject", "200",
575 &prefs_common.summary_col_size[S_COL_SUBJECT], P_INT, NULL, NULL, NULL},
576 {"summary_col_size_from", "120",
577 &prefs_common.summary_col_size[S_COL_FROM], P_INT, NULL, NULL, NULL},
578 {"summary_col_size_date", "118",
579 &prefs_common.summary_col_size[S_COL_DATE], P_INT, NULL, NULL, NULL},
580 {"summary_col_size_size", "45",
581 &prefs_common.summary_col_size[S_COL_SIZE], P_INT, NULL, NULL, NULL},
582 {"summary_col_size_number", "40",
583 &prefs_common.summary_col_size[S_COL_NUMBER], P_INT, NULL, NULL, NULL},
584 {"summary_col_size_score", "40",
585 &prefs_common.summary_col_size[S_COL_SCORE], P_INT, NULL, NULL, NULL},
586 {"summary_col_size_locked", "13",
587 &prefs_common.summary_col_size[S_COL_LOCKED], P_INT, NULL, NULL, NULL},
590 {"folderview_width", "179", &prefs_common.folderview_width, P_INT,
592 {"folderview_height", "600", &prefs_common.folderview_height, P_INT,
594 {"folder_col_folder", "150", &prefs_common.folder_col_folder, P_INT,
596 {"folder_col_new", "32", &prefs_common.folder_col_new, P_INT,
598 {"folder_col_unread", "32", &prefs_common.folder_col_unread, P_INT,
600 {"folder_col_total", "32", &prefs_common.folder_col_total, P_INT,
603 {"summaryview_width", "600", &prefs_common.summaryview_width, P_INT,
605 {"summaryview_height", "173", &prefs_common.summaryview_height, P_INT,
608 {"mainview_x", "64", &prefs_common.mainview_x, P_INT,
610 {"mainview_y", "64", &prefs_common.mainview_y, P_INT,
612 {"mainview_width", "600", &prefs_common.mainview_width, P_INT,
614 {"mainview_height", "600", &prefs_common.mainview_height, P_INT,
616 {"mainwin_x", "64", &prefs_common.mainwin_x, P_INT,
618 {"mainwin_y", "64", &prefs_common.mainwin_y, P_INT,
620 {"mainwin_width", "800", &prefs_common.mainwin_width, P_INT,
622 {"mainwin_height", "600", &prefs_common.mainwin_height, P_INT,
624 {"messagewin_width", "600", &prefs_common.msgwin_width, P_INT,
626 {"messagewin_height", "540", &prefs_common.msgwin_height, P_INT,
628 {"sourcewin_width", "600", &prefs_common.sourcewin_width, P_INT,
630 {"sourcewin_height", "500", &prefs_common.sourcewin_height, P_INT,
632 {"compose_width", "600", &prefs_common.compose_width, P_INT,
634 {"compose_height", "560", &prefs_common.compose_height, P_INT,
638 {"enable_color", "TRUE", &prefs_common.enable_color, P_BOOL,
639 &message.chkbtn_enablecol,
640 prefs_set_data_from_toggle, prefs_set_toggle},
642 {"quote_level1_color", "179", &prefs_common.quote_level1_col, P_COLOR,
644 {"quote_level2_color", "179", &prefs_common.quote_level2_col, P_COLOR,
646 {"quote_level3_color", "179", &prefs_common.quote_level3_col, P_COLOR,
648 {"uri_color", "32512", &prefs_common.uri_col, P_COLOR,
650 {"target_folder_color", "14294218", &prefs_common.tgt_folder_col, P_COLOR,
652 {"signature_color", "7960953", &prefs_common.signature_col, P_COLOR,
654 {"recycle_quote_colors", "FALSE", &prefs_common.recycle_quote_colors,
655 P_BOOL, NULL, NULL, NULL},
657 {"convert_mb_alnum", "FALSE", &prefs_common.conv_mb_alnum, P_BOOL,
658 &message.chkbtn_mbalnum,
659 prefs_set_data_from_toggle, prefs_set_toggle},
660 {"display_header_pane", "TRUE", &prefs_common.display_header_pane,
661 P_BOOL, &message.chkbtn_disphdrpane,
662 prefs_set_data_from_toggle, prefs_set_toggle},
663 {"display_header", "TRUE", &prefs_common.display_header, P_BOOL,
664 &message.chkbtn_disphdr,
665 prefs_set_data_from_toggle, prefs_set_toggle},
666 {"line_space", "2", &prefs_common.line_space, P_INT,
667 &message.spinbtn_linespc,
668 prefs_set_data_from_spinbtn, prefs_set_spinbtn},
669 {"enable_head_space", "FALSE", &prefs_common.head_space, P_BOOL,
670 &message.chkbtn_headspc,
671 prefs_set_data_from_toggle, prefs_set_toggle},
673 {"enable_smooth_scroll", "FALSE",
674 &prefs_common.enable_smooth_scroll, P_BOOL,
675 &message.chkbtn_smoothscroll,
676 prefs_set_data_from_toggle, prefs_set_toggle},
677 {"scroll_step", "1", &prefs_common.scroll_step, P_INT,
678 &message.spinbtn_scrollstep,
679 prefs_set_data_from_spinbtn, prefs_set_spinbtn},
680 {"scroll_half_page", "FALSE", &prefs_common.scroll_halfpage, P_BOOL,
681 &message.chkbtn_halfpage,
682 prefs_set_data_from_toggle, prefs_set_toggle},
684 {"show_other_header", "FALSE", &prefs_common.show_other_header, P_BOOL,
687 {"attach_desc", "TRUE", &prefs_common.attach_desc, P_BOOL,
688 &message.chkbtn_attach_desc,
689 prefs_set_data_from_toggle, prefs_set_toggle},
692 {"mime_image_viewer", "display '%s'",
693 &prefs_common.mime_image_viewer, P_STRING, NULL, NULL, NULL},
694 {"mime_audio_player", "play '%s'",
695 &prefs_common.mime_audio_player, P_STRING, NULL, NULL, NULL},
696 {"mime_open_command", "gedit '%s'",
697 &prefs_common.mime_open_cmd, P_STRING, NULL, NULL, NULL},
701 {"auto_check_signatures", "TRUE",
702 &prefs_common.auto_check_signatures, P_BOOL,
703 &privacy.checkbtn_auto_check_signatures,
704 prefs_set_data_from_toggle, prefs_set_toggle},
705 {"gpg_signature_popup", "FALSE",
706 &prefs_common.gpg_signature_popup, P_BOOL,
707 &privacy.checkbtn_gpg_signature_popup,
708 prefs_set_data_from_toggle, prefs_set_toggle},
709 {"store_passphrase", "FALSE", &prefs_common.store_passphrase, P_BOOL,
710 &privacy.checkbtn_store_passphrase,
711 prefs_set_data_from_toggle, prefs_set_toggle},
712 {"store_passphrase_timeout", "0",
713 &prefs_common.store_passphrase_timeout, P_INT,
714 &privacy.spinbtn_store_passphrase,
715 prefs_set_data_from_spinbtn, prefs_set_spinbtn},
717 {"passphrase_grab", "FALSE", &prefs_common.passphrase_grab, P_BOOL,
718 &privacy.checkbtn_passphrase_grab,
719 prefs_set_data_from_toggle, prefs_set_toggle},
720 #endif /* __MINGW32__ */
721 {"gpg_warning", "TRUE", &prefs_common.gpg_warning, P_BOOL,
722 &privacy.checkbtn_gpg_warning,
723 prefs_set_data_from_toggle, prefs_set_toggle},
724 #endif /* USE_GPGME */
727 {"separate_folder", "FALSE", &prefs_common.sep_folder, P_BOOL,
729 {"separate_message", "FALSE", &prefs_common.sep_msg, P_BOOL,
732 /* {"emulate_emacs", "FALSE", &prefs_common.emulate_emacs, P_BOOL,
733 NULL, NULL, NULL}, */
734 {"show_message_with_cursor_key", "FALSE",
735 &prefs_common.show_msg_with_cursor_key,
736 P_BOOL, &interface.checkbtn_show_msg_with_cursor,
737 prefs_set_data_from_toggle, prefs_set_toggle},
738 {"open_unread_on_enter", "FALSE", &prefs_common.open_unread_on_enter,
739 P_BOOL, &interface.checkbtn_openunread,
740 prefs_set_data_from_toggle, prefs_set_toggle},
741 {"mark_as_read_on_new_window", "FALSE",
742 &prefs_common.mark_as_read_on_new_window,
743 P_BOOL, &interface.checkbtn_mark_as_read_on_newwin,
744 prefs_set_data_from_toggle, prefs_set_toggle},
745 {"open_inbox_on_inc", "FALSE", &prefs_common.open_inbox_on_inc,
746 P_BOOL, &interface.checkbtn_openinbox,
747 prefs_set_data_from_toggle, prefs_set_toggle},
748 {"immediate_execution", "TRUE", &prefs_common.immediate_exec, P_BOOL,
749 &interface.checkbtn_immedexec,
750 prefs_set_data_from_toggle, prefs_set_toggle},
751 {"receive_dialog_mode", "1", &prefs_common.recv_dialog_mode, P_ENUM,
752 &interface.optmenu_recvdialog,
753 prefs_common_recv_dialog_set_data_from_optmenu,
754 prefs_common_recv_dialog_set_optmenu},
755 {"send_dialog_mode", "0", &prefs_common.send_dialog_mode, P_ENUM,
756 &interface.optmenu_senddialog,
757 prefs_common_send_dialog_set_data_from_optmenu,
758 prefs_common_send_dialog_set_optmenu},
759 {"no_receive_error_panel", "FALSE", &prefs_common.no_recv_err_panel,
760 P_BOOL, &interface.checkbtn_no_recv_err_panel,
761 prefs_set_data_from_toggle, prefs_set_toggle},
762 {"close_receive_dialog", "TRUE", &prefs_common.close_recv_dialog,
763 P_BOOL, &interface.checkbtn_close_recv_dialog,
764 prefs_set_data_from_toggle, prefs_set_toggle},
765 {"nextunreadmsg_dialog", NULL, &prefs_common.next_unread_msg_dialog, P_ENUM,
766 &interface.optmenu_nextunreadmsgdialog,
767 prefs_nextunreadmsgdialog_set_data_from_optmenu,
768 prefs_nextunreadmsgdialog_set_optmenu},
770 {"pixmap_theme_path", DEFAULT_PIXMAP_THEME,
771 &prefs_common.pixmap_theme_path, P_STRING,
772 &interface.entry_pixmap_theme, prefs_set_data_from_entry, prefs_set_entry},
775 {"uri_open_command", DEFAULT_BROWSER_CMD,
776 &prefs_common.uri_cmd, P_STRING,
777 &other.uri_entry, prefs_set_data_from_entry, prefs_set_entry},
778 {"print_command", "lpr %s", &prefs_common.print_cmd, P_STRING,
779 &other.printcmd_entry, prefs_set_data_from_entry, prefs_set_entry},
780 {"ext_editor_command", "gedit %s",
781 &prefs_common.ext_editor_cmd, P_STRING,
782 &other.exteditor_entry, prefs_set_data_from_entry, prefs_set_entry},
784 {"add_address_by_click", "FALSE", &prefs_common.add_address_by_click,
785 P_BOOL, &other.checkbtn_addaddrbyclick,
786 prefs_set_data_from_toggle, prefs_set_toggle},
788 {"confirm_on_exit", "TRUE", &prefs_common.confirm_on_exit, P_BOOL,
789 &other.checkbtn_confonexit,
790 prefs_set_data_from_toggle, prefs_set_toggle},
791 {"clean_trash_on_exit", "FALSE", &prefs_common.clean_on_exit, P_BOOL,
792 &other.checkbtn_cleanonexit,
793 prefs_set_data_from_toggle, prefs_set_toggle},
794 {"ask_on_cleaning", "TRUE", &prefs_common.ask_on_clean, P_BOOL,
795 &other.checkbtn_askonclean,
796 prefs_set_data_from_toggle, prefs_set_toggle},
797 {"warn_queued_on_exit", "TRUE", &prefs_common.warn_queued_on_exit,
798 P_BOOL, &other.checkbtn_warnqueued,
799 prefs_set_data_from_toggle, prefs_set_toggle},
802 {"ssl_ask_unknown_valid", "TRUE", &prefs_common.ssl_ask_unknown_valid,
803 P_BOOL, &other.checkbtn_ssl_ask_unknown_valid,
804 prefs_set_data_from_toggle, prefs_set_toggle},
807 {"work_offline", "FALSE", &prefs_common.work_offline, P_BOOL,
809 {"summary_quicksearch_type", "0", &prefs_common.summary_quicksearch_type, P_INT,
812 {"hide_score", "-9999", &prefs_common.kill_score, P_INT,
814 {"important_score", "1", &prefs_common.important_score, P_INT,
816 {"clip_log", "FALSE", &prefs_common.cliplog, P_BOOL,
817 &other.checkbtn_cliplog,
818 prefs_set_data_from_toggle, prefs_set_toggle},
819 {"log_length", "1000", &prefs_common.loglength, P_INT,
820 &other.loglength_entry,
821 prefs_set_data_from_entry, prefs_set_entry},
823 {"cache_max_mem_usage", "4096", &prefs_common.cache_max_mem_usage, P_INT,
825 {"cache_min_keep_time", "15", &prefs_common.cache_min_keep_time, P_INT,
828 {"color_new", "179", &prefs_common.color_new, P_COLOR,
831 {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
834 /* widget creating functions */
835 static void prefs_common_create (void);
836 static void prefs_receive_create (void);
837 static void prefs_send_create (void);
839 static void prefs_spelling_create (void);
841 static void prefs_compose_create (void);
842 static void prefs_quote_create (void);
843 static void prefs_display_create (void);
844 static void prefs_message_create (void);
846 static void prefs_privacy_create (void);
848 static void prefs_interface_create (void);
849 static void prefs_other_create (void);
851 static void date_format_ok_btn_clicked (GtkButton *button,
853 static void date_format_cancel_btn_clicked (GtkButton *button,
855 static void date_format_key_pressed (GtkWidget *keywidget,
858 static gboolean date_format_on_delete (GtkWidget *dialogwidget,
861 static void date_format_entry_on_change (GtkEditable *editable,
863 static void date_format_select_row (GtkWidget *date_format_list,
866 GdkEventButton *event,
867 GtkWidget *date_format);
868 static GtkWidget *date_format_create (GtkButton *button,
871 static void prefs_quote_colors_dialog (void);
872 static void prefs_quote_colors_dialog_create (void);
873 static void prefs_quote_colors_key_pressed (GtkWidget *widget,
876 static void quote_color_set_dialog (GtkWidget *widget,
878 static void quote_colors_set_dialog_ok (GtkWidget *widget,
880 static void quote_colors_set_dialog_cancel (GtkWidget *widget,
882 static void quote_colors_set_dialog_key_pressed (GtkWidget *widget,
885 static void set_button_bg_color (GtkWidget *widget,
887 static void prefs_enable_message_color_toggled (void);
888 static void prefs_recycle_colors_toggled (GtkWidget *widget);
890 static void prefs_font_select (GtkButton *button, GtkEntry *entry);
892 static void prefs_font_selection_key_pressed (GtkWidget *widget,
895 static void prefs_font_selection_ok (GtkButton *button, GtkEntry *entry);
897 static void prefs_keybind_select (void);
898 static gint prefs_keybind_deleted (GtkWidget *widget,
901 static void prefs_keybind_key_pressed (GtkWidget *widget,
904 static void prefs_keybind_cancel (void);
905 static void prefs_keybind_apply_clicked (GtkWidget *widget);
907 static gint prefs_common_deleted (GtkWidget *widget,
910 static void prefs_common_key_pressed (GtkWidget *widget,
913 static void prefs_common_ok (void);
914 static void prefs_common_apply (void);
915 static void prefs_common_cancel (void);
917 void prefs_common_init() {
918 prefs_common.disphdr_list = NULL;
921 PrefsCommon *prefs_common_get(void)
923 return &prefs_common;
926 void prefs_common_read_config(void)
930 gchar buf[PREFSBUFSIZE];
932 prefs_read_config(param, "Common", COMMON_RC);
934 path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMAND_HISTORY,
936 if ((fp = fopen(path, "rb")) == NULL) {
937 if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
942 while (fgets(buf, sizeof(buf), fp) != NULL) {
944 if (buf[0] == '\0') continue;
945 prefs_common.mime_open_cmd_history =
946 add_history(prefs_common.mime_open_cmd_history, buf);
950 prefs_common.mime_open_cmd_history =
951 g_list_reverse(prefs_common.mime_open_cmd_history);
954 void prefs_common_save_config(void)
960 prefs_save_config(param, "Common", COMMON_RC);
962 path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMAND_HISTORY,
964 if ((fp = fopen(path, "wb")) == NULL) {
965 FILE_OP_ERROR(path, "fopen");
970 for (cur = prefs_common.mime_open_cmd_history;
971 cur != NULL; cur = cur->next) {
972 fputs((gchar *)cur->data, fp);
980 void prefs_common_open(void)
982 if (prefs_rc_is_readonly(COMMON_RC))
987 if (!dialog.window) {
988 prefs_common_create();
991 manage_window_set_transient(GTK_WINDOW(dialog.window));
992 gtk_notebook_set_page(GTK_NOTEBOOK(dialog.notebook), 0);
993 gtk_widget_grab_focus(dialog.ok_btn);
995 prefs_set_dialog(param);
997 gtk_widget_show(dialog.window);
1000 static void prefs_common_create(void)
1004 debug_print("Creating common preferences window...\n");
1006 prefs_dialog_create(&dialog);
1007 gtk_window_set_title (GTK_WINDOW(dialog.window),
1008 _("Common Preferences"));
1009 gtk_signal_connect (GTK_OBJECT(dialog.window), "delete_event",
1010 GTK_SIGNAL_FUNC(prefs_common_deleted), NULL);
1011 gtk_signal_connect (GTK_OBJECT(dialog.window), "key_press_event",
1012 GTK_SIGNAL_FUNC(prefs_common_key_pressed), NULL);
1013 MANAGE_WINDOW_SIGNALS_CONNECT(dialog.window);
1015 gtk_signal_connect (GTK_OBJECT(dialog.ok_btn), "clicked",
1016 GTK_SIGNAL_FUNC(prefs_common_ok), NULL);
1017 gtk_signal_connect (GTK_OBJECT(dialog.apply_btn), "clicked",
1018 GTK_SIGNAL_FUNC(prefs_common_apply), NULL);
1019 gtk_signal_connect_object (GTK_OBJECT(dialog.cancel_btn), "clicked",
1020 GTK_SIGNAL_FUNC(prefs_common_cancel),
1021 GTK_OBJECT(dialog.window));
1023 /* create all widgets on notebook */
1024 prefs_receive_create();
1025 SET_NOTEBOOK_LABEL(dialog.notebook, _("Receive"), page++);
1026 prefs_send_create();
1027 SET_NOTEBOOK_LABEL(dialog.notebook, _("Send"), page++);
1028 prefs_compose_create();
1029 SET_NOTEBOOK_LABEL(dialog.notebook, _("Compose"), page++);
1031 prefs_spelling_create();
1032 SET_NOTEBOOK_LABEL(dialog.notebook, _("Spell Checker"), page++);
1034 prefs_quote_create();
1035 SET_NOTEBOOK_LABEL(dialog.notebook, _("Quote"), page++);
1036 prefs_display_create();
1037 SET_NOTEBOOK_LABEL(dialog.notebook, _("Display"), page++);
1038 prefs_message_create();
1039 SET_NOTEBOOK_LABEL(dialog.notebook, _("Message"), page++);
1041 prefs_privacy_create();
1042 SET_NOTEBOOK_LABEL(dialog.notebook, _("Privacy"), page++);
1044 prefs_interface_create();
1045 SET_NOTEBOOK_LABEL(dialog.notebook, _("Interface"), page++);
1046 prefs_other_create();
1047 SET_NOTEBOOK_LABEL(dialog.notebook, _("Other"), page++);
1049 gtk_widget_show_all(dialog.window);
1052 static void prefs_receive_create(void)
1056 GtkWidget *frame_incext;
1057 GtkWidget *checkbtn_incext;
1059 GtkWidget *label_incext;
1060 GtkWidget *entry_incext;
1061 /* GtkWidget *button_incext; */
1063 GtkWidget *frame_spool;
1064 GtkWidget *checkbtn_local;
1065 GtkWidget *checkbtn_filter_on_inc;
1066 GtkWidget *label_spool;
1067 GtkWidget *entry_spool;
1069 GtkWidget *hbox_autochk;
1070 GtkWidget *checkbtn_autochk;
1071 GtkWidget *label_autochk1;
1072 GtkObject *spinbtn_autochk_adj;
1073 GtkWidget *spinbtn_autochk;
1074 GtkWidget *label_autochk2;
1075 GtkWidget *checkbtn_chkonstartup;
1076 GtkWidget *checkbtn_scan_after_inc;
1079 GtkWidget *frame_newmail;
1080 GtkWidget *hbox_newmail_notify;
1081 GtkWidget *checkbtn_newmail_auto;
1082 GtkWidget *checkbtn_newmail_manu;
1083 GtkWidget *entry_newmail_notify_cmd;
1084 GtkWidget *label_newmail_notify_cmd;
1086 vbox1 = gtk_vbox_new (FALSE, VSPACING);
1087 gtk_widget_show (vbox1);
1088 gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
1089 gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
1091 PACK_FRAME(vbox1, frame_incext, _("External program"));
1093 vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW);
1094 gtk_widget_show (vbox2);
1095 gtk_container_add (GTK_CONTAINER (frame_incext), vbox2);
1096 gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
1098 /* Use of external incorporation program */
1099 PACK_CHECK_BUTTON (vbox2, checkbtn_incext,
1100 _("Use external program for incorporation"));
1102 hbox = gtk_hbox_new (FALSE, 8);
1103 gtk_widget_show (hbox);
1104 gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
1105 SET_TOGGLE_SENSITIVITY (checkbtn_incext, hbox);
1107 label_incext = gtk_label_new (_("Command"));
1108 gtk_widget_show (label_incext);
1109 gtk_box_pack_start (GTK_BOX (hbox), label_incext, FALSE, FALSE, 0);
1111 entry_incext = gtk_entry_new ();
1112 gtk_widget_show (entry_incext);
1113 gtk_box_pack_start (GTK_BOX (hbox), entry_incext, TRUE, TRUE, 0);
1116 button_incext = gtk_button_new_with_label ("... ");
1117 gtk_widget_show (button_incext);
1118 gtk_box_pack_start (GTK_BOX (hbox), button_incext, FALSE, FALSE, 0);
1121 PACK_FRAME(vbox1, frame_spool, _("Local spool"));
1123 vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW);
1124 gtk_widget_show (vbox2);
1125 gtk_container_add (GTK_CONTAINER (frame_spool), vbox2);
1126 gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
1128 hbox = gtk_hbox_new (FALSE, 32);
1129 gtk_widget_show (hbox);
1130 gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
1132 PACK_CHECK_BUTTON (hbox, checkbtn_local, _("Incorporate from spool"));
1133 PACK_CHECK_BUTTON (hbox, checkbtn_filter_on_inc,
1134 _("Filter on incorporation"));
1135 SET_TOGGLE_SENSITIVITY (checkbtn_local, checkbtn_filter_on_inc);
1137 hbox = gtk_hbox_new (FALSE, 8);
1138 gtk_widget_show (hbox);
1139 gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
1140 SET_TOGGLE_SENSITIVITY (checkbtn_local, hbox);
1142 label_spool = gtk_label_new (_("Spool directory"));
1143 gtk_widget_show (label_spool);
1144 gtk_box_pack_start (GTK_BOX (hbox), label_spool, FALSE, FALSE, 0);
1146 entry_spool = gtk_entry_new ();
1147 gtk_widget_show (entry_spool);
1148 gtk_box_pack_start (GTK_BOX (hbox), entry_spool, TRUE, TRUE, 0);
1150 vbox2 = gtk_vbox_new (FALSE, 0);
1151 gtk_widget_show (vbox2);
1152 gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
1155 hbox_autochk = gtk_hbox_new (FALSE, 8);
1156 gtk_widget_show (hbox_autochk);
1157 gtk_box_pack_start (GTK_BOX (vbox2), hbox_autochk, FALSE, FALSE, 0);
1159 PACK_CHECK_BUTTON (hbox_autochk, checkbtn_autochk,
1160 _("Auto-check new mail"));
1162 label_autochk1 = gtk_label_new (_("every"));
1163 gtk_widget_show (label_autochk1);
1164 gtk_box_pack_start (GTK_BOX (hbox_autochk), label_autochk1, FALSE, FALSE, 0);
1166 spinbtn_autochk_adj = gtk_adjustment_new (5, 1, 100, 1, 10, 10);
1167 spinbtn_autochk = gtk_spin_button_new
1168 (GTK_ADJUSTMENT (spinbtn_autochk_adj), 1, 0);
1169 gtk_widget_show (spinbtn_autochk);
1170 gtk_box_pack_start (GTK_BOX (hbox_autochk), spinbtn_autochk, FALSE, FALSE, 0);
1171 gtk_widget_set_usize (spinbtn_autochk, 64, -1);
1172 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_autochk), TRUE);
1174 label_autochk2 = gtk_label_new (_("minute(s)"));
1175 gtk_widget_show (label_autochk2);
1176 gtk_box_pack_start (GTK_BOX (hbox_autochk), label_autochk2, FALSE, FALSE, 0);
1178 SET_TOGGLE_SENSITIVITY(checkbtn_autochk, label_autochk1);
1179 SET_TOGGLE_SENSITIVITY(checkbtn_autochk, spinbtn_autochk);
1180 SET_TOGGLE_SENSITIVITY(checkbtn_autochk, label_autochk2);
1182 PACK_CHECK_BUTTON (vbox2, checkbtn_chkonstartup,
1183 _("Check new mail on startup"));
1184 PACK_CHECK_BUTTON (vbox2, checkbtn_scan_after_inc,
1185 _("Update all local folders after incorporation"));
1188 PACK_FRAME(vbox1, frame_newmail, _("Run command when new mail "
1190 vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW);
1191 gtk_widget_show (vbox2);
1192 gtk_container_add (GTK_CONTAINER (frame_newmail), vbox2);
1193 gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
1195 hbox = gtk_hbox_new (TRUE, 8);
1196 gtk_widget_show (hbox);
1197 PACK_CHECK_BUTTON (hbox, checkbtn_newmail_auto,
1198 _("after autochecking"));
1199 PACK_CHECK_BUTTON (hbox, checkbtn_newmail_manu,
1200 _("after manual checking"));
1201 gtk_box_pack_start (GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
1202 gtk_signal_connect(GTK_OBJECT(checkbtn_newmail_auto), "toggled",
1203 GTK_SIGNAL_FUNC(prefs_common_recv_dialog_newmail_notify_toggle_cb),
1205 gtk_signal_connect(GTK_OBJECT(checkbtn_newmail_manu), "toggled",
1206 GTK_SIGNAL_FUNC(prefs_common_recv_dialog_newmail_notify_toggle_cb),
1209 hbox_newmail_notify = gtk_hbox_new (FALSE, 8);
1210 gtk_widget_show (hbox);
1211 gtk_box_pack_start (GTK_BOX (vbox2), hbox_newmail_notify, FALSE,
1214 label_newmail_notify_cmd = gtk_label_new (_("Command to execute:\n"
1215 "(use %d as number of new "
1217 gtk_label_set_justify(GTK_LABEL(label_newmail_notify_cmd),
1219 gtk_widget_show (label_newmail_notify_cmd);
1220 gtk_box_pack_start (GTK_BOX (hbox_newmail_notify),
1221 label_newmail_notify_cmd, FALSE, FALSE, 0);
1223 entry_newmail_notify_cmd = gtk_entry_new ();
1224 gtk_widget_show (entry_newmail_notify_cmd);
1225 gtk_box_pack_start (GTK_BOX (hbox_newmail_notify),
1226 entry_newmail_notify_cmd, TRUE, TRUE, 0);
1228 gtk_widget_set_sensitive(hbox_newmail_notify,
1229 prefs_common.newmail_notify_auto ||
1230 prefs_common.newmail_notify_manu);
1232 receive.checkbtn_incext = checkbtn_incext;
1233 receive.entry_incext = entry_incext;
1234 /* receive.button_incext = button_incext; */
1236 receive.checkbtn_local = checkbtn_local;
1237 receive.checkbtn_filter_on_inc = checkbtn_filter_on_inc;
1238 receive.entry_spool = entry_spool;
1240 receive.checkbtn_autochk = checkbtn_autochk;
1241 receive.spinbtn_autochk = spinbtn_autochk;
1242 receive.spinbtn_autochk_adj = spinbtn_autochk_adj;
1244 receive.checkbtn_chkonstartup = checkbtn_chkonstartup;
1245 receive.checkbtn_scan_after_inc = checkbtn_scan_after_inc;
1248 receive.checkbtn_newmail_auto = checkbtn_newmail_auto;
1249 receive.checkbtn_newmail_manu = checkbtn_newmail_manu;
1250 receive.hbox_newmail_notify = hbox_newmail_notify;
1251 receive.entry_newmail_notify_cmd = entry_newmail_notify_cmd;
1254 static void prefs_send_create(void)
1258 GtkWidget *frame_extsend;
1259 GtkWidget *vbox_extsend;
1260 GtkWidget *checkbtn_extsend;
1262 GtkWidget *label_extsend;
1263 GtkWidget *entry_extsend;
1264 /* GtkWidget *button_extsend; */
1265 GtkWidget *checkbtn_savemsg;
1266 GtkWidget *checkbtn_queuemsg;
1267 GtkWidget *label_outcharset;
1268 GtkWidget *optmenu_charset;
1269 GtkWidget *optmenu_menu;
1270 GtkWidget *menuitem;
1271 GtkWidget *label_charset_desc;
1272 GtkWidget *optmenu_encoding;
1273 GtkWidget *label_encoding;
1274 GtkWidget *label_encoding_desc;
1276 vbox1 = gtk_vbox_new (FALSE, VSPACING);
1277 gtk_widget_show (vbox1);
1278 gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
1279 gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
1281 PACK_FRAME(vbox1, frame_extsend, _("External program"));
1283 vbox_extsend = gtk_vbox_new (FALSE, VSPACING_NARROW);
1284 gtk_widget_show (vbox_extsend);
1285 gtk_container_add (GTK_CONTAINER (frame_extsend), vbox_extsend);
1286 gtk_container_set_border_width (GTK_CONTAINER (vbox_extsend), 8);
1288 PACK_CHECK_BUTTON (vbox_extsend, checkbtn_extsend,
1289 _("Use external program for sending"));
1291 hbox1 = gtk_hbox_new (FALSE, 8);
1292 gtk_widget_show (hbox1);
1293 gtk_box_pack_start (GTK_BOX (vbox_extsend), hbox1, FALSE, FALSE, 0);
1294 SET_TOGGLE_SENSITIVITY(checkbtn_extsend, hbox1);
1296 label_extsend = gtk_label_new (_("Command"));
1297 gtk_widget_show (label_extsend);
1298 gtk_box_pack_start (GTK_BOX (hbox1), label_extsend, FALSE, FALSE, 0);
1300 entry_extsend = gtk_entry_new ();
1301 gtk_widget_show (entry_extsend);
1302 gtk_box_pack_start (GTK_BOX (hbox1), entry_extsend, TRUE, TRUE, 0);
1305 button_extsend = gtk_button_new_with_label ("... ");
1306 gtk_widget_show (button_extsend);
1307 gtk_box_pack_start (GTK_BOX (hbox1), button_extsend, FALSE, FALSE, 0);
1310 vbox2 = gtk_vbox_new (FALSE, 0);
1311 gtk_widget_show (vbox2);
1312 gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
1314 PACK_CHECK_BUTTON (vbox2, checkbtn_savemsg,
1315 _("Save sent messages to Sent folder"));
1316 PACK_CHECK_BUTTON (vbox2, checkbtn_queuemsg,
1317 _("Queue messages that fail to send"));
1319 hbox1 = gtk_hbox_new (FALSE, 8);
1320 gtk_widget_show (hbox1);
1321 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
1323 label_outcharset = gtk_label_new (_("Outgoing codeset"));
1324 gtk_widget_show (label_outcharset);
1325 gtk_box_pack_start (GTK_BOX (hbox1), label_outcharset, FALSE, FALSE, 0);
1327 optmenu_charset = gtk_option_menu_new ();
1328 gtk_widget_show (optmenu_charset);
1329 gtk_box_pack_start (GTK_BOX (hbox1), optmenu_charset, FALSE, FALSE, 0);
1331 optmenu_menu = gtk_menu_new ();
1333 #define SET_MENUITEM(str, data) \
1335 MENUITEM_ADD(optmenu_menu, menuitem, str, data); \
1338 SET_MENUITEM(_("Automatic (Recommended)"), CS_AUTO);
1339 SET_MENUITEM(_("7bit ascii (US-ASCII)"), CS_US_ASCII);
1341 SET_MENUITEM(_("Unicode (UTF-8)"), CS_UTF_8);
1343 SET_MENUITEM(_("Western European (ISO-8859-1)"), CS_ISO_8859_1);
1344 SET_MENUITEM(_("Western European (ISO-8859-15)"), CS_ISO_8859_15);
1345 SET_MENUITEM(_("Central European (ISO-8859-2)"), CS_ISO_8859_2);
1346 SET_MENUITEM(_("Baltic (ISO-8859-13)"), CS_ISO_8859_13);
1347 SET_MENUITEM(_("Baltic (ISO-8859-4)"), CS_ISO_8859_4);
1348 SET_MENUITEM(_("Greek (ISO-8859-7)"), CS_ISO_8859_7);
1349 SET_MENUITEM(_("Turkish (ISO-8859-9)"), CS_ISO_8859_9);
1351 SET_MENUITEM(_("Cyrillic (ISO-8859-5)"), CS_ISO_8859_5);
1353 SET_MENUITEM(_("Cyrillic (KOI8-R)"), CS_KOI8_R);
1355 SET_MENUITEM(_("Cyrillic (Windows-1251)"), CS_WINDOWS_1251);
1356 SET_MENUITEM(_("Cyrillic (KOI8-U)"), CS_KOI8_U);
1358 SET_MENUITEM(_("Japanese (ISO-2022-JP)"), CS_ISO_2022_JP);
1360 SET_MENUITEM(_("Japanese (EUC-JP)"), CS_EUC_JP);
1361 SET_MENUITEM(_("Japanese (Shift_JIS)"), CS_SHIFT_JIS);
1363 SET_MENUITEM(_("Simplified Chinese (GB2312)"), CS_GB2312);
1364 SET_MENUITEM(_("Traditional Chinese (Big5)"), CS_BIG5);
1366 SET_MENUITEM(_("Traditional Chinese (EUC-TW)"), CS_EUC_TW);
1367 SET_MENUITEM(_("Chinese (ISO-2022-CN)"), CS_ISO_2022_CN);
1369 SET_MENUITEM(_("Korean (EUC-KR)"), CS_EUC_KR);
1370 SET_MENUITEM(_("Thai (TIS-620)"), CS_TIS_620);
1371 SET_MENUITEM(_("Thai (Windows-874)"), CS_WINDOWS_874);
1373 gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_charset),
1376 hbox1 = gtk_hbox_new (FALSE, 8);
1377 gtk_widget_show (hbox1);
1378 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
1380 label_charset_desc = gtk_label_new
1381 (_("If `Automatic' is selected, the optimal encoding\n"
1382 "for the current locale will be used."));
1383 gtk_widget_show (label_charset_desc);
1384 gtk_box_pack_start (GTK_BOX (hbox1), label_charset_desc,
1386 gtk_label_set_justify (GTK_LABEL (label_charset_desc),
1389 hbox1 = gtk_hbox_new (FALSE, 8);
1390 gtk_widget_show (hbox1);
1391 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
1393 label_encoding = gtk_label_new (_("Transfer encoding"));
1394 gtk_widget_show (label_encoding);
1395 gtk_box_pack_start (GTK_BOX (hbox1), label_encoding, FALSE, FALSE, 0);
1397 optmenu_encoding = gtk_option_menu_new ();
1398 gtk_widget_show (optmenu_encoding);
1399 gtk_box_pack_start (GTK_BOX (hbox1), optmenu_encoding, FALSE, FALSE, 0);
1401 optmenu_menu = gtk_menu_new ();
1403 SET_MENUITEM(_("Automatic"), CTE_AUTO);
1404 SET_MENUITEM("base64", CTE_BASE64);
1405 SET_MENUITEM("quoted-printable", CTE_QUOTED_PRINTABLE);
1406 SET_MENUITEM("8bit", CTE_8BIT);
1408 gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_encoding),
1411 hbox1 = gtk_hbox_new (FALSE, 8);
1412 gtk_widget_show (hbox1);
1413 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
1415 label_encoding_desc = gtk_label_new
1416 (_("Specify Content-Transfer-Encoding used when\n"
1417 "message body contains non-ASCII characters."));
1418 gtk_widget_show (label_encoding_desc);
1419 gtk_box_pack_start (GTK_BOX (hbox1), label_encoding_desc,
1421 gtk_label_set_justify (GTK_LABEL (label_encoding_desc),
1424 p_send.checkbtn_extsend = checkbtn_extsend;
1425 p_send.entry_extsend = entry_extsend;
1426 /* p_send.button_extsend = button_extsend; */
1428 p_send.checkbtn_savemsg = checkbtn_savemsg;
1429 p_send.checkbtn_queuemsg = checkbtn_queuemsg;
1431 p_send.optmenu_charset = optmenu_charset;
1432 p_send.optmenu_encoding_method = optmenu_encoding;
1435 static void prefs_common_recv_dialog_newmail_notify_toggle_cb(GtkWidget *w, gpointer data)
1439 toggled = gtk_toggle_button_get_active
1440 (GTK_TOGGLE_BUTTON(receive.checkbtn_newmail_manu)) ||
1441 gtk_toggle_button_get_active
1442 (GTK_TOGGLE_BUTTON(receive.checkbtn_newmail_auto));
1443 gtk_widget_set_sensitive(receive.hbox_newmail_notify, toggled);
1447 static void prefs_dictionary_set_data_from_optmenu(PrefParam *param)
1450 gchar *dict_fullname;
1452 g_return_if_fail(param);
1453 g_return_if_fail(param->data);
1454 g_return_if_fail(param->widget);
1455 g_return_if_fail(*(param->widget));
1457 dict_fullname = gtkaspell_get_dictionary_menu_active_item
1458 (gtk_option_menu_get_menu(GTK_OPTION_MENU(*(param->widget))));
1459 str = *((gchar **) param->data);
1462 *((gchar **) param->data) = dict_fullname;
1465 static void prefs_dictionary_set_optmenu(PrefParam *pparam)
1468 GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget);
1470 GtkWidget *menuitem;
1474 g_return_if_fail(optmenu != NULL);
1475 g_return_if_fail(pparam->data != NULL);
1477 if (*(gchar **) pparam->data) {
1478 menu = gtk_option_menu_get_menu(optmenu);
1479 for (cur = GTK_MENU_SHELL(menu)->children;
1480 cur != NULL; cur = cur->next) {
1481 menuitem = GTK_WIDGET(cur->data);
1482 dict_name = gtk_object_get_data(GTK_OBJECT(menuitem),
1484 if (!strcmp2(dict_name, *((gchar **)pparam->data))) {
1485 gtk_option_menu_set_history(optmenu, n);
1492 gtk_option_menu_set_history(optmenu, 0);
1493 prefs_dictionary_set_data_from_optmenu(pparam);
1496 static void prefs_speller_sugmode_set_data_from_optmenu(PrefParam *param)
1499 g_return_if_fail(param);
1500 g_return_if_fail(param->data);
1501 g_return_if_fail(param->widget);
1502 g_return_if_fail(*(param->widget));
1504 sugmode = gtkaspell_get_sugmode_from_option_menu
1505 (GTK_OPTION_MENU(*(param->widget)));
1506 *((gint *) param->data) = sugmode;
1509 static void prefs_speller_sugmode_set_optmenu(PrefParam *pparam)
1511 GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget);
1514 g_return_if_fail(optmenu != NULL);
1515 g_return_if_fail(pparam->data != NULL);
1517 sugmode = *(gint *) pparam->data;
1518 gtkaspell_sugmode_option_menu_set(optmenu, sugmode);
1522 static void prefs_spelling_checkbtn_enable_aspell_toggle_cb
1528 toggled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1530 gtk_widget_set_sensitive(spelling.entry_aspell_path, toggled);
1531 gtk_widget_set_sensitive(spelling.optmenu_dictionary, toggled);
1532 gtk_widget_set_sensitive(spelling.optmenu_sugmode, toggled);
1533 gtk_widget_set_sensitive(spelling.btn_aspell_path, toggled);
1534 gtk_widget_set_sensitive(spelling.misspelled_btn, toggled);
1535 gtk_widget_set_sensitive(spelling.checkbtn_use_alternate, toggled);
1536 gtk_widget_set_sensitive(spelling.checkbtn_check_while_typing, toggled);
1539 static void prefs_spelling_btn_aspell_path_clicked_cb(GtkWidget *widget,
1542 gchar *file_path, *tmp;
1543 GtkWidget *new_menu;
1545 file_path = filesel_select_file(_("Select dictionaries location"),
1546 prefs_common.aspell_path);
1547 if (file_path == NULL) {
1551 tmp=g_dirname(file_path);
1553 if (prefs_common.aspell_path)
1554 g_free(prefs_common.aspell_path);
1555 prefs_common.aspell_path = g_strdup_printf("%s%s",tmp,
1558 new_menu = gtkaspell_dictionary_option_menu_new(prefs_common.aspell_path);
1559 gtk_option_menu_set_menu(GTK_OPTION_MENU(spelling.optmenu_dictionary),
1562 gtk_entry_set_text(GTK_ENTRY(spelling.entry_aspell_path),
1563 prefs_common.aspell_path);
1564 /* select first one */
1565 gtk_option_menu_set_history(GTK_OPTION_MENU(
1566 spelling.optmenu_dictionary), 0);
1568 if (prefs_common.dictionary)
1569 g_free(prefs_common.dictionary);
1571 prefs_common.dictionary =
1572 gtkaspell_get_dictionary_menu_active_item(
1573 gtk_option_menu_get_menu(
1575 spelling.optmenu_dictionary)));
1581 static void prefs_spelling_create()
1584 GtkWidget *frame_spell;
1585 GtkWidget *vbox_spell;
1586 GtkWidget *hbox_aspell_path;
1587 GtkWidget *checkbtn_enable_aspell;
1588 GtkWidget *label_aspell_path;
1589 GtkWidget *entry_aspell_path;
1590 GtkWidget *btn_aspell_path;
1591 GtkWidget *spell_table;
1592 GtkWidget *label_dictionary;
1593 GtkWidget *optmenu_dictionary;
1594 GtkWidget *sugmode_label;
1595 GtkWidget *sugmode_optmenu;
1596 GtkWidget *checkbtn_use_alternate;
1597 GtkWidget *help_label;
1598 GtkWidget *checkbtn_check_while_typing;
1599 GtkWidget *color_label;
1600 GtkWidget *col_align;
1602 vbox1 = gtk_vbox_new (FALSE, VSPACING);
1603 gtk_widget_show (vbox1);
1604 gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
1605 gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
1607 /* spell checker defaults */
1608 PACK_FRAME(vbox1, frame_spell, _("Global spelling checker settings"));
1609 vbox_spell = gtk_vbox_new(FALSE, VSPACING_NARROW);
1610 gtk_widget_show (vbox_spell);
1611 gtk_container_add(GTK_CONTAINER(frame_spell), vbox_spell);
1612 gtk_container_set_border_width(GTK_CONTAINER(vbox_spell), 8);
1614 PACK_CHECK_BUTTON(vbox_spell, checkbtn_enable_aspell,
1615 _("Enable spell checker"));
1617 gtk_signal_connect(GTK_OBJECT(checkbtn_enable_aspell), "toggled",
1618 GTK_SIGNAL_FUNC(prefs_spelling_checkbtn_enable_aspell_toggle_cb),
1621 /* Check while typing */
1622 PACK_CHECK_BUTTON(vbox_spell, checkbtn_check_while_typing,
1623 _("Check while typing"));
1625 PACK_CHECK_BUTTON(vbox_spell, checkbtn_use_alternate,
1626 _("Enable alternate dictionary"));
1628 help_label = gtk_label_new(_("Enabling an alternate dictionary makes switching\n"
1629 "with the last used dictionary faster."));
1630 gtk_misc_set_alignment (GTK_MISC (help_label), 0, 0);
1631 gtk_widget_show(help_label);
1632 gtk_box_pack_start(GTK_BOX(vbox_spell), help_label, FALSE, TRUE, 0);
1634 spell_table = gtk_table_new(4, 3, FALSE);
1635 gtk_container_set_border_width (GTK_CONTAINER (spell_table), VSPACING);
1636 gtk_table_set_row_spacings(GTK_TABLE(spell_table), 8);
1637 gtk_table_set_col_spacings(GTK_TABLE(spell_table), 8);
1639 gtk_box_pack_start(GTK_BOX(vbox_spell), spell_table, TRUE, TRUE, 0);
1641 label_aspell_path = gtk_label_new (_("Dictionaries path:"));
1642 gtk_misc_set_alignment(GTK_MISC(label_aspell_path), 1.0, 0.5);
1643 gtk_widget_show(label_aspell_path);
1644 gtk_table_attach (GTK_TABLE (spell_table), label_aspell_path, 0, 1, 0,
1645 1, GTK_FILL, (GTK_EXPAND | GTK_FILL), 0, 0);
1647 hbox_aspell_path = gtk_hbox_new (FALSE, 8);
1648 gtk_table_attach (GTK_TABLE (spell_table), hbox_aspell_path, 1, 2, 0,
1649 1, GTK_FILL, (GTK_EXPAND | GTK_FILL), 0, 0);
1650 gtk_widget_show(hbox_aspell_path);
1652 entry_aspell_path = gtk_entry_new();
1653 gtk_widget_show(entry_aspell_path);
1654 gtk_box_pack_start(GTK_BOX(hbox_aspell_path), entry_aspell_path, TRUE,
1657 gtk_widget_set_sensitive(entry_aspell_path, prefs_common.enable_aspell);
1659 btn_aspell_path = gtk_button_new_with_label(" ... ");
1660 gtk_widget_show(btn_aspell_path);
1661 gtk_box_pack_start(GTK_BOX(hbox_aspell_path), btn_aspell_path, FALSE, FALSE, 0);
1662 gtk_widget_set_sensitive(btn_aspell_path, prefs_common.enable_aspell);
1664 gtk_signal_connect(GTK_OBJECT(btn_aspell_path), "clicked",
1665 GTK_SIGNAL_FUNC(prefs_spelling_btn_aspell_path_clicked_cb),
1668 label_dictionary = gtk_label_new(_("Default dictionary:"));
1669 gtk_misc_set_alignment(GTK_MISC(label_dictionary), 1.0, 0.5);
1670 gtk_widget_show(label_dictionary);
1671 gtk_table_attach (GTK_TABLE (spell_table), label_dictionary, 0, 1, 1, 2,
1672 GTK_FILL, (GTK_EXPAND | GTK_FILL), 0, 0);
1674 optmenu_dictionary = gtk_option_menu_new();
1675 gtk_widget_show(optmenu_dictionary);
1676 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu_dictionary),
1677 gtkaspell_dictionary_option_menu_new(
1678 prefs_common.aspell_path));
1679 gtk_table_attach (GTK_TABLE (spell_table), optmenu_dictionary, 1, 2, 1,
1680 2, GTK_FILL, (GTK_EXPAND | GTK_FILL), 0, 0);
1681 gtk_widget_set_sensitive(optmenu_dictionary, prefs_common.enable_aspell);
1683 /* Suggestion mode */
1684 sugmode_label = gtk_label_new(_("Default suggestion mode"));
1685 gtk_misc_set_alignment(GTK_MISC(sugmode_label), 1.0, 0.5);
1686 gtk_widget_show(sugmode_label);
1687 gtk_table_attach(GTK_TABLE (spell_table), sugmode_label, 0, 1, 2, 3,
1688 GTK_FILL, (GTK_EXPAND | GTK_FILL), 0, 0);
1690 sugmode_optmenu = gtk_option_menu_new();
1691 gtk_widget_show(sugmode_optmenu);
1692 gtk_option_menu_set_menu(GTK_OPTION_MENU(sugmode_optmenu),
1693 gtkaspell_sugmode_option_menu_new(prefs_common.aspell_sugmode));
1694 gtk_table_attach(GTK_TABLE(spell_table), sugmode_optmenu, 1, 2, 2, 3,
1695 GTK_FILL, (GTK_EXPAND | GTK_FILL), 0, 0);
1696 gtk_widget_set_sensitive(sugmode_optmenu, prefs_common.enable_aspell);
1699 color_label = gtk_label_new(_("Misspelled word color:"));
1700 gtk_misc_set_alignment(GTK_MISC(color_label), 1.0, 0.5);
1701 gtk_table_attach (GTK_TABLE (spell_table), color_label, 0, 1, 3, 4,
1702 GTK_FILL, GTK_SHRINK, 0, 0);
1703 gtk_widget_show(color_label);
1705 col_align = gtk_alignment_new(0.0, 0.5, 0, 0);
1706 gtk_widget_show(col_align);
1707 gtk_table_attach (GTK_TABLE (spell_table), col_align, 1, 2, 3, 4,
1708 GTK_FILL, GTK_SHRINK, 0, 0);
1710 spelling.misspelled_btn = gtk_button_new_with_label ("");
1711 set_button_bg_color(spelling.misspelled_btn,
1712 prefs_common.misspelled_col);
1713 gtk_widget_set_usize (spelling.misspelled_btn, 30, 20);
1714 gtk_widget_set_sensitive(spelling.misspelled_btn, prefs_common.enable_aspell);
1715 gtk_signal_connect (GTK_OBJECT (spelling.misspelled_btn), "clicked",
1716 GTK_SIGNAL_FUNC(quote_color_set_dialog), "Misspelled word");
1717 gtk_container_add(GTK_CONTAINER(col_align), spelling.misspelled_btn);
1720 spelling.checkbtn_enable_aspell = checkbtn_enable_aspell;
1721 spelling.entry_aspell_path = entry_aspell_path;
1722 spelling.btn_aspell_path = btn_aspell_path;
1723 spelling.optmenu_dictionary = optmenu_dictionary;
1724 spelling.optmenu_sugmode = sugmode_optmenu;
1725 spelling.checkbtn_use_alternate = checkbtn_use_alternate;
1726 spelling.checkbtn_check_while_typing = checkbtn_check_while_typing;
1732 static void prefs_compose_create(void)
1737 GtkWidget *checkbtn_autoextedit;
1739 GtkWidget *frame_autosel;
1740 GtkWidget *hbox_autosel;
1741 GtkWidget *checkbtn_reply_account_autosel;
1742 GtkWidget *checkbtn_forward_account_autosel;
1743 GtkWidget *checkbtn_reedit_account_autosel;
1745 GtkWidget *hbox_undolevel;
1746 GtkWidget *label_undolevel;
1747 GtkObject *spinbtn_undolevel_adj;
1748 GtkWidget *spinbtn_undolevel;
1750 GtkWidget *vbox_linewrap;
1755 GtkWidget *label_linewrap;
1756 GtkObject *spinbtn_linewrap_adj;
1757 GtkWidget *spinbtn_linewrap;
1758 GtkWidget *checkbtn_wrapquote;
1759 GtkWidget *checkbtn_autowrap;
1760 GtkWidget *checkbtn_wrapatsend;
1762 GtkWidget *checkbtn_default_reply_list;
1764 GtkWidget *checkbtn_forward_as_attachment;
1765 GtkWidget *checkbtn_redirect_keep_from;
1766 GtkWidget *checkbtn_smart_wrapping;
1767 GtkWidget *checkbtn_block_cursor;
1768 GtkWidget *frame_msgwrap;
1770 GtkWidget *hbox_autosave;
1771 GtkWidget *checkbtn_autosave;
1772 GtkWidget *entry_autosave_length;
1773 GtkWidget *label_autosave_length;
1775 vbox1 = gtk_vbox_new (FALSE, VSPACING);
1776 gtk_widget_show (vbox1);
1777 gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
1778 gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
1780 /* Account autoselection */
1781 PACK_FRAME(vbox1, frame_autosel, _("Automatic account selection"));
1783 hbox_autosel = gtk_hbox_new (FALSE, VSPACING_NARROW);
1784 gtk_widget_show (hbox_autosel);
1785 gtk_container_add (GTK_CONTAINER (frame_autosel), hbox_autosel);
1786 gtk_container_set_border_width (GTK_CONTAINER (hbox_autosel), 8);
1788 PACK_CHECK_BUTTON (hbox_autosel, checkbtn_reply_account_autosel,
1789 _("when replying"));
1790 PACK_CHECK_BUTTON (hbox_autosel, checkbtn_forward_account_autosel,
1791 _("when forwarding"));
1792 PACK_CHECK_BUTTON (hbox_autosel, checkbtn_reedit_account_autosel,
1793 _("when re-editing"));
1795 vbox2 = gtk_vbox_new (FALSE, 0);
1796 gtk_widget_show (vbox2);
1797 gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
1799 PACK_CHECK_BUTTON (vbox2, checkbtn_default_reply_list,
1800 _("Reply button invokes mailing list reply"));
1802 PACK_CHECK_BUTTON (vbox2, checkbtn_autoextedit,
1803 _("Automatically launch the external editor"));
1805 hbox5 = gtk_hbox_new (FALSE, 8);
1806 gtk_widget_show (hbox5);
1807 gtk_box_pack_start (GTK_BOX (vbox2), hbox5, FALSE, FALSE, 0);
1809 PACK_CHECK_BUTTON (hbox5, checkbtn_forward_as_attachment,
1810 _("Forward as attachment"));
1812 PACK_CHECK_BUTTON (hbox5, checkbtn_block_cursor,
1815 PACK_CHECK_BUTTON (vbox2, checkbtn_redirect_keep_from,
1816 _("Keep the original 'From' header when redirecting"));
1819 hbox_autosave = gtk_hbox_new (FALSE, 8);
1820 gtk_widget_show (hbox_autosave);
1821 gtk_box_pack_start (GTK_BOX (vbox1), hbox_autosave, FALSE, FALSE, 0);
1823 PACK_CHECK_BUTTON (hbox_autosave, checkbtn_autosave,
1824 _("Autosave to Drafts folder every "));
1826 entry_autosave_length = gtk_entry_new();
1827 gtk_widget_set_usize (entry_autosave_length, 64, -1);
1828 gtk_widget_show (entry_autosave_length);
1829 gtk_box_pack_start (GTK_BOX (hbox_autosave), entry_autosave_length, FALSE, FALSE, 0);
1831 label_autosave_length = gtk_label_new(_("characters"));
1832 gtk_widget_show (label_autosave_length);
1833 gtk_box_pack_start (GTK_BOX (hbox_autosave), label_autosave_length, FALSE, FALSE, 0);
1835 hbox_undolevel = gtk_hbox_new (FALSE, 8);
1836 gtk_widget_show (hbox_undolevel);
1837 gtk_box_pack_start (GTK_BOX (vbox1), hbox_undolevel, FALSE, FALSE, 0);
1839 label_undolevel = gtk_label_new (_("Undo level"));
1840 gtk_widget_show (label_undolevel);
1841 gtk_box_pack_start (GTK_BOX (hbox_undolevel), label_undolevel, FALSE, FALSE, 0);
1843 spinbtn_undolevel_adj = gtk_adjustment_new (50, 0, 100, 1, 10, 10);
1844 spinbtn_undolevel = gtk_spin_button_new
1845 (GTK_ADJUSTMENT (spinbtn_undolevel_adj), 1, 0);
1846 gtk_widget_show (spinbtn_undolevel);
1847 gtk_box_pack_start (GTK_BOX (hbox_undolevel), spinbtn_undolevel, FALSE, FALSE, 0);
1848 gtk_widget_set_usize (spinbtn_undolevel, 64, -1);
1849 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_undolevel), TRUE);
1852 PACK_FRAME(vbox1, frame_msgwrap, _("Message wrapping"));
1854 vbox_linewrap = gtk_vbox_new (FALSE, VSPACING_NARROW);
1855 gtk_widget_show (vbox_linewrap);
1856 gtk_container_add (GTK_CONTAINER (frame_msgwrap), vbox_linewrap);
1857 gtk_container_set_border_width (GTK_CONTAINER (vbox_linewrap), 8);
1859 hbox3 = gtk_hbox_new (FALSE, 8);
1860 gtk_widget_show (hbox3);
1861 gtk_box_pack_start (GTK_BOX (vbox_linewrap), hbox3, FALSE, FALSE, 0);
1864 label_linewrap = gtk_label_new (_("Wrap messages at"));
1865 gtk_widget_show (label_linewrap);
1866 gtk_box_pack_start (GTK_BOX (hbox3), label_linewrap, FALSE, FALSE, 0);
1868 spinbtn_linewrap_adj = gtk_adjustment_new (72, 20, 1024, 1, 10, 10);
1869 spinbtn_linewrap = gtk_spin_button_new
1870 (GTK_ADJUSTMENT (spinbtn_linewrap_adj), 1, 0);
1871 gtk_widget_show (spinbtn_linewrap);
1872 gtk_box_pack_start (GTK_BOX (hbox3), spinbtn_linewrap, FALSE, FALSE, 0);
1873 gtk_widget_set_usize (spinbtn_linewrap, 64, -1);
1874 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_linewrap), TRUE);
1876 label_linewrap = gtk_label_new (_("characters"));
1877 gtk_widget_show (label_linewrap);
1878 gtk_box_pack_start (GTK_BOX (hbox3), label_linewrap, FALSE, FALSE, 0);
1880 hbox4 = gtk_hbox_new (FALSE, VSPACING);
1881 gtk_widget_show (hbox4);
1882 gtk_box_pack_start (GTK_BOX (vbox_linewrap), hbox4, FALSE, FALSE, 0);
1884 PACK_CHECK_BUTTON (hbox4, checkbtn_wrapquote, _("Wrap quotation"));
1886 PACK_CHECK_BUTTON (hbox4, checkbtn_autowrap, _("Wrap on input"));
1889 (hbox4, checkbtn_wrapatsend, _("Wrap before sending"));
1891 PACK_CHECK_BUTTON (vbox_linewrap, checkbtn_smart_wrapping,
1892 _("Smart wrapping (EXPERIMENTAL)"));
1895 compose.checkbtn_quote = checkbtn_quote;
1896 compose.entry_quotemark = entry_quotemark;
1897 compose.text_quotefmt = text_quotefmt;
1900 compose.checkbtn_autoextedit = checkbtn_autoextedit;
1902 compose.checkbtn_reply_account_autosel = checkbtn_reply_account_autosel;
1903 compose.checkbtn_forward_account_autosel = checkbtn_forward_account_autosel;
1904 compose.checkbtn_reedit_account_autosel = checkbtn_reedit_account_autosel;
1906 compose.spinbtn_undolevel = spinbtn_undolevel;
1907 compose.spinbtn_undolevel_adj = spinbtn_undolevel_adj;
1909 compose.spinbtn_linewrap = spinbtn_linewrap;
1910 compose.spinbtn_linewrap_adj = spinbtn_linewrap_adj;
1911 compose.checkbtn_wrapquote = checkbtn_wrapquote;
1912 compose.checkbtn_autowrap = checkbtn_autowrap;
1913 compose.checkbtn_wrapatsend = checkbtn_wrapatsend;
1915 compose.checkbtn_autosave = checkbtn_autosave;
1916 compose.entry_autosave_length = entry_autosave_length;
1918 compose.checkbtn_forward_as_attachment =
1919 checkbtn_forward_as_attachment;
1920 compose.checkbtn_redirect_keep_from =
1921 checkbtn_redirect_keep_from;
1922 compose.checkbtn_smart_wrapping =
1923 checkbtn_smart_wrapping;
1924 compose.checkbtn_block_cursor =
1925 checkbtn_block_cursor;
1926 compose.checkbtn_default_reply_list = checkbtn_default_reply_list;
1929 static void prefs_quote_create(void)
1932 GtkWidget *frame_quote;
1933 GtkWidget *vbox_quote;
1936 GtkWidget *label_quotemark;
1937 GtkWidget *entry_quotemark;
1938 GtkWidget *scrolledwin_quotefmt;
1939 GtkWidget *text_quotefmt;
1941 GtkWidget *entry_fw_quotemark;
1942 GtkWidget *text_fw_quotefmt;
1944 GtkWidget *entry_quote_chars;
1945 GtkWidget *label_quote_chars;
1947 GtkWidget *btn_quotedesc;
1949 GtkWidget *checkbtn_reply_with_quote;
1951 vbox1 = gtk_vbox_new (FALSE, VSPACING);
1952 gtk_widget_show (vbox1);
1953 gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
1954 gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
1958 PACK_CHECK_BUTTON (vbox1, checkbtn_reply_with_quote, _("Reply will quote by default"));
1960 PACK_FRAME (vbox1, frame_quote, _("Reply format"));
1962 vbox_quote = gtk_vbox_new (FALSE, VSPACING_NARROW);
1963 gtk_widget_show (vbox_quote);
1964 gtk_container_add (GTK_CONTAINER (frame_quote), vbox_quote);
1965 gtk_container_set_border_width (GTK_CONTAINER (vbox_quote), 8);
1967 hbox1 = gtk_hbox_new (FALSE, 32);
1968 gtk_widget_show (hbox1);
1969 gtk_box_pack_start (GTK_BOX (vbox_quote), hbox1, FALSE, FALSE, 0);
1971 hbox2 = gtk_hbox_new (FALSE, 8);
1972 gtk_widget_show (hbox2);
1973 gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0);
1975 label_quotemark = gtk_label_new (_("Quotation mark"));
1976 gtk_widget_show (label_quotemark);
1977 gtk_box_pack_start (GTK_BOX (hbox2), label_quotemark, FALSE, FALSE, 0);
1979 entry_quotemark = gtk_entry_new ();
1980 gtk_widget_show (entry_quotemark);
1981 gtk_box_pack_start (GTK_BOX (hbox2), entry_quotemark, FALSE, FALSE, 0);
1982 gtk_widget_set_usize (entry_quotemark, 64, -1);
1984 scrolledwin_quotefmt = gtk_scrolled_window_new (NULL, NULL);
1985 gtk_widget_show (scrolledwin_quotefmt);
1986 gtk_box_pack_start (GTK_BOX (vbox_quote), scrolledwin_quotefmt, TRUE, TRUE, 0);
1987 gtk_scrolled_window_set_policy
1988 (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt),
1989 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
1991 text_quotefmt = gtk_text_new (NULL, NULL);
1992 gtk_widget_show (text_quotefmt);
1993 gtk_container_add(GTK_CONTAINER(scrolledwin_quotefmt), text_quotefmt);
1994 gtk_text_set_editable (GTK_TEXT (text_quotefmt), TRUE);
1995 gtk_widget_set_usize(text_quotefmt, -1, 60);
1999 PACK_FRAME (vbox1, frame_quote, _("Forward format"));
2001 vbox_quote = gtk_vbox_new (FALSE, VSPACING_NARROW);
2002 gtk_widget_show (vbox_quote);
2003 gtk_container_add (GTK_CONTAINER (frame_quote), vbox_quote);
2004 gtk_container_set_border_width (GTK_CONTAINER (vbox_quote), 8);
2006 hbox1 = gtk_hbox_new (FALSE, 32);
2007 gtk_widget_show (hbox1);
2008 gtk_box_pack_start (GTK_BOX (vbox_quote), hbox1, FALSE, FALSE, 0);
2010 hbox2 = gtk_hbox_new (FALSE, 8);
2011 gtk_widget_show (hbox2);
2012 gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0);
2014 label_quotemark = gtk_label_new (_("Quotation mark"));
2015 gtk_widget_show (label_quotemark);
2016 gtk_box_pack_start (GTK_BOX (hbox2), label_quotemark, FALSE, FALSE, 0);
2018 entry_fw_quotemark = gtk_entry_new ();
2019 gtk_widget_show (entry_fw_quotemark);
2020 gtk_box_pack_start (GTK_BOX (hbox2), entry_fw_quotemark,
2022 gtk_widget_set_usize (entry_fw_quotemark, 64, -1);
2024 scrolledwin_quotefmt = gtk_scrolled_window_new (NULL, NULL);
2025 gtk_widget_show (scrolledwin_quotefmt);
2026 gtk_box_pack_start (GTK_BOX (vbox_quote), scrolledwin_quotefmt, TRUE, TRUE, 0);
2027 gtk_scrolled_window_set_policy
2028 (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt),
2029 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
2031 text_fw_quotefmt = gtk_text_new (NULL, NULL);
2032 gtk_widget_show (text_fw_quotefmt);
2033 gtk_container_add(GTK_CONTAINER(scrolledwin_quotefmt),
2035 gtk_text_set_editable (GTK_TEXT (text_fw_quotefmt), TRUE);
2036 gtk_widget_set_usize(text_fw_quotefmt, -1, 60);
2038 hbox1 = gtk_hbox_new (FALSE, 32);
2039 gtk_widget_show (hbox1);
2040 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
2043 gtk_button_new_with_label (_(" Description of symbols "));
2044 gtk_widget_show (btn_quotedesc);
2045 gtk_box_pack_start (GTK_BOX (hbox1), btn_quotedesc, FALSE, FALSE, 0);
2046 gtk_signal_connect(GTK_OBJECT(btn_quotedesc), "clicked",
2047 GTK_SIGNAL_FUNC(quote_fmt_quote_description), NULL);
2051 PACK_FRAME (vbox1, frame_quote, _("Quotation characters"));
2053 vbox_quote = gtk_vbox_new (FALSE, VSPACING_NARROW);
2054 gtk_widget_show (vbox_quote);
2055 gtk_container_add (GTK_CONTAINER (frame_quote), vbox_quote);
2056 gtk_container_set_border_width (GTK_CONTAINER (vbox_quote), 8);
2058 hbox1 = gtk_hbox_new (FALSE, 32);
2059 gtk_widget_show (hbox1);
2060 gtk_box_pack_start (GTK_BOX (vbox_quote), hbox1, FALSE, FALSE, 0);
2062 hbox2 = gtk_hbox_new (FALSE, 8);
2063 gtk_widget_show (hbox2);
2064 gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0);
2066 label_quote_chars = gtk_label_new (_("Treat these characters as quotation marks: "));
2067 gtk_widget_show (label_quote_chars);
2068 gtk_box_pack_start (GTK_BOX (hbox2), label_quote_chars, FALSE, FALSE, 0);
2070 entry_quote_chars = gtk_entry_new ();
2071 gtk_widget_show (entry_quote_chars);
2072 gtk_box_pack_start (GTK_BOX (hbox2), entry_quote_chars,
2074 gtk_widget_set_usize (entry_quote_chars, 64, -1);
2077 compose.checkbtn_reply_with_quote= checkbtn_reply_with_quote;
2078 quote.entry_quotemark = entry_quotemark;
2079 quote.text_quotefmt = text_quotefmt;
2080 quote.entry_fw_quotemark = entry_fw_quotemark;
2081 quote.text_fw_quotefmt = text_fw_quotefmt;
2082 quote.entry_quote_chars = entry_quote_chars;
2085 static void prefs_display_create(void)
2088 GtkWidget *frame_font;
2090 GtkWidget *label_textfont;
2091 GtkWidget *entry_textfont;
2092 GtkWidget *button_textfont;
2093 GtkWidget *chkbtn_transhdr;
2094 GtkWidget *chkbtn_folder_unread;
2096 GtkWidget *label_ng_abbrev;
2097 GtkWidget *spinbtn_ng_abbrev_len;
2098 GtkObject *spinbtn_ng_abbrev_len_adj;
2099 GtkWidget *frame_summary;
2101 GtkWidget *chkbtn_swapfrom;
2102 GtkWidget *chkbtn_useaddrbook;
2103 GtkWidget *chkbtn_threadsubj;
2105 GtkWidget *label_datefmt;
2106 GtkWidget *button_datefmt;
2107 GtkWidget *entry_datefmt;
2108 GtkWidget *button_dispitem;
2109 GtkWidget *tmplabel, *tmpbutton, *tmpentry;
2111 vbox1 = gtk_vbox_new (FALSE, VSPACING);
2112 gtk_widget_show (vbox1);
2113 gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
2114 gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
2116 PACK_FRAME(vbox1, frame_font, _("Font"));
2118 table1 = gtk_table_new (4, 3, FALSE);
2120 gtk_widget_show (table1);
2121 gtk_container_add (GTK_CONTAINER (frame_font), table1);
2122 gtk_container_set_border_width (GTK_CONTAINER (table1), 8);
2123 gtk_table_set_row_spacings (GTK_TABLE (table1), 8);
2124 gtk_table_set_col_spacings (GTK_TABLE (table1), 8);
2126 label_textfont = gtk_label_new (_("Text"));
2127 gtk_misc_set_alignment(GTK_MISC(label_textfont), 0, 0.5);
2128 gtk_widget_show (label_textfont);
2129 gtk_table_attach (GTK_TABLE (table1), label_textfont, 0, 1, 0, 1,
2130 GTK_FILL, (GTK_EXPAND | GTK_FILL), 0, 0);
2132 entry_textfont = gtk_entry_new ();
2133 gtk_widget_show (entry_textfont);
2134 gtk_table_attach (GTK_TABLE (table1), entry_textfont, 1, 2, 0, 1,
2135 (GTK_EXPAND | GTK_FILL), 0, 0, 0);
2137 button_textfont = gtk_button_new_with_label (" ... ");
2139 gtk_widget_show (button_textfont);
2140 gtk_table_attach (GTK_TABLE (table1), button_textfont, 2, 3, 0, 1,
2142 gtk_signal_connect (GTK_OBJECT (button_textfont), "clicked",
2143 GTK_SIGNAL_FUNC (prefs_font_select), entry_textfont);
2145 tmplabel = gtk_label_new (_("Small"));
2146 gtk_misc_set_alignment(GTK_MISC(tmplabel), 0, 0.5);
2147 gtk_widget_show (tmplabel);
2148 gtk_table_attach (GTK_TABLE (table1), tmplabel, 0, 1, 1, 2,
2149 GTK_FILL, (GTK_EXPAND | GTK_FILL), 0, 0);
2151 tmpentry = gtk_entry_new ();
2152 gtk_widget_show (tmpentry);
2153 gtk_table_attach (GTK_TABLE (table1), tmpentry, 1, 2, 1, 2,
2154 (GTK_EXPAND | GTK_FILL), 0, 0, 0);
2156 tmpbutton = gtk_button_new_with_label (" ... ");
2157 gtk_widget_show (tmpbutton);
2158 gtk_table_attach (GTK_TABLE (table1), tmpbutton, 2, 3, 1, 2,
2160 gtk_signal_connect (GTK_OBJECT(tmpbutton), "clicked",
2161 GTK_SIGNAL_FUNC(prefs_font_select), tmpentry);
2162 display.entry_smallfont = tmpentry;
2164 tmplabel = gtk_label_new (_("Normal"));
2165 gtk_misc_set_alignment(GTK_MISC(tmplabel), 0, 0.5);
2166 gtk_widget_show (tmplabel);
2167 gtk_table_attach (GTK_TABLE (table1), tmplabel, 0, 1, 2, 3,
2168 GTK_FILL, (GTK_EXPAND | GTK_FILL), 0, 0);
2170 tmpentry = gtk_entry_new ();
2171 gtk_widget_show (tmpentry);
2172 gtk_table_attach (GTK_TABLE (table1), tmpentry, 1, 2, 2, 3,
2173 (GTK_EXPAND | GTK_FILL), 0, 0, 0);
2175 tmpbutton = gtk_button_new_with_label (" ... ");
2176 gtk_widget_show (tmpbutton);
2177 gtk_table_attach (GTK_TABLE (table1), tmpbutton, 2, 3, 2, 3,
2179 gtk_signal_connect (GTK_OBJECT(tmpbutton), "clicked",
2180 GTK_SIGNAL_FUNC(prefs_font_select), tmpentry);
2181 display.entry_normalfont = tmpentry;
2183 tmplabel = gtk_label_new (_("Bold"));
2184 gtk_misc_set_alignment(GTK_MISC(tmplabel), 0, 0.5);
2185 gtk_widget_show (tmplabel);
2186 gtk_table_attach (GTK_TABLE (table1), tmplabel, 0, 1, 3, 4,
2187 GTK_FILL, (GTK_EXPAND | GTK_FILL), 0, 0);
2189 tmpentry = gtk_entry_new ();
2190 gtk_widget_show (tmpentry);
2191 gtk_table_attach (GTK_TABLE (table1), tmpentry, 1, 2, 3, 4,
2192 (GTK_EXPAND | GTK_FILL), 0, 0, 0);
2194 tmpbutton = gtk_button_new_with_label (" ... ");
2195 gtk_widget_show (tmpbutton);
2196 gtk_table_attach (GTK_TABLE (table1), tmpbutton, 2, 3, 3, 4,
2198 gtk_signal_connect (GTK_OBJECT(tmpbutton), "clicked",
2199 GTK_SIGNAL_FUNC(prefs_font_select), tmpentry);
2200 display.entry_boldfont = tmpentry;
2202 vbox2 = gtk_vbox_new (FALSE, 0);
2203 gtk_widget_show (vbox2);
2204 gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, TRUE, 0);
2207 (vbox2, chkbtn_transhdr,
2208 _("Translate header name (such as `From:', `Subject:')"));
2210 PACK_CHECK_BUTTON (vbox2, chkbtn_folder_unread,
2211 _("Display unread number next to folder name"));
2213 PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2);
2215 hbox1 = gtk_hbox_new (FALSE, 8);
2216 gtk_widget_show (hbox1);
2217 gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
2219 label_ng_abbrev = gtk_label_new
2220 (_("Abbreviate newsgroup names longer than"));
2221 gtk_widget_show (label_ng_abbrev);
2222 gtk_box_pack_start (GTK_BOX (hbox1), label_ng_abbrev, FALSE, FALSE, 0);
2224 spinbtn_ng_abbrev_len_adj = gtk_adjustment_new (16, 0, 999, 1, 10, 10);
2225 spinbtn_ng_abbrev_len = gtk_spin_button_new
2226 (GTK_ADJUSTMENT (spinbtn_ng_abbrev_len_adj), 1, 0);
2227 gtk_widget_show (spinbtn_ng_abbrev_len);
2228 gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_ng_abbrev_len,
2230 gtk_widget_set_usize (spinbtn_ng_abbrev_len, 56, -1);
2231 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_ng_abbrev_len),
2234 label_ng_abbrev = gtk_label_new
2236 gtk_widget_show (label_ng_abbrev);
2237 gtk_box_pack_start (GTK_BOX (hbox1), label_ng_abbrev, FALSE, FALSE, 0);
2239 /* ---- Summary ---- */
2241 PACK_FRAME(vbox1, frame_summary, _("Summary View"));
2243 vbox2 = gtk_vbox_new (FALSE, 0);
2244 gtk_widget_show (vbox2);
2245 gtk_container_add (GTK_CONTAINER (frame_summary), vbox2);
2246 gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
2249 (vbox2, chkbtn_swapfrom,
2250 _("Display recipient in `From' column if sender is yourself"));
2252 (vbox2, chkbtn_useaddrbook,
2253 _("Display sender using address book"));
2255 (vbox2, chkbtn_threadsubj,
2256 _("Thread using subject in addition to standard headers"));
2258 PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2);
2260 hbox1 = gtk_hbox_new (FALSE, 8);
2261 gtk_widget_show (hbox1);
2262 gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
2264 label_datefmt = gtk_label_new (_("Date format"));
2265 gtk_widget_show (label_datefmt);
2266 gtk_box_pack_start (GTK_BOX (hbox1), label_datefmt, FALSE, FALSE, 0);
2268 entry_datefmt = gtk_entry_new ();
2269 gtk_widget_show (entry_datefmt);
2270 gtk_box_pack_start (GTK_BOX (hbox1), entry_datefmt, TRUE, TRUE, 0);
2272 button_datefmt = gtk_button_new_with_label (" ... ");
2274 gtk_widget_show (button_datefmt);
2275 gtk_box_pack_start (GTK_BOX (hbox1), button_datefmt, FALSE, FALSE, 0);
2276 gtk_signal_connect (GTK_OBJECT (button_datefmt), "clicked",
2277 GTK_SIGNAL_FUNC (date_format_create), NULL);
2279 PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW);
2281 hbox1 = gtk_hbox_new (FALSE, 8);
2282 gtk_widget_show (hbox1);
2283 gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
2285 button_dispitem = gtk_button_new_with_label
2286 (_(" Set displayed items in summary... "));
2287 gtk_widget_show (button_dispitem);
2288 gtk_box_pack_start (GTK_BOX (hbox1), button_dispitem, FALSE, TRUE, 0);
2289 gtk_signal_connect (GTK_OBJECT (button_dispitem), "clicked",
2290 GTK_SIGNAL_FUNC (prefs_summary_column_open),
2293 display.entry_textfont = entry_textfont;
2294 display.button_textfont = button_textfont;
2296 display.chkbtn_transhdr = chkbtn_transhdr;
2297 display.chkbtn_folder_unread = chkbtn_folder_unread;
2298 display.spinbtn_ng_abbrev_len = spinbtn_ng_abbrev_len;
2299 display.spinbtn_ng_abbrev_len_adj = spinbtn_ng_abbrev_len_adj;
2301 display.chkbtn_swapfrom = chkbtn_swapfrom;
2302 display.chkbtn_useaddrbook = chkbtn_useaddrbook;
2303 display.chkbtn_threadsubj = chkbtn_threadsubj;
2304 display.entry_datefmt = entry_datefmt;
2307 static void prefs_message_create(void)
2313 GtkWidget *chkbtn_enablecol;
2314 GtkWidget *button_edit_col;
2315 GtkWidget *chkbtn_mbalnum;
2316 GtkWidget *chkbtn_disphdrpane;
2317 GtkWidget *chkbtn_disphdr;
2318 GtkWidget *button_edit_disphdr;
2319 GtkWidget *hbox_linespc;
2320 GtkWidget *label_linespc;
2321 GtkObject *spinbtn_linespc_adj;
2322 GtkWidget *spinbtn_linespc;
2323 GtkWidget *chkbtn_headspc;
2325 GtkWidget *frame_scr;
2326 GtkWidget *vbox_scr;
2327 GtkWidget *chkbtn_smoothscroll;
2328 GtkWidget *hbox_scr;
2329 GtkWidget *label_scr;
2330 GtkObject *spinbtn_scrollstep_adj;
2331 GtkWidget *spinbtn_scrollstep;
2332 GtkWidget *chkbtn_halfpage;
2334 GtkWidget *chkbtn_attach_desc;
2336 vbox1 = gtk_vbox_new (FALSE, VSPACING);
2337 gtk_widget_show (vbox1);
2338 gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
2339 gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
2341 vbox2 = gtk_vbox_new (FALSE, 0);
2342 gtk_widget_show (vbox2);
2343 gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
2345 hbox1 = gtk_hbox_new (FALSE, 8);
2346 gtk_widget_show (hbox1);
2347 gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
2349 PACK_CHECK_BUTTON (hbox1, chkbtn_enablecol,
2350 _("Enable coloration of message"));
2351 gtk_signal_connect (GTK_OBJECT (chkbtn_enablecol), "toggled",
2352 GTK_SIGNAL_FUNC (prefs_enable_message_color_toggled),
2355 button_edit_col = gtk_button_new_with_label (_(" Edit... "));
2356 gtk_widget_show (button_edit_col);
2357 gtk_box_pack_end (GTK_BOX (hbox1), button_edit_col, FALSE, TRUE, 0);
2358 gtk_signal_connect (GTK_OBJECT (button_edit_col), "clicked",
2359 GTK_SIGNAL_FUNC (prefs_quote_colors_dialog), NULL);
2361 SET_TOGGLE_SENSITIVITY(chkbtn_enablecol, button_edit_col);
2364 (vbox2, chkbtn_mbalnum,
2365 _("Display multi-byte alphanumeric as\n"
2366 "ASCII character (Japanese only)"));
2367 gtk_label_set_justify (GTK_LABEL (GTK_BIN(chkbtn_mbalnum)->child),
2370 PACK_CHECK_BUTTON(vbox2, chkbtn_disphdrpane,
2371 _("Display header pane above message view"));
2373 hbox1 = gtk_hbox_new (FALSE, 8);
2374 gtk_widget_show (hbox1);
2375 gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
2377 PACK_CHECK_BUTTON(hbox1, chkbtn_disphdr,
2378 _("Display short headers on message view"));
2380 button_edit_disphdr = gtk_button_new_with_label (_(" Edit... "));
2381 gtk_widget_show (button_edit_disphdr);
2382 gtk_box_pack_end (GTK_BOX (hbox1), button_edit_disphdr,
2384 gtk_signal_connect (GTK_OBJECT (button_edit_disphdr), "clicked",
2385 GTK_SIGNAL_FUNC (prefs_display_header_open),
2388 SET_TOGGLE_SENSITIVITY(chkbtn_disphdr, button_edit_disphdr);
2390 PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2);
2392 hbox1 = gtk_hbox_new (FALSE, 32);
2393 gtk_widget_show (hbox1);
2394 gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);
2396 hbox_linespc = gtk_hbox_new (FALSE, 8);
2397 gtk_widget_show (hbox1);
2398 gtk_box_pack_start (GTK_BOX (hbox1), hbox_linespc, FALSE, TRUE, 0);
2400 label_linespc = gtk_label_new (_("Line space"));
2401 gtk_widget_show (label_linespc);
2402 gtk_box_pack_start (GTK_BOX (hbox_linespc), label_linespc,
2405 spinbtn_linespc_adj = gtk_adjustment_new (2, 0, 16, 1, 1, 16);
2406 spinbtn_linespc = gtk_spin_button_new
2407 (GTK_ADJUSTMENT (spinbtn_linespc_adj), 1, 0);
2408 gtk_widget_show (spinbtn_linespc);
2409 gtk_box_pack_start (GTK_BOX (hbox_linespc), spinbtn_linespc,
2411 gtk_widget_set_usize (spinbtn_linespc, 64, -1);
2412 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_linespc), TRUE);
2414 label_linespc = gtk_label_new (_("pixel(s)"));
2415 gtk_widget_show (label_linespc);
2416 gtk_box_pack_start (GTK_BOX (hbox_linespc), label_linespc,
2419 PACK_CHECK_BUTTON(hbox1, chkbtn_headspc, _("Leave space on head"));
2421 PACK_FRAME(vbox1, frame_scr, _("Scroll"));
2423 vbox_scr = gtk_vbox_new (FALSE, 0);
2424 gtk_widget_show (vbox_scr);
2425 gtk_container_add (GTK_CONTAINER (frame_scr), vbox_scr);
2426 gtk_container_set_border_width (GTK_CONTAINER (vbox_scr), 8);
2428 PACK_CHECK_BUTTON(vbox_scr, chkbtn_halfpage, _("Half page"));
2430 hbox1 = gtk_hbox_new (FALSE, 32);
2431 gtk_widget_show (hbox1);
2432 gtk_box_pack_start (GTK_BOX (vbox_scr), hbox1, FALSE, TRUE, 0);
2434 PACK_CHECK_BUTTON(hbox1, chkbtn_smoothscroll, _("Smooth scroll"));
2436 hbox_scr = gtk_hbox_new (FALSE, 8);
2437 gtk_widget_show (hbox_scr);
2438 gtk_box_pack_start (GTK_BOX (hbox1), hbox_scr, FALSE, FALSE, 0);
2440 label_scr = gtk_label_new (_("Step"));
2441 gtk_widget_show (label_scr);
2442 gtk_box_pack_start (GTK_BOX (hbox_scr), label_scr, FALSE, FALSE, 0);
2444 spinbtn_scrollstep_adj = gtk_adjustment_new (1, 1, 100, 1, 10, 10);
2445 spinbtn_scrollstep = gtk_spin_button_new
2446 (GTK_ADJUSTMENT (spinbtn_scrollstep_adj), 1, 0);
2447 gtk_widget_show (spinbtn_scrollstep);
2448 gtk_box_pack_start (GTK_BOX (hbox_scr), spinbtn_scrollstep,
2450 gtk_widget_set_usize (spinbtn_scrollstep, 64, -1);
2451 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_scrollstep),
2454 label_scr = gtk_label_new (_("pixel(s)"));
2455 gtk_widget_show (label_scr);
2456 gtk_box_pack_start (GTK_BOX (hbox_scr), label_scr, FALSE, FALSE, 0);
2458 SET_TOGGLE_SENSITIVITY (chkbtn_smoothscroll, hbox_scr)
2460 vbox3 = gtk_vbox_new (FALSE, 0);
2461 gtk_widget_show (vbox3);
2462 gtk_box_pack_start (GTK_BOX (vbox1), vbox3, FALSE, FALSE, 0);
2464 PACK_CHECK_BUTTON(vbox3, chkbtn_attach_desc,
2465 _("Show attachment descriptions (rather than names)"));
2468 message.chkbtn_enablecol = chkbtn_enablecol;
2469 message.button_edit_col = button_edit_col;
2470 message.chkbtn_mbalnum = chkbtn_mbalnum;
2471 message.chkbtn_disphdrpane = chkbtn_disphdrpane;
2472 message.chkbtn_disphdr = chkbtn_disphdr;
2473 message.spinbtn_linespc = spinbtn_linespc;
2474 message.chkbtn_headspc = chkbtn_headspc;
2476 message.chkbtn_smoothscroll = chkbtn_smoothscroll;
2477 message.spinbtn_scrollstep = spinbtn_scrollstep;
2478 message.spinbtn_scrollstep_adj = spinbtn_scrollstep_adj;
2479 message.chkbtn_halfpage = chkbtn_halfpage;
2481 message.chkbtn_attach_desc = chkbtn_attach_desc;
2485 static void prefs_privacy_create(void)
2491 GtkWidget *hbox_spc;
2493 GtkWidget *checkbtn_auto_check_signatures;
2494 GtkWidget *checkbtn_gpg_signature_popup;
2495 GtkWidget *checkbtn_store_passphrase;
2496 GtkObject *spinbtn_store_passphrase_adj;
2497 GtkWidget *spinbtn_store_passphrase;
2498 GtkWidget *checkbtn_passphrase_grab;
2499 GtkWidget *checkbtn_gpg_warning;
2501 vbox1 = gtk_vbox_new (FALSE, VSPACING);
2502 gtk_widget_show (vbox1);
2503 gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
2504 gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
2506 vbox2 = gtk_vbox_new (FALSE, 0);
2507 gtk_widget_show (vbox2);
2508 gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
2510 PACK_CHECK_BUTTON (vbox2, checkbtn_auto_check_signatures,
2511 _("Automatically check signatures"));
2513 PACK_CHECK_BUTTON (vbox2, checkbtn_gpg_signature_popup,
2514 _("Show signature check result in a popup window"));
2516 PACK_CHECK_BUTTON (vbox2, checkbtn_store_passphrase,
2517 _("Store passphrase in memory temporarily"));
2519 vbox3 = gtk_vbox_new (FALSE, 0);
2520 gtk_widget_show (vbox3);
2521 gtk_box_pack_start (GTK_BOX (vbox2), vbox3, FALSE, FALSE, 0);
2523 hbox1 = gtk_hbox_new (FALSE, 8);
2524 gtk_widget_show (hbox1);
2525 gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0);
2527 hbox_spc = gtk_hbox_new (FALSE, 0);
2528 gtk_widget_show (hbox_spc);
2529 gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0);
2530 gtk_widget_set_usize (hbox_spc, 12, -1);
2532 label = gtk_label_new (_("Expire after"));
2533 gtk_widget_show (label);
2534 gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
2536 spinbtn_store_passphrase_adj = gtk_adjustment_new (0, 0, 1440, 1, 5, 5);
2537 spinbtn_store_passphrase = gtk_spin_button_new
2538 (GTK_ADJUSTMENT (spinbtn_store_passphrase_adj), 1, 0);
2539 gtk_widget_show (spinbtn_store_passphrase);
2540 gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_store_passphrase, FALSE, FALSE, 0);
2541 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_store_passphrase),
2543 gtk_widget_set_usize (spinbtn_store_passphrase, 64, -1);
2545 label = gtk_label_new (_("minute(s) "));
2546 gtk_widget_show (label);
2547 gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
2549 hbox1 = gtk_hbox_new (FALSE, 8);
2550 gtk_widget_show (hbox1);
2551 gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0);
2553 hbox_spc = gtk_hbox_new (FALSE, 0);
2554 gtk_widget_show (hbox_spc);
2555 gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0);
2556 gtk_widget_set_usize (hbox_spc, 12, -1);
2558 label = gtk_label_new (_("(Setting to '0' will store the passphrase\n"
2559 " for the whole session)"));
2560 gtk_widget_show (label);
2561 gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
2562 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
2564 SET_TOGGLE_SENSITIVITY (checkbtn_store_passphrase, vbox3);
2567 PACK_CHECK_BUTTON (vbox2, checkbtn_passphrase_grab,
2568 _("Grab input while entering a passphrase"));
2572 (vbox2, checkbtn_gpg_warning,
2573 _("Display warning on startup if GnuPG doesn't work"));
2575 hbox1 = gtk_hbox_new (FALSE, 8);
2576 gtk_widget_show (hbox1);
2577 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
2579 privacy.checkbtn_auto_check_signatures
2580 = checkbtn_auto_check_signatures;
2581 privacy.checkbtn_gpg_signature_popup
2582 = checkbtn_gpg_signature_popup;
2583 privacy.checkbtn_store_passphrase = checkbtn_store_passphrase;
2584 privacy.spinbtn_store_passphrase = spinbtn_store_passphrase;
2585 privacy.spinbtn_store_passphrase_adj = spinbtn_store_passphrase_adj;
2586 privacy.checkbtn_passphrase_grab = checkbtn_passphrase_grab;
2587 privacy.checkbtn_gpg_warning = checkbtn_gpg_warning;
2589 #endif /* USE_GPGME */
2591 static void prefs_interface_create(void)
2596 /* GtkWidget *checkbtn_emacs; */
2597 GtkWidget *checkbtn_show_msg_with_cursor;
2598 GtkWidget *checkbtn_openunread;
2599 GtkWidget *checkbtn_mark_as_read_on_newwin;
2600 GtkWidget *checkbtn_openinbox;
2601 GtkWidget *checkbtn_immedexec;
2602 GtkWidget *frame_dialogs;
2603 GtkWidget *vbox_dialogs;
2606 GtkWidget *dialogs_table;
2607 GtkWidget *optmenu_recvdialog;
2608 GtkWidget *optmenu_senddialog;
2610 GtkWidget *menuitem;
2611 GtkWidget *checkbtn_no_recv_err_panel;
2612 GtkWidget *checkbtn_close_recv_dialog;
2614 GtkWidget *button_keybind;
2616 GtkWidget *optmenu_nextunreadmsgdialog;
2618 GtkWidget *frame_pixmap_theme;
2619 GtkWidget *vbox_pixmap_theme;
2620 GtkWidget *entry_pixmap_theme;
2621 GtkWidget *combo_pixmap_theme;
2622 GList *avail_pixmap_themes = NULL;
2624 vbox1 = gtk_vbox_new (FALSE, VSPACING);
2625 gtk_widget_show (vbox1);
2626 gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
2627 gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
2629 vbox2 = gtk_vbox_new (FALSE, 0);
2630 gtk_widget_show (vbox2);
2631 gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
2633 /* PACK_CHECK_BUTTON (vbox2, checkbtn_emacs,
2634 _("Emulate the behavior of mouse operation of\n"
2635 "Emacs-based mailer"));
2636 gtk_label_set_justify (GTK_LABEL (GTK_BIN (checkbtn_emacs)->child),
2637 GTK_JUSTIFY_LEFT); */
2640 (vbox2, checkbtn_show_msg_with_cursor,
2641 _("Open messages in summary with cursor keys"));
2644 (vbox2, checkbtn_openunread,
2645 _("Open first unread message when entering a folder"));
2648 (vbox2, checkbtn_mark_as_read_on_newwin,
2649 _("Only mark message as read when opened in new window"));
2652 (vbox2, checkbtn_openinbox,
2653 _("Go to inbox after receiving new mail"));
2655 vbox3 = gtk_vbox_new (FALSE, 0);
2656 gtk_widget_show (vbox3);
2657 gtk_box_pack_start (GTK_BOX (vbox2), vbox3, FALSE, FALSE, 0);
2660 (vbox3, checkbtn_immedexec,
2661 _("Execute immediately when moving or deleting messages"));
2663 hbox1 = gtk_hbox_new (FALSE, 0);
2664 gtk_widget_show (hbox1);
2665 gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0);
2667 label = gtk_label_new
2668 (_("(Messages will be marked until execution\n"
2669 " if this is turned off)"));
2670 gtk_widget_show (label);
2671 gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 8);
2672 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
2674 PACK_FRAME (vbox1, frame_dialogs, _("Dialogs"));
2675 vbox_dialogs = gtk_vbox_new (FALSE, 0);
2676 gtk_widget_show (vbox_dialogs);
2677 gtk_container_add (GTK_CONTAINER (frame_dialogs), vbox_dialogs);
2678 gtk_container_set_border_width (GTK_CONTAINER (vbox_dialogs), 8);
2680 dialogs_table = gtk_table_new (2, 2, FALSE);
2681 gtk_widget_show (dialogs_table);
2682 gtk_container_add (GTK_CONTAINER (vbox_dialogs), dialogs_table);
2683 gtk_container_set_border_width (GTK_CONTAINER (dialogs_table), 4);
2684 gtk_table_set_row_spacings (GTK_TABLE (dialogs_table), VSPACING_NARROW);
2685 gtk_table_set_col_spacings (GTK_TABLE (dialogs_table), 8);
2687 /* Next Unread Message Dialog */
2688 label = gtk_label_new (_("Show no-unread-message dialog"));
2689 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
2690 gtk_widget_show (label);
2691 gtk_table_attach (GTK_TABLE (dialogs_table), label, 0, 1, 0, 1,
2692 GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
2695 optmenu_nextunreadmsgdialog = gtk_option_menu_new ();
2696 gtk_widget_show (optmenu_nextunreadmsgdialog);
2697 gtk_table_attach (GTK_TABLE (dialogs_table),
2698 optmenu_nextunreadmsgdialog, 1, 2, 0, 1,
2699 GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
2701 menu = gtk_menu_new ();
2702 MENUITEM_ADD (menu, menuitem, _("Always"), NEXTUNREADMSGDIALOG_ALWAYS);
2703 MENUITEM_ADD (menu, menuitem, _("Assume 'Yes'"),
2704 NEXTUNREADMSGDIALOG_ASSUME_YES);
2705 MENUITEM_ADD (menu, menuitem, _("Assume 'No'"),
2706 NEXTUNREADMSGDIALOG_ASSUME_NO);
2708 gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_nextunreadmsgdialog), menu);
2710 label = gtk_label_new (_("Show send dialog"));
2711 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
2712 gtk_widget_show (label);
2713 gtk_table_attach (GTK_TABLE (dialogs_table), label, 0, 1, 1, 2,
2714 GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
2716 optmenu_senddialog = gtk_option_menu_new ();
2717 gtk_widget_show (optmenu_senddialog);
2718 gtk_table_attach (GTK_TABLE (dialogs_table),
2719 optmenu_senddialog, 1, 2, 1, 2,
2720 GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
2722 menu = gtk_menu_new ();
2723 MENUITEM_ADD (menu, menuitem, _("Always"), SEND_DIALOG_ALWAYS);
2724 MENUITEM_ADD (menu, menuitem, _("Never"), SEND_DIALOG_NEVER);
2726 gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_senddialog), menu);
2728 label = gtk_label_new (_("Show receive dialog"));
2729 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
2730 gtk_widget_show (label);
2731 gtk_table_attach (GTK_TABLE (dialogs_table), label, 0, 1, 2, 3,
2732 GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
2734 optmenu_recvdialog = gtk_option_menu_new ();
2735 gtk_widget_show (optmenu_recvdialog);
2736 gtk_table_attach (GTK_TABLE (dialogs_table), optmenu_recvdialog, 1, 2, 2, 3,
2737 GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
2739 menu = gtk_menu_new ();
2740 MENUITEM_ADD (menu, menuitem, _("Always"), RECV_DIALOG_ALWAYS);
2741 MENUITEM_ADD (menu, menuitem, _("Only if a window is active"),
2742 RECV_DIALOG_ACTIVE);
2743 MENUITEM_ADD (menu, menuitem, _("Never"), RECV_DIALOG_NEVER);
2745 gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_recvdialog), menu);
2747 PACK_CHECK_BUTTON (vbox_dialogs, checkbtn_no_recv_err_panel,
2748 _("Don't popup error dialog on receive error"));
2750 PACK_CHECK_BUTTON (vbox_dialogs, checkbtn_close_recv_dialog,
2751 _("Close receive dialog when finished"));
2754 hbox1 = gtk_hbox_new (FALSE, 8);
2755 gtk_widget_show (hbox1);
2756 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
2758 button_keybind = gtk_button_new_with_label (_(" Set key bindings... "));
2759 gtk_widget_show (button_keybind);
2760 gtk_box_pack_start (GTK_BOX (hbox1), button_keybind, FALSE, FALSE, 0);
2761 gtk_signal_connect (GTK_OBJECT (button_keybind), "clicked",
2762 GTK_SIGNAL_FUNC (prefs_keybind_select), NULL);
2764 PACK_FRAME(vbox1, frame_pixmap_theme, _("Icon theme"));
2766 vbox_pixmap_theme = gtk_vbox_new(FALSE, 0);
2767 gtk_widget_show(vbox_pixmap_theme);
2768 gtk_container_add(GTK_CONTAINER(frame_pixmap_theme), vbox_pixmap_theme);
2769 gtk_container_set_border_width(GTK_CONTAINER(vbox_pixmap_theme), 8);
2771 avail_pixmap_themes = stock_pixmap_themes_list_new();
2773 combo_pixmap_theme = gtk_combo_new ();
2774 gtk_widget_show (combo_pixmap_theme);
2775 gtk_box_pack_start (GTK_BOX (vbox_pixmap_theme), combo_pixmap_theme, TRUE, TRUE, 0);
2776 gtk_combo_set_popdown_strings(GTK_COMBO(combo_pixmap_theme), avail_pixmap_themes);
2777 entry_pixmap_theme = GTK_COMBO (combo_pixmap_theme)->entry;
2779 stock_pixmap_themes_list_free(avail_pixmap_themes);
2781 /* interface.checkbtn_emacs = checkbtn_emacs; */
2782 interface.checkbtn_show_msg_with_cursor
2783 = checkbtn_show_msg_with_cursor;
2784 interface.checkbtn_openunread = checkbtn_openunread;
2785 interface.checkbtn_mark_as_read_on_newwin
2786 = checkbtn_mark_as_read_on_newwin;
2787 interface.checkbtn_openinbox = checkbtn_openinbox;
2788 interface.checkbtn_immedexec = checkbtn_immedexec;
2789 interface.optmenu_recvdialog = optmenu_recvdialog;
2790 interface.optmenu_senddialog = optmenu_senddialog;
2791 interface.checkbtn_no_recv_err_panel = checkbtn_no_recv_err_panel;
2792 interface.checkbtn_close_recv_dialog = checkbtn_close_recv_dialog;
2793 interface.optmenu_nextunreadmsgdialog = optmenu_nextunreadmsgdialog;
2794 interface.combo_pixmap_theme = combo_pixmap_theme;
2795 interface.entry_pixmap_theme = entry_pixmap_theme;
2798 static void prefs_other_create(void)
2801 GtkWidget *ext_frame;
2802 GtkWidget *ext_table;
2805 GtkWidget *uri_label;
2806 GtkWidget *uri_combo;
2807 GtkWidget *uri_entry;
2809 GtkWidget *printcmd_label;
2810 GtkWidget *printcmd_entry;
2812 GtkWidget *exteditor_label;
2813 GtkWidget *exteditor_combo;
2814 GtkWidget *exteditor_entry;
2816 GtkWidget *frame_addr;
2817 GtkWidget *vbox_addr;
2818 GtkWidget *checkbtn_addaddrbyclick;
2820 GtkWidget *frame_cliplog;
2821 GtkWidget *vbox_cliplog;
2822 GtkWidget *hbox_cliplog;
2823 GtkWidget *checkbtn_cliplog;
2824 GtkWidget *loglength_label;
2825 GtkWidget *loglength_entry;
2827 GtkWidget *frame_exit;
2828 GtkWidget *vbox_exit;
2829 GtkWidget *checkbtn_confonexit;
2830 GtkWidget *checkbtn_cleanonexit;
2831 GtkWidget *checkbtn_askonclean;
2832 GtkWidget *checkbtn_warnqueued;
2835 GtkWidget *frame_ssl;
2836 GtkWidget *vbox_ssl;
2837 GtkWidget *hbox_ssl;
2838 GtkWidget *checkbtn_ssl_ask_unknown_valid;
2841 vbox1 = gtk_vbox_new (FALSE, VSPACING);
2842 gtk_widget_show (vbox1);
2843 gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
2844 gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
2846 PACK_FRAME(vbox1, ext_frame,
2847 _("External commands (%s will be replaced with file name / URI)"));
2849 ext_table = gtk_table_new (3, 2, FALSE);
2850 gtk_widget_show (ext_table);
2851 gtk_container_add (GTK_CONTAINER (ext_frame), ext_table);
2852 gtk_container_set_border_width (GTK_CONTAINER (ext_table), 8);
2853 gtk_table_set_row_spacings (GTK_TABLE (ext_table), VSPACING_NARROW);
2854 gtk_table_set_col_spacings (GTK_TABLE (ext_table), 8);
2856 uri_label = gtk_label_new (_("Web browser"));
2857 gtk_widget_show(uri_label);
2858 gtk_table_attach (GTK_TABLE (ext_table), uri_label, 0, 1, 0, 1,
2859 GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
2860 gtk_misc_set_alignment (GTK_MISC (uri_label), 1, 0.5);
2862 uri_combo = gtk_combo_new ();
2863 gtk_widget_show (uri_combo);
2864 gtk_table_attach (GTK_TABLE (ext_table), uri_combo, 1, 2, 0, 1,
2865 GTK_EXPAND | GTK_FILL, 0, 0, 0);
2866 gtkut_combo_set_items (GTK_COMBO (uri_combo),
2867 DEFAULT_BROWSER_CMD,
2868 "galeon --new-tab '%s'",
2870 "mozilla -remote 'openurl(%s,new-window)'",
2871 "netscape -remote 'openURL(%s, new-window)'",
2873 "gnome-moz-remote --newwin '%s'",
2874 "kfmclient openURL '%s'",
2875 "opera -newwindow '%s'",
2876 "kterm -e w3m '%s'",
2877 "kterm -e lynx '%s'",
2879 uri_entry = GTK_COMBO (uri_combo)->entry;
2881 printcmd_label = gtk_label_new (_("Print"));
2882 gtk_widget_show (printcmd_label);
2883 gtk_table_attach (GTK_TABLE (ext_table), printcmd_label, 0, 1, 1, 2,
2884 GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
2885 gtk_misc_set_alignment (GTK_MISC (printcmd_label), 1, 0.5);
2887 printcmd_entry = gtk_entry_new ();
2888 gtk_widget_show (printcmd_entry);
2889 gtk_table_attach (GTK_TABLE (ext_table), printcmd_entry, 1, 2, 1, 2,
2890 GTK_EXPAND | GTK_FILL, 0, 0, 0);
2892 exteditor_label = gtk_label_new (_("Editor"));
2893 gtk_widget_show (exteditor_label);
2894 gtk_table_attach (GTK_TABLE (ext_table), exteditor_label, 0, 1, 2, 3,
2895 GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
2896 gtk_misc_set_alignment (GTK_MISC (exteditor_label), 1, 0.5);
2898 exteditor_combo = gtk_combo_new ();
2899 gtk_widget_show (exteditor_combo);
2900 gtk_table_attach (GTK_TABLE (ext_table), exteditor_combo, 1, 2, 2, 3,
2901 GTK_EXPAND | GTK_FILL, 0, 0, 0);
2902 gtkut_combo_set_items (GTK_COMBO (exteditor_combo),
2905 "mgedit --no-fork %s",
2911 exteditor_entry = GTK_COMBO (exteditor_combo)->entry;
2913 PACK_FRAME (vbox1, frame_addr, _("Address book"));
2915 vbox_addr = gtk_vbox_new (FALSE, 0);
2916 gtk_widget_show (vbox_addr);
2917 gtk_container_add (GTK_CONTAINER (frame_addr), vbox_addr);
2918 gtk_container_set_border_width (GTK_CONTAINER (vbox_addr), 8);
2921 (vbox_addr, checkbtn_addaddrbyclick,
2922 _("Add address to destination when double-clicked"));
2925 PACK_FRAME (vbox1, frame_cliplog, _("Log Size"));
2927 vbox_cliplog = gtk_vbox_new (FALSE, 0);
2928 gtk_widget_show (vbox_cliplog);
2929 gtk_container_add (GTK_CONTAINER (frame_cliplog), vbox_cliplog);
2930 gtk_container_set_border_width (GTK_CONTAINER (vbox_cliplog), 8);
2931 PACK_CHECK_BUTTON (vbox_cliplog, checkbtn_cliplog,
2932 _("Clip the log size"));
2933 hbox_cliplog = gtk_hbox_new (FALSE, 3);
2934 gtk_container_add (GTK_CONTAINER (vbox_cliplog), hbox_cliplog);
2935 gtk_widget_show (hbox_cliplog);
2937 loglength_label = gtk_label_new (_("Log window length"));
2938 gtk_box_pack_start (GTK_BOX (hbox_cliplog), loglength_label,
2940 gtk_widget_show (GTK_WIDGET (loglength_label));
2941 loglength_entry = gtk_entry_new ();
2942 gtk_widget_set_usize (GTK_WIDGET (loglength_entry), 64, -1);
2943 gtk_box_pack_start (GTK_BOX (hbox_cliplog), loglength_entry,
2945 gtk_widget_show (GTK_WIDGET (loglength_entry));
2946 loglength_label = gtk_label_new (_("(0 to stop logging in the log window)"));
2947 gtk_box_pack_start (GTK_BOX (hbox_cliplog), loglength_label,
2949 SET_TOGGLE_SENSITIVITY(checkbtn_cliplog, loglength_entry);
2954 PACK_FRAME (vbox1, frame_ssl, _("Security"));
2956 vbox_ssl = gtk_vbox_new (FALSE, 0);
2957 gtk_widget_show (vbox_ssl);
2958 gtk_container_add (GTK_CONTAINER (frame_ssl), vbox_ssl);
2959 gtk_container_set_border_width (GTK_CONTAINER (vbox_ssl), 8);
2960 PACK_CHECK_BUTTON (vbox_ssl, checkbtn_ssl_ask_unknown_valid,
2961 _("Ask before accepting SSL certificates"));
2962 hbox_ssl = gtk_hbox_new (FALSE, 3);
2963 gtk_container_add (GTK_CONTAINER (vbox_ssl), hbox_ssl);
2964 gtk_widget_show (hbox_ssl);
2969 PACK_FRAME (vbox1, frame_exit, _("On exit"));
2971 vbox_exit = gtk_vbox_new (FALSE, 0);
2972 gtk_widget_show (vbox_exit);
2973 gtk_container_add (GTK_CONTAINER (frame_exit), vbox_exit);
2974 gtk_container_set_border_width (GTK_CONTAINER (vbox_exit), 8);
2976 PACK_CHECK_BUTTON (vbox_exit, checkbtn_confonexit,
2977 _("Confirm on exit"));
2979 hbox1 = gtk_hbox_new (FALSE, 32);
2980 gtk_widget_show (hbox1);
2981 gtk_box_pack_start (GTK_BOX (vbox_exit), hbox1, FALSE, FALSE, 0);
2983 PACK_CHECK_BUTTON (hbox1, checkbtn_cleanonexit,
2984 _("Empty trash on exit"));
2985 PACK_CHECK_BUTTON (hbox1, checkbtn_askonclean,
2986 _("Ask before emptying"));
2987 SET_TOGGLE_SENSITIVITY (checkbtn_cleanonexit, checkbtn_askonclean);
2989 PACK_CHECK_BUTTON (vbox_exit, checkbtn_warnqueued,
2990 _("Warn if there are queued messages"));
2992 other.uri_combo = uri_combo;
2993 other.uri_entry = uri_entry;
2994 other.printcmd_entry = printcmd_entry;
2996 other.exteditor_combo = exteditor_combo;
2997 other.exteditor_entry = exteditor_entry;
2999 other.checkbtn_addaddrbyclick = checkbtn_addaddrbyclick;
3001 other.checkbtn_cliplog = checkbtn_cliplog;
3002 other.loglength_entry = loglength_entry;
3004 other.checkbtn_confonexit = checkbtn_confonexit;
3005 other.checkbtn_cleanonexit = checkbtn_cleanonexit;
3006 other.checkbtn_askonclean = checkbtn_askonclean;
3007 other.checkbtn_warnqueued = checkbtn_warnqueued;
3011 other.checkbtn_ssl_ask_unknown_valid = checkbtn_ssl_ask_unknown_valid;
3016 static void date_format_ok_btn_clicked(GtkButton *button, GtkWidget **widget)
3018 GtkWidget *datefmt_sample = NULL;
3021 g_return_if_fail(widget != NULL);
3022 g_return_if_fail(*widget != NULL);
3023 g_return_if_fail(display.entry_datefmt != NULL);
3025 datefmt_sample = GTK_WIDGET(gtk_object_get_data
3026 (GTK_OBJECT(*widget), "datefmt_sample"));
3027 g_return_if_fail(datefmt_sample != NULL);
3029 text = gtk_editable_get_chars(GTK_EDITABLE(datefmt_sample), 0, -1);
3030 g_free(prefs_common.date_format);
3031 prefs_common.date_format = text;
3032 gtk_entry_set_text(GTK_ENTRY(display.entry_datefmt), text);
3034 gtk_widget_destroy(*widget);
3038 static void date_format_cancel_btn_clicked(GtkButton *button,
3041 g_return_if_fail(widget != NULL);
3042 g_return_if_fail(*widget != NULL);
3044 gtk_widget_destroy(*widget);
3048 static void date_format_key_pressed(GtkWidget *keywidget, GdkEventKey *event,
3051 if (event && event->keyval == GDK_Escape)
3052 date_format_cancel_btn_clicked(NULL, widget);
3055 static gboolean date_format_on_delete(GtkWidget *dialogwidget,
3056 GdkEventAny *event, GtkWidget **widget)
3058 g_return_val_if_fail(widget != NULL, FALSE);
3059 g_return_val_if_fail(*widget != NULL, FALSE);
3065 static void date_format_entry_on_change(GtkEditable *editable,
3069 struct tm *cal_time;
3073 cur_time = time(NULL);
3074 cal_time = localtime(&cur_time);
3076 text = gtk_editable_get_chars(editable, 0, -1);
3078 strftime(buffer, sizeof buffer, text, cal_time);
3080 gtk_label_set_text(example, buffer);
3083 static void date_format_select_row(GtkWidget *date_format_list, gint row,
3084 gint column, GdkEventButton *event,
3085 GtkWidget *date_format)
3091 GtkWidget *datefmt_sample;
3093 /* only on double click */
3094 if (!event || event->type != GDK_2BUTTON_PRESS) return;
3097 datefmt_sample = GTK_WIDGET(gtk_object_get_data
3098 (GTK_OBJECT(date_format), "datefmt_sample"));
3100 g_return_if_fail(date_format_list != NULL);
3101 g_return_if_fail(date_format != NULL);
3102 g_return_if_fail(datefmt_sample != NULL);
3104 /* get format from clist */
3105 gtk_clist_get_text(GTK_CLIST(date_format_list), row, 0, &format);
3107 cur_pos = gtk_editable_get_position(GTK_EDITABLE(datefmt_sample));
3108 old_format = gtk_entry_get_text(GTK_ENTRY(datefmt_sample));
3110 /* insert the format into the text entry */
3111 new_format = g_malloc(strlen(old_format) + 3);
3113 strncpy(new_format, old_format, cur_pos);
3114 new_format[cur_pos] = '\0';
3115 strcat(new_format, format);
3116 strcat(new_format, &old_format[cur_pos]);
3118 gtk_entry_set_text(GTK_ENTRY(datefmt_sample), new_format);
3119 gtk_editable_set_position(GTK_EDITABLE(datefmt_sample), cur_pos + 2);
3124 static GtkWidget *date_format_create(GtkButton *button, void *data)
3126 static GtkWidget *datefmt_win = NULL;
3128 GtkWidget *scrolledwindow1;
3129 GtkWidget *datefmt_clist;
3134 GtkWidget *confirm_area;
3136 GtkWidget *cancel_btn;
3137 GtkWidget *datefmt_entry;
3166 const gint TIME_FORMAT_ELEMS =
3167 sizeof time_format / sizeof time_format[0];
3169 time_format[0].txt = _("the full abbreviated weekday name");
3170 time_format[1].txt = _("the full weekday name");
3171 time_format[2].txt = _("the abbreviated month name");
3172 time_format[3].txt = _("the full month name");
3173 time_format[4].txt = _("the preferred date and time for the current locale");
3174 time_format[5].txt = _("the century number (year/100)");
3175 time_format[6].txt = _("the day of the month as a decimal number");
3176 time_format[7].txt = _("the hour as a decimal number using a 24-hour clock");
3177 time_format[8].txt = _("the hour as a decimal number using a 12-hour clock");
3178 time_format[9].txt = _("the day of the year as a decimal number");
3179 time_format[10].txt = _("the month as a decimal number");
3180 time_format[11].txt = _("the minute as a decimal number");
3181 time_format[12].txt = _("either AM or PM");
3182 time_format[13].txt = _("the second as a decimal number");
3183 time_format[14].txt = _("the day of the week as a decimal number");
3184 time_format[15].txt = _("the preferred date for the current locale");
3185 time_format[16].txt = _("the last two digits of a year");
3186 time_format[17].txt = _("the year as a decimal number");
3187 time_format[18].txt = _("the time zone or name or abbreviation");
3189 if (datefmt_win) return datefmt_win;
3191 datefmt_win = gtk_window_new(GTK_WINDOW_DIALOG);
3192 gtk_container_set_border_width(GTK_CONTAINER(datefmt_win), 8);
3193 gtk_window_set_title(GTK_WINDOW(datefmt_win), _("Date format"));
3194 gtk_window_set_position(GTK_WINDOW(datefmt_win), GTK_WIN_POS_CENTER);
3195 gtk_widget_set_usize(datefmt_win, 440, 280);
3197 vbox1 = gtk_vbox_new(FALSE, 10);
3198 gtk_widget_show(vbox1);
3199 gtk_container_add(GTK_CONTAINER(datefmt_win), vbox1);
3201 scrolledwindow1 = gtk_scrolled_window_new(NULL, NULL);
3202 gtk_scrolled_window_set_policy
3203 (GTK_SCROLLED_WINDOW(scrolledwindow1),
3204 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
3205 gtk_widget_show(scrolledwindow1);
3206 gtk_box_pack_start(GTK_BOX(vbox1), scrolledwindow1, TRUE, TRUE, 0);
3208 titles[0] = _("Specifier");
3209 titles[1] = _("Description");
3210 datefmt_clist = gtk_clist_new_with_titles(2, titles);
3211 gtk_widget_show(datefmt_clist);
3212 gtk_container_add(GTK_CONTAINER(scrolledwindow1), datefmt_clist);
3213 /* gtk_clist_set_column_width(GTK_CLIST(datefmt_clist), 0, 80); */
3214 gtk_clist_set_selection_mode(GTK_CLIST(datefmt_clist),
3215 GTK_SELECTION_BROWSE);
3217 for (i = 0; i < TIME_FORMAT_ELEMS; i++) {
3219 /* phoney casting necessary because of gtk... */
3220 text[0] = (gchar *)time_format[i].fmt;
3221 text[1] = (gchar *)time_format[i].txt;
3222 gtk_clist_append(GTK_CLIST(datefmt_clist), text);
3225 table = gtk_table_new(2, 2, FALSE);
3226 gtk_widget_show(table);
3227 gtk_box_pack_start(GTK_BOX(vbox1), table, FALSE, FALSE, 0);
3228 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
3229 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
3231 label1 = gtk_label_new(_("Date format"));
3232 gtk_widget_show(label1);
3233 gtk_table_attach(GTK_TABLE(table), label1, 0, 1, 0, 1,
3235 gtk_label_set_justify(GTK_LABEL(label1), GTK_JUSTIFY_LEFT);
3236 gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5);
3238 datefmt_entry = gtk_entry_new_with_max_length(256);
3239 gtk_widget_show(datefmt_entry);
3240 gtk_table_attach(GTK_TABLE(table), datefmt_entry, 1, 2, 0, 1,
3241 (GTK_EXPAND | GTK_FILL), 0, 0, 0);
3243 /* we need the "sample" entry box; add it as data so callbacks can
3244 * get the entry box */
3245 gtk_object_set_data(GTK_OBJECT(datefmt_win), "datefmt_sample",
3248 label2 = gtk_label_new(_("Example"));
3249 gtk_widget_show(label2);
3250 gtk_table_attach(GTK_TABLE(table), label2, 0, 1, 1, 2,
3252 gtk_label_set_justify(GTK_LABEL(label2), GTK_JUSTIFY_LEFT);
3253 gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5);
3255 label3 = gtk_label_new("");
3256 gtk_widget_show(label3);
3257 gtk_table_attach(GTK_TABLE(table), label3, 1, 2, 1, 2,
3258 (GTK_EXPAND | GTK_FILL), 0, 0, 0);
3259 gtk_label_set_justify(GTK_LABEL(label3), GTK_JUSTIFY_LEFT);
3260 gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5);
3262 gtkut_button_set_create(&confirm_area, &ok_btn, _("OK"),
3263 &cancel_btn, _("Cancel"), NULL, NULL);
3264 gtk_widget_grab_default(ok_btn);
3265 gtk_widget_show(confirm_area);
3267 gtk_box_pack_start(GTK_BOX(vbox1), confirm_area, FALSE, FALSE, 0);
3269 /* set the current format */
3270 gtk_entry_set_text(GTK_ENTRY(datefmt_entry), prefs_common.date_format);
3271 date_format_entry_on_change(GTK_EDITABLE(datefmt_entry),
3274 gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
3275 GTK_SIGNAL_FUNC(date_format_ok_btn_clicked),
3277 gtk_signal_connect(GTK_OBJECT(cancel_btn), "clicked",
3278 GTK_SIGNAL_FUNC(date_format_cancel_btn_clicked),
3280 gtk_signal_connect(GTK_OBJECT(datefmt_win), "key_press_event",
3281 GTK_SIGNAL_FUNC(date_format_key_pressed),
3283 gtk_signal_connect(GTK_OBJECT(datefmt_win), "delete_event",
3284 GTK_SIGNAL_FUNC(date_format_on_delete),
3286 gtk_signal_connect(GTK_OBJECT(datefmt_entry), "changed",
3287 GTK_SIGNAL_FUNC(date_format_entry_on_change),
3290 gtk_signal_connect(GTK_OBJECT(datefmt_clist), "select_row",
3291 GTK_SIGNAL_FUNC(date_format_select_row),
3294 gtk_window_set_position(GTK_WINDOW(datefmt_win), GTK_WIN_POS_CENTER);
3295 gtk_window_set_modal(GTK_WINDOW(datefmt_win), TRUE);
3297 gtk_widget_show(datefmt_win);
3298 manage_window_set_transient(GTK_WINDOW(datefmt_win));
3300 gtk_widget_grab_focus(ok_btn);
3305 void prefs_quote_colors_dialog(void)
3307 if (!quote_color_win)
3308 prefs_quote_colors_dialog_create();
3309 gtk_widget_show(quote_color_win);
3310 manage_window_set_transient(GTK_WINDOW(quote_color_win));
3313 gtk_widget_hide(quote_color_win);
3315 textview_update_message_colors();
3316 main_window_reflect_prefs_all();
3319 static void prefs_quote_colors_dialog_create(void)
3324 GtkWidget *quotelevel1_label;
3325 GtkWidget *quotelevel2_label;
3326 GtkWidget *quotelevel3_label;
3327 GtkWidget *uri_label;
3328 GtkWidget *signature_label;
3329 GtkWidget *tgt_folder_label;
3332 GtkWidget *recycle_colors_btn;
3333 GtkWidget *frame_colors;
3335 window = gtk_window_new(GTK_WINDOW_DIALOG);
3336 gtk_container_set_border_width(GTK_CONTAINER(window), 2);
3337 gtk_window_set_title(GTK_WINDOW(window), _("Set message colors"));
3338 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
3339 gtk_window_set_modal(GTK_WINDOW(window), TRUE);
3340 gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
3342 vbox = gtk_vbox_new (FALSE, VSPACING);
3343 gtk_container_add (GTK_CONTAINER (window), vbox);
3344 gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
3345 PACK_FRAME(vbox, frame_colors, _("Colors"));
3347 table = gtk_table_new (5, 2, FALSE);
3348 gtk_container_add (GTK_CONTAINER (frame_colors), table);
3349 gtk_container_set_border_width (GTK_CONTAINER (table), 8);
3350 gtk_table_set_row_spacings (GTK_TABLE (table), 2);
3351 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
3354 color_buttons.quote_level1_btn = gtk_button_new();
3355 gtk_table_attach (GTK_TABLE (table), color_buttons.quote_level1_btn,
3356 0, 1, 0, 1, 0, 0, 0, 0);
3357 gtk_widget_set_usize (color_buttons.quote_level1_btn, 40, 30);
3358 gtk_container_set_border_width
3359 (GTK_CONTAINER (color_buttons.quote_level1_btn), 5);
3361 color_buttons.quote_level2_btn = gtk_button_new();
3362 gtk_table_attach (GTK_TABLE (table), color_buttons.quote_level2_btn,
3363 0, 1, 1, 2, 0, 0, 0, 0);
3364 gtk_widget_set_usize (color_buttons.quote_level2_btn, 40, 30);
3365 gtk_container_set_border_width (GTK_CONTAINER (color_buttons.quote_level2_btn), 5);
3367 color_buttons.quote_level3_btn = gtk_button_new_with_label ("");
3368 gtk_table_attach (GTK_TABLE (table), color_buttons.quote_level3_btn,
3369 0, 1, 2, 3, 0, 0, 0, 0);
3370 gtk_widget_set_usize (color_buttons.quote_level3_btn, 40, 30);
3371 gtk_container_set_border_width
3372 (GTK_CONTAINER (color_buttons.quote_level3_btn), 5);
3374 color_buttons.uri_btn = gtk_button_new_with_label ("");
3375 gtk_table_attach (GTK_TABLE (table), color_buttons.uri_btn,
3376 0, 1, 3, 4, 0, 0, 0, 0);
3377 gtk_widget_set_usize (color_buttons.uri_btn, 40, 30);
3378 gtk_container_set_border_width (GTK_CONTAINER (color_buttons.uri_btn), 5);
3380 color_buttons.tgt_folder_btn = gtk_button_new_with_label ("");
3381 gtk_table_attach (GTK_TABLE (table), color_buttons.tgt_folder_btn,
3382 0, 1, 4, 5, 0, 0, 0, 0);
3383 gtk_widget_set_usize (color_buttons.tgt_folder_btn, 40, 30);
3384 gtk_container_set_border_width (GTK_CONTAINER (color_buttons.tgt_folder_btn), 5);
3386 color_buttons.signature_btn = gtk_button_new_with_label ("");
3387 gtk_table_attach (GTK_TABLE (table), color_buttons.signature_btn,
3388 0, 1, 5, 6, 0, 0, 0, 0);
3389 gtk_widget_set_usize (color_buttons.signature_btn, 40, 30);
3390 gtk_container_set_border_width (GTK_CONTAINER (color_buttons.signature_btn), 5);
3392 quotelevel1_label = gtk_label_new (_("Quoted Text - First Level"));
3393 gtk_table_attach (GTK_TABLE (table), quotelevel1_label, 1, 2, 0, 1,
3394 (GTK_EXPAND | GTK_FILL), 0, 0, 0);
3395 gtk_label_set_justify (GTK_LABEL (quotelevel1_label), GTK_JUSTIFY_LEFT);
3396 gtk_misc_set_alignment (GTK_MISC (quotelevel1_label), 0, 0.5);
3398 quotelevel2_label = gtk_label_new (_("Quoted Text - Second Level"));
3399 gtk_table_attach (GTK_TABLE (table), quotelevel2_label, 1, 2, 1, 2,
3400 (GTK_EXPAND | GTK_FILL), 0, 0, 0);
3401 gtk_label_set_justify (GTK_LABEL (quotelevel2_label), GTK_JUSTIFY_LEFT);
3402 gtk_misc_set_alignment (GTK_MISC (quotelevel2_label), 0, 0.5);
3404 quotelevel3_label = gtk_label_new (_("Quoted Text - Third Level"));
3405 gtk_table_attach (GTK_TABLE (table), quotelevel3_label, 1, 2, 2, 3,
3406 (GTK_EXPAND | GTK_FILL), 0, 0, 0);
3407 gtk_label_set_justify (GTK_LABEL (quotelevel3_label), GTK_JUSTIFY_LEFT);
3408 gtk_misc_set_alignment (GTK_MISC (quotelevel3_label), 0, 0.5);
3410 uri_label = gtk_label_new (_("URI link"));
3411 gtk_table_attach (GTK_TABLE (table), uri_label, 1, 2, 3, 4,
3412 (GTK_EXPAND | GTK_FILL), 0, 0, 0);
3413 gtk_label_set_justify (GTK_LABEL (uri_label), GTK_JUSTIFY_LEFT);
3414 gtk_misc_set_alignment (GTK_MISC (uri_label), 0, 0.5);
3416 tgt_folder_label = gtk_label_new (_("Target folder"));
3417 gtk_table_attach (GTK_TABLE (table), tgt_folder_label, 1, 2, 4, 5,
3418 (GTK_EXPAND | GTK_FILL), 0, 0, 0);
3419 gtk_label_set_justify (GTK_LABEL (tgt_folder_label), GTK_JUSTIFY_LEFT);
3420 gtk_misc_set_alignment (GTK_MISC (tgt_folder_label), 0, 0.5);
3422 signature_label = gtk_label_new (_("Signatures"));
3423 gtk_table_attach (GTK_TABLE (table), signature_label, 1, 2, 5, 6,
3424 (GTK_EXPAND | GTK_FILL), 0, 0, 0);
3425 gtk_label_set_justify (GTK_LABEL (signature_label), GTK_JUSTIFY_LEFT);
3426 gtk_misc_set_alignment (GTK_MISC (signature_label), 0, 0.5);
3428 PACK_CHECK_BUTTON (vbox, recycle_colors_btn,
3429 _("Recycle quote colors"));
3431 gtkut_button_set_create(&hbbox, &ok_btn, _("OK"),
3432 NULL, NULL, NULL, NULL);
3433 gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0);
3435 gtk_widget_grab_default(ok_btn);
3436 MANAGE_WINDOW_SIGNALS_CONNECT(window);
3437 gtk_signal_connect(GTK_OBJECT(window), "delete_event",
3438 GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
3439 gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
3440 GTK_SIGNAL_FUNC(prefs_quote_colors_key_pressed),
3443 gtk_signal_connect(GTK_OBJECT(color_buttons.quote_level1_btn), "clicked",
3444 GTK_SIGNAL_FUNC(quote_color_set_dialog), "LEVEL1");
3445 gtk_signal_connect(GTK_OBJECT(color_buttons.quote_level2_btn), "clicked",
3446 GTK_SIGNAL_FUNC(quote_color_set_dialog), "LEVEL2");
3447 gtk_signal_connect(GTK_OBJECT(color_buttons.quote_level3_btn), "clicked",
3448 GTK_SIGNAL_FUNC(quote_color_set_dialog), "LEVEL3");
3449 gtk_signal_connect(GTK_OBJECT(color_buttons.uri_btn), "clicked",
3450 GTK_SIGNAL_FUNC(quote_color_set_dialog), "URI");
3451 gtk_signal_connect(GTK_OBJECT(color_buttons.tgt_folder_btn), "clicked",
3452 GTK_SIGNAL_FUNC(quote_color_set_dialog), "TGTFLD");
3453 gtk_signal_connect(GTK_OBJECT(color_buttons.signature_btn), "clicked",
3454 GTK_SIGNAL_FUNC(quote_color_set_dialog), "SIGNATURE");
3455 gtk_signal_connect(GTK_OBJECT(recycle_colors_btn), "toggled",
3456 GTK_SIGNAL_FUNC(prefs_recycle_colors_toggled), NULL);
3457 gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
3458 GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
3460 /* show message button colors and recycle options */
3461 set_button_bg_color(color_buttons.quote_level1_btn,
3462 prefs_common.quote_level1_col);
3463 set_button_bg_color(color_buttons.quote_level2_btn,
3464 prefs_common.quote_level2_col);
3465 set_button_bg_color(color_buttons.quote_level3_btn,
3466 prefs_common.quote_level3_col);
3467 set_button_bg_color(color_buttons.uri_btn,
3468 prefs_common.uri_col);
3469 set_button_bg_color(color_buttons.tgt_folder_btn,
3470 prefs_common.tgt_folder_col);
3471 set_button_bg_color(color_buttons.signature_btn,
3472 prefs_common.signature_col);
3473 gtk_toggle_button_set_active((GtkToggleButton *)recycle_colors_btn,
3474 prefs_common.recycle_quote_colors);
3476 gtk_widget_show_all(vbox);
3477 quote_color_win = window;
3480 static void prefs_quote_colors_key_pressed(GtkWidget *widget,
3481 GdkEventKey *event, gpointer data)
3483 if (event && event->keyval == GDK_Escape)
3487 static void quote_color_set_dialog(GtkWidget *widget, gpointer data)
3489 gchar *type = (gchar *)data;
3490 gchar *title = NULL;
3491 gdouble color[4] = {0.0, 0.0, 0.0, 0.0};
3493 GtkColorSelectionDialog *dialog;
3495 if(g_strcasecmp(type, "LEVEL1") == 0) {
3496 title = _("Pick color for quotation level 1");
3497 rgbvalue = prefs_common.quote_level1_col;
3498 } else if(g_strcasecmp(type, "LEVEL2") == 0) {
3499 title = _("Pick color for quotation level 2");
3500 rgbvalue = prefs_common.quote_level2_col;
3501 } else if(g_strcasecmp(type, "LEVEL3") == 0) {
3502 title = _("Pick color for quotation level 3");
3503 rgbvalue = prefs_common.quote_level3_col;
3504 } else if(g_strcasecmp(type, "URI") == 0) {
3505 title = _("Pick color for URI");
3506 rgbvalue = prefs_common.uri_col;
3507 } else if(g_strcasecmp(type, "TGTFLD") == 0) {
3508 title = _("Pick color for target folder");
3509 rgbvalue = prefs_common.tgt_folder_col;
3510 } else if(g_strcasecmp(type, "SIGNATURE") == 0) {
3511 title = _("Pick color for signatures");
3512 rgbvalue = prefs_common.signature_col;
3514 } else if(g_strcasecmp(type, "Misspelled word") == 0) {
3515 title = _("Pick color for misspelled word");
3516 rgbvalue = prefs_common.misspelled_col;
3518 } else { /* Should never be called */
3519 g_warning("Unrecognized datatype '%s' in quote_color_set_dialog\n", type);
3523 color_dialog = gtk_color_selection_dialog_new(title);
3524 gtk_window_set_position(GTK_WINDOW(color_dialog), GTK_WIN_POS_CENTER);
3525 gtk_window_set_modal(GTK_WINDOW(color_dialog), TRUE);
3526 gtk_window_set_policy(GTK_WINDOW(color_dialog), FALSE, FALSE, FALSE);
3527 manage_window_set_transient(GTK_WINDOW(color_dialog));
3529 gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(color_dialog)->ok_button),
3530 "clicked", GTK_SIGNAL_FUNC(quote_colors_set_dialog_ok), data);
3531 gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(color_dialog)->cancel_button),
3532 "clicked", GTK_SIGNAL_FUNC(quote_colors_set_dialog_cancel), data);
3533 gtk_signal_connect(GTK_OBJECT(color_dialog), "key_press_event",
3534 GTK_SIGNAL_FUNC(quote_colors_set_dialog_key_pressed),
3537 /* preselect the previous color in the color selection dialog */
3538 color[0] = (gdouble) ((rgbvalue & 0xff0000) >> 16) / 255.0;
3539 color[1] = (gdouble) ((rgbvalue & 0x00ff00) >> 8) / 255.0;
3540 color[2] = (gdouble) (rgbvalue & 0x0000ff) / 255.0;
3541 dialog = GTK_COLOR_SELECTION_DIALOG(color_dialog);
3542 gtk_color_selection_set_color
3543 (GTK_COLOR_SELECTION(dialog->colorsel), color);
3545 gtk_widget_show(color_dialog);
3548 static void quote_colors_set_dialog_ok(GtkWidget *widget, gpointer data)
3550 GtkColorSelection *colorsel = (GtkColorSelection *)
3551 ((GtkColorSelectionDialog *)color_dialog)->colorsel;
3553 gint red, green, blue, rgbvalue;
3554 gchar *type = (gchar *)data;
3556 gtk_color_selection_get_color(colorsel, color);
3558 red = (gint) (color[0] * 255.0);
3559 green = (gint) (color[1] * 255.0);
3560 blue = (gint) (color[2] * 255.0);
3561 rgbvalue = (gint) ((red * 0x10000) | (green * 0x100) | blue);
3564 fprintf(stderr, "redc = %f, greenc = %f, bluec = %f\n", color[0], color[1], color[2]);
3565 fprintf(stderr, "red = %d, green = %d, blue = %d\n", red, green, blue);
3566 fprintf(stderr, "Color is %x\n", rgbvalue);
3569 if (g_strcasecmp(type, "LEVEL1") == 0) {
3570 prefs_common.quote_level1_col = rgbvalue;
3571 set_button_bg_color(color_buttons.quote_level1_btn, rgbvalue);
3572 } else if (g_strcasecmp(type, "LEVEL2") == 0) {
3573 prefs_common.quote_level2_col = rgbvalue;
3574 set_button_bg_color(color_buttons.quote_level2_btn, rgbvalue);
3575 } else if (g_strcasecmp(type, "LEVEL3") == 0) {
3576 prefs_common.quote_level3_col = rgbvalue;
3577 set_button_bg_color(color_buttons.quote_level3_btn, rgbvalue);
3578 } else if (g_strcasecmp(type, "URI") == 0) {
3579 prefs_common.uri_col = rgbvalue;
3580 set_button_bg_color(color_buttons.uri_btn, rgbvalue);
3581 } else if (g_strcasecmp(type, "TGTFLD") == 0) {
3582 prefs_common.tgt_folder_col = rgbvalue;
3583 set_button_bg_color(color_buttons.tgt_folder_btn, rgbvalue);
3584 folderview_set_target_folder_color(prefs_common.tgt_folder_col);
3585 } else if (g_strcasecmp(type, "SIGNATURE") == 0) {
3586 prefs_common.signature_col = rgbvalue;
3587 set_button_bg_color(color_buttons.signature_btn, rgbvalue);
3589 } else if (g_strcasecmp(type, "Misspelled word") == 0) {
3590 prefs_common.misspelled_col = rgbvalue;
3591 set_button_bg_color(spelling.misspelled_btn, rgbvalue);
3594 fprintf( stderr, "Unrecognized datatype '%s' in quote_color_set_dialog_ok\n", type );
3596 gtk_widget_destroy(color_dialog);
3599 static void quote_colors_set_dialog_cancel(GtkWidget *widget, gpointer data)
3601 gtk_widget_destroy(color_dialog);
3604 static void quote_colors_set_dialog_key_pressed(GtkWidget *widget,
3608 gtk_widget_destroy(color_dialog);
3611 static void set_button_bg_color(GtkWidget *widget, gint rgbvalue)
3616 gtkut_convert_int_to_gdk_color(rgbvalue, &color);
3617 newstyle = gtk_style_copy(gtk_widget_get_default_style());
3618 newstyle->bg[GTK_STATE_NORMAL] = color;
3619 newstyle->bg[GTK_STATE_PRELIGHT] = color;
3620 newstyle->bg[GTK_STATE_ACTIVE] = color;
3622 gtk_widget_set_style(GTK_WIDGET(widget), newstyle);
3625 static void prefs_enable_message_color_toggled(void)
3629 is_active = gtk_toggle_button_get_active
3630 (GTK_TOGGLE_BUTTON(message.chkbtn_enablecol));
3631 gtk_widget_set_sensitive(message.button_edit_col, is_active);
3632 prefs_common.enable_color = is_active;
3635 static void prefs_recycle_colors_toggled(GtkWidget *widget)
3639 is_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
3640 prefs_common.recycle_quote_colors = is_active;
3643 static void prefs_font_select(GtkButton *button, GtkEntry *entry)
3647 g_return_if_fail(entry != NULL);
3649 if (!font_sel_win) {
3650 font_sel_win = gtk_font_selection_dialog_new
3651 (_("Font selection"));
3652 gtk_window_position(GTK_WINDOW(font_sel_win),
3653 GTK_WIN_POS_CENTER);
3654 gtk_signal_connect(GTK_OBJECT(font_sel_win), "delete_event",
3655 GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete),
3658 (GTK_OBJECT(font_sel_win), "key_press_event",
3659 GTK_SIGNAL_FUNC(prefs_font_selection_key_pressed),
3661 gtk_signal_connect_object
3662 (GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(font_sel_win)->cancel_button),
3664 GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete),
3665 GTK_OBJECT(font_sel_win));
3668 if(font_sel_conn_id) {
3669 gtk_signal_disconnect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(font_sel_win)->ok_button), font_sel_conn_id);
3671 font_sel_conn_id = gtk_signal_connect
3672 (GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(font_sel_win)->ok_button),
3674 GTK_SIGNAL_FUNC(prefs_font_selection_ok),
3676 printf("%i\n", font_sel_conn_id);
3678 font_name = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
3679 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(font_sel_win), font_name);
3681 manage_window_set_transient(GTK_WINDOW(font_sel_win));
3682 gtk_window_set_modal(GTK_WINDOW(font_sel_win), TRUE);
3683 gtk_widget_grab_focus
3684 (GTK_FONT_SELECTION_DIALOG(font_sel_win)->ok_button);
3685 gtk_widget_show(font_sel_win);
3688 static void prefs_font_selection_key_pressed(GtkWidget *widget,
3692 if (event && event->keyval == GDK_Escape)
3693 gtk_widget_hide(font_sel_win);
3696 static void prefs_font_selection_ok(GtkButton *button, GtkEntry *entry)
3700 fontname = gtk_font_selection_dialog_get_font_name
3701 (GTK_FONT_SELECTION_DIALOG(font_sel_win));
3704 gtk_entry_set_text(entry, fontname);
3709 gtk_widget_hide(font_sel_win);
3712 static void prefs_keybind_select(void)
3719 GtkWidget *confirm_area;
3721 GtkWidget *cancel_btn;
3723 window = gtk_window_new (GTK_WINDOW_DIALOG);
3724 gtk_container_set_border_width (GTK_CONTAINER (window), 8);
3725 gtk_window_set_title (GTK_WINDOW (window), _("Key bindings"));
3726 gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
3727 gtk_window_set_modal (GTK_WINDOW (window), TRUE);
3728 gtk_window_set_policy (GTK_WINDOW (window), FALSE, FALSE, FALSE);
3729 manage_window_set_transient (GTK_WINDOW (window));
3731 vbox1 = gtk_vbox_new (FALSE, VSPACING);
3732 gtk_container_add (GTK_CONTAINER (window), vbox1);
3733 gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2);
3735 hbox1 = gtk_hbox_new (FALSE, 8);
3736 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
3738 label = gtk_label_new
3739 (_("Select preset:"));
3740 gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
3741 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
3743 hbox1 = gtk_hbox_new (FALSE, 8);
3744 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
3746 combo = gtk_combo_new ();
3747 gtk_box_pack_start (GTK_BOX (hbox1), combo, TRUE, TRUE, 0);
3748 gtkut_combo_set_items (GTK_COMBO (combo),
3754 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
3756 hbox1 = gtk_hbox_new (FALSE, 8);
3757 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
3759 label = gtk_label_new
3760 (_("You can also modify each menu shortcut by pressing\n"
3761 "any key(s) when placing the mouse pointer on the item."));
3762 gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
3763 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
3765 hbox1 = gtk_hbox_new (FALSE, 8);
3766 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
3768 gtkut_button_set_create (&confirm_area, &ok_btn, _("OK"),
3769 &cancel_btn, _("Cancel"), NULL, NULL);
3770 gtk_box_pack_end (GTK_BOX (hbox1), confirm_area, FALSE, FALSE, 0);
3771 gtk_widget_grab_default (ok_btn);
3773 MANAGE_WINDOW_SIGNALS_CONNECT(window);
3774 gtk_signal_connect (GTK_OBJECT (window), "delete_event",
3775 GTK_SIGNAL_FUNC (prefs_keybind_deleted), NULL);
3776 gtk_signal_connect (GTK_OBJECT (window), "key_press_event",
3777 GTK_SIGNAL_FUNC (prefs_keybind_key_pressed), NULL);
3778 gtk_signal_connect (GTK_OBJECT (ok_btn), "clicked",
3779 GTK_SIGNAL_FUNC (prefs_keybind_apply_clicked),
3781 gtk_signal_connect (GTK_OBJECT (cancel_btn), "clicked",
3782 GTK_SIGNAL_FUNC (prefs_keybind_cancel),
3785 gtk_widget_show_all(window);
3787 keybind.window = window;
3788 keybind.combo = combo;
3791 static void prefs_keybind_key_pressed(GtkWidget *widget, GdkEventKey *event,
3794 if (event && event->keyval == GDK_Escape)
3795 prefs_keybind_cancel();
3798 static gint prefs_keybind_deleted(GtkWidget *widget, GdkEventAny *event,
3801 prefs_keybind_cancel();
3805 static void prefs_keybind_cancel(void)
3807 gtk_widget_destroy(keybind.window);
3808 keybind.window = NULL;
3809 keybind.combo = NULL;
3812 static void prefs_keybind_apply_clicked(GtkWidget *widget)
3814 GtkEntry *entry = GTK_ENTRY(GTK_COMBO(keybind.combo)->entry);
3818 static gchar *default_menurc =
3819 "(menu-path \"<Main>/File/Empty trash\" \"\")\n"
3820 "(menu-path \"<Main>/File/Save as...\" \"<control>S\")\n"
3821 "(menu-path \"<Main>/File/Print...\" \"\")\n"
3822 "(menu-path \"<Main>/File/Exit\" \"<control>Q\")\n"
3824 "(menu-path \"<Main>/Edit/Copy\" \"<control>C\")\n"
3825 "(menu-path \"<Main>/Edit/Select all\" \"<control>A\")\n"
3826 "(menu-path \"<Main>/Edit/Find in current message...\" \"<control>F\")\n"
3827 "(menu-path \"<Main>/Edit/Search folder...\" \"<shift><control>F\")\n"
3829 "(menu-path \"<Main>/View/Expand Summary View\" \"V\")\n"
3830 "(menu-path \"<Main>/View/Expand Message View\" \"<shift>V\")\n"
3831 "(menu-path \"<Main>/View/Thread view\" \"<control>T\")\n"
3832 "(menu-path \"<Main>/View/Go to/Prev message\" \"P\")\n"
3833 "(menu-path \"<Main>/View/Go to/Next message\" \"N\")\n"
3834 "(menu-path \"<Main>/View/Go to/Prev unread message\" \"<shift>P\")\n"
3835 "(menu-path \"<Main>/View/Go to/Next unread message\" \"<shift>N\")\n"
3836 "(menu-path \"<Main>/View/Go to/Other folder...\" \"G\")\n"
3837 "(menu-path \"<Main>/View/Open in new window\" \"<control><alt>N\")\n"
3838 "(menu-path \"<Main>/View/View source\" \"<control>U\")\n"
3839 "(menu-path \"<Main>/View/Show all headers\" \"<control>H\")\n"
3840 "(menu-path \"<Main>/View/Update\" \"<control><alt>U\")\n"
3842 "(menu-path \"<Main>/Message/Get new mail\" \"<control>I\")\n"
3843 "(menu-path \"<Main>/Message/Get from all accounts\" \"<shift><control>I\")\n"
3844 "(menu-path \"<Main>/Message/Compose an email message\" \"<control>M\")\n"
3845 "(menu-path \"<Main>/Message/Reply\" \"<control>R\")\n"
3846 "(menu-path \"<Main>/Message/Reply to/all\" \"<shift><control>R\")\n"
3847 "(menu-path \"<Main>/Message/Reply to/sender\" \"\")\n"
3848 "(menu-path \"<Main>/Message/Reply to/mailing list\" \"<control>L\")\n"
3849 "(menu-path \"<Main>/Message/Forward\" \"<control><alt>F\")\n"
3850 /* "(menu-path \"<Main>/Message/Forward as attachment\" \"\")\n" */
3851 "(menu-path \"<Main>/Message/Move...\" \"<control>O\")\n"
3852 "(menu-path \"<Main>/Message/Copy...\" \"<shift><control>O\")\n"
3853 "(menu-path \"<Main>/Message/Delete\" \"<control>D\")\n"
3854 "(menu-path \"<Main>/Message/Mark/Mark\" \"<shift>asterisk\")\n"
3855 "(menu-path \"<Main>/Message/Mark/Unmark\" \"U\")\n"
3856 "(menu-path \"<Main>/Message/Mark/Mark as unread\" \"<shift>exclam\")\n"
3857 "(menu-path \"<Main>/Message/Mark/Mark as read\" \"\")\n"
3859 "(menu-path \"<Main>/Tools/Address book\" \"<shift><control>A\")\n"
3860 "(menu-path \"<Main>/Tools/Execute\" \"X\")\n"
3861 "(menu-path \"<Main>/Tools/Log window\" \"<shift><control>L\")\n"
3863 "(menu-path \"<Compose>/File/Close\" \"<control>W\")\n"
3864 "(menu-path \"<Compose>/Edit/Select all\" \"<control>A\")\n"
3865 "(menu-path \"<Compose>/Edit/Advanced/Move a word backward\" \"\")\n"
3866 "(menu-path \"<Compose>/Edit/Advanced/Move a word forward\" \"\")\n"
3867 "(menu-path \"<Compose>/Edit/Advanced/Move to beginning of line\" \"\")\n"
3868 "(menu-path \"<Compose>/Edit/Advanced/Delete a word backward\" \"\")\n"
3869 "(menu-path \"<Compose>/Edit/Advanced/Delete a word forward\" \"\")";
3871 static gchar *mew_wl_menurc =
3872 "(menu-path \"<Main>/File/Empty trash\" \"<shift>D\")\n"
3873 "(menu-path \"<Main>/File/Save as...\" \"Y\")\n"
3874 "(menu-path \"<Main>/File/Print...\" \"<shift>numbersign\")\n"
3875 "(menu-path \"<Main>/File/Exit\" \"<shift>Q\")\n"
3877 "(menu-path \"<Main>/Edit/Copy\" \"<control>C\")\n"
3878 "(menu-path \"<Main>/Edit/Select all\" \"<control>A\")\n"
3879 "(menu-path \"<Main>/Edit/Find in current message...\" \"<control>F\")\n"
3880 "(menu-path \"<Main>/Edit/Search folder...\" \"<control>S\")\n"
3882 "(menu-path \"<Main>/View/Expand Summary View\" \"\")\n"
3883 "(menu-path \"<Main>/View/Expand Message View\" \"\")\n"
3884 "(menu-path \"<Main>/View/Thread view\" \"<shift>T\")\n"
3885 "(menu-path \"<Main>/View/Go to/Prev message\" \"P\")\n"
3886 "(menu-path \"<Main>/View/Go to/Next message\" \"N\")\n"
3887 "(menu-path \"<Main>/View/Go to/Prev unread message\" \"<shift>P\")\n"
3888 "(menu-path \"<Main>/View/Go to/Next unread message\" \"<shift>N\")\n"
3889 "(menu-path \"<Main>/View/Go to/Other folder...\" \"G\")\n"
3890 "(menu-path \"<Main>/View/Open in new window\" \"<control><alt>N\")\n"
3891 "(menu-path \"<Main>/View/View source\" \"<control>U\")\n"
3892 "(menu-path \"<Main>/View/Show all headers\" \"<shift>H\")\n"
3893 "(menu-path \"<Main>/View/Update\" \"<shift>S\")\n"
3895 "(menu-path \"<Main>/Message/Get new mail\" \"<control>I\")\n"
3896 "(menu-path \"<Main>/Message/Get from all accounts\" \"<shift><control>I\")\n"
3897 "(menu-path \"<Main>/Message/Compose an email message\" \"W\")\n"
3898 "(menu-path \"<Main>/Message/Reply\" \"<control>R\")\n"
3899 "(menu-path \"<Main>/Message/Reply to/all\" \"<shift>A\")\n"
3900 "(menu-path \"<Main>/Message/Reply to/sender\" \"\")\n"
3901 "(menu-path \"<Main>/Message/Reply to/mailing list\" \"<control>L\")\n"
3902 "(menu-path \"<Main>/Message/Forward\" \"F\")\n"
3903 /* "(menu-path \"<Main>/Message/Forward as attachment\" \"<shift>F\")\n" */
3904 "(menu-path \"<Main>/Message/Move...\" \"O\")\n"
3905 "(menu-path \"<Main>/Message/Copy...\" \"<shift>O\")\n"
3906 "(menu-path \"<Main>/Message/Delete\" \"D\")\n"
3907 "(menu-path \"<Main>/Message/Mark/Mark\" \"<shift>asterisk\")\n"
3908 "(menu-path \"<Main>/Message/Mark/Unmark\" \"U\")\n"
3909 "(menu-path \"<Main>/Message/Mark/Mark as unread\" \"<shift>exclam\")\n"
3910 "(menu-path \"<Main>/Message/Mark/Mark as read\" \"<shift>R\")\n"
3912 "(menu-path \"<Main>/Tools/Address book\" \"<shift><control>A\")\n"
3913 "(menu-path \"<Main>/Tools/Execute\" \"X\")\n"
3914 "(menu-path \"<Main>/Tools/Log window\" \"<shift><control>L\")\n"
3916 "(menu-path \"<Compose>/File/Close\" \"<alt>W\")\n"
3917 "(menu-path \"<Compose>/Edit/Select all\" \"\")\n"
3918 "(menu-path \"<Compose>/Edit/Advanced/Move a word backward\" \"<alt>B\")\n"
3919 "(menu-path \"<Compose>/Edit/Advanced/Move a word forward\" \"<alt>F\")\n"
3920 "(menu-path \"<Compose>/Edit/Advanced/Move to beginning of line\" \"<control>A\")\n"
3921 "(menu-path \"<Compose>/Edit/Advanced/Delete a word backward\" \"<control>W\")\n"
3922 "(menu-path \"<Compose>/Edit/Advanced/Delete a word forward\" \"<alt>D\")";
3924 static gchar *mutt_menurc =
3925 "(menu-path \"<Main>/File/Empty trash\" \"\")\n"
3926 "(menu-path \"<Main>/File/Save as...\" \"S\")\n"
3927 "(menu-path \"<Main>/File/Print...\" \"P\")\n"
3928 "(menu-path \"<Main>/File/Exit\" \"Q\")\n"
3930 "(menu-path \"<Main>/Edit/Copy\" \"<control>C\")\n"
3931 "(menu-path \"<Main>/Edit/Select all\" \"<control>A\")\n"
3932 "(menu-path \"<Main>/Edit/Find in current message...\" \"<control>F\")\n"
3933 "(menu-path \"<Main>/Edit/Search messages...\" \"slash\")\n"
3935 "(menu-path \"<Main>/View/Toggle summary view\" \"V\")\n"
3936 "(menu-path \"<Main>/View/Thread view\" \"<control>T\")\n"
3937 "(menu-path \"<Main>/View/Go to/Prev message\" \"\")\n"
3938 "(menu-path \"<Main>/View/Go to/Next message\" \"\")\n"
3939 "(menu-path \"<Main>/View/Go to/Prev unread message\" \"\")\n"
3940 "(menu-path \"<Main>/View/Go to/Next unread message\" \"\")\n"
3941 "(menu-path \"<Main>/View/Go to/Other folder...\" \"C\")\n"
3942 "(menu-path \"<Main>/View/Open in new window\" \"<control><alt>N\")\n"
3943 "(menu-path \"<Main>/View/View source\" \"<control>U\")\n"
3944 "(menu-path \"<Main>/View/Show all headers\" \"<control>H\")\n"
3945 "(menu-path \"<Main>/View/Update\" \"<control><alt>U\")\n"
3947 "(menu-path \"<Main>/Message/Get new mail\" \"<control>I\")\n"
3948 "(menu-path \"<Main>/Message/Get from all accounts\" \"<shift><control>I\")\n"
3949 "(menu-path \"<Main>/Message/Compose new message\" \"M\")\n"
3950 "(menu-path \"<Main>/Message/Reply\" \"R\")\n"
3951 "(menu-path \"<Main>/Message/Reply to/all\" \"G\")\n"
3952 "(menu-path \"<Main>/Message/Reply to/sender\" \"\")\n"
3953 "(menu-path \"<Main>/Message/Reply to/mailing list\" \"<control>L\")\n"
3954 "(menu-path \"<Main>/Message/Forward\" \"F\")\n"
3955 "(menu-path \"<Main>/Message/Forward as attachment\" \"\")\n"
3956 "(menu-path \"<Main>/Message/Move...\" \"<control>O\")\n"
3957 "(menu-path \"<Main>/Message/Copy...\" \"<shift>C\")\n"
3958 "(menu-path \"<Main>/Message/Delete\" \"D\")\n"
3959 "(menu-path \"<Main>/Message/Mark/Mark\" \"<shift>F\")\n"
3960 "(menu-path \"<Main>/Message/Mark/Unmark\" \"U\")\n"
3961 "(menu-path \"<Main>/Message/Mark/Mark as unread\" \"<shift>N\")\n"
3962 "(menu-path \"<Main>/Message/Mark/Mark as read\" \"\")\n"
3964 "(menu-path \"<Main>/Tools/Address book\" \"<shift><control>A\")\n"
3965 "(menu-path \"<Main>/Tools/Execute\" \"X\")\n"
3966 "(menu-path \"<Main>/Tools/Log window\" \"<shift><control>L\")\n"
3968 "(menu-path \"<Compose>/File/Close\" \"<alt>W\")\n"
3969 "(menu-path \"<Compose>/Edit/Select all\" \"\")\n"
3970 "(menu-path \"<Compose>/Edit/Advanced/Move a word backward\" \"<alt>B\")\n"
3971 "(menu-path \"<Compose>/Edit/Advanced/Move a word forward\" \"<alt>F\")\n"
3972 "(menu-path \"<Compose>/Edit/Advanced/Move to beginning of line\" \"<control>A\")\n"
3973 "(menu-path \"<Compose>/Edit/Advanced/Delete a word backward\" \"<control>W\")\n"
3974 "(menu-path \"<Compose>/Edit/Advanced/Delete a word forward\" \"<alt>D\")";
3976 static gchar *old_sylpheed_menurc =
3977 "(menu-path \"<Main>/File/Empty trash\" \"\")\n"
3978 "(menu-path \"<Main>/File/Save as...\" \"\")\n"
3979 "(menu-path \"<Main>/File/Print...\" \"<alt>P\")\n"
3980 "(menu-path \"<Main>/File/Exit\" \"<alt>Q\")\n"
3982 "(menu-path \"<Main>/Edit/Copy\" \"<control>C\")\n"
3983 "(menu-path \"<Main>/Edit/Select all\" \"<control>A\")\n"
3984 "(menu-path \"<Main>/Edit/Find in current message...\" \"<control>F\")\n"
3985 "(menu-path \"<Main>/Edit/Search folder...\" \"<control>S\")\n"
3987 "(menu-path \"<Main>/View/Expand Summary View\" \"\")\n"
3988 "(menu-path \"<Main>/View/Expand Message View\" \"\")\n"
3989 "(menu-path \"<Main>/View/Thread view\" \"<control>T\")\n"
3990 "(menu-path \"<Main>/View/Go to/Prev message\" \"P\")\n"
3991 "(menu-path \"<Main>/View/Go to/Next message\" \"N\")\n"
3992 "(menu-path \"<Main>/View/Go to/Prev unread message\" \"<shift>P\")\n"
3993 "(menu-path \"<Main>/View/Go to/Next unread message\" \"<shift>N\")\n"
3994 "(menu-path \"<Main>/View/Go to/Other folder...\" \"<alt>G\")\n"
3995 "(menu-path \"<Main>/View/Open in new window\" \"<shift><control>N\")\n"
3996 "(menu-path \"<Main>/View/View source\" \"<control>U\")\n"
3997 "(menu-path \"<Main>/View/Show all headers\" \"<control>H\")\n"
3998 "(menu-path \"<Main>/View/Update\" \"<alt>U\")\n"
4000 "(menu-path \"<Main>/Message/Get new mail\" \"<alt>I\")\n"
4001 "(menu-path \"<Main>/Message/Get from all accounts\" \"<shift><alt>I\")\n"
4002 "(menu-path \"<Main>/Message/Compose an email message\" \"<alt>N\")\n"
4003 "(menu-path \"<Main>/Message/Reply\" \"<alt>R\")\n"
4004 "(menu-path \"<Main>/Message/Reply to/all\" \"<shift><alt>R\")\n"
4005 "(menu-path \"<Main>/Message/Reply to/sender\" \"<control><alt>R\")\n"
4006 "(menu-path \"<Main>/Message/Reply to/mailing list\" \"<control>L\")\n"
4007 "(menu-path \"<Main>/Message/Forward\" \"<shift><alt>F\")\n"
4008 /* "(menu-path \"<Main>/Message/Forward as attachment\" \"<shift><control>F\")\n" */
4009 "(menu-path \"<Main>/Message/Move...\" \"<alt>O\")\n"
4010 "(menu-path \"<Main>/Message/Copy...\" \"\")\n"
4011 "(menu-path \"<Main>/Message/Delete\" \"<alt>D\")\n"
4012 "(menu-path \"<Main>/Message/Mark/Mark\" \"<shift>asterisk\")\n"
4013 "(menu-path \"<Main>/Message/Mark/Unmark\" \"U\")\n"
4014 "(menu-path \"<Main>/Message/Mark/Mark as unread\" \"<shift>exclam\")\n"
4015 "(menu-path \"<Main>/Message/Mark/Mark as read\" \"\")\n"
4017 "(menu-path \"<Main>/Tools/Address book\" \"<alt>A\")\n"
4018 "(menu-path \"<Main>/Tools/Execute\" \"<alt>X\")\n"
4019 "(menu-path \"<Main>/Tools/Log window\" \"<alt>L\")\n"
4021 "(menu-path \"<Compose>/File/Close\" \"<alt>W\")\n"
4022 "(menu-path \"<Compose>/Edit/Select all\" \"\")\n"
4023 "(menu-path \"<Compose>/Edit/Advanced/Move a word backward\" \"<alt>B\")\n"
4024 "(menu-path \"<Compose>/Edit/Advanced/Move a word forward\" \"<alt>F\")\n"
4025 "(menu-path \"<Compose>/Edit/Advanced/Move to beginning of line\" \"<control>A\")\n"
4026 "(menu-path \"<Compose>/Edit/Advanced/Delete a word backward\" \"<control>W\")\n"
4027 "(menu-path \"<Compose>/Edit/Advanced/Delete a word forward\" \"<alt>D\")";
4029 static gchar *empty_menurc =
4030 "(menu-path \"<Main>/File/Empty trash\" \"\")\n"
4031 "(menu-path \"<Main>/File/Save as...\" \"\")\n"
4032 "(menu-path \"<Main>/File/Print...\" \"\")\n"
4033 "(menu-path \"<Main>/File/Exit\" \"\")\n"
4035 "(menu-path \"<Main>/Edit/Copy\" \"\")\n"
4036 "(menu-path \"<Main>/Edit/Select all\" \"\")\n"
4037 "(menu-path \"<Main>/Edit/Find in current message...\" \"\")\n"
4038 "(menu-path \"<Main>/Edit/Search folder...\" \"\")\n"
4040 "(menu-path \"<Main>/View/Expand Summary View\" \"\")\n"
4041 "(menu-path \"<Main>/View/Expand Message View\" \"\")\n"
4042 "(menu-path \"<Main>/View/Thread view\" \"\")\n"
4043 "(menu-path \"<Main>/View/Go to/Prev message\" \"\")\n"
4044 "(menu-path \"<Main>/View/Go to/Next message\" \"\")\n"
4045 "(menu-path \"<Main>/View/Go to/Prev unread message\" \"\")\n"
4046 "(menu-path \"<Main>/View/Go to/Next unread message\" \"\")\n"
4047 "(menu-path \"<Main>/View/Go to/Other folder...\" \"\")\n"
4048 "(menu-path \"<Main>/View/Open in new window\" \"\")\n"
4049 "(menu-path \"<Main>/View/View source\" \"\")\n"
4050 "(menu-path \"<Main>/View/Show all headers\" \"\")\n"
4051 "(menu-path \"<Main>/View/Update\" \"\")\n"
4053 "(menu-path \"<Main>/Message/Get new mail\" \"\")\n"
4054 "(menu-path \"<Main>/Message/Get from all accounts\" \"\")\n"
4055 "(menu-path \"<Main>/Message/Compose an email message\" \"\")\n"
4056 "(menu-path \"<Main>/Message/Reply\" \"\")\n"
4057 "(menu-path \"<Main>/Message/Reply to/all\" \"\")\n"
4058 "(menu-path \"<Main>/Message/Reply to/sender\" \"\")\n"
4059 "(menu-path \"<Main>/Message/Reply to/mailing list\" \"\")\n"
4060 "(menu-path \"<Main>/Message/Forward\" \"\")\n"
4061 /* "(menu-path \"<Main>/Message/Forward as attachment\" \"\")\n" */
4062 "(menu-path \"<Main>/Message/Move...\" \"\")\n"
4063 "(menu-path \"<Main>/Message/Copy...\" \"\")\n"
4064 "(menu-path \"<Main>/Message/Delete\" \"\")\n"
4065 "(menu-path \"<Main>/Message/Mark/Mark\" \"\")\n"
4066 "(menu-path \"<Main>/Message/Mark/Unmark\" \"\")\n"
4067 "(menu-path \"<Main>/Message/Mark/Mark as unread\" \"\")\n"
4068 "(menu-path \"<Main>/Message/Mark/Mark as read\" \"\")\n"
4070 "(menu-path \"<Main>/Tools/Address book\" \"\")\n"
4071 "(menu-path \"<Main>/Tools/Execute\" \"\")\n"
4072 "(menu-path \"<Main>/Tools/Log window\" \"\")\n"
4074 "(menu-path \"<Compose>/File/Close\" \"\")\n"
4075 "(menu-path \"<Compose>/Edit/Select all\" \"\")\n"
4076 "(menu-path \"<Compose>/Edit/Advanced/Move a word backward\" \"\")\n"
4077 "(menu-path \"<Compose>/Edit/Advanced/Move a word forward\" \"\")\n"
4078 "(menu-path \"<Compose>/Edit/Advanced/Move to beginning of line\" \"\")\n"
4079 "(menu-path \"<Compose>/Edit/Advanced/Delete a word backward\" \"\")\n"
4080 "(menu-path \"<Compose>/Edit/Advanced/Delete a word forward\" \"\")";
4082 text = gtk_entry_get_text(entry);
4084 if (!strcmp(text, _("Default")))
4085 rc_str = default_menurc;
4086 else if (!strcmp(text, "Mew / Wanderlust"))
4087 rc_str = mew_wl_menurc;
4088 else if (!strcmp(text, "Mutt"))
4089 rc_str = mutt_menurc;
4090 else if (!strcmp(text, _("Old Sylpheed")))
4091 rc_str = old_sylpheed_menurc;
4095 gtk_item_factory_parse_rc_string(empty_menurc);
4096 gtk_item_factory_parse_rc_string(rc_str);
4098 gtk_widget_destroy(keybind.window);
4099 keybind.window = NULL;
4100 keybind.combo = NULL;
4103 static void prefs_common_charset_set_data_from_optmenu(PrefParam *pparam)
4106 GtkWidget *menuitem;
4109 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget));
4110 menuitem = gtk_menu_get_active(GTK_MENU(menu));
4111 charset = gtk_object_get_user_data(GTK_OBJECT(menuitem));
4112 g_free(*((gchar **)pparam->data));
4113 *((gchar **)pparam->data) = g_strdup(charset);
4116 static void prefs_common_charset_set_optmenu(PrefParam *pparam)
4118 GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget);
4121 g_return_if_fail(optmenu != NULL);
4122 g_return_if_fail(*((gchar **)pparam->data) != NULL);
4124 index = menu_find_option_menu_index(optmenu, *((gchar **)pparam->data),
4125 (GCompareFunc)strcmp);
4127 gtk_option_menu_set_history(optmenu, index);
4129 gtk_option_menu_set_history(optmenu, 0);
4130 prefs_common_charset_set_data_from_optmenu(pparam);
4134 static void prefs_common_encoding_set_data_from_optmenu(PrefParam *pparam)
4137 GtkWidget *menuitem;
4139 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget));
4140 menuitem = gtk_menu_get_active(GTK_MENU(menu));
4141 *((TransferEncodingMethod *)pparam->data) = GPOINTER_TO_INT
4142 (gtk_object_get_user_data(GTK_OBJECT(menuitem)));
4145 static void prefs_common_encoding_set_optmenu(PrefParam *pparam)
4147 TransferEncodingMethod method =
4148 *((TransferEncodingMethod *)pparam->data);
4149 GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget);
4152 g_return_if_fail(optmenu != NULL);
4154 index = menu_find_option_menu_index(optmenu, GINT_TO_POINTER(method),
4157 gtk_option_menu_set_history(optmenu, index);
4159 gtk_option_menu_set_history(optmenu, 0);
4160 prefs_common_encoding_set_data_from_optmenu(pparam);
4164 static void prefs_common_recv_dialog_set_data_from_optmenu(PrefParam *pparam)
4167 GtkWidget *menuitem;
4169 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget));
4170 menuitem = gtk_menu_get_active(GTK_MENU(menu));
4171 *((RecvDialogMode *)pparam->data) = GPOINTER_TO_INT
4172 (gtk_object_get_user_data(GTK_OBJECT(menuitem)));
4175 static void prefs_common_recv_dialog_set_optmenu(PrefParam *pparam)
4177 RecvDialogMode mode = *((RecvDialogMode *)pparam->data);
4178 GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget);
4180 GtkWidget *menuitem;
4183 index = menu_find_option_menu_index(optmenu, GINT_TO_POINTER(mode),
4186 gtk_option_menu_set_history(optmenu, index);
4188 gtk_option_menu_set_history(optmenu, 0);
4189 prefs_common_recv_dialog_set_data_from_optmenu(pparam);
4192 menu = gtk_option_menu_get_menu(optmenu);
4193 menuitem = gtk_menu_get_active(GTK_MENU(menu));
4194 gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
4197 static void prefs_common_send_dialog_set_data_from_optmenu(PrefParam *pparam)
4200 GtkWidget *menuitem;
4202 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget));
4203 menuitem = gtk_menu_get_active(GTK_MENU(menu));
4204 *((SendDialogMode *)pparam->data) = GPOINTER_TO_INT
4205 (gtk_object_get_user_data(GTK_OBJECT(menuitem)));
4208 static void prefs_common_send_dialog_set_optmenu(PrefParam *pparam)
4210 SendDialogMode mode = *((SendDialogMode *)pparam->data);
4211 GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget);
4213 GtkWidget *menuitem;
4216 case SEND_DIALOG_ALWAYS:
4217 gtk_option_menu_set_history(optmenu, 0);
4219 case SEND_DIALOG_NEVER:
4220 gtk_option_menu_set_history(optmenu, 1);
4226 menu = gtk_option_menu_get_menu(optmenu);
4227 menuitem = gtk_menu_get_active(GTK_MENU(menu));
4228 gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
4231 static gint prefs_common_deleted(GtkWidget *widget, GdkEventAny *event,
4234 prefs_common_cancel();
4238 static void prefs_common_key_pressed(GtkWidget *widget, GdkEventKey *event,
4241 if (event && event->keyval == GDK_Escape)
4242 prefs_common_cancel();
4245 static void prefs_common_ok(void)
4247 prefs_common_apply();
4248 gtk_widget_hide(dialog.window);
4253 static void prefs_common_apply(void)
4255 gchar *entry_pixmap_theme_str;
4256 gboolean update_pixmap_theme;
4258 entry_pixmap_theme_str = gtk_entry_get_text(GTK_ENTRY(interface.entry_pixmap_theme));
4259 if (entry_pixmap_theme_str &&
4260 (strcmp(prefs_common.pixmap_theme_path, entry_pixmap_theme_str) != 0) )
4261 update_pixmap_theme = TRUE;
4263 update_pixmap_theme = FALSE;
4265 prefs_set_data_from_dialog(param);
4267 if (update_pixmap_theme)
4269 main_window_reflect_prefs_all_real(TRUE);
4270 compose_reflect_prefs_pixmap_theme();
4272 main_window_reflect_prefs_all_real(FALSE);
4274 prefs_common_save_config();
4276 inc_autocheck_timer_remove();
4277 inc_autocheck_timer_set();
4280 static void prefs_nextunreadmsgdialog_set_data_from_optmenu(PrefParam *pparam)
4283 GtkWidget *menuitem;
4285 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget));
4286 menuitem = gtk_menu_get_active(GTK_MENU(menu));
4287 *((NextUnreadMsgDialogShow *)pparam->data) = GPOINTER_TO_INT
4288 (gtk_object_get_user_data(GTK_OBJECT(menuitem)));
4291 static void prefs_nextunreadmsgdialog_set_optmenu(PrefParam *pparam)
4293 NextUnreadMsgDialogShow dialog_show;
4294 GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget);
4296 GtkWidget *menuitem;
4298 dialog_show = *((NextUnreadMsgDialogShow *)pparam->data);
4300 switch (dialog_show) {
4301 case NEXTUNREADMSGDIALOG_ALWAYS:
4302 gtk_option_menu_set_history(optmenu, 0);
4304 case NEXTUNREADMSGDIALOG_ASSUME_YES:
4305 gtk_option_menu_set_history(optmenu, 1);
4307 case NEXTUNREADMSGDIALOG_ASSUME_NO:
4308 gtk_option_menu_set_history(optmenu, 2);
4312 menu = gtk_option_menu_get_menu(optmenu);
4313 menuitem = gtk_menu_get_active(GTK_MENU(menu));
4314 gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
4317 static void prefs_common_cancel(void)
4319 gtk_widget_hide(dialog.window);
4324 /* static void prefs_recvdialog_set_data_from_optmenu(PrefParam *pparam)
4327 GtkWidget *menuitem;
4329 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget));
4330 menuitem = gtk_menu_get_active(GTK_MENU(menu));
4331 *((RecvDialogShow *)pparam->data) = GPOINTER_TO_INT
4332 (gtk_object_get_user_data(GTK_OBJECT(menuitem)));
4335 /* static void prefs_recvdialog_set_optmenu(PrefParam *pparam)
4337 RecvDialogShow dialog_show;
4338 GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget);
4340 GtkWidget *menuitem;
4342 dialog_show = *((RecvDialogShow *)pparam->data);
4344 switch (dialog_show) {
4345 case RECVDIALOG_ALWAYS:
4346 gtk_option_menu_set_history(optmenu, 0);
4348 case RECVDIALOG_WINDOW_ACTIVE:
4349 gtk_option_menu_set_history(optmenu, 1);
4351 case RECVDIALOG_NEVER:
4352 gtk_option_menu_set_history(optmenu, 2);
4357 menu = gtk_option_menu_get_menu(optmenu);
4358 menuitem = gtk_menu_get_active(GTK_MENU(menu));
4359 gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));