From 61988f3a30a6a8e76530c36482b1227571721fd4 Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 31 Aug 2005 11:40:06 +0000 Subject: separated UI code from prefs_common.c and prefs_account.c. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@533 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 14 + ChangeLog.ja | 14 + libsylph/prefs.h | 6 +- src/Makefile.am | 2 + src/account.c | 1 + src/mainwindow.c | 1 + src/prefs_account.c | 2280 ++------------------------- src/prefs_account.h | 8 +- src/prefs_account_dialog.c | 2200 ++++++++++++++++++++++++++ src/prefs_account_dialog.h | 29 + src/prefs_common.c | 3706 +++----------------------------------------- src/prefs_common.h | 18 +- src/prefs_common_dialog.c | 3520 +++++++++++++++++++++++++++++++++++++++++ src/prefs_common_dialog.h | 33 + src/prefs_template.c | 1 + src/prefs_ui.c | 128 +- src/prefs_ui.h | 12 + 17 files changed, 6223 insertions(+), 5750 deletions(-) create mode 100644 src/prefs_account_dialog.c create mode 100644 src/prefs_account_dialog.h create mode 100644 src/prefs_common_dialog.c create mode 100644 src/prefs_common_dialog.h diff --git a/ChangeLog b/ChangeLog index 1346027e..ab70ca70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2005-08-31 + + * libsylph/prefs.h + src/prefs_ui.[ch] + src/account.c + src/prefs_template.c + src/prefs_account.[ch] + src/prefs_common.[ch] + src/prefs_account_dialog.[ch] + src/prefs_common_dialog.[ch] + src/mainwindow.c + src/Makefile.am: separated UI code from prefs_common.c and + prefs_account.c. + 2005-08-31 * src/trayicon.c: enable compilation on MinGW. diff --git a/ChangeLog.ja b/ChangeLog.ja index f94f1661..a9d1ded2 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,17 @@ +2005-08-31 + + * libsylph/prefs.h + src/prefs_ui.[ch] + src/account.c + src/prefs_template.c + src/prefs_account.[ch] + src/prefs_common.[ch] + src/prefs_account_dialog.[ch] + src/prefs_common_dialog.[ch] + src/mainwindow.c + src/Makefile.am: prefs_common.c と prefs_account.c から UI コード + を分離。 + 2005-08-31 * src/trayicon.c: MinGW でコンパイルできるようにした。 diff --git a/libsylph/prefs.h b/libsylph/prefs.h index 265bf190..1a77eccd 100644 --- a/libsylph/prefs.h +++ b/libsylph/prefs.h @@ -28,8 +28,6 @@ typedef struct _PrefFile PrefFile; #define PREFSBUFSIZE 1024 -#define P_WID(wid) ((gpointer *)(wid)) - typedef enum { P_STRING, @@ -48,9 +46,7 @@ struct _PrefParam { gchar *defval; gpointer data; PrefType type; - gpointer *widget; - DataSetFunc data_set_func; - WidgetSetFunc widget_set_func; + gpointer ui_data; }; struct _PrefFile { diff --git a/src/Makefile.am b/src/Makefile.am index b81e23cf..f2b78da6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,9 +28,11 @@ sylpheed_SOURCES = \ stock_pixmap.c stock_pixmap.h \ prefs_ui.c prefs_ui.h \ prefs_common.c prefs_common.h \ + prefs_common_dialog.c prefs_common_dialog.h \ prefs_filter.c prefs_filter.h \ prefs_filter_edit.c prefs_filter_edit.h \ prefs_account.c prefs_account.h \ + prefs_account_dialog.c prefs_account_dialog.h \ prefs_folder_item.c prefs_folder_item.h \ prefs_display_header.c prefs_display_header.h \ prefs_customheader.c prefs_customheader.h \ diff --git a/src/account.c b/src/account.c index ce2f2689..77b604eb 100644 --- a/src/account.c +++ b/src/account.c @@ -37,6 +37,7 @@ #include "account.h" #include "prefs.h" #include "prefs_account.h" +#include "prefs_account_dialog.h" #include "procmsg.h" #include "procheader.h" #include "compose.h" diff --git a/src/mainwindow.c b/src/mainwindow.c index 4adb8de6..e1493359 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -64,6 +64,7 @@ #include "import.h" #include "export.h" #include "prefs_common.h" +#include "prefs_common_dialog.h" #include "prefs_filter.h" #include "prefs_actions.h" #include "prefs_account.h" diff --git a/src/prefs_account.c b/src/prefs_account.c index 8cd55299..825f85df 100644 --- a/src/prefs_account.c +++ b/src/prefs_account.c @@ -25,8 +25,6 @@ #include #include -#include -#include #include #include #include @@ -34,493 +32,130 @@ #include #include -#include "main.h" #include "prefs.h" -#include "prefs_ui.h" #include "prefs_account.h" #include "prefs_customheader.h" #include "prefs_common.h" #include "account.h" -#include "mainwindow.h" -#include "manage_window.h" -#include "foldersel.h" -#include "inc.h" -#include "menu.h" -#include "gtkutils.h" #include "utils.h" -#include "alertpanel.h" #include "smtp.h" #include "imap.h" -static gboolean cancelled; - static PrefsAccount tmp_ac_prefs; -static PrefsDialog dialog; - -static struct Basic { - GtkWidget *acname_entry; - GtkWidget *default_chkbtn; - - GtkWidget *name_entry; - GtkWidget *addr_entry; - GtkWidget *org_entry; - - GtkWidget *serv_frame; - GtkWidget *serv_table; - GtkWidget *protocol_optmenu; - GtkWidget *recvserv_label; - GtkWidget *smtpserv_label; - GtkWidget *nntpserv_label; - GtkWidget *recvserv_entry; - GtkWidget *smtpserv_entry; - GtkWidget *nntpserv_entry; - GtkWidget *nntpauth_chkbtn; - GtkWidget *uid_label; - GtkWidget *pass_label; - GtkWidget *uid_entry; - GtkWidget *pass_entry; -} basic; - -static struct Receive { - GtkWidget *pop3_frame; - GtkWidget *use_apop_chkbtn; - GtkWidget *rmmail_chkbtn; - GtkWidget *leave_time_entry; - GtkWidget *getall_chkbtn; - GtkWidget *size_limit_chkbtn; - GtkWidget *size_limit_entry; - GtkWidget *filter_on_recv_chkbtn; - GtkWidget *inbox_label; - GtkWidget *inbox_entry; - GtkWidget *inbox_btn; - - GtkWidget *imap_frame; - GtkWidget *imap_auth_type_optmenu; - - GtkWidget *nntp_frame; - GtkWidget *maxarticle_spinbtn; - GtkObject *maxarticle_spinbtn_adj; - - GtkWidget *recvatgetall_chkbtn; -} receive; - -static struct Send { - GtkWidget *date_chkbtn; - GtkWidget *msgid_chkbtn; - - GtkWidget *customhdr_chkbtn; - - GtkWidget *smtp_auth_chkbtn; - GtkWidget *smtp_auth_type_optmenu; - GtkWidget *smtp_uid_entry; - GtkWidget *smtp_pass_entry; - /* GtkWidget *pop_bfr_smtp_chkbtn; */ -} p_send; - -static struct Compose { - GtkWidget *sigfile_radiobtn; - GtkWidget *sigpath_entry; - - GtkWidget *autocc_chkbtn; - GtkWidget *autocc_entry; - GtkWidget *autobcc_chkbtn; - GtkWidget *autobcc_entry; - GtkWidget *autoreplyto_chkbtn; - GtkWidget *autoreplyto_entry; -} compose; - -#if USE_GPGME -static struct Privacy { - GtkWidget *default_sign_chkbtn; - GtkWidget *default_encrypt_chkbtn; - GtkWidget *encrypt_reply_chkbtn; - GtkWidget *ascii_armored_chkbtn; - GtkWidget *clearsign_chkbtn; - GtkWidget *defaultkey_radiobtn; - GtkWidget *emailkey_radiobtn; - GtkWidget *customkey_radiobtn; - GtkWidget *customkey_entry; -} privacy; -#endif /* USE_GPGME */ - -#if USE_SSL -static struct SSLPrefs { - GtkWidget *pop_frame; - GtkWidget *pop_nossl_radiobtn; - GtkWidget *pop_ssltunnel_radiobtn; - GtkWidget *pop_starttls_radiobtn; - - GtkWidget *imap_frame; - GtkWidget *imap_nossl_radiobtn; - GtkWidget *imap_ssltunnel_radiobtn; - GtkWidget *imap_starttls_radiobtn; - - GtkWidget *nntp_frame; - GtkWidget *nntp_nossl_radiobtn; - GtkWidget *nntp_ssltunnel_radiobtn; - - GtkWidget *send_frame; - GtkWidget *smtp_nossl_radiobtn; - GtkWidget *smtp_ssltunnel_radiobtn; - GtkWidget *smtp_starttls_radiobtn; - - GtkWidget *use_nonblocking_ssl_chkbtn; -} ssl; -#endif /* USE_SSL */ - -static struct Advanced { - GtkWidget *smtpport_chkbtn; - GtkWidget *smtpport_entry; - GtkWidget *popport_hbox; - GtkWidget *popport_chkbtn; - GtkWidget *popport_entry; - GtkWidget *imapport_hbox; - GtkWidget *imapport_chkbtn; - GtkWidget *imapport_entry; - GtkWidget *nntpport_hbox; - GtkWidget *nntpport_chkbtn; - GtkWidget *nntpport_entry; - GtkWidget *domain_chkbtn; - GtkWidget *domain_entry; - - GtkWidget *imap_frame; - GtkWidget *imapdir_entry; - - GtkWidget *sent_folder_chkbtn; - GtkWidget *sent_folder_entry; - GtkWidget *draft_folder_chkbtn; - GtkWidget *draft_folder_entry; - GtkWidget *trash_folder_chkbtn; - GtkWidget *trash_folder_entry; -} advanced; - -static void prefs_account_protocol_set_data_from_optmenu(PrefParam *pparam); -static void prefs_account_protocol_set_optmenu (PrefParam *pparam); -static void prefs_account_protocol_activated (GtkMenuItem *menuitem); - -static void prefs_account_imap_auth_type_set_data_from_optmenu - (PrefParam *pparam); -static void prefs_account_imap_auth_type_set_optmenu (PrefParam *pparam); -static void prefs_account_smtp_auth_type_set_data_from_optmenu - (PrefParam *pparam); -static void prefs_account_smtp_auth_type_set_optmenu (PrefParam *pparam); - -static void prefs_account_enum_set_data_from_radiobtn (PrefParam *pparam); -static void prefs_account_enum_set_radiobtn (PrefParam *pparam); - -#if USE_GPGME -static void prefs_account_ascii_armored_warning (GtkWidget *widget); -#endif /* USE_GPGME */ - static PrefParam param[] = { /* Basic */ - {"account_name", NULL, &tmp_ac_prefs.account_name, P_STRING, - P_WID(&basic.acname_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"is_default", "FALSE", &tmp_ac_prefs.is_default, P_BOOL, - P_WID(&basic.default_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"name", NULL, &tmp_ac_prefs.name, P_STRING, - P_WID(&basic.name_entry), prefs_set_data_from_entry, prefs_set_entry}, - - {"address", NULL, &tmp_ac_prefs.address, P_STRING, - P_WID(&basic.addr_entry), prefs_set_data_from_entry, prefs_set_entry}, - - {"organization", NULL, &tmp_ac_prefs.organization, P_STRING, - P_WID(&basic.org_entry), prefs_set_data_from_entry, prefs_set_entry}, - - {"protocol", NULL, &tmp_ac_prefs.protocol, P_ENUM, - P_WID(&basic.protocol_optmenu), - prefs_account_protocol_set_data_from_optmenu, - prefs_account_protocol_set_optmenu}, - - {"receive_server", NULL, &tmp_ac_prefs.recv_server, P_STRING, - P_WID(&basic.recvserv_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"smtp_server", NULL, &tmp_ac_prefs.smtp_server, P_STRING, - P_WID(&basic.smtpserv_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"nntp_server", NULL, &tmp_ac_prefs.nntp_server, P_STRING, - P_WID(&basic.nntpserv_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"use_nntp_auth", "FALSE", &tmp_ac_prefs.use_nntp_auth, P_BOOL, - P_WID(&basic.nntpauth_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"user_id", "ENV_USER", &tmp_ac_prefs.userid, P_STRING, - P_WID(&basic.uid_entry), prefs_set_data_from_entry, prefs_set_entry}, - - {"password", NULL, &tmp_ac_prefs.passwd, P_STRING, - P_WID(&basic.pass_entry), prefs_set_data_from_entry, prefs_set_entry}, - - {"inbox", "inbox", &tmp_ac_prefs.inbox, P_STRING, - P_WID(&receive.inbox_entry), - prefs_set_data_from_entry, prefs_set_entry}, + {"account_name", NULL, &tmp_ac_prefs.account_name, P_STRING}, + {"is_default", "FALSE", &tmp_ac_prefs.is_default, P_BOOL}, + {"name", NULL, &tmp_ac_prefs.name, P_STRING}, + {"address", NULL, &tmp_ac_prefs.address, P_STRING}, + {"organization", NULL, &tmp_ac_prefs.organization, P_STRING}, + {"protocol", NULL, &tmp_ac_prefs.protocol, P_ENUM}, + {"receive_server", NULL, &tmp_ac_prefs.recv_server, P_STRING}, + {"smtp_server", NULL, &tmp_ac_prefs.smtp_server, P_STRING}, + {"nntp_server", NULL, &tmp_ac_prefs.nntp_server, P_STRING}, + {"use_nntp_auth", "FALSE", &tmp_ac_prefs.use_nntp_auth, P_BOOL}, + {"user_id", "ENV_USER", &tmp_ac_prefs.userid, P_STRING}, + {"password", NULL, &tmp_ac_prefs.passwd, P_STRING}, + {"inbox", "inbox", &tmp_ac_prefs.inbox, P_STRING}, /* Receive */ - {"use_apop_auth", "FALSE", &tmp_ac_prefs.use_apop_auth, P_BOOL, - P_WID(&receive.use_apop_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"remove_mail", "TRUE", &tmp_ac_prefs.rmmail, P_BOOL, - P_WID(&receive.rmmail_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"message_leave_time", "0", &tmp_ac_prefs.msg_leave_time, P_INT, - P_WID(&receive.leave_time_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"get_all_mail", "FALSE", &tmp_ac_prefs.getall, P_BOOL, - P_WID(&receive.getall_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"enable_size_limit", "FALSE", &tmp_ac_prefs.enable_size_limit, P_BOOL, - P_WID(&receive.size_limit_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"size_limit", "1024", &tmp_ac_prefs.size_limit, P_INT, - P_WID(&receive.size_limit_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"filter_on_receive", "TRUE", &tmp_ac_prefs.filter_on_recv, P_BOOL, - P_WID(&receive.filter_on_recv_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"imap_auth_method", "0", &tmp_ac_prefs.imap_auth_type, P_ENUM, - P_WID(&receive.imap_auth_type_optmenu), - prefs_account_imap_auth_type_set_data_from_optmenu, - prefs_account_imap_auth_type_set_optmenu}, - - {"max_nntp_articles", "300", &tmp_ac_prefs.max_nntp_articles, P_INT, - P_WID(&receive.maxarticle_spinbtn), - prefs_set_data_from_spinbtn, prefs_set_spinbtn}, - - {"receive_at_get_all", "TRUE", &tmp_ac_prefs.recv_at_getall, P_BOOL, - P_WID(&receive.recvatgetall_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, + {"use_apop_auth", "FALSE", &tmp_ac_prefs.use_apop_auth, P_BOOL}, + {"remove_mail", "TRUE", &tmp_ac_prefs.rmmail, P_BOOL}, + {"message_leave_time", "0", &tmp_ac_prefs.msg_leave_time, P_INT}, + {"get_all_mail", "FALSE", &tmp_ac_prefs.getall, P_BOOL}, + {"enable_size_limit", "FALSE", &tmp_ac_prefs.enable_size_limit, P_BOOL}, + {"size_limit", "1024", &tmp_ac_prefs.size_limit, P_INT}, + {"filter_on_receive", "TRUE", &tmp_ac_prefs.filter_on_recv, P_BOOL}, + {"imap_auth_method", "0", &tmp_ac_prefs.imap_auth_type, P_ENUM}, + {"max_nntp_articles", "300", &tmp_ac_prefs.max_nntp_articles, P_INT}, + {"receive_at_get_all", "TRUE", &tmp_ac_prefs.recv_at_getall, P_BOOL}, /* Send */ - {"add_date", "TRUE", &tmp_ac_prefs.add_date, P_BOOL, - P_WID(&p_send.date_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"generate_msgid", "TRUE", &tmp_ac_prefs.gen_msgid, P_BOOL, - P_WID(&p_send.msgid_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"add_custom_header", "FALSE", &tmp_ac_prefs.add_customhdr, P_BOOL, - P_WID(&p_send.customhdr_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"use_smtp_auth", "FALSE", &tmp_ac_prefs.use_smtp_auth, P_BOOL, - P_WID(&p_send.smtp_auth_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"smtp_auth_method", "0", &tmp_ac_prefs.smtp_auth_type, P_ENUM, - P_WID(&p_send.smtp_auth_type_optmenu), - prefs_account_smtp_auth_type_set_data_from_optmenu, - prefs_account_smtp_auth_type_set_optmenu}, - - {"smtp_user_id", NULL, &tmp_ac_prefs.smtp_userid, P_STRING, - P_WID(&p_send.smtp_uid_entry), - prefs_set_data_from_entry, prefs_set_entry}, - {"smtp_password", NULL, &tmp_ac_prefs.smtp_passwd, P_STRING, - P_WID(&p_send.smtp_pass_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"pop_before_smtp", "FALSE", &tmp_ac_prefs.pop_before_smtp, P_BOOL, - NULL, NULL, NULL}, -#if 0 - P_WID(&p_send.pop_bfr_smtp_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, -#endif + {"add_date", "TRUE", &tmp_ac_prefs.add_date, P_BOOL}, + {"generate_msgid", "TRUE", &tmp_ac_prefs.gen_msgid, P_BOOL}, + {"add_custom_header", "FALSE", &tmp_ac_prefs.add_customhdr, P_BOOL}, + {"use_smtp_auth", "FALSE", &tmp_ac_prefs.use_smtp_auth, P_BOOL}, + {"smtp_auth_method", "0", &tmp_ac_prefs.smtp_auth_type, P_ENUM}, + {"smtp_user_id", NULL, &tmp_ac_prefs.smtp_userid, P_STRING}, + {"smtp_password", NULL, &tmp_ac_prefs.smtp_passwd, P_STRING}, + {"pop_before_smtp", "FALSE", &tmp_ac_prefs.pop_before_smtp, P_BOOL}, /* Compose */ - {"signature_type", "0", &tmp_ac_prefs.sig_type, P_ENUM, - P_WID(&compose.sigfile_radiobtn), - prefs_account_enum_set_data_from_radiobtn, - prefs_account_enum_set_radiobtn}, + {"signature_type", "0", &tmp_ac_prefs.sig_type, P_ENUM}, {"signature_path", "~" G_DIR_SEPARATOR_S DEFAULT_SIGNATURE, - &tmp_ac_prefs.sig_path, P_STRING, - P_WID(&compose.sigpath_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"set_autocc", "FALSE", &tmp_ac_prefs.set_autocc, P_BOOL, - P_WID(&compose.autocc_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"auto_cc", NULL, &tmp_ac_prefs.auto_cc, P_STRING, - P_WID(&compose.autocc_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"set_autobcc", "FALSE", &tmp_ac_prefs.set_autobcc, P_BOOL, - P_WID(&compose.autobcc_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"auto_bcc", NULL, &tmp_ac_prefs.auto_bcc, P_STRING, - P_WID(&compose.autobcc_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"set_autoreplyto", "FALSE", &tmp_ac_prefs.set_autoreplyto, P_BOOL, - P_WID(&compose.autoreplyto_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"auto_replyto", NULL, &tmp_ac_prefs.auto_replyto, P_STRING, - P_WID(&compose.autoreplyto_entry), - prefs_set_data_from_entry, prefs_set_entry}, + &tmp_ac_prefs.sig_path, P_STRING}, + {"set_autocc", "FALSE", &tmp_ac_prefs.set_autocc, P_BOOL}, + {"auto_cc", NULL, &tmp_ac_prefs.auto_cc, P_STRING}, + {"set_autobcc", "FALSE", &tmp_ac_prefs.set_autobcc, P_BOOL}, + {"auto_bcc", NULL, &tmp_ac_prefs.auto_bcc, P_STRING}, + {"set_autoreplyto", "FALSE", &tmp_ac_prefs.set_autoreplyto, P_BOOL}, + {"auto_replyto", NULL, &tmp_ac_prefs.auto_replyto, P_STRING}, #if USE_GPGME /* Privacy */ - {"default_sign", "FALSE", &tmp_ac_prefs.default_sign, P_BOOL, - P_WID(&privacy.default_sign_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"default_encrypt", "FALSE", &tmp_ac_prefs.default_encrypt, P_BOOL, - P_WID(&privacy.default_encrypt_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"encrypt_reply", "TRUE", &tmp_ac_prefs.encrypt_reply, P_BOOL, - P_WID(&privacy.encrypt_reply_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"ascii_armored", "FALSE", &tmp_ac_prefs.ascii_armored, P_BOOL, - P_WID(&privacy.ascii_armored_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"clearsign", "FALSE", &tmp_ac_prefs.clearsign, P_BOOL, - P_WID(&privacy.clearsign_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"sign_key", NULL, &tmp_ac_prefs.sign_key, P_ENUM, - P_WID(&privacy.defaultkey_radiobtn), - prefs_account_enum_set_data_from_radiobtn, - prefs_account_enum_set_radiobtn}, - {"sign_key_id", NULL, &tmp_ac_prefs.sign_key_id, P_STRING, - P_WID(&privacy.customkey_entry), - prefs_set_data_from_entry, prefs_set_entry}, + {"default_sign", "FALSE", &tmp_ac_prefs.default_sign, P_BOOL}, + {"default_encrypt", "FALSE", &tmp_ac_prefs.default_encrypt, P_BOOL}, + {"encrypt_reply", "TRUE", &tmp_ac_prefs.encrypt_reply, P_BOOL}, + {"ascii_armored", "FALSE", &tmp_ac_prefs.ascii_armored, P_BOOL}, + {"clearsign", "FALSE", &tmp_ac_prefs.clearsign, P_BOOL}, + {"sign_key", NULL, &tmp_ac_prefs.sign_key, P_ENUM}, + {"sign_key_id", NULL, &tmp_ac_prefs.sign_key_id, P_STRING}, #endif /* USE_GPGME */ #if USE_SSL /* SSL */ - {"ssl_pop", "0", &tmp_ac_prefs.ssl_pop, P_ENUM, - P_WID(&ssl.pop_nossl_radiobtn), - prefs_account_enum_set_data_from_radiobtn, - prefs_account_enum_set_radiobtn}, - {"ssl_imap", "0", &tmp_ac_prefs.ssl_imap, P_ENUM, - P_WID(&ssl.imap_nossl_radiobtn), - prefs_account_enum_set_data_from_radiobtn, - prefs_account_enum_set_radiobtn}, - {"ssl_nntp", "0", &tmp_ac_prefs.ssl_nntp, P_ENUM, - P_WID(&ssl.nntp_nossl_radiobtn), - prefs_account_enum_set_data_from_radiobtn, - prefs_account_enum_set_radiobtn}, - {"ssl_smtp", "0", &tmp_ac_prefs.ssl_smtp, P_ENUM, - P_WID(&ssl.smtp_nossl_radiobtn), - prefs_account_enum_set_data_from_radiobtn, - prefs_account_enum_set_radiobtn}, - - {"use_nonblocking_ssl", "1", &tmp_ac_prefs.use_nonblocking_ssl, P_BOOL, - P_WID(&ssl.use_nonblocking_ssl_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, + {"ssl_pop", "0", &tmp_ac_prefs.ssl_pop, P_ENUM}, + {"ssl_imap", "0", &tmp_ac_prefs.ssl_imap, P_ENUM}, + {"ssl_nntp", "0", &tmp_ac_prefs.ssl_nntp, P_ENUM}, + {"ssl_smtp", "0", &tmp_ac_prefs.ssl_smtp, P_ENUM}, + {"use_nonblocking_ssl", "1", &tmp_ac_prefs.use_nonblocking_ssl, P_BOOL}, #endif /* USE_SSL */ /* Advanced */ - {"set_smtpport", "FALSE", &tmp_ac_prefs.set_smtpport, P_BOOL, - P_WID(&advanced.smtpport_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"smtp_port", "25", &tmp_ac_prefs.smtpport, P_USHORT, - P_WID(&advanced.smtpport_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"set_popport", "FALSE", &tmp_ac_prefs.set_popport, P_BOOL, - P_WID(&advanced.popport_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"pop_port", "110", &tmp_ac_prefs.popport, P_USHORT, - P_WID(&advanced.popport_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"set_imapport", "FALSE", &tmp_ac_prefs.set_imapport, P_BOOL, - P_WID(&advanced.imapport_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"imap_port", "143", &tmp_ac_prefs.imapport, P_USHORT, - P_WID(&advanced.imapport_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"set_nntpport", "FALSE", &tmp_ac_prefs.set_nntpport, P_BOOL, - P_WID(&advanced.nntpport_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"nntp_port", "119", &tmp_ac_prefs.nntpport, P_USHORT, - P_WID(&advanced.nntpport_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"set_domain", "FALSE", &tmp_ac_prefs.set_domain, P_BOOL, - P_WID(&advanced.domain_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"domain", NULL, &tmp_ac_prefs.domain, P_STRING, - P_WID(&advanced.domain_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"imap_directory", NULL, &tmp_ac_prefs.imap_dir, P_STRING, - P_WID(&advanced.imapdir_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"set_sent_folder", "FALSE", &tmp_ac_prefs.set_sent_folder, P_BOOL, - P_WID(&advanced.sent_folder_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"sent_folder", NULL, &tmp_ac_prefs.sent_folder, P_STRING, - P_WID(&advanced.sent_folder_entry), - prefs_set_data_from_entry, prefs_set_entry}, - - {"set_draft_folder", "FALSE", &tmp_ac_prefs.set_draft_folder, P_BOOL, - P_WID(&advanced.draft_folder_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"draft_folder", NULL, &tmp_ac_prefs.draft_folder, P_STRING, - P_WID(&advanced.draft_folder_entry), - prefs_set_data_from_entry, prefs_set_entry}, + {"set_smtpport", "FALSE", &tmp_ac_prefs.set_smtpport, P_BOOL}, + {"smtp_port", "25", &tmp_ac_prefs.smtpport, P_USHORT}, + {"set_popport", "FALSE", &tmp_ac_prefs.set_popport, P_BOOL}, + {"pop_port", "110", &tmp_ac_prefs.popport, P_USHORT}, + {"set_imapport", "FALSE", &tmp_ac_prefs.set_imapport, P_BOOL}, + {"imap_port", "143", &tmp_ac_prefs.imapport, P_USHORT}, + {"set_nntpport", "FALSE", &tmp_ac_prefs.set_nntpport, P_BOOL}, + {"nntp_port", "119", &tmp_ac_prefs.nntpport, P_USHORT}, + {"set_domain", "FALSE", &tmp_ac_prefs.set_domain, P_BOOL}, + {"domain", NULL, &tmp_ac_prefs.domain, P_STRING}, + {"imap_directory", NULL, &tmp_ac_prefs.imap_dir, P_STRING}, + {"set_sent_folder", "FALSE", &tmp_ac_prefs.set_sent_folder, P_BOOL}, + {"sent_folder", NULL, &tmp_ac_prefs.sent_folder, P_STRING}, + {"set_draft_folder", "FALSE", &tmp_ac_prefs.set_draft_folder, P_BOOL}, + {"draft_folder", NULL, &tmp_ac_prefs.draft_folder, P_STRING}, + {"set_trash_folder", "FALSE", &tmp_ac_prefs.set_trash_folder, P_BOOL}, + {"trash_folder", NULL, &tmp_ac_prefs.trash_folder, P_STRING}, + + {NULL, NULL, NULL, P_OTHER} +}; - {"set_trash_folder", "FALSE", &tmp_ac_prefs.set_trash_folder, P_BOOL, - P_WID(&advanced.trash_folder_chkbtn), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"trash_folder", NULL, &tmp_ac_prefs.trash_folder, P_STRING, - P_WID(&advanced.trash_folder_entry), - prefs_set_data_from_entry, prefs_set_entry}, +static gint prefs_account_get_new_id(void); - {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL} -}; -static gint prefs_account_get_new_id (void); +PrefsAccount *prefs_account_get_tmp_prefs(void) +{ + return &tmp_ac_prefs; +} -static void prefs_account_create (void); -static void prefs_account_basic_create (void); -static void prefs_account_receive_create (void); -static void prefs_account_send_create (void); -static void prefs_account_compose_create (void); -#if USE_GPGME -static void prefs_account_privacy_create (void); -#endif /* USE_GPGME */ -#if USE_SSL -static void prefs_account_ssl_create (void); -#endif /* USE_SSL */ -static void prefs_account_advanced_create (void); +void prefs_account_set_tmp_prefs(PrefsAccount *ac_prefs) +{ + tmp_ac_prefs = *ac_prefs; +} -static void prefs_account_select_folder_cb (GtkWidget *widget, - gpointer data); -static void prefs_account_edit_custom_header (void); +void prefs_account_apply_tmp_prefs(PrefsAccount *ac_prefs) +{ + *ac_prefs = tmp_ac_prefs; +} -static gint prefs_account_deleted (GtkWidget *widget, - GdkEventAny *event, - gpointer data); -static gboolean prefs_account_key_pressed (GtkWidget *widget, - GdkEventKey *event, - gpointer data); -static void prefs_account_ok (void); -static gint prefs_account_apply (void); -static void prefs_account_cancel (void); +PrefParam *prefs_account_get_params(void) +{ + return param; +} PrefsAccount *prefs_account_new(void) { @@ -623,1742 +258,3 @@ static gint prefs_account_get_new_id(void) return last_id + 1; } - -PrefsAccount *prefs_account_open(PrefsAccount *ac_prefs) -{ - gboolean new_account = FALSE; - - debug_print(_("Opening account preferences window...\n")); - - inc_lock(); - - cancelled = FALSE; - - if (!ac_prefs) { - ac_prefs = prefs_account_new(); - new_account = TRUE; - } - - if (!dialog.window) { - prefs_account_create(); - } - - gtkut_box_set_reverse_order(GTK_BOX(dialog.confirm_area), - !prefs_common.comply_gnome_hig); - manage_window_set_transient(GTK_WINDOW(dialog.window)); - gtk_notebook_set_current_page(GTK_NOTEBOOK(dialog.notebook), 0); - gtk_widget_grab_focus(dialog.ok_btn); - - tmp_ac_prefs = *ac_prefs; - - if (new_account) { - PrefsAccount *def_ac; - gchar *buf; - - prefs_set_dialog_to_default(param); - buf = g_strdup_printf(_("Account%d"), ac_prefs->account_id); - gtk_entry_set_text(GTK_ENTRY(basic.acname_entry), buf); - g_free(buf); - def_ac = account_get_default(); - if (def_ac) { - gtk_entry_set_text(GTK_ENTRY(basic.name_entry), - def_ac->name ? def_ac->name : ""); - gtk_entry_set_text(GTK_ENTRY(basic.addr_entry), - def_ac->address ? def_ac->address : ""); - gtk_entry_set_text(GTK_ENTRY(basic.org_entry), - def_ac->organization ? def_ac->organization : ""); - } - menu_set_sensitive_all - (GTK_MENU_SHELL - (gtk_option_menu_get_menu - (GTK_OPTION_MENU - (basic.protocol_optmenu))), - TRUE); - gtk_window_set_title(GTK_WINDOW(dialog.window), - _("Preferences for new account")); - gtk_widget_hide(dialog.apply_btn); - } else { - prefs_set_dialog(param); - gtk_window_set_title(GTK_WINDOW(dialog.window), - _("Account preferences")); - gtk_widget_show(dialog.apply_btn); - } - - gtk_widget_show(dialog.window); - gtk_main(); - gtk_widget_hide(dialog.window); - - inc_unlock(); - - if (cancelled && new_account) { - g_free(ac_prefs); - return NULL; - } else { - *ac_prefs = tmp_ac_prefs; - return ac_prefs; - } -} - -static void prefs_account_create(void) -{ - gint page = 0; - - debug_print(_("Creating account preferences window...\n")); - - /* create dialog */ - prefs_dialog_create(&dialog); - g_signal_connect(G_OBJECT(dialog.window), "delete_event", - G_CALLBACK(prefs_account_deleted), NULL); - g_signal_connect(G_OBJECT(dialog.window), "key_press_event", - G_CALLBACK(prefs_account_key_pressed), NULL); - MANAGE_WINDOW_SIGNALS_CONNECT(dialog.window); - - g_signal_connect(G_OBJECT(dialog.ok_btn), "clicked", - G_CALLBACK(prefs_account_ok), NULL); - g_signal_connect(G_OBJECT(dialog.apply_btn), "clicked", - G_CALLBACK(prefs_account_apply), NULL); - g_signal_connect(G_OBJECT(dialog.cancel_btn), "clicked", - G_CALLBACK(prefs_account_cancel), NULL); - - prefs_account_basic_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Basic"), page++); - prefs_account_receive_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Receive"), page++); - prefs_account_send_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Send"), page++); - prefs_account_compose_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Compose"), page++); -#if USE_GPGME - prefs_account_privacy_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Privacy"), page++); -#endif /* USE_GPGME */ -#if USE_SSL - prefs_account_ssl_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("SSL"), page++); -#endif /* USE_SSL */ - prefs_account_advanced_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Advanced"), page++); -} - -#define SET_ACTIVATE(menuitem) \ -{ \ - g_signal_connect(G_OBJECT(menuitem), "activate", \ - G_CALLBACK(prefs_account_protocol_activated), NULL); \ -} - -static void prefs_account_basic_create(void) -{ - GtkWidget *vbox1; - GtkWidget *hbox; - GtkWidget *label; - GtkWidget *acname_entry; - GtkWidget *default_chkbtn; - GtkWidget *frame1; - GtkWidget *table1; - GtkWidget *name_entry; - GtkWidget *addr_entry; - GtkWidget *org_entry; - - GtkWidget *serv_frame; - GtkWidget *vbox2; - GtkWidget *optmenu; - GtkWidget *optmenu_menu; - GtkWidget *menuitem; - GtkWidget *serv_table; - GtkWidget *recvserv_label; - GtkWidget *smtpserv_label; - GtkWidget *nntpserv_label; - GtkWidget *recvserv_entry; - GtkWidget *smtpserv_entry; - GtkWidget *nntpserv_entry; - GtkWidget *nntpauth_chkbtn; - GtkWidget *uid_label; - GtkWidget *pass_label; - GtkWidget *uid_entry; - GtkWidget *pass_entry; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - hbox = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox1), hbox, FALSE, FALSE, 0); - - label = gtk_label_new (_("Name of this account")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - acname_entry = gtk_entry_new (); - gtk_widget_show (acname_entry); - gtk_widget_set_size_request (acname_entry, DEFAULT_ENTRY_WIDTH, -1); - gtk_box_pack_start (GTK_BOX (hbox), acname_entry, TRUE, TRUE, 0); - - default_chkbtn = gtk_check_button_new_with_label (_("Set as default")); - gtk_widget_show (default_chkbtn); - gtk_box_pack_end (GTK_BOX (hbox), default_chkbtn, FALSE, FALSE, 0); - - PACK_FRAME (vbox1, frame1, _("Personal information")); - - table1 = gtk_table_new (3, 2, FALSE); - gtk_widget_show (table1); - gtk_container_add (GTK_CONTAINER (frame1), table1); - gtk_container_set_border_width (GTK_CONTAINER (table1), 8); - gtk_table_set_row_spacings (GTK_TABLE (table1), VSPACING_NARROW); - gtk_table_set_col_spacings (GTK_TABLE (table1), 8); - - label = gtk_label_new (_("Full name")); - gtk_widget_show (label); - gtk_table_attach (GTK_TABLE (table1), label, 0, 1, 0, 1, - GTK_FILL, 0, 0, 0); - gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); - - label = gtk_label_new (_("Mail address")); - gtk_widget_show (label); - gtk_table_attach (GTK_TABLE (table1), label, 0, 1, 1, 2, - GTK_FILL, 0, 0, 0); - gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); - - label = gtk_label_new (_("Organization")); - gtk_widget_show (label); - gtk_table_attach (GTK_TABLE (table1), label, 0, 1, 2, 3, - GTK_FILL, 0, 0, 0); - gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); - - name_entry = gtk_entry_new (); - gtk_widget_show (name_entry); - gtk_table_attach (GTK_TABLE (table1), name_entry, 1, 2, 0, 1, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); - - addr_entry = gtk_entry_new (); - gtk_widget_show (addr_entry); - gtk_table_attach (GTK_TABLE (table1), addr_entry, 1, 2, 1, 2, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); - - org_entry = gtk_entry_new (); - gtk_widget_show (org_entry); - gtk_table_attach (GTK_TABLE (table1), org_entry, 1, 2, 2, 3, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); - - PACK_FRAME (vbox1, serv_frame, _("Server information")); - - vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW); - gtk_widget_show (vbox2); - gtk_container_add (GTK_CONTAINER (serv_frame), vbox2); - gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); - - hbox = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); - - label = gtk_label_new (_("Protocol")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - optmenu = gtk_option_menu_new (); - gtk_widget_show (optmenu); - gtk_box_pack_start (GTK_BOX (hbox), optmenu, FALSE, FALSE, 0); - - optmenu_menu = gtk_menu_new (); - - MENUITEM_ADD (optmenu_menu, menuitem, _("POP3"), A_POP3); - SET_ACTIVATE (menuitem); - MENUITEM_ADD (optmenu_menu, menuitem, _("IMAP4"), A_IMAP4); - SET_ACTIVATE (menuitem); - MENUITEM_ADD (optmenu_menu, menuitem, _("News (NNTP)"), A_NNTP); - SET_ACTIVATE (menuitem); - MENUITEM_ADD (optmenu_menu, menuitem, _("None (local)"), A_LOCAL); - SET_ACTIVATE (menuitem); - - gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu), optmenu_menu); - - serv_table = gtk_table_new (6, 4, FALSE); - gtk_widget_show (serv_table); - gtk_box_pack_start (GTK_BOX (vbox2), serv_table, FALSE, FALSE, 0); - gtk_table_set_row_spacings (GTK_TABLE (serv_table), VSPACING_NARROW); - gtk_table_set_row_spacing (GTK_TABLE (serv_table), 3, 0); - gtk_table_set_col_spacings (GTK_TABLE (serv_table), 8); - - nntpauth_chkbtn = gtk_check_button_new_with_label - (_("This server requires authentication")); - gtk_widget_show (nntpauth_chkbtn); - gtk_table_attach (GTK_TABLE (serv_table), nntpauth_chkbtn, 0, 4, 4, 5, - GTK_FILL, 0, 0, 0); - - nntpserv_entry = gtk_entry_new (); - gtk_widget_show (nntpserv_entry); - gtk_table_attach (GTK_TABLE (serv_table), nntpserv_entry, 1, 4, 0, 1, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); - gtk_table_set_row_spacing (GTK_TABLE (serv_table), 0, 0); - - recvserv_entry = gtk_entry_new (); - gtk_widget_show (recvserv_entry); - gtk_table_attach (GTK_TABLE (serv_table), recvserv_entry, 1, 4, 1, 2, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); - - smtpserv_entry = gtk_entry_new (); - gtk_widget_show (smtpserv_entry); - gtk_table_attach (GTK_TABLE (serv_table), smtpserv_entry, 1, 4, 2, 3, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); - - uid_entry = gtk_entry_new (); - gtk_widget_show (uid_entry); - gtk_widget_set_size_request (uid_entry, DEFAULT_ENTRY_WIDTH, -1); - gtk_table_attach (GTK_TABLE (serv_table), uid_entry, 1, 2, 5, 6, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); - - pass_entry = gtk_entry_new (); - gtk_widget_show (pass_entry); - gtk_widget_set_size_request (pass_entry, DEFAULT_ENTRY_WIDTH, -1); - gtk_table_attach (GTK_TABLE (serv_table), pass_entry, 3, 4, 5, 6, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); - gtk_entry_set_visibility (GTK_ENTRY (pass_entry), FALSE); - - nntpserv_label = gtk_label_new (_("News server")); - gtk_widget_show (nntpserv_label); - gtk_table_attach (GTK_TABLE (serv_table), nntpserv_label, 0, 1, 0, 1, - GTK_FILL, 0, 0, 0); - gtk_misc_set_alignment (GTK_MISC (nntpserv_label), 1, 0.5); - - recvserv_label = gtk_label_new (_("Server for receiving")); - gtk_widget_show (recvserv_label); - gtk_table_attach (GTK_TABLE (serv_table), recvserv_label, 0, 1, 1, 2, - GTK_FILL, 0, 0, 0); - gtk_misc_set_alignment (GTK_MISC (recvserv_label), 1, 0.5); - - smtpserv_label = gtk_label_new (_("SMTP server (send)")); - gtk_widget_show (smtpserv_label); - gtk_table_attach (GTK_TABLE (serv_table), smtpserv_label, 0, 1, 2, 3, - GTK_FILL, 0, 0, 0); - gtk_misc_set_alignment (GTK_MISC (smtpserv_label), 1, 0.5); - gtk_table_set_row_spacing (GTK_TABLE (serv_table), 2, 0); - - uid_label = gtk_label_new (_("User ID")); - gtk_widget_show (uid_label); - gtk_table_attach (GTK_TABLE (serv_table), uid_label, 0, 1, 5, 6, - GTK_FILL, 0, 0, 0); - gtk_misc_set_alignment (GTK_MISC (uid_label), 1, 0.5); - - pass_label = gtk_label_new (_("Password")); - gtk_widget_show (pass_label); - gtk_table_attach (GTK_TABLE (serv_table), pass_label, 2, 3, 5, 6, - 0, 0, 0, 0); - - SET_TOGGLE_SENSITIVITY (nntpauth_chkbtn, uid_label); - SET_TOGGLE_SENSITIVITY (nntpauth_chkbtn, pass_label); - SET_TOGGLE_SENSITIVITY (nntpauth_chkbtn, uid_entry); - SET_TOGGLE_SENSITIVITY (nntpauth_chkbtn, pass_entry); - - basic.acname_entry = acname_entry; - basic.default_chkbtn = default_chkbtn; - - basic.name_entry = name_entry; - basic.addr_entry = addr_entry; - basic.org_entry = org_entry; - - basic.serv_frame = serv_frame; - basic.serv_table = serv_table; - basic.protocol_optmenu = optmenu; - basic.recvserv_label = recvserv_label; - basic.recvserv_entry = recvserv_entry; - basic.smtpserv_label = smtpserv_label; - basic.smtpserv_entry = smtpserv_entry; - basic.nntpserv_label = nntpserv_label; - basic.nntpserv_entry = nntpserv_entry; - basic.nntpauth_chkbtn = nntpauth_chkbtn; - basic.uid_label = uid_label; - basic.pass_label = pass_label; - basic.uid_entry = uid_entry; - basic.pass_entry = pass_entry; -} - -static void prefs_account_receive_create(void) -{ - GtkWidget *vbox1; - GtkWidget *frame1; - GtkWidget *vbox2; - GtkWidget *use_apop_chkbtn; - GtkWidget *rmmail_chkbtn; - GtkWidget *hbox_spc; - GtkWidget *leave_time_label; - GtkWidget *leave_time_entry; - GtkWidget *getall_chkbtn; - GtkWidget *hbox1; - GtkWidget *size_limit_chkbtn; - GtkWidget *size_limit_entry; - GtkWidget *label; - GtkWidget *filter_on_recv_chkbtn; - GtkWidget *vbox3; - GtkWidget *inbox_label; - GtkWidget *inbox_entry; - GtkWidget *inbox_btn; - - GtkWidget *imap_frame; - GtkWidget *optmenu; - GtkWidget *optmenu_menu; - GtkWidget *menuitem; - - GtkWidget *nntp_frame; - GtkWidget *maxarticle_label; - GtkWidget *maxarticle_spinbtn; - GtkObject *maxarticle_spinbtn_adj; - GtkWidget *maxarticle_desc_label; - - GtkWidget *recvatgetall_chkbtn; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - PACK_FRAME (vbox1, frame1, _("POP3")); - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_container_add (GTK_CONTAINER (frame1), vbox2); - gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); - - PACK_CHECK_BUTTON (vbox2, use_apop_chkbtn, - _("Use secure authentication (APOP)")); - - PACK_CHECK_BUTTON (vbox2, rmmail_chkbtn, - _("Remove messages on server when received")); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); - - hbox_spc = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox_spc); - gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0); - gtk_widget_set_size_request (hbox_spc, 12, -1); - - leave_time_label = gtk_label_new (_("Remove after")); - gtk_widget_show (leave_time_label); - gtk_box_pack_start (GTK_BOX (hbox1), leave_time_label, FALSE, FALSE, 0); - - leave_time_entry = gtk_entry_new (); - gtk_widget_show (leave_time_entry); - gtk_widget_set_size_request (leave_time_entry, 64, -1); - gtk_box_pack_start (GTK_BOX (hbox1), leave_time_entry, FALSE, FALSE, 0); - - leave_time_label = gtk_label_new (_("days")); - gtk_widget_show (leave_time_label); - gtk_box_pack_start (GTK_BOX (hbox1), leave_time_label, FALSE, FALSE, 0); - - SET_TOGGLE_SENSITIVITY (rmmail_chkbtn, hbox1); - - PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); - - hbox_spc = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox_spc); - gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0); - gtk_widget_set_size_request (hbox_spc, 12, -1); - - leave_time_label = gtk_label_new (_("(0 days: remove immediately)")); - gtk_widget_show (leave_time_label); - gtk_box_pack_start (GTK_BOX (hbox1), leave_time_label, FALSE, FALSE, 0); - - SET_TOGGLE_SENSITIVITY (rmmail_chkbtn, hbox1); - - PACK_CHECK_BUTTON (vbox2, getall_chkbtn, - _("Download all messages on server")); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON (hbox1, size_limit_chkbtn, _("Receive size limit")); - - size_limit_entry = gtk_entry_new (); - gtk_widget_show (size_limit_entry); - gtk_widget_set_size_request (size_limit_entry, 64, -1); - gtk_box_pack_start (GTK_BOX (hbox1), size_limit_entry, FALSE, FALSE, 0); - - label = gtk_label_new (_("KB")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); - - SET_TOGGLE_SENSITIVITY (size_limit_chkbtn, size_limit_entry); - - PACK_CHECK_BUTTON (vbox2, filter_on_recv_chkbtn, - _("Filter messages on receiving")); - - PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); - - inbox_label = gtk_label_new (_("Default inbox")); - gtk_widget_show (inbox_label); - gtk_box_pack_start (GTK_BOX (hbox1), inbox_label, FALSE, FALSE, 0); - - inbox_entry = gtk_entry_new (); - gtk_widget_show (inbox_entry); - gtk_widget_set_size_request (inbox_entry, DEFAULT_ENTRY_WIDTH, -1); - gtk_box_pack_start (GTK_BOX (hbox1), inbox_entry, TRUE, TRUE, 0); - - inbox_btn = gtk_button_new_with_label (_(" Select... ")); - gtk_widget_show (inbox_btn); - gtk_box_pack_start (GTK_BOX (hbox1), inbox_btn, FALSE, FALSE, 0); - g_signal_connect (G_OBJECT (inbox_btn), "clicked", - G_CALLBACK (prefs_account_select_folder_cb), - inbox_entry); - - PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2); - - PACK_SMALL_LABEL - (vbox2, label, - _("Unfiltered messages will be stored in this folder.")); - - PACK_FRAME (vbox1, imap_frame, _("IMAP4")); - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_container_add (GTK_CONTAINER (imap_frame), vbox2); - gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); - - label = gtk_label_new (_("Authentication method")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); - - optmenu = gtk_option_menu_new (); - gtk_widget_show (optmenu); - gtk_box_pack_start (GTK_BOX (hbox1), optmenu, FALSE, FALSE, 0); - - optmenu_menu = gtk_menu_new (); - - MENUITEM_ADD (optmenu_menu, menuitem, _("Automatic"), 0); - MENUITEM_ADD (optmenu_menu, menuitem, "LOGIN", IMAP_AUTH_LOGIN); - MENUITEM_ADD (optmenu_menu, menuitem, "CRAM-MD5", IMAP_AUTH_CRAM_MD5); - - gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu), optmenu_menu); - - PACK_FRAME (vbox1, nntp_frame, _("News")); - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_container_add (GTK_CONTAINER (nntp_frame), vbox2); - gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); - - maxarticle_label = gtk_label_new - (_("Maximum number of articles to download")); - gtk_widget_show (maxarticle_label); - gtk_box_pack_start (GTK_BOX (hbox1), maxarticle_label, FALSE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (maxarticle_label), GTK_JUSTIFY_LEFT); - - maxarticle_spinbtn_adj = - gtk_adjustment_new (300, 0, 10000, 10, 100, 100); - maxarticle_spinbtn = gtk_spin_button_new - (GTK_ADJUSTMENT (maxarticle_spinbtn_adj), 10, 0); - gtk_widget_show (maxarticle_spinbtn); - gtk_box_pack_start (GTK_BOX (hbox1), maxarticle_spinbtn, - FALSE, FALSE, 0); - gtk_widget_set_size_request (maxarticle_spinbtn, 64, -1); - gtk_spin_button_set_numeric - (GTK_SPIN_BUTTON (maxarticle_spinbtn), TRUE); - - PACK_SMALL_LABEL (vbox2, maxarticle_desc_label, - _("No limit if 0 is specified.")); - - PACK_CHECK_BUTTON - (vbox1, recvatgetall_chkbtn, - _("`Get all' checks for new messages on this account")); - - receive.pop3_frame = frame1; - receive.use_apop_chkbtn = use_apop_chkbtn; - receive.rmmail_chkbtn = rmmail_chkbtn; - receive.leave_time_entry = leave_time_entry; - receive.getall_chkbtn = getall_chkbtn; - receive.size_limit_chkbtn = size_limit_chkbtn; - receive.size_limit_entry = size_limit_entry; - receive.filter_on_recv_chkbtn = filter_on_recv_chkbtn; - receive.inbox_label = inbox_label; - receive.inbox_entry = inbox_entry; - receive.inbox_btn = inbox_btn; - - receive.imap_frame = imap_frame; - receive.imap_auth_type_optmenu = optmenu; - - receive.nntp_frame = nntp_frame; - receive.maxarticle_spinbtn = maxarticle_spinbtn; - receive.maxarticle_spinbtn_adj = maxarticle_spinbtn_adj; - - receive.recvatgetall_chkbtn = recvatgetall_chkbtn; -} - -static void prefs_account_send_create(void) -{ - GtkWidget *vbox1; - GtkWidget *vbox2; - GtkWidget *frame; - GtkWidget *date_chkbtn; - GtkWidget *msgid_chkbtn; - GtkWidget *hbox; - GtkWidget *customhdr_chkbtn; - GtkWidget *customhdr_edit_btn; - GtkWidget *vbox3; - GtkWidget *smtp_auth_chkbtn; - GtkWidget *optmenu; - GtkWidget *optmenu_menu; - GtkWidget *menuitem; - GtkWidget *vbox4; - GtkWidget *hbox_spc; - GtkWidget *label; - GtkWidget *smtp_uid_entry; - GtkWidget *smtp_pass_entry; - GtkWidget *vbox_spc; - /* GtkWidget *pop_bfr_smtp_chkbtn; */ - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - PACK_FRAME (vbox1, frame, _("Header")); - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_container_add (GTK_CONTAINER (frame), vbox2); - gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); - - PACK_CHECK_BUTTON (vbox2, date_chkbtn, _("Add Date header field")); - PACK_CHECK_BUTTON (vbox2, msgid_chkbtn, _("Generate Message-ID")); - - hbox = gtk_hbox_new (FALSE, 12); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON (hbox, customhdr_chkbtn, - _("Add user-defined header")); - - customhdr_edit_btn = gtk_button_new_with_label (_(" Edit... ")); - gtk_widget_show (customhdr_edit_btn); - gtk_box_pack_start (GTK_BOX (hbox), customhdr_edit_btn, - FALSE, FALSE, 0); - g_signal_connect (G_OBJECT (customhdr_edit_btn), "clicked", - G_CALLBACK (prefs_account_edit_custom_header), - NULL); - - SET_TOGGLE_SENSITIVITY (customhdr_chkbtn, customhdr_edit_btn); - - PACK_FRAME (vbox1, frame, _("Authentication")); - - vbox3 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox3); - gtk_container_add (GTK_CONTAINER (frame), vbox3); - gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8); - - PACK_CHECK_BUTTON (vbox3, smtp_auth_chkbtn, - _("SMTP Authentication (SMTP AUTH)")); - - vbox4 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox4); - gtk_box_pack_start (GTK_BOX (vbox3), vbox4, FALSE, FALSE, 0); - - hbox = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox4), hbox, FALSE, FALSE, 0); - - hbox_spc = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox_spc); - gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0); - gtk_widget_set_size_request (hbox_spc, 12, -1); - - label = gtk_label_new (_("Authentication method")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - optmenu = gtk_option_menu_new (); - gtk_widget_show (optmenu); - gtk_box_pack_start (GTK_BOX (hbox), optmenu, FALSE, FALSE, 0); - - optmenu_menu = gtk_menu_new (); - - MENUITEM_ADD (optmenu_menu, menuitem, _("Automatic"), 0); - MENUITEM_ADD (optmenu_menu, menuitem, "PLAIN", SMTPAUTH_PLAIN); - MENUITEM_ADD (optmenu_menu, menuitem, "LOGIN", SMTPAUTH_LOGIN); - MENUITEM_ADD (optmenu_menu, menuitem, "CRAM-MD5", SMTPAUTH_CRAM_MD5); - MENUITEM_ADD (optmenu_menu, menuitem, "DIGEST-MD5", SMTPAUTH_DIGEST_MD5); - gtk_widget_set_sensitive (menuitem, FALSE); - - gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu), optmenu_menu); - - PACK_VSPACER(vbox4, vbox_spc, VSPACING_NARROW_2); - - hbox = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox4), hbox, FALSE, FALSE, 0); - - hbox_spc = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox_spc); - gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0); - gtk_widget_set_size_request (hbox_spc, 12, -1); - - label = gtk_label_new (_("User ID")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - smtp_uid_entry = gtk_entry_new (); - gtk_widget_show (smtp_uid_entry); - gtk_widget_set_size_request (smtp_uid_entry, DEFAULT_ENTRY_WIDTH, -1); - gtk_box_pack_start (GTK_BOX (hbox), smtp_uid_entry, TRUE, TRUE, 0); - - label = gtk_label_new (_("Password")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - smtp_pass_entry = gtk_entry_new (); - gtk_widget_show (smtp_pass_entry); - gtk_widget_set_size_request (smtp_pass_entry, DEFAULT_ENTRY_WIDTH, -1); - gtk_box_pack_start (GTK_BOX (hbox), smtp_pass_entry, TRUE, TRUE, 0); - gtk_entry_set_visibility (GTK_ENTRY (smtp_pass_entry), FALSE); - - PACK_VSPACER(vbox4, vbox_spc, VSPACING_NARROW_2); - - hbox = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox4), hbox, FALSE, FALSE, 0); - - hbox_spc = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox_spc); - gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0); - gtk_widget_set_size_request (hbox_spc, 12, -1); - - label = gtk_label_new - (_("If you leave these entries empty, the same " - "user ID and password as receiving will be used.")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtkut_widget_set_small_font_size (label); - - SET_TOGGLE_SENSITIVITY (smtp_auth_chkbtn, vbox4); - -#if 0 - PACK_CHECK_BUTTON (vbox3, pop_bfr_smtp_chkbtn, - _("Authenticate with POP3 before sending")); - gtk_widget_set_sensitive(pop_bfr_smtp_chkbtn, FALSE); -#endif - - p_send.date_chkbtn = date_chkbtn; - p_send.msgid_chkbtn = msgid_chkbtn; - p_send.customhdr_chkbtn = customhdr_chkbtn; - - p_send.smtp_auth_chkbtn = smtp_auth_chkbtn; - p_send.smtp_auth_type_optmenu = optmenu; - p_send.smtp_uid_entry = smtp_uid_entry; - p_send.smtp_pass_entry = smtp_pass_entry; - /* p_send.pop_bfr_smtp_chkbtn = pop_bfr_smtp_chkbtn; */ -} - -static void prefs_account_compose_create(void) -{ - GtkWidget *vbox1; - GtkWidget *sig_vbox; - GtkWidget *sig_hbox; - GtkWidget *sigfile_radiobtn; - GtkWidget *sigcmd_radiobtn; - GtkWidget *sigpath_entry; - GtkWidget *frame; - GtkWidget *table; - GtkWidget *autocc_chkbtn; - GtkWidget *autocc_entry; - GtkWidget *autobcc_chkbtn; - GtkWidget *autobcc_entry; - GtkWidget *autoreplyto_chkbtn; - GtkWidget *autoreplyto_entry; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - PACK_FRAME (vbox1, frame, _("Signature")); - - sig_vbox = gtk_vbox_new (FALSE, VSPACING_NARROW_2); - gtk_widget_show (sig_vbox); - gtk_container_add (GTK_CONTAINER (frame), sig_vbox); - gtk_container_set_border_width (GTK_CONTAINER (sig_vbox), 8); - - sig_hbox = gtk_hbox_new (FALSE, 8); - gtk_widget_show (sig_hbox); - gtk_box_pack_start (GTK_BOX (sig_vbox), sig_hbox, FALSE, FALSE, 0); - - sigfile_radiobtn = gtk_radio_button_new_with_label (NULL, _("File")); - gtk_widget_show (sigfile_radiobtn); - gtk_box_pack_start (GTK_BOX (sig_hbox), sigfile_radiobtn, - FALSE, FALSE, 0); - g_object_set_data (G_OBJECT (sigfile_radiobtn), MENU_VAL_ID, - GINT_TO_POINTER (SIG_FILE)); - - sigcmd_radiobtn = gtk_radio_button_new_with_label_from_widget - (GTK_RADIO_BUTTON(sigfile_radiobtn), _("Command output")); - gtk_widget_show (sigcmd_radiobtn); - gtk_box_pack_start (GTK_BOX (sig_hbox), sigcmd_radiobtn, - FALSE, FALSE, 0); - g_object_set_data (G_OBJECT (sigcmd_radiobtn), MENU_VAL_ID, - GINT_TO_POINTER (SIG_COMMAND)); - - sigpath_entry = gtk_entry_new (); - gtk_widget_show (sigpath_entry); - gtk_box_pack_start (GTK_BOX (sig_vbox), sigpath_entry, TRUE, TRUE, 0); - - PACK_FRAME (vbox1, frame, _("Automatically set the following addresses")); - - table = gtk_table_new (3, 2, FALSE); - gtk_widget_show (table); - gtk_container_add (GTK_CONTAINER (frame), table); - gtk_container_set_border_width (GTK_CONTAINER (table), 8); - gtk_table_set_row_spacings (GTK_TABLE (table), VSPACING_NARROW_2); - gtk_table_set_col_spacings (GTK_TABLE (table), 8); - - autocc_chkbtn = gtk_check_button_new_with_label (_("Cc")); - gtk_widget_show (autocc_chkbtn); - gtk_table_attach (GTK_TABLE (table), autocc_chkbtn, 0, 1, 0, 1, - GTK_FILL, 0, 0, 0); - - autocc_entry = gtk_entry_new (); - gtk_widget_show (autocc_entry); - gtk_table_attach (GTK_TABLE (table), autocc_entry, 1, 2, 0, 1, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); - - SET_TOGGLE_SENSITIVITY (autocc_chkbtn, autocc_entry); - - autobcc_chkbtn = gtk_check_button_new_with_label (_("Bcc")); - gtk_widget_show (autobcc_chkbtn); - gtk_table_attach (GTK_TABLE (table), autobcc_chkbtn, 0, 1, 1, 2, - GTK_FILL, 0, 0, 0); - - autobcc_entry = gtk_entry_new (); - gtk_widget_show (autobcc_entry); - gtk_table_attach (GTK_TABLE (table), autobcc_entry, 1, 2, 1, 2, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); - - SET_TOGGLE_SENSITIVITY (autobcc_chkbtn, autobcc_entry); - - autoreplyto_chkbtn = gtk_check_button_new_with_label (_("Reply-To")); - gtk_widget_show (autoreplyto_chkbtn); - gtk_table_attach (GTK_TABLE (table), autoreplyto_chkbtn, 0, 1, 2, 3, - GTK_FILL, 0, 0, 0); - - autoreplyto_entry = gtk_entry_new (); - gtk_widget_show (autoreplyto_entry); - gtk_table_attach (GTK_TABLE (table), autoreplyto_entry, 1, 2, 2, 3, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); - - SET_TOGGLE_SENSITIVITY (autoreplyto_chkbtn, autoreplyto_entry); - - - compose.sigfile_radiobtn = sigfile_radiobtn; - compose.sigpath_entry = sigpath_entry; - - compose.autocc_chkbtn = autocc_chkbtn; - compose.autocc_entry = autocc_entry; - compose.autobcc_chkbtn = autobcc_chkbtn; - compose.autobcc_entry = autobcc_entry; - compose.autoreplyto_chkbtn = autoreplyto_chkbtn; - compose.autoreplyto_entry = autoreplyto_entry; -} - -#if USE_GPGME -static void prefs_account_privacy_create(void) -{ - GtkWidget *vbox1; - GtkWidget *frame1; - GtkWidget *vbox2; - GtkWidget *hbox1; - GtkWidget *label; - GtkWidget *default_sign_chkbtn; - GtkWidget *default_encrypt_chkbtn; - GtkWidget *encrypt_reply_chkbtn; - GtkWidget *ascii_armored_chkbtn; - GtkWidget *clearsign_chkbtn; - GtkWidget *defaultkey_radiobtn; - GtkWidget *emailkey_radiobtn; - GtkWidget *customkey_radiobtn; - GtkWidget *customkey_entry; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON (vbox2, default_sign_chkbtn, - _("Sign message by default")); - PACK_CHECK_BUTTON (vbox2, default_encrypt_chkbtn, - _("Encrypt message by default")); - PACK_CHECK_BUTTON (vbox2, encrypt_reply_chkbtn, - _("Encrypt when replying to encrypted message")); - PACK_CHECK_BUTTON (vbox2, ascii_armored_chkbtn, - _("Use ASCII-armored format for encryption")); - PACK_CHECK_BUTTON (vbox2, clearsign_chkbtn, - _("Use clear text signature")); - g_signal_connect (G_OBJECT (ascii_armored_chkbtn), "toggled", - G_CALLBACK (prefs_account_ascii_armored_warning), - NULL); - - PACK_FRAME (vbox1, frame1, _("Sign key")); - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_container_add (GTK_CONTAINER (frame1), vbox2); - gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); - - defaultkey_radiobtn = gtk_radio_button_new_with_label - (NULL, _("Use default GnuPG key")); - gtk_widget_show (defaultkey_radiobtn); - gtk_box_pack_start (GTK_BOX (vbox2), defaultkey_radiobtn, - FALSE, FALSE, 0); - g_object_set_data (G_OBJECT (defaultkey_radiobtn), MENU_VAL_ID, - GINT_TO_POINTER (SIGN_KEY_DEFAULT)); - - emailkey_radiobtn = gtk_radio_button_new_with_label_from_widget - (GTK_RADIO_BUTTON (defaultkey_radiobtn), - _("Select key by your email address")); - gtk_widget_show (emailkey_radiobtn); - gtk_box_pack_start (GTK_BOX (vbox2), emailkey_radiobtn, - FALSE, FALSE, 0); - g_object_set_data (G_OBJECT (emailkey_radiobtn), MENU_VAL_ID, - GINT_TO_POINTER (SIGN_KEY_BY_FROM)); - - customkey_radiobtn = gtk_radio_button_new_with_label_from_widget - (GTK_RADIO_BUTTON (defaultkey_radiobtn), - _("Specify key manually")); - gtk_widget_show (customkey_radiobtn); - gtk_box_pack_start (GTK_BOX (vbox2), customkey_radiobtn, - FALSE, FALSE, 0); - g_object_set_data (G_OBJECT (customkey_radiobtn), MENU_VAL_ID, - GINT_TO_POINTER (SIGN_KEY_CUSTOM)); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); - - label = gtk_label_new (""); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); - gtk_widget_set_size_request (label, 16, -1); - - label = gtk_label_new (_("User or key ID:")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); - - customkey_entry = gtk_entry_new (); - gtk_widget_show (customkey_entry); - gtk_box_pack_start (GTK_BOX (hbox1), customkey_entry, - TRUE, TRUE, 0); - - SET_TOGGLE_SENSITIVITY (customkey_radiobtn, customkey_entry); - - privacy.default_sign_chkbtn = default_sign_chkbtn; - privacy.default_encrypt_chkbtn = default_encrypt_chkbtn; - privacy.encrypt_reply_chkbtn = encrypt_reply_chkbtn; - privacy.ascii_armored_chkbtn = ascii_armored_chkbtn; - privacy.clearsign_chkbtn = clearsign_chkbtn; - privacy.defaultkey_radiobtn = defaultkey_radiobtn; - privacy.emailkey_radiobtn = emailkey_radiobtn; - privacy.customkey_radiobtn = customkey_radiobtn; - privacy.customkey_entry = customkey_entry; -} -#endif /* USE_GPGME */ - -#if USE_SSL - -#define CREATE_RADIO_BUTTON(box, btn, btn_p, label, data) \ -{ \ - btn = gtk_radio_button_new_with_label_from_widget \ - (GTK_RADIO_BUTTON (btn_p), label); \ - gtk_widget_show (btn); \ - gtk_box_pack_start (GTK_BOX (box), btn, FALSE, FALSE, 0); \ - g_object_set_data (G_OBJECT (btn), MENU_VAL_ID, \ - GINT_TO_POINTER (data)); \ -} - -#define CREATE_RADIO_BUTTONS(box, \ - btn1, btn1_label, btn1_data, \ - btn2, btn2_label, btn2_data, \ - btn3, btn3_label, btn3_data) \ -{ \ - btn1 = gtk_radio_button_new_with_label(NULL, btn1_label); \ - gtk_widget_show (btn1); \ - gtk_box_pack_start (GTK_BOX (box), btn1, FALSE, FALSE, 0); \ - g_object_set_data (G_OBJECT (btn1), MENU_VAL_ID, \ - GINT_TO_POINTER (btn1_data)); \ - \ - CREATE_RADIO_BUTTON(box, btn2, btn1, btn2_label, btn2_data); \ - CREATE_RADIO_BUTTON(box, btn3, btn1, btn3_label, btn3_data); \ -} - -static void prefs_account_ssl_create(void) -{ - GtkWidget *vbox1; - - GtkWidget *pop_frame; - GtkWidget *vbox2; - GtkWidget *pop_nossl_radiobtn; - GtkWidget *pop_ssltunnel_radiobtn; - GtkWidget *pop_starttls_radiobtn; - - GtkWidget *imap_frame; - GtkWidget *vbox3; - GtkWidget *imap_nossl_radiobtn; - GtkWidget *imap_ssltunnel_radiobtn; - GtkWidget *imap_starttls_radiobtn; - - GtkWidget *nntp_frame; - GtkWidget *vbox4; - GtkWidget *nntp_nossl_radiobtn; - GtkWidget *nntp_ssltunnel_radiobtn; - - GtkWidget *send_frame; - GtkWidget *vbox5; - GtkWidget *smtp_nossl_radiobtn; - GtkWidget *smtp_ssltunnel_radiobtn; - GtkWidget *smtp_starttls_radiobtn; - - GtkWidget *vbox6; - GtkWidget *use_nonblocking_ssl_chkbtn; - GtkWidget *label; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - PACK_FRAME (vbox1, pop_frame, _("POP3")); - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_container_add (GTK_CONTAINER (pop_frame), vbox2); - gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); - - CREATE_RADIO_BUTTONS(vbox2, - pop_nossl_radiobtn, - _("Don't use SSL"), - SSL_NONE, - pop_ssltunnel_radiobtn, - _("Use SSL for POP3 connection"), - SSL_TUNNEL, - pop_starttls_radiobtn, - _("Use STARTTLS command to start SSL session"), - SSL_STARTTLS); - - PACK_FRAME (vbox1, imap_frame, _("IMAP4")); - vbox3 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox3); - gtk_container_add (GTK_CONTAINER (imap_frame), vbox3); - gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8); - - CREATE_RADIO_BUTTONS(vbox3, - imap_nossl_radiobtn, - _("Don't use SSL"), - SSL_NONE, - imap_ssltunnel_radiobtn, - _("Use SSL for IMAP4 connection"), - SSL_TUNNEL, - imap_starttls_radiobtn, - _("Use STARTTLS command to start SSL session"), - SSL_STARTTLS); - - PACK_FRAME (vbox1, nntp_frame, _("NNTP")); - vbox4 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox4); - gtk_container_add (GTK_CONTAINER (nntp_frame), vbox4); - gtk_container_set_border_width (GTK_CONTAINER (vbox4), 8); - - nntp_nossl_radiobtn = - gtk_radio_button_new_with_label (NULL, _("Don't use SSL")); - gtk_widget_show (nntp_nossl_radiobtn); - gtk_box_pack_start (GTK_BOX (vbox4), nntp_nossl_radiobtn, - FALSE, FALSE, 0); - g_object_set_data (G_OBJECT (nntp_nossl_radiobtn), MENU_VAL_ID, - GINT_TO_POINTER (SSL_NONE)); - - CREATE_RADIO_BUTTON(vbox4, nntp_ssltunnel_radiobtn, nntp_nossl_radiobtn, - _("Use SSL for NNTP connection"), SSL_TUNNEL); - - PACK_FRAME (vbox1, send_frame, _("Send (SMTP)")); - vbox5 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox5); - gtk_container_add (GTK_CONTAINER (send_frame), vbox5); - gtk_container_set_border_width (GTK_CONTAINER (vbox5), 8); - - CREATE_RADIO_BUTTONS(vbox5, - smtp_nossl_radiobtn, - _("Don't use SSL"), - SSL_NONE, - smtp_ssltunnel_radiobtn, - _("Use SSL for SMTP connection"), - SSL_TUNNEL, - smtp_starttls_radiobtn, - _("Use STARTTLS command to start SSL session"), - SSL_STARTTLS); - - vbox6 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox6); - gtk_box_pack_start (GTK_BOX (vbox1), vbox6, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON(vbox6, use_nonblocking_ssl_chkbtn, - _("Use non-blocking SSL")); - PACK_SMALL_LABEL - (vbox6, label, - _("Turn this off if you have problems in SSL connection.")); - - ssl.pop_frame = pop_frame; - ssl.pop_nossl_radiobtn = pop_nossl_radiobtn; - ssl.pop_ssltunnel_radiobtn = pop_ssltunnel_radiobtn; - ssl.pop_starttls_radiobtn = pop_starttls_radiobtn; - - ssl.imap_frame = imap_frame; - ssl.imap_nossl_radiobtn = imap_nossl_radiobtn; - ssl.imap_ssltunnel_radiobtn = imap_ssltunnel_radiobtn; - ssl.imap_starttls_radiobtn = imap_starttls_radiobtn; - - ssl.nntp_frame = nntp_frame; - ssl.nntp_nossl_radiobtn = nntp_nossl_radiobtn; - ssl.nntp_ssltunnel_radiobtn = nntp_ssltunnel_radiobtn; - - ssl.send_frame = send_frame; - ssl.smtp_nossl_radiobtn = smtp_nossl_radiobtn; - ssl.smtp_ssltunnel_radiobtn = smtp_ssltunnel_radiobtn; - ssl.smtp_starttls_radiobtn = smtp_starttls_radiobtn; - - ssl.use_nonblocking_ssl_chkbtn = use_nonblocking_ssl_chkbtn; -} - -#undef CREATE_RADIO_BUTTONS -#undef CREATE_RADIO_BUTTON - -#endif /* USE_SSL */ - -static void prefs_account_advanced_create(void) -{ - GtkWidget *vbox1; - GtkWidget *vbox2; - GtkWidget *hbox1; - GtkWidget *checkbtn_smtpport; - GtkWidget *entry_smtpport; - GtkWidget *hbox_popport; - GtkWidget *checkbtn_popport; - GtkWidget *entry_popport; - GtkWidget *hbox_imapport; - GtkWidget *checkbtn_imapport; - GtkWidget *entry_imapport; - GtkWidget *hbox_nntpport; - GtkWidget *checkbtn_nntpport; - GtkWidget *entry_nntpport; - GtkWidget *checkbtn_domain; - GtkWidget *entry_domain; - GtkWidget *imap_frame; - GtkWidget *imapdir_label; - GtkWidget *imapdir_entry; - GtkWidget *folder_frame; - GtkWidget *vbox3; - GtkWidget *table; - GtkWidget *sent_folder_chkbtn; - GtkWidget *sent_folder_entry; - GtkWidget *draft_folder_chkbtn; - GtkWidget *draft_folder_entry; - GtkWidget *trash_folder_chkbtn; - GtkWidget *trash_folder_entry; - -#define PACK_HBOX(hbox) \ -{ \ - hbox = gtk_hbox_new (FALSE, 8); \ - gtk_widget_show (hbox); \ - gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); \ -} - -#define PACK_PORT_ENTRY(box, entry) \ -{ \ - entry = gtk_entry_new (); \ - gtk_entry_set_max_length (GTK_ENTRY(entry), 5); \ - gtk_widget_show (entry); \ - gtk_box_pack_start (GTK_BOX (box), entry, FALSE, FALSE, 0); \ - gtk_widget_set_size_request (entry, 64, -1); \ -} - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW_2); - gtk_widget_show (vbox2); - gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); - - PACK_HBOX (hbox1); - PACK_CHECK_BUTTON (hbox1, checkbtn_smtpport, _("Specify SMTP port")); - PACK_PORT_ENTRY (hbox1, entry_smtpport); - SET_TOGGLE_SENSITIVITY (checkbtn_smtpport, entry_smtpport); - - PACK_HBOX (hbox_popport); - PACK_CHECK_BUTTON (hbox_popport, checkbtn_popport, - _("Specify POP3 port")); - PACK_PORT_ENTRY (hbox_popport, entry_popport); - SET_TOGGLE_SENSITIVITY (checkbtn_popport, entry_popport); - - PACK_HBOX (hbox_imapport); - PACK_CHECK_BUTTON (hbox_imapport, checkbtn_imapport, - _("Specify IMAP4 port")); - PACK_PORT_ENTRY (hbox_imapport, entry_imapport); - SET_TOGGLE_SENSITIVITY (checkbtn_imapport, entry_imapport); - - PACK_HBOX (hbox_nntpport); - PACK_CHECK_BUTTON (hbox_nntpport, checkbtn_nntpport, - _("Specify NNTP port")); - PACK_PORT_ENTRY (hbox_nntpport, entry_nntpport); - SET_TOGGLE_SENSITIVITY (checkbtn_nntpport, entry_nntpport); - - PACK_HBOX (hbox1); - PACK_CHECK_BUTTON (hbox1, checkbtn_domain, _("Specify domain name")); - - entry_domain = gtk_entry_new (); - gtk_widget_show (entry_domain); - gtk_box_pack_start (GTK_BOX (hbox1), entry_domain, TRUE, TRUE, 0); - SET_TOGGLE_SENSITIVITY (checkbtn_domain, entry_domain); - - PACK_FRAME (vbox1, imap_frame, _("IMAP4")); - - vbox3 = gtk_vbox_new (FALSE, VSPACING_NARROW); - gtk_widget_show (vbox3); - gtk_container_add (GTK_CONTAINER (imap_frame), vbox3); - gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0); - - imapdir_label = gtk_label_new (_("IMAP server directory")); - gtk_widget_show (imapdir_label); - gtk_box_pack_start (GTK_BOX (hbox1), imapdir_label, FALSE, FALSE, 0); - - imapdir_entry = gtk_entry_new(); - gtk_widget_show (imapdir_entry); - gtk_box_pack_start (GTK_BOX (hbox1), imapdir_entry, TRUE, TRUE, 0); - -#undef PACK_HBOX -#undef PACK_PORT_ENTRY - - /* special folder setting (maybe these options are redundant) */ - - PACK_FRAME (vbox1, folder_frame, _("Folder")); - - vbox3 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox3); - gtk_container_add (GTK_CONTAINER (folder_frame), vbox3); - gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8); - - table = gtk_table_new (3, 3, FALSE); - gtk_widget_show (table); - gtk_container_add (GTK_CONTAINER (vbox3), table); - gtk_table_set_row_spacings (GTK_TABLE (table), VSPACING_NARROW_2); - gtk_table_set_col_spacings (GTK_TABLE (table), 4); - -#define SET_CHECK_BTN_AND_ENTRY(label, chkbtn, entry, n) \ -{ \ - GtkWidget *button; \ - \ - chkbtn = gtk_check_button_new_with_label (label); \ - gtk_widget_show (chkbtn); \ - gtk_table_attach (GTK_TABLE (table), chkbtn, \ - 0, 1, n, n + 1, GTK_FILL, 0, 0, 0); \ - \ - entry = gtk_entry_new (); \ - gtk_widget_show (entry); \ - gtk_table_attach (GTK_TABLE (table), entry, 1, 2, n, n + 1, \ - GTK_EXPAND | GTK_SHRINK | GTK_FILL, \ - GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); \ - \ - button = gtk_button_new_with_label (_(" ... ")); \ - gtk_widget_show (button); \ - gtk_table_attach (GTK_TABLE (table), button, \ - 2, 3, n, n + 1, GTK_FILL, 0, 0, 0); \ - g_signal_connect \ - (G_OBJECT (button), "clicked", \ - G_CALLBACK (prefs_account_select_folder_cb), \ - entry); \ - \ - SET_TOGGLE_SENSITIVITY (chkbtn, entry); \ - SET_TOGGLE_SENSITIVITY (chkbtn, button); \ -} - - SET_CHECK_BTN_AND_ENTRY(_("Put sent messages in"), - sent_folder_chkbtn, sent_folder_entry, 0); - SET_CHECK_BTN_AND_ENTRY(_("Put draft messages in"), - draft_folder_chkbtn, draft_folder_entry, 1); - SET_CHECK_BTN_AND_ENTRY(_("Put deleted messages in"), - trash_folder_chkbtn, trash_folder_entry, 2); - - advanced.smtpport_chkbtn = checkbtn_smtpport; - advanced.smtpport_entry = entry_smtpport; - advanced.popport_hbox = hbox_popport; - advanced.popport_chkbtn = checkbtn_popport; - advanced.popport_entry = entry_popport; - advanced.imapport_hbox = hbox_imapport; - advanced.imapport_chkbtn = checkbtn_imapport; - advanced.imapport_entry = entry_imapport; - advanced.nntpport_hbox = hbox_nntpport; - advanced.nntpport_chkbtn = checkbtn_nntpport; - advanced.nntpport_entry = entry_nntpport; - advanced.domain_chkbtn = checkbtn_domain; - advanced.domain_entry = entry_domain; - - advanced.imap_frame = imap_frame; - advanced.imapdir_entry = imapdir_entry; - - advanced.sent_folder_chkbtn = sent_folder_chkbtn; - advanced.sent_folder_entry = sent_folder_entry; - advanced.draft_folder_chkbtn = draft_folder_chkbtn; - advanced.draft_folder_entry = draft_folder_entry; - advanced.trash_folder_chkbtn = trash_folder_chkbtn; - advanced.trash_folder_entry = trash_folder_entry; -} - -static gint prefs_account_deleted(GtkWidget *widget, GdkEventAny *event, - gpointer data) -{ - prefs_account_cancel(); - return TRUE; -} - -static gboolean prefs_account_key_pressed(GtkWidget *widget, GdkEventKey *event, - gpointer data) -{ - if (event && event->keyval == GDK_Escape) - prefs_account_cancel(); - return FALSE; -} - -static void prefs_account_ok(void) -{ - if (prefs_account_apply() == 0) - gtk_main_quit(); -} - -static gint prefs_account_apply(void) -{ - RecvProtocol protocol; - GtkWidget *menu; - GtkWidget *menuitem; - - menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(basic.protocol_optmenu)); - menuitem = gtk_menu_get_active(GTK_MENU(menu)); - protocol = GPOINTER_TO_INT - (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID)); - - if (*gtk_entry_get_text(GTK_ENTRY(basic.acname_entry)) == '\0') { - alertpanel_error(_("Account name is not entered.")); - return -1; - } - if (*gtk_entry_get_text(GTK_ENTRY(basic.addr_entry)) == '\0') { - alertpanel_error(_("Mail address is not entered.")); - return -1; - } - if ((protocol == A_POP3 || protocol == A_LOCAL) && - *gtk_entry_get_text(GTK_ENTRY(basic.smtpserv_entry)) == '\0') { - alertpanel_error(_("SMTP server is not entered.")); - return -1; - } - if ((protocol == A_POP3 || protocol == A_IMAP4) && - *gtk_entry_get_text(GTK_ENTRY(basic.uid_entry)) == '\0') { - alertpanel_error(_("User ID is not entered.")); - return -1; - } - if (protocol == A_POP3 && - *gtk_entry_get_text(GTK_ENTRY(basic.recvserv_entry)) == '\0') { - alertpanel_error(_("POP3 server is not entered.")); - return -1; - } - if (protocol == A_IMAP4 && - *gtk_entry_get_text(GTK_ENTRY(basic.recvserv_entry)) == '\0') { - alertpanel_error(_("IMAP4 server is not entered.")); - return -1; - } - if (protocol == A_NNTP && - *gtk_entry_get_text(GTK_ENTRY(basic.nntpserv_entry)) == '\0') { - alertpanel_error(_("NNTP server is not entered.")); - return -1; - } - - prefs_set_data_from_dialog(param); - return 0; -} - -static void prefs_account_cancel(void) -{ - cancelled = TRUE; - gtk_main_quit(); -} - -static void prefs_account_select_folder_cb(GtkWidget *widget, gpointer data) -{ - FolderItem *item; - gchar *id; - - item = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL); - if (item && item->path) { - id = folder_item_get_identifier(item); - if (id) { - gtk_entry_set_text(GTK_ENTRY(data), id); - g_free(id); - } - } -} - -static void prefs_account_edit_custom_header(void) -{ - prefs_custom_header_open(&tmp_ac_prefs); -} - -static void prefs_account_enum_set_data_from_radiobtn(PrefParam *pparam) -{ - GtkRadioButton *radiobtn; - GSList *group; - - radiobtn = GTK_RADIO_BUTTON (*pparam->widget); - group = gtk_radio_button_get_group (radiobtn); - while (group != NULL) { - GtkToggleButton *btn = GTK_TOGGLE_BUTTON (group->data); - if (gtk_toggle_button_get_active (btn)) { - *((gint *)pparam->data) = GPOINTER_TO_INT - (g_object_get_data (G_OBJECT (btn), - MENU_VAL_ID)); - break; - } - group = group->next; - } -} - -static void prefs_account_enum_set_radiobtn(PrefParam *pparam) -{ - GtkRadioButton *radiobtn; - GSList *group; - gpointer data; - - data = GINT_TO_POINTER (*((gint *)pparam->data)); - radiobtn = GTK_RADIO_BUTTON (*pparam->widget); - group = gtk_radio_button_get_group (radiobtn); - while (group != NULL) { - GtkToggleButton *btn = GTK_TOGGLE_BUTTON (group->data); - gpointer data1; - - data1 = g_object_get_data (G_OBJECT (btn), MENU_VAL_ID); - if (data1 == data) { - gtk_toggle_button_set_active (btn, TRUE); - break; - } - group = group->next; - } -} - - -#if USE_GPGME -static void prefs_account_ascii_armored_warning(GtkWidget *widget) -{ - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) && - gtk_notebook_get_current_page(GTK_NOTEBOOK(dialog.notebook)) > 0) - alertpanel_warning - (_("It's not recommended to use the old style ASCII-armored\n" - "mode for encrypted messages. It doesn't comply with the\n" - "RFC 3156 - MIME Security with OpenPGP.")); -} -#endif /* USE_GPGME */ - -static void prefs_account_protocol_set_data_from_optmenu(PrefParam *pparam) -{ - GtkWidget *menu; - GtkWidget *menuitem; - - menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget)); - menuitem = gtk_menu_get_active(GTK_MENU(menu)); - *((RecvProtocol *)pparam->data) = GPOINTER_TO_INT - (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID)); -} - -static void prefs_account_protocol_set_optmenu(PrefParam *pparam) -{ - RecvProtocol protocol; - GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget); - GtkWidget *menu; - GtkWidget *menuitem; - gint index; - - protocol = *((RecvProtocol *)pparam->data); - index = menu_find_option_menu_index - (optmenu, GINT_TO_POINTER(protocol), NULL); - if (index < 0) return; - gtk_option_menu_set_history(optmenu, index); - - menu = gtk_option_menu_get_menu(optmenu); - menu_set_insensitive_all(GTK_MENU_SHELL(menu)); - - menuitem = gtk_menu_get_active(GTK_MENU(menu)); - gtk_widget_set_sensitive(menuitem, TRUE); - gtk_menu_item_activate(GTK_MENU_ITEM(menuitem)); -} - -static void prefs_account_imap_auth_type_set_data_from_optmenu(PrefParam *pparam) -{ - GtkWidget *menu; - GtkWidget *menuitem; - - menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget)); - menuitem = gtk_menu_get_active(GTK_MENU(menu)); - *((RecvProtocol *)pparam->data) = GPOINTER_TO_INT - (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID)); -} - -static void prefs_account_imap_auth_type_set_optmenu(PrefParam *pparam) -{ - IMAPAuthType type = *((IMAPAuthType *)pparam->data); - GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget); - GtkWidget *menu; - GtkWidget *menuitem; - - switch (type) { - case IMAP_AUTH_LOGIN: - gtk_option_menu_set_history(optmenu, 1); - break; - case IMAP_AUTH_CRAM_MD5: - gtk_option_menu_set_history(optmenu, 2); - break; - case 0: - default: - gtk_option_menu_set_history(optmenu, 0); - } - - menu = gtk_option_menu_get_menu(optmenu); - menuitem = gtk_menu_get_active(GTK_MENU(menu)); - gtk_menu_item_activate(GTK_MENU_ITEM(menuitem)); -} - -static void prefs_account_smtp_auth_type_set_data_from_optmenu(PrefParam *pparam) -{ - GtkWidget *menu; - GtkWidget *menuitem; - - menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget)); - menuitem = gtk_menu_get_active(GTK_MENU(menu)); - *((RecvProtocol *)pparam->data) = GPOINTER_TO_INT - (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID)); -} - -static void prefs_account_smtp_auth_type_set_optmenu(PrefParam *pparam) -{ - SMTPAuthType type = *((SMTPAuthType *)pparam->data); - GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget); - GtkWidget *menu; - GtkWidget *menuitem; - - switch (type) { - case SMTPAUTH_PLAIN: - gtk_option_menu_set_history(optmenu, 1); - break; - case SMTPAUTH_LOGIN: - gtk_option_menu_set_history(optmenu, 2); - break; - case SMTPAUTH_CRAM_MD5: - gtk_option_menu_set_history(optmenu, 3); - break; - case SMTPAUTH_DIGEST_MD5: - gtk_option_menu_set_history(optmenu, 4); - break; - case 0: - default: - gtk_option_menu_set_history(optmenu, 0); - } - - menu = gtk_option_menu_get_menu(optmenu); - menuitem = gtk_menu_get_active(GTK_MENU(menu)); - gtk_menu_item_activate(GTK_MENU_ITEM(menuitem)); -} - -static void prefs_account_protocol_activated(GtkMenuItem *menuitem) -{ - RecvProtocol protocol; - gboolean active; - - protocol = GPOINTER_TO_INT - (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID)); - - switch(protocol) { - case A_NNTP: - gtk_widget_show(basic.nntpserv_label); - gtk_widget_show(basic.nntpserv_entry); - gtk_widget_show(basic.nntpauth_chkbtn); - gtk_widget_hide(basic.recvserv_label); - gtk_widget_hide(basic.recvserv_entry); - gtk_widget_hide(basic.smtpserv_label); - gtk_widget_hide(basic.smtpserv_entry); - active = gtk_toggle_button_get_active - (GTK_TOGGLE_BUTTON(basic.nntpauth_chkbtn)); - gtk_widget_set_sensitive(basic.uid_label, active); - gtk_widget_set_sensitive(basic.pass_label, active); - gtk_widget_set_sensitive(basic.uid_entry, active); - gtk_widget_set_sensitive(basic.pass_entry, active); - gtk_widget_hide(receive.pop3_frame); - gtk_widget_hide(receive.imap_frame); - gtk_widget_show(receive.nntp_frame); - gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE); - - if (!tmp_ac_prefs.account_name) { - gtk_toggle_button_set_active - (GTK_TOGGLE_BUTTON(receive.recvatgetall_chkbtn), - FALSE); - } - -#if USE_SSL - gtk_widget_hide(ssl.pop_frame); - gtk_widget_hide(ssl.imap_frame); - gtk_widget_show(ssl.nntp_frame); - gtk_widget_hide(ssl.send_frame); -#endif - gtk_widget_hide(advanced.popport_hbox); - gtk_widget_hide(advanced.imapport_hbox); - gtk_widget_show(advanced.nntpport_hbox); - gtk_widget_hide(advanced.imap_frame); - break; - case A_LOCAL: - gtk_widget_hide(basic.nntpserv_label); - gtk_widget_hide(basic.nntpserv_entry); - gtk_widget_hide(basic.nntpauth_chkbtn); - gtk_widget_set_sensitive(basic.recvserv_label, FALSE); - gtk_widget_set_sensitive(basic.recvserv_entry, FALSE); - gtk_widget_show(basic.recvserv_label); - gtk_widget_show(basic.recvserv_entry); - gtk_widget_show(basic.smtpserv_label); - gtk_widget_show(basic.smtpserv_entry); - gtk_widget_set_sensitive(basic.uid_label, FALSE); - gtk_widget_set_sensitive(basic.pass_label, FALSE); - gtk_widget_set_sensitive(basic.uid_entry, FALSE); - gtk_widget_set_sensitive(basic.pass_entry, FALSE); - gtk_widget_hide(receive.pop3_frame); - gtk_widget_hide(receive.imap_frame); - gtk_widget_hide(receive.nntp_frame); - gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, FALSE); - - if (!tmp_ac_prefs.account_name) { - gtk_toggle_button_set_active - (GTK_TOGGLE_BUTTON(receive.recvatgetall_chkbtn), - TRUE); - } - -#if USE_SSL - gtk_widget_hide(ssl.pop_frame); - gtk_widget_hide(ssl.imap_frame); - gtk_widget_hide(ssl.nntp_frame); - gtk_widget_show(ssl.send_frame); -#endif - gtk_widget_hide(advanced.popport_hbox); - gtk_widget_hide(advanced.imapport_hbox); - gtk_widget_hide(advanced.nntpport_hbox); - gtk_widget_hide(advanced.imap_frame); - break; - case A_IMAP4: - gtk_widget_hide(basic.nntpserv_label); - gtk_widget_hide(basic.nntpserv_entry); - gtk_widget_hide(basic.nntpauth_chkbtn); - gtk_widget_set_sensitive(basic.recvserv_label, TRUE); - gtk_widget_set_sensitive(basic.recvserv_entry, TRUE); - gtk_widget_show(basic.recvserv_label); - gtk_widget_show(basic.recvserv_entry); - gtk_widget_show(basic.smtpserv_label); - gtk_widget_show(basic.smtpserv_entry); - gtk_widget_set_sensitive(basic.uid_label, TRUE); - gtk_widget_set_sensitive(basic.pass_label, TRUE); - gtk_widget_set_sensitive(basic.uid_entry, TRUE); - gtk_widget_set_sensitive(basic.pass_entry, TRUE); - gtk_widget_hide(receive.pop3_frame); - gtk_widget_show(receive.imap_frame); - gtk_widget_hide(receive.nntp_frame); - gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE); - - if (!tmp_ac_prefs.account_name) { - gtk_toggle_button_set_active - (GTK_TOGGLE_BUTTON(receive.recvatgetall_chkbtn), - FALSE); - } - -#if USE_SSL - gtk_widget_hide(ssl.pop_frame); - gtk_widget_show(ssl.imap_frame); - gtk_widget_hide(ssl.nntp_frame); - gtk_widget_show(ssl.send_frame); -#endif - gtk_widget_hide(advanced.popport_hbox); - gtk_widget_show(advanced.imapport_hbox); - gtk_widget_hide(advanced.nntpport_hbox); - gtk_widget_show(advanced.imap_frame); - break; - case A_POP3: - default: - gtk_widget_hide(basic.nntpserv_label); - gtk_widget_hide(basic.nntpserv_entry); - gtk_widget_hide(basic.nntpauth_chkbtn); - gtk_widget_set_sensitive(basic.recvserv_label, TRUE); - gtk_widget_set_sensitive(basic.recvserv_entry, TRUE); - gtk_widget_show(basic.recvserv_label); - gtk_widget_show(basic.recvserv_entry); - gtk_widget_show(basic.smtpserv_label); - gtk_widget_show(basic.smtpserv_entry); - gtk_widget_set_sensitive(basic.uid_label, TRUE); - gtk_widget_set_sensitive(basic.pass_label, TRUE); - gtk_widget_set_sensitive(basic.uid_entry, TRUE); - gtk_widget_set_sensitive(basic.pass_entry, TRUE); - gtk_widget_show(receive.pop3_frame); - gtk_widget_hide(receive.imap_frame); - gtk_widget_hide(receive.nntp_frame); - gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE); - - if (!tmp_ac_prefs.account_name) { - gtk_toggle_button_set_active - (GTK_TOGGLE_BUTTON(receive.recvatgetall_chkbtn), - TRUE); - } - -#if USE_SSL - gtk_widget_show(ssl.pop_frame); - gtk_widget_hide(ssl.imap_frame); - gtk_widget_hide(ssl.nntp_frame); - gtk_widget_show(ssl.send_frame); -#endif - gtk_widget_show(advanced.popport_hbox); - gtk_widget_hide(advanced.imapport_hbox); - gtk_widget_hide(advanced.nntpport_hbox); - gtk_widget_hide(advanced.imap_frame); - break; - } - - gtk_widget_queue_resize(basic.serv_frame); -} diff --git a/src/prefs_account.h b/src/prefs_account.h index 0adff7ca..13ef8d94 100644 --- a/src/prefs_account.h +++ b/src/prefs_account.h @@ -30,6 +30,7 @@ typedef struct _PrefsAccount PrefsAccount; #include "folder.h" #include "smtp.h" +#include "prefs.h" typedef enum { A_POP3, @@ -167,12 +168,15 @@ struct _PrefsAccount PrefsAccount *prefs_account_new (void); +PrefsAccount *prefs_account_get_tmp_prefs (void); +void prefs_account_set_tmp_prefs (PrefsAccount *ac_prefs); +void prefs_account_apply_tmp_prefs (PrefsAccount *ac_prefs); +PrefParam *prefs_account_get_params (void); + void prefs_account_read_config (PrefsAccount *ac_prefs, const gchar *label); void prefs_account_write_config_all (GList *account_list); void prefs_account_free (PrefsAccount *ac_prefs); -PrefsAccount *prefs_account_open (PrefsAccount *ac_prefs); - #endif /* __PREFS_ACCOUNT_H__ */ diff --git a/src/prefs_account_dialog.c b/src/prefs_account_dialog.c new file mode 100644 index 00000000..66929de7 --- /dev/null +++ b/src/prefs_account_dialog.c @@ -0,0 +1,2200 @@ +/* + * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client + * Copyright (C) 1999-2005 Hiroyuki Yamamoto + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "defs.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "main.h" +#include "prefs.h" +#include "prefs_ui.h" +#include "prefs_account.h" +#include "prefs_account_dialog.h" +#include "prefs_customheader.h" +#include "prefs_common.h" +#include "account.h" +#include "mainwindow.h" +#include "manage_window.h" +#include "foldersel.h" +#include "inc.h" +#include "menu.h" +#include "gtkutils.h" +#include "utils.h" +#include "alertpanel.h" +#include "smtp.h" +#include "imap.h" + +static gboolean cancelled; +static PrefsDialog dialog; + +static struct Basic { + GtkWidget *acname_entry; + GtkWidget *default_chkbtn; + + GtkWidget *name_entry; + GtkWidget *addr_entry; + GtkWidget *org_entry; + + GtkWidget *serv_frame; + GtkWidget *serv_table; + GtkWidget *protocol_optmenu; + GtkWidget *recvserv_label; + GtkWidget *smtpserv_label; + GtkWidget *nntpserv_label; + GtkWidget *recvserv_entry; + GtkWidget *smtpserv_entry; + GtkWidget *nntpserv_entry; + GtkWidget *nntpauth_chkbtn; + GtkWidget *uid_label; + GtkWidget *pass_label; + GtkWidget *uid_entry; + GtkWidget *pass_entry; +} basic; + +static struct Receive { + GtkWidget *pop3_frame; + GtkWidget *use_apop_chkbtn; + GtkWidget *rmmail_chkbtn; + GtkWidget *leave_time_entry; + GtkWidget *getall_chkbtn; + GtkWidget *size_limit_chkbtn; + GtkWidget *size_limit_entry; + GtkWidget *filter_on_recv_chkbtn; + GtkWidget *inbox_label; + GtkWidget *inbox_entry; + GtkWidget *inbox_btn; + + GtkWidget *imap_frame; + GtkWidget *imap_auth_type_optmenu; + + GtkWidget *nntp_frame; + GtkWidget *maxarticle_spinbtn; + GtkObject *maxarticle_spinbtn_adj; + + GtkWidget *recvatgetall_chkbtn; +} receive; + +static struct Send { + GtkWidget *date_chkbtn; + GtkWidget *msgid_chkbtn; + + GtkWidget *customhdr_chkbtn; + + GtkWidget *smtp_auth_chkbtn; + GtkWidget *smtp_auth_type_optmenu; + GtkWidget *smtp_uid_entry; + GtkWidget *smtp_pass_entry; + /* GtkWidget *pop_bfr_smtp_chkbtn; */ +} p_send; + +static struct Compose { + GtkWidget *sigfile_radiobtn; + GtkWidget *sigpath_entry; + + GtkWidget *autocc_chkbtn; + GtkWidget *autocc_entry; + GtkWidget *autobcc_chkbtn; + GtkWidget *autobcc_entry; + GtkWidget *autoreplyto_chkbtn; + GtkWidget *autoreplyto_entry; +} compose; + +#if USE_GPGME +static struct Privacy { + GtkWidget *default_sign_chkbtn; + GtkWidget *default_encrypt_chkbtn; + GtkWidget *encrypt_reply_chkbtn; + GtkWidget *ascii_armored_chkbtn; + GtkWidget *clearsign_chkbtn; + GtkWidget *defaultkey_radiobtn; + GtkWidget *emailkey_radiobtn; + GtkWidget *customkey_radiobtn; + GtkWidget *customkey_entry; +} privacy; +#endif /* USE_GPGME */ + +#if USE_SSL +static struct SSLPrefs { + GtkWidget *pop_frame; + GtkWidget *pop_nossl_radiobtn; + GtkWidget *pop_ssltunnel_radiobtn; + GtkWidget *pop_starttls_radiobtn; + + GtkWidget *imap_frame; + GtkWidget *imap_nossl_radiobtn; + GtkWidget *imap_ssltunnel_radiobtn; + GtkWidget *imap_starttls_radiobtn; + + GtkWidget *nntp_frame; + GtkWidget *nntp_nossl_radiobtn; + GtkWidget *nntp_ssltunnel_radiobtn; + + GtkWidget *send_frame; + GtkWidget *smtp_nossl_radiobtn; + GtkWidget *smtp_ssltunnel_radiobtn; + GtkWidget *smtp_starttls_radiobtn; + + GtkWidget *use_nonblocking_ssl_chkbtn; +} ssl; +#endif /* USE_SSL */ + +static struct Advanced { + GtkWidget *smtpport_chkbtn; + GtkWidget *smtpport_entry; + GtkWidget *popport_hbox; + GtkWidget *popport_chkbtn; + GtkWidget *popport_entry; + GtkWidget *imapport_hbox; + GtkWidget *imapport_chkbtn; + GtkWidget *imapport_entry; + GtkWidget *nntpport_hbox; + GtkWidget *nntpport_chkbtn; + GtkWidget *nntpport_entry; + GtkWidget *domain_chkbtn; + GtkWidget *domain_entry; + + GtkWidget *imap_frame; + GtkWidget *imapdir_entry; + + GtkWidget *sent_folder_chkbtn; + GtkWidget *sent_folder_entry; + GtkWidget *draft_folder_chkbtn; + GtkWidget *draft_folder_entry; + GtkWidget *trash_folder_chkbtn; + GtkWidget *trash_folder_entry; +} advanced; + +static void prefs_account_protocol_set_data_from_optmenu(PrefParam *pparam); +static void prefs_account_protocol_set_optmenu (PrefParam *pparam); +static void prefs_account_protocol_activated (GtkMenuItem *menuitem); + +static void prefs_account_imap_auth_type_set_data_from_optmenu + (PrefParam *pparam); +static void prefs_account_imap_auth_type_set_optmenu (PrefParam *pparam); +static void prefs_account_smtp_auth_type_set_data_from_optmenu + (PrefParam *pparam); +static void prefs_account_smtp_auth_type_set_optmenu (PrefParam *pparam); + +static void prefs_account_enum_set_data_from_radiobtn (PrefParam *pparam); +static void prefs_account_enum_set_radiobtn (PrefParam *pparam); + +#if USE_GPGME +static void prefs_account_ascii_armored_warning (GtkWidget *widget); +#endif /* USE_GPGME */ + +static PrefsUIData ui_data[] = { + /* Basic */ + {"account_name", &basic.acname_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"is_default", &basic.default_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"name", &basic.name_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"address", &basic.addr_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"organization", &basic.org_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"protocol", &basic.protocol_optmenu, + prefs_account_protocol_set_data_from_optmenu, + prefs_account_protocol_set_optmenu}, + {"receive_server", &basic.recvserv_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"smtp_server", &basic.smtpserv_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"nntp_server", &basic.nntpserv_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"use_nntp_auth", &basic.nntpauth_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"user_id", &basic.uid_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"password", &basic.pass_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"inbox", &receive.inbox_entry, + prefs_set_data_from_entry, prefs_set_entry}, + + /* Receive */ + {"use_apop_auth", &receive.use_apop_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"remove_mail", &receive.rmmail_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"message_leave_time", &receive.leave_time_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"get_all_mail", &receive.getall_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"enable_size_limit", &receive.size_limit_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"size_limit", &receive.size_limit_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"filter_on_receive", &receive.filter_on_recv_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"imap_auth_method", &receive.imap_auth_type_optmenu, + prefs_account_imap_auth_type_set_data_from_optmenu, + prefs_account_imap_auth_type_set_optmenu}, + {"max_nntp_articles", &receive.maxarticle_spinbtn, + prefs_set_data_from_spinbtn, prefs_set_spinbtn}, + {"receive_at_get_all", &receive.recvatgetall_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + + /* Send */ + {"add_date", &p_send.date_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"generate_msgid", &p_send.msgid_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"add_custom_header", &p_send.customhdr_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"use_smtp_auth", &p_send.smtp_auth_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"smtp_auth_method", &p_send.smtp_auth_type_optmenu, + prefs_account_smtp_auth_type_set_data_from_optmenu, + prefs_account_smtp_auth_type_set_optmenu}, + {"smtp_user_id", &p_send.smtp_uid_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"smtp_password", &p_send.smtp_pass_entry, + prefs_set_data_from_entry, prefs_set_entry}, + + /* {"pop_before_smtp", NULL, NULL, NULL}, */ + + /* Compose */ + {"signature_type", &compose.sigfile_radiobtn, + prefs_account_enum_set_data_from_radiobtn, + prefs_account_enum_set_radiobtn}, + {"signature_path", &compose.sigpath_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"set_autocc", &compose.autocc_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"auto_cc", &compose.autocc_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"set_autobcc", &compose.autobcc_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"auto_bcc", &compose.autobcc_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"set_autoreplyto", &compose.autoreplyto_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"auto_replyto", &compose.autoreplyto_entry, + prefs_set_data_from_entry, prefs_set_entry}, + +#if USE_GPGME + /* Privacy */ + {"default_sign", &privacy.default_sign_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"default_encrypt", &privacy.default_encrypt_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"encrypt_reply", &privacy.encrypt_reply_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"ascii_armored", &privacy.ascii_armored_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"clearsign", &privacy.clearsign_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"sign_key", &privacy.defaultkey_radiobtn, + prefs_account_enum_set_data_from_radiobtn, + prefs_account_enum_set_radiobtn}, + {"sign_key_id", &privacy.customkey_entry, + prefs_set_data_from_entry, prefs_set_entry}, +#endif /* USE_GPGME */ + +#if USE_SSL + /* SSL */ + {"ssl_pop", &ssl.pop_nossl_radiobtn, + prefs_account_enum_set_data_from_radiobtn, + prefs_account_enum_set_radiobtn}, + {"ssl_imap", &ssl.imap_nossl_radiobtn, + prefs_account_enum_set_data_from_radiobtn, + prefs_account_enum_set_radiobtn}, + {"ssl_nntp", &ssl.nntp_nossl_radiobtn, + prefs_account_enum_set_data_from_radiobtn, + prefs_account_enum_set_radiobtn}, + {"ssl_smtp", &ssl.smtp_nossl_radiobtn, + prefs_account_enum_set_data_from_radiobtn, + prefs_account_enum_set_radiobtn}, + {"use_nonblocking_ssl", &ssl.use_nonblocking_ssl_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, +#endif /* USE_SSL */ + + /* Advanced */ + {"set_smtpport", &advanced.smtpport_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"smtp_port", &advanced.smtpport_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"set_popport", &advanced.popport_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"pop_port", &advanced.popport_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"set_imapport", &advanced.imapport_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"imap_port", &advanced.imapport_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"set_nntpport", &advanced.nntpport_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"nntp_port", &advanced.nntpport_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"set_domain", &advanced.domain_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"domain", &advanced.domain_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"imap_directory", &advanced.imapdir_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"set_sent_folder", &advanced.sent_folder_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"sent_folder", &advanced.sent_folder_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"set_draft_folder", &advanced.draft_folder_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"draft_folder", &advanced.draft_folder_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"set_trash_folder", &advanced.trash_folder_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"trash_folder", &advanced.trash_folder_entry, + prefs_set_data_from_entry, prefs_set_entry}, + + {NULL, NULL, NULL, NULL} +}; + +static void prefs_account_create (void); +static void prefs_account_basic_create (void); +static void prefs_account_receive_create (void); +static void prefs_account_send_create (void); +static void prefs_account_compose_create (void); +#if USE_GPGME +static void prefs_account_privacy_create (void); +#endif /* USE_GPGME */ +#if USE_SSL +static void prefs_account_ssl_create (void); +#endif /* USE_SSL */ +static void prefs_account_advanced_create (void); + +static void prefs_account_select_folder_cb (GtkWidget *widget, + gpointer data); +static void prefs_account_edit_custom_header (void); + +static gint prefs_account_deleted (GtkWidget *widget, + GdkEventAny *event, + gpointer data); +static gboolean prefs_account_key_pressed (GtkWidget *widget, + GdkEventKey *event, + gpointer data); +static void prefs_account_ok (void); +static gint prefs_account_apply (void); +static void prefs_account_cancel (void); + + +PrefsAccount *prefs_account_open(PrefsAccount *ac_prefs) +{ + gboolean new_account = FALSE; + static gboolean ui_registered = FALSE; + + debug_print(_("Opening account preferences window...\n")); + + inc_lock(); + + cancelled = FALSE; + + if (!ui_registered) { + prefs_register_ui(prefs_account_get_params(), ui_data); + ui_registered = TRUE; + } + + if (!ac_prefs) { + ac_prefs = prefs_account_new(); + new_account = TRUE; + } + + if (!dialog.window) { + prefs_account_create(); + } + + gtkut_box_set_reverse_order(GTK_BOX(dialog.confirm_area), + !prefs_common.comply_gnome_hig); + manage_window_set_transient(GTK_WINDOW(dialog.window)); + gtk_notebook_set_current_page(GTK_NOTEBOOK(dialog.notebook), 0); + gtk_widget_grab_focus(dialog.ok_btn); + + prefs_account_set_tmp_prefs(ac_prefs); + + if (new_account) { + PrefsAccount *def_ac; + gchar *buf; + + prefs_set_dialog_to_default(prefs_account_get_params()); + buf = g_strdup_printf(_("Account%d"), ac_prefs->account_id); + gtk_entry_set_text(GTK_ENTRY(basic.acname_entry), buf); + g_free(buf); + def_ac = account_get_default(); + if (def_ac) { + gtk_entry_set_text(GTK_ENTRY(basic.name_entry), + def_ac->name ? def_ac->name : ""); + gtk_entry_set_text(GTK_ENTRY(basic.addr_entry), + def_ac->address ? def_ac->address : ""); + gtk_entry_set_text(GTK_ENTRY(basic.org_entry), + def_ac->organization ? def_ac->organization : ""); + } + menu_set_sensitive_all + (GTK_MENU_SHELL + (gtk_option_menu_get_menu + (GTK_OPTION_MENU + (basic.protocol_optmenu))), + TRUE); + gtk_window_set_title(GTK_WINDOW(dialog.window), + _("Preferences for new account")); + gtk_widget_hide(dialog.apply_btn); + } else { + prefs_set_dialog(prefs_account_get_params()); + gtk_window_set_title(GTK_WINDOW(dialog.window), + _("Account preferences")); + gtk_widget_show(dialog.apply_btn); + } + + gtk_widget_show(dialog.window); + gtk_main(); + gtk_widget_hide(dialog.window); + + inc_unlock(); + + if (cancelled && new_account) { + g_free(ac_prefs); + return NULL; + } else { + prefs_account_apply_tmp_prefs(ac_prefs); + return ac_prefs; + } +} + +static void prefs_account_create(void) +{ + gint page = 0; + + debug_print(_("Creating account preferences window...\n")); + + /* create dialog */ + prefs_dialog_create(&dialog); + g_signal_connect(G_OBJECT(dialog.window), "delete_event", + G_CALLBACK(prefs_account_deleted), NULL); + g_signal_connect(G_OBJECT(dialog.window), "key_press_event", + G_CALLBACK(prefs_account_key_pressed), NULL); + MANAGE_WINDOW_SIGNALS_CONNECT(dialog.window); + + g_signal_connect(G_OBJECT(dialog.ok_btn), "clicked", + G_CALLBACK(prefs_account_ok), NULL); + g_signal_connect(G_OBJECT(dialog.apply_btn), "clicked", + G_CALLBACK(prefs_account_apply), NULL); + g_signal_connect(G_OBJECT(dialog.cancel_btn), "clicked", + G_CALLBACK(prefs_account_cancel), NULL); + + prefs_account_basic_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Basic"), page++); + prefs_account_receive_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Receive"), page++); + prefs_account_send_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Send"), page++); + prefs_account_compose_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Compose"), page++); +#if USE_GPGME + prefs_account_privacy_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Privacy"), page++); +#endif /* USE_GPGME */ +#if USE_SSL + prefs_account_ssl_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("SSL"), page++); +#endif /* USE_SSL */ + prefs_account_advanced_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Advanced"), page++); +} + +#define SET_ACTIVATE(menuitem) \ +{ \ + g_signal_connect(G_OBJECT(menuitem), "activate", \ + G_CALLBACK(prefs_account_protocol_activated), NULL); \ +} + +static void prefs_account_basic_create(void) +{ + GtkWidget *vbox1; + GtkWidget *hbox; + GtkWidget *label; + GtkWidget *acname_entry; + GtkWidget *default_chkbtn; + GtkWidget *frame1; + GtkWidget *table1; + GtkWidget *name_entry; + GtkWidget *addr_entry; + GtkWidget *org_entry; + + GtkWidget *serv_frame; + GtkWidget *vbox2; + GtkWidget *optmenu; + GtkWidget *optmenu_menu; + GtkWidget *menuitem; + GtkWidget *serv_table; + GtkWidget *recvserv_label; + GtkWidget *smtpserv_label; + GtkWidget *nntpserv_label; + GtkWidget *recvserv_entry; + GtkWidget *smtpserv_entry; + GtkWidget *nntpserv_entry; + GtkWidget *nntpauth_chkbtn; + GtkWidget *uid_label; + GtkWidget *pass_label; + GtkWidget *uid_entry; + GtkWidget *pass_entry; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (vbox1), hbox, FALSE, FALSE, 0); + + label = gtk_label_new (_("Name of this account")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + + acname_entry = gtk_entry_new (); + gtk_widget_show (acname_entry); + gtk_widget_set_size_request (acname_entry, DEFAULT_ENTRY_WIDTH, -1); + gtk_box_pack_start (GTK_BOX (hbox), acname_entry, TRUE, TRUE, 0); + + default_chkbtn = gtk_check_button_new_with_label (_("Set as default")); + gtk_widget_show (default_chkbtn); + gtk_box_pack_end (GTK_BOX (hbox), default_chkbtn, FALSE, FALSE, 0); + + PACK_FRAME (vbox1, frame1, _("Personal information")); + + table1 = gtk_table_new (3, 2, FALSE); + gtk_widget_show (table1); + gtk_container_add (GTK_CONTAINER (frame1), table1); + gtk_container_set_border_width (GTK_CONTAINER (table1), 8); + gtk_table_set_row_spacings (GTK_TABLE (table1), VSPACING_NARROW); + gtk_table_set_col_spacings (GTK_TABLE (table1), 8); + + label = gtk_label_new (_("Full name")); + gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table1), label, 0, 1, 0, 1, + GTK_FILL, 0, 0, 0); + gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); + + label = gtk_label_new (_("Mail address")); + gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table1), label, 0, 1, 1, 2, + GTK_FILL, 0, 0, 0); + gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); + + label = gtk_label_new (_("Organization")); + gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table1), label, 0, 1, 2, 3, + GTK_FILL, 0, 0, 0); + gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); + + name_entry = gtk_entry_new (); + gtk_widget_show (name_entry); + gtk_table_attach (GTK_TABLE (table1), name_entry, 1, 2, 0, 1, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); + + addr_entry = gtk_entry_new (); + gtk_widget_show (addr_entry); + gtk_table_attach (GTK_TABLE (table1), addr_entry, 1, 2, 1, 2, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); + + org_entry = gtk_entry_new (); + gtk_widget_show (org_entry); + gtk_table_attach (GTK_TABLE (table1), org_entry, 1, 2, 2, 3, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); + + PACK_FRAME (vbox1, serv_frame, _("Server information")); + + vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (serv_frame), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); + + hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); + + label = gtk_label_new (_("Protocol")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + + optmenu = gtk_option_menu_new (); + gtk_widget_show (optmenu); + gtk_box_pack_start (GTK_BOX (hbox), optmenu, FALSE, FALSE, 0); + + optmenu_menu = gtk_menu_new (); + + MENUITEM_ADD (optmenu_menu, menuitem, _("POP3"), A_POP3); + SET_ACTIVATE (menuitem); + MENUITEM_ADD (optmenu_menu, menuitem, _("IMAP4"), A_IMAP4); + SET_ACTIVATE (menuitem); + MENUITEM_ADD (optmenu_menu, menuitem, _("News (NNTP)"), A_NNTP); + SET_ACTIVATE (menuitem); + MENUITEM_ADD (optmenu_menu, menuitem, _("None (local)"), A_LOCAL); + SET_ACTIVATE (menuitem); + + gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu), optmenu_menu); + + serv_table = gtk_table_new (6, 4, FALSE); + gtk_widget_show (serv_table); + gtk_box_pack_start (GTK_BOX (vbox2), serv_table, FALSE, FALSE, 0); + gtk_table_set_row_spacings (GTK_TABLE (serv_table), VSPACING_NARROW); + gtk_table_set_row_spacing (GTK_TABLE (serv_table), 3, 0); + gtk_table_set_col_spacings (GTK_TABLE (serv_table), 8); + + nntpauth_chkbtn = gtk_check_button_new_with_label + (_("This server requires authentication")); + gtk_widget_show (nntpauth_chkbtn); + gtk_table_attach (GTK_TABLE (serv_table), nntpauth_chkbtn, 0, 4, 4, 5, + GTK_FILL, 0, 0, 0); + + nntpserv_entry = gtk_entry_new (); + gtk_widget_show (nntpserv_entry); + gtk_table_attach (GTK_TABLE (serv_table), nntpserv_entry, 1, 4, 0, 1, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); + gtk_table_set_row_spacing (GTK_TABLE (serv_table), 0, 0); + + recvserv_entry = gtk_entry_new (); + gtk_widget_show (recvserv_entry); + gtk_table_attach (GTK_TABLE (serv_table), recvserv_entry, 1, 4, 1, 2, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); + + smtpserv_entry = gtk_entry_new (); + gtk_widget_show (smtpserv_entry); + gtk_table_attach (GTK_TABLE (serv_table), smtpserv_entry, 1, 4, 2, 3, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); + + uid_entry = gtk_entry_new (); + gtk_widget_show (uid_entry); + gtk_widget_set_size_request (uid_entry, DEFAULT_ENTRY_WIDTH, -1); + gtk_table_attach (GTK_TABLE (serv_table), uid_entry, 1, 2, 5, 6, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); + + pass_entry = gtk_entry_new (); + gtk_widget_show (pass_entry); + gtk_widget_set_size_request (pass_entry, DEFAULT_ENTRY_WIDTH, -1); + gtk_table_attach (GTK_TABLE (serv_table), pass_entry, 3, 4, 5, 6, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); + gtk_entry_set_visibility (GTK_ENTRY (pass_entry), FALSE); + + nntpserv_label = gtk_label_new (_("News server")); + gtk_widget_show (nntpserv_label); + gtk_table_attach (GTK_TABLE (serv_table), nntpserv_label, 0, 1, 0, 1, + GTK_FILL, 0, 0, 0); + gtk_misc_set_alignment (GTK_MISC (nntpserv_label), 1, 0.5); + + recvserv_label = gtk_label_new (_("Server for receiving")); + gtk_widget_show (recvserv_label); + gtk_table_attach (GTK_TABLE (serv_table), recvserv_label, 0, 1, 1, 2, + GTK_FILL, 0, 0, 0); + gtk_misc_set_alignment (GTK_MISC (recvserv_label), 1, 0.5); + + smtpserv_label = gtk_label_new (_("SMTP server (send)")); + gtk_widget_show (smtpserv_label); + gtk_table_attach (GTK_TABLE (serv_table), smtpserv_label, 0, 1, 2, 3, + GTK_FILL, 0, 0, 0); + gtk_misc_set_alignment (GTK_MISC (smtpserv_label), 1, 0.5); + gtk_table_set_row_spacing (GTK_TABLE (serv_table), 2, 0); + + uid_label = gtk_label_new (_("User ID")); + gtk_widget_show (uid_label); + gtk_table_attach (GTK_TABLE (serv_table), uid_label, 0, 1, 5, 6, + GTK_FILL, 0, 0, 0); + gtk_misc_set_alignment (GTK_MISC (uid_label), 1, 0.5); + + pass_label = gtk_label_new (_("Password")); + gtk_widget_show (pass_label); + gtk_table_attach (GTK_TABLE (serv_table), pass_label, 2, 3, 5, 6, + 0, 0, 0, 0); + + SET_TOGGLE_SENSITIVITY (nntpauth_chkbtn, uid_label); + SET_TOGGLE_SENSITIVITY (nntpauth_chkbtn, pass_label); + SET_TOGGLE_SENSITIVITY (nntpauth_chkbtn, uid_entry); + SET_TOGGLE_SENSITIVITY (nntpauth_chkbtn, pass_entry); + + basic.acname_entry = acname_entry; + basic.default_chkbtn = default_chkbtn; + + basic.name_entry = name_entry; + basic.addr_entry = addr_entry; + basic.org_entry = org_entry; + + basic.serv_frame = serv_frame; + basic.serv_table = serv_table; + basic.protocol_optmenu = optmenu; + basic.recvserv_label = recvserv_label; + basic.recvserv_entry = recvserv_entry; + basic.smtpserv_label = smtpserv_label; + basic.smtpserv_entry = smtpserv_entry; + basic.nntpserv_label = nntpserv_label; + basic.nntpserv_entry = nntpserv_entry; + basic.nntpauth_chkbtn = nntpauth_chkbtn; + basic.uid_label = uid_label; + basic.pass_label = pass_label; + basic.uid_entry = uid_entry; + basic.pass_entry = pass_entry; +} + +static void prefs_account_receive_create(void) +{ + GtkWidget *vbox1; + GtkWidget *frame1; + GtkWidget *vbox2; + GtkWidget *use_apop_chkbtn; + GtkWidget *rmmail_chkbtn; + GtkWidget *hbox_spc; + GtkWidget *leave_time_label; + GtkWidget *leave_time_entry; + GtkWidget *getall_chkbtn; + GtkWidget *hbox1; + GtkWidget *size_limit_chkbtn; + GtkWidget *size_limit_entry; + GtkWidget *label; + GtkWidget *filter_on_recv_chkbtn; + GtkWidget *vbox3; + GtkWidget *inbox_label; + GtkWidget *inbox_entry; + GtkWidget *inbox_btn; + + GtkWidget *imap_frame; + GtkWidget *optmenu; + GtkWidget *optmenu_menu; + GtkWidget *menuitem; + + GtkWidget *nntp_frame; + GtkWidget *maxarticle_label; + GtkWidget *maxarticle_spinbtn; + GtkObject *maxarticle_spinbtn_adj; + GtkWidget *maxarticle_desc_label; + + GtkWidget *recvatgetall_chkbtn; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + PACK_FRAME (vbox1, frame1, _("POP3")); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (frame1), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); + + PACK_CHECK_BUTTON (vbox2, use_apop_chkbtn, + _("Use secure authentication (APOP)")); + + PACK_CHECK_BUTTON (vbox2, rmmail_chkbtn, + _("Remove messages on server when received")); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); + + hbox_spc = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox_spc); + gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0); + gtk_widget_set_size_request (hbox_spc, 12, -1); + + leave_time_label = gtk_label_new (_("Remove after")); + gtk_widget_show (leave_time_label); + gtk_box_pack_start (GTK_BOX (hbox1), leave_time_label, FALSE, FALSE, 0); + + leave_time_entry = gtk_entry_new (); + gtk_widget_show (leave_time_entry); + gtk_widget_set_size_request (leave_time_entry, 64, -1); + gtk_box_pack_start (GTK_BOX (hbox1), leave_time_entry, FALSE, FALSE, 0); + + leave_time_label = gtk_label_new (_("days")); + gtk_widget_show (leave_time_label); + gtk_box_pack_start (GTK_BOX (hbox1), leave_time_label, FALSE, FALSE, 0); + + SET_TOGGLE_SENSITIVITY (rmmail_chkbtn, hbox1); + + PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); + + hbox_spc = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox_spc); + gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0); + gtk_widget_set_size_request (hbox_spc, 12, -1); + + leave_time_label = gtk_label_new (_("(0 days: remove immediately)")); + gtk_widget_show (leave_time_label); + gtk_box_pack_start (GTK_BOX (hbox1), leave_time_label, FALSE, FALSE, 0); + + SET_TOGGLE_SENSITIVITY (rmmail_chkbtn, hbox1); + + PACK_CHECK_BUTTON (vbox2, getall_chkbtn, + _("Download all messages on server")); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); + + PACK_CHECK_BUTTON (hbox1, size_limit_chkbtn, _("Receive size limit")); + + size_limit_entry = gtk_entry_new (); + gtk_widget_show (size_limit_entry); + gtk_widget_set_size_request (size_limit_entry, 64, -1); + gtk_box_pack_start (GTK_BOX (hbox1), size_limit_entry, FALSE, FALSE, 0); + + label = gtk_label_new (_("KB")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); + + SET_TOGGLE_SENSITIVITY (size_limit_chkbtn, size_limit_entry); + + PACK_CHECK_BUTTON (vbox2, filter_on_recv_chkbtn, + _("Filter messages on receiving")); + + PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); + + inbox_label = gtk_label_new (_("Default inbox")); + gtk_widget_show (inbox_label); + gtk_box_pack_start (GTK_BOX (hbox1), inbox_label, FALSE, FALSE, 0); + + inbox_entry = gtk_entry_new (); + gtk_widget_show (inbox_entry); + gtk_widget_set_size_request (inbox_entry, DEFAULT_ENTRY_WIDTH, -1); + gtk_box_pack_start (GTK_BOX (hbox1), inbox_entry, TRUE, TRUE, 0); + + inbox_btn = gtk_button_new_with_label (_(" Select... ")); + gtk_widget_show (inbox_btn); + gtk_box_pack_start (GTK_BOX (hbox1), inbox_btn, FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (inbox_btn), "clicked", + G_CALLBACK (prefs_account_select_folder_cb), + inbox_entry); + + PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2); + + PACK_SMALL_LABEL + (vbox2, label, + _("Unfiltered messages will be stored in this folder.")); + + PACK_FRAME (vbox1, imap_frame, _("IMAP4")); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (imap_frame), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); + + label = gtk_label_new (_("Authentication method")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); + + optmenu = gtk_option_menu_new (); + gtk_widget_show (optmenu); + gtk_box_pack_start (GTK_BOX (hbox1), optmenu, FALSE, FALSE, 0); + + optmenu_menu = gtk_menu_new (); + + MENUITEM_ADD (optmenu_menu, menuitem, _("Automatic"), 0); + MENUITEM_ADD (optmenu_menu, menuitem, "LOGIN", IMAP_AUTH_LOGIN); + MENUITEM_ADD (optmenu_menu, menuitem, "CRAM-MD5", IMAP_AUTH_CRAM_MD5); + + gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu), optmenu_menu); + + PACK_FRAME (vbox1, nntp_frame, _("News")); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (nntp_frame), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); + + maxarticle_label = gtk_label_new + (_("Maximum number of articles to download")); + gtk_widget_show (maxarticle_label); + gtk_box_pack_start (GTK_BOX (hbox1), maxarticle_label, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (maxarticle_label), GTK_JUSTIFY_LEFT); + + maxarticle_spinbtn_adj = + gtk_adjustment_new (300, 0, 10000, 10, 100, 100); + maxarticle_spinbtn = gtk_spin_button_new + (GTK_ADJUSTMENT (maxarticle_spinbtn_adj), 10, 0); + gtk_widget_show (maxarticle_spinbtn); + gtk_box_pack_start (GTK_BOX (hbox1), maxarticle_spinbtn, + FALSE, FALSE, 0); + gtk_widget_set_size_request (maxarticle_spinbtn, 64, -1); + gtk_spin_button_set_numeric + (GTK_SPIN_BUTTON (maxarticle_spinbtn), TRUE); + + PACK_SMALL_LABEL (vbox2, maxarticle_desc_label, + _("No limit if 0 is specified.")); + + PACK_CHECK_BUTTON + (vbox1, recvatgetall_chkbtn, + _("`Get all' checks for new messages on this account")); + + receive.pop3_frame = frame1; + receive.use_apop_chkbtn = use_apop_chkbtn; + receive.rmmail_chkbtn = rmmail_chkbtn; + receive.leave_time_entry = leave_time_entry; + receive.getall_chkbtn = getall_chkbtn; + receive.size_limit_chkbtn = size_limit_chkbtn; + receive.size_limit_entry = size_limit_entry; + receive.filter_on_recv_chkbtn = filter_on_recv_chkbtn; + receive.inbox_label = inbox_label; + receive.inbox_entry = inbox_entry; + receive.inbox_btn = inbox_btn; + + receive.imap_frame = imap_frame; + receive.imap_auth_type_optmenu = optmenu; + + receive.nntp_frame = nntp_frame; + receive.maxarticle_spinbtn = maxarticle_spinbtn; + receive.maxarticle_spinbtn_adj = maxarticle_spinbtn_adj; + + receive.recvatgetall_chkbtn = recvatgetall_chkbtn; +} + +static void prefs_account_send_create(void) +{ + GtkWidget *vbox1; + GtkWidget *vbox2; + GtkWidget *frame; + GtkWidget *date_chkbtn; + GtkWidget *msgid_chkbtn; + GtkWidget *hbox; + GtkWidget *customhdr_chkbtn; + GtkWidget *customhdr_edit_btn; + GtkWidget *vbox3; + GtkWidget *smtp_auth_chkbtn; + GtkWidget *optmenu; + GtkWidget *optmenu_menu; + GtkWidget *menuitem; + GtkWidget *vbox4; + GtkWidget *hbox_spc; + GtkWidget *label; + GtkWidget *smtp_uid_entry; + GtkWidget *smtp_pass_entry; + GtkWidget *vbox_spc; + /* GtkWidget *pop_bfr_smtp_chkbtn; */ + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + PACK_FRAME (vbox1, frame, _("Header")); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (frame), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); + + PACK_CHECK_BUTTON (vbox2, date_chkbtn, _("Add Date header field")); + PACK_CHECK_BUTTON (vbox2, msgid_chkbtn, _("Generate Message-ID")); + + hbox = gtk_hbox_new (FALSE, 12); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); + + PACK_CHECK_BUTTON (hbox, customhdr_chkbtn, + _("Add user-defined header")); + + customhdr_edit_btn = gtk_button_new_with_label (_(" Edit... ")); + gtk_widget_show (customhdr_edit_btn); + gtk_box_pack_start (GTK_BOX (hbox), customhdr_edit_btn, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (customhdr_edit_btn), "clicked", + G_CALLBACK (prefs_account_edit_custom_header), + NULL); + + SET_TOGGLE_SENSITIVITY (customhdr_chkbtn, customhdr_edit_btn); + + PACK_FRAME (vbox1, frame, _("Authentication")); + + vbox3 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox3); + gtk_container_add (GTK_CONTAINER (frame), vbox3); + gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8); + + PACK_CHECK_BUTTON (vbox3, smtp_auth_chkbtn, + _("SMTP Authentication (SMTP AUTH)")); + + vbox4 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox4); + gtk_box_pack_start (GTK_BOX (vbox3), vbox4, FALSE, FALSE, 0); + + hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (vbox4), hbox, FALSE, FALSE, 0); + + hbox_spc = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox_spc); + gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0); + gtk_widget_set_size_request (hbox_spc, 12, -1); + + label = gtk_label_new (_("Authentication method")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + + optmenu = gtk_option_menu_new (); + gtk_widget_show (optmenu); + gtk_box_pack_start (GTK_BOX (hbox), optmenu, FALSE, FALSE, 0); + + optmenu_menu = gtk_menu_new (); + + MENUITEM_ADD (optmenu_menu, menuitem, _("Automatic"), 0); + MENUITEM_ADD (optmenu_menu, menuitem, "PLAIN", SMTPAUTH_PLAIN); + MENUITEM_ADD (optmenu_menu, menuitem, "LOGIN", SMTPAUTH_LOGIN); + MENUITEM_ADD (optmenu_menu, menuitem, "CRAM-MD5", SMTPAUTH_CRAM_MD5); + MENUITEM_ADD (optmenu_menu, menuitem, "DIGEST-MD5", SMTPAUTH_DIGEST_MD5); + gtk_widget_set_sensitive (menuitem, FALSE); + + gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu), optmenu_menu); + + PACK_VSPACER(vbox4, vbox_spc, VSPACING_NARROW_2); + + hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (vbox4), hbox, FALSE, FALSE, 0); + + hbox_spc = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox_spc); + gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0); + gtk_widget_set_size_request (hbox_spc, 12, -1); + + label = gtk_label_new (_("User ID")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + + smtp_uid_entry = gtk_entry_new (); + gtk_widget_show (smtp_uid_entry); + gtk_widget_set_size_request (smtp_uid_entry, DEFAULT_ENTRY_WIDTH, -1); + gtk_box_pack_start (GTK_BOX (hbox), smtp_uid_entry, TRUE, TRUE, 0); + + label = gtk_label_new (_("Password")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + + smtp_pass_entry = gtk_entry_new (); + gtk_widget_show (smtp_pass_entry); + gtk_widget_set_size_request (smtp_pass_entry, DEFAULT_ENTRY_WIDTH, -1); + gtk_box_pack_start (GTK_BOX (hbox), smtp_pass_entry, TRUE, TRUE, 0); + gtk_entry_set_visibility (GTK_ENTRY (smtp_pass_entry), FALSE); + + PACK_VSPACER(vbox4, vbox_spc, VSPACING_NARROW_2); + + hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (vbox4), hbox, FALSE, FALSE, 0); + + hbox_spc = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox_spc); + gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0); + gtk_widget_set_size_request (hbox_spc, 12, -1); + + label = gtk_label_new + (_("If you leave these entries empty, the same " + "user ID and password as receiving will be used.")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); + gtkut_widget_set_small_font_size (label); + + SET_TOGGLE_SENSITIVITY (smtp_auth_chkbtn, vbox4); + +#if 0 + PACK_CHECK_BUTTON (vbox3, pop_bfr_smtp_chkbtn, + _("Authenticate with POP3 before sending")); + gtk_widget_set_sensitive(pop_bfr_smtp_chkbtn, FALSE); +#endif + + p_send.date_chkbtn = date_chkbtn; + p_send.msgid_chkbtn = msgid_chkbtn; + p_send.customhdr_chkbtn = customhdr_chkbtn; + + p_send.smtp_auth_chkbtn = smtp_auth_chkbtn; + p_send.smtp_auth_type_optmenu = optmenu; + p_send.smtp_uid_entry = smtp_uid_entry; + p_send.smtp_pass_entry = smtp_pass_entry; + /* p_send.pop_bfr_smtp_chkbtn = pop_bfr_smtp_chkbtn; */ +} + +static void prefs_account_compose_create(void) +{ + GtkWidget *vbox1; + GtkWidget *sig_vbox; + GtkWidget *sig_hbox; + GtkWidget *sigfile_radiobtn; + GtkWidget *sigcmd_radiobtn; + GtkWidget *sigpath_entry; + GtkWidget *frame; + GtkWidget *table; + GtkWidget *autocc_chkbtn; + GtkWidget *autocc_entry; + GtkWidget *autobcc_chkbtn; + GtkWidget *autobcc_entry; + GtkWidget *autoreplyto_chkbtn; + GtkWidget *autoreplyto_entry; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + PACK_FRAME (vbox1, frame, _("Signature")); + + sig_vbox = gtk_vbox_new (FALSE, VSPACING_NARROW_2); + gtk_widget_show (sig_vbox); + gtk_container_add (GTK_CONTAINER (frame), sig_vbox); + gtk_container_set_border_width (GTK_CONTAINER (sig_vbox), 8); + + sig_hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_show (sig_hbox); + gtk_box_pack_start (GTK_BOX (sig_vbox), sig_hbox, FALSE, FALSE, 0); + + sigfile_radiobtn = gtk_radio_button_new_with_label (NULL, _("File")); + gtk_widget_show (sigfile_radiobtn); + gtk_box_pack_start (GTK_BOX (sig_hbox), sigfile_radiobtn, + FALSE, FALSE, 0); + g_object_set_data (G_OBJECT (sigfile_radiobtn), MENU_VAL_ID, + GINT_TO_POINTER (SIG_FILE)); + + sigcmd_radiobtn = gtk_radio_button_new_with_label_from_widget + (GTK_RADIO_BUTTON(sigfile_radiobtn), _("Command output")); + gtk_widget_show (sigcmd_radiobtn); + gtk_box_pack_start (GTK_BOX (sig_hbox), sigcmd_radiobtn, + FALSE, FALSE, 0); + g_object_set_data (G_OBJECT (sigcmd_radiobtn), MENU_VAL_ID, + GINT_TO_POINTER (SIG_COMMAND)); + + sigpath_entry = gtk_entry_new (); + gtk_widget_show (sigpath_entry); + gtk_box_pack_start (GTK_BOX (sig_vbox), sigpath_entry, TRUE, TRUE, 0); + + PACK_FRAME (vbox1, frame, _("Automatically set the following addresses")); + + table = gtk_table_new (3, 2, FALSE); + gtk_widget_show (table); + gtk_container_add (GTK_CONTAINER (frame), table); + gtk_container_set_border_width (GTK_CONTAINER (table), 8); + gtk_table_set_row_spacings (GTK_TABLE (table), VSPACING_NARROW_2); + gtk_table_set_col_spacings (GTK_TABLE (table), 8); + + autocc_chkbtn = gtk_check_button_new_with_label (_("Cc")); + gtk_widget_show (autocc_chkbtn); + gtk_table_attach (GTK_TABLE (table), autocc_chkbtn, 0, 1, 0, 1, + GTK_FILL, 0, 0, 0); + + autocc_entry = gtk_entry_new (); + gtk_widget_show (autocc_entry); + gtk_table_attach (GTK_TABLE (table), autocc_entry, 1, 2, 0, 1, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); + + SET_TOGGLE_SENSITIVITY (autocc_chkbtn, autocc_entry); + + autobcc_chkbtn = gtk_check_button_new_with_label (_("Bcc")); + gtk_widget_show (autobcc_chkbtn); + gtk_table_attach (GTK_TABLE (table), autobcc_chkbtn, 0, 1, 1, 2, + GTK_FILL, 0, 0, 0); + + autobcc_entry = gtk_entry_new (); + gtk_widget_show (autobcc_entry); + gtk_table_attach (GTK_TABLE (table), autobcc_entry, 1, 2, 1, 2, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); + + SET_TOGGLE_SENSITIVITY (autobcc_chkbtn, autobcc_entry); + + autoreplyto_chkbtn = gtk_check_button_new_with_label (_("Reply-To")); + gtk_widget_show (autoreplyto_chkbtn); + gtk_table_attach (GTK_TABLE (table), autoreplyto_chkbtn, 0, 1, 2, 3, + GTK_FILL, 0, 0, 0); + + autoreplyto_entry = gtk_entry_new (); + gtk_widget_show (autoreplyto_entry); + gtk_table_attach (GTK_TABLE (table), autoreplyto_entry, 1, 2, 2, 3, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); + + SET_TOGGLE_SENSITIVITY (autoreplyto_chkbtn, autoreplyto_entry); + + + compose.sigfile_radiobtn = sigfile_radiobtn; + compose.sigpath_entry = sigpath_entry; + + compose.autocc_chkbtn = autocc_chkbtn; + compose.autocc_entry = autocc_entry; + compose.autobcc_chkbtn = autobcc_chkbtn; + compose.autobcc_entry = autobcc_entry; + compose.autoreplyto_chkbtn = autoreplyto_chkbtn; + compose.autoreplyto_entry = autoreplyto_entry; +} + +#if USE_GPGME +static void prefs_account_privacy_create(void) +{ + GtkWidget *vbox1; + GtkWidget *frame1; + GtkWidget *vbox2; + GtkWidget *hbox1; + GtkWidget *label; + GtkWidget *default_sign_chkbtn; + GtkWidget *default_encrypt_chkbtn; + GtkWidget *encrypt_reply_chkbtn; + GtkWidget *ascii_armored_chkbtn; + GtkWidget *clearsign_chkbtn; + GtkWidget *defaultkey_radiobtn; + GtkWidget *emailkey_radiobtn; + GtkWidget *customkey_radiobtn; + GtkWidget *customkey_entry; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); + + PACK_CHECK_BUTTON (vbox2, default_sign_chkbtn, + _("Sign message by default")); + PACK_CHECK_BUTTON (vbox2, default_encrypt_chkbtn, + _("Encrypt message by default")); + PACK_CHECK_BUTTON (vbox2, encrypt_reply_chkbtn, + _("Encrypt when replying to encrypted message")); + PACK_CHECK_BUTTON (vbox2, ascii_armored_chkbtn, + _("Use ASCII-armored format for encryption")); + PACK_CHECK_BUTTON (vbox2, clearsign_chkbtn, + _("Use clear text signature")); + g_signal_connect (G_OBJECT (ascii_armored_chkbtn), "toggled", + G_CALLBACK (prefs_account_ascii_armored_warning), + NULL); + + PACK_FRAME (vbox1, frame1, _("Sign key")); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (frame1), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); + + defaultkey_radiobtn = gtk_radio_button_new_with_label + (NULL, _("Use default GnuPG key")); + gtk_widget_show (defaultkey_radiobtn); + gtk_box_pack_start (GTK_BOX (vbox2), defaultkey_radiobtn, + FALSE, FALSE, 0); + g_object_set_data (G_OBJECT (defaultkey_radiobtn), MENU_VAL_ID, + GINT_TO_POINTER (SIGN_KEY_DEFAULT)); + + emailkey_radiobtn = gtk_radio_button_new_with_label_from_widget + (GTK_RADIO_BUTTON (defaultkey_radiobtn), + _("Select key by your email address")); + gtk_widget_show (emailkey_radiobtn); + gtk_box_pack_start (GTK_BOX (vbox2), emailkey_radiobtn, + FALSE, FALSE, 0); + g_object_set_data (G_OBJECT (emailkey_radiobtn), MENU_VAL_ID, + GINT_TO_POINTER (SIGN_KEY_BY_FROM)); + + customkey_radiobtn = gtk_radio_button_new_with_label_from_widget + (GTK_RADIO_BUTTON (defaultkey_radiobtn), + _("Specify key manually")); + gtk_widget_show (customkey_radiobtn); + gtk_box_pack_start (GTK_BOX (vbox2), customkey_radiobtn, + FALSE, FALSE, 0); + g_object_set_data (G_OBJECT (customkey_radiobtn), MENU_VAL_ID, + GINT_TO_POINTER (SIGN_KEY_CUSTOM)); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); + + label = gtk_label_new (""); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); + gtk_widget_set_size_request (label, 16, -1); + + label = gtk_label_new (_("User or key ID:")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); + + customkey_entry = gtk_entry_new (); + gtk_widget_show (customkey_entry); + gtk_box_pack_start (GTK_BOX (hbox1), customkey_entry, + TRUE, TRUE, 0); + + SET_TOGGLE_SENSITIVITY (customkey_radiobtn, customkey_entry); + + privacy.default_sign_chkbtn = default_sign_chkbtn; + privacy.default_encrypt_chkbtn = default_encrypt_chkbtn; + privacy.encrypt_reply_chkbtn = encrypt_reply_chkbtn; + privacy.ascii_armored_chkbtn = ascii_armored_chkbtn; + privacy.clearsign_chkbtn = clearsign_chkbtn; + privacy.defaultkey_radiobtn = defaultkey_radiobtn; + privacy.emailkey_radiobtn = emailkey_radiobtn; + privacy.customkey_radiobtn = customkey_radiobtn; + privacy.customkey_entry = customkey_entry; +} +#endif /* USE_GPGME */ + +#if USE_SSL + +#define CREATE_RADIO_BUTTON(box, btn, btn_p, label, data) \ +{ \ + btn = gtk_radio_button_new_with_label_from_widget \ + (GTK_RADIO_BUTTON (btn_p), label); \ + gtk_widget_show (btn); \ + gtk_box_pack_start (GTK_BOX (box), btn, FALSE, FALSE, 0); \ + g_object_set_data (G_OBJECT (btn), MENU_VAL_ID, \ + GINT_TO_POINTER (data)); \ +} + +#define CREATE_RADIO_BUTTONS(box, \ + btn1, btn1_label, btn1_data, \ + btn2, btn2_label, btn2_data, \ + btn3, btn3_label, btn3_data) \ +{ \ + btn1 = gtk_radio_button_new_with_label(NULL, btn1_label); \ + gtk_widget_show (btn1); \ + gtk_box_pack_start (GTK_BOX (box), btn1, FALSE, FALSE, 0); \ + g_object_set_data (G_OBJECT (btn1), MENU_VAL_ID, \ + GINT_TO_POINTER (btn1_data)); \ + \ + CREATE_RADIO_BUTTON(box, btn2, btn1, btn2_label, btn2_data); \ + CREATE_RADIO_BUTTON(box, btn3, btn1, btn3_label, btn3_data); \ +} + +static void prefs_account_ssl_create(void) +{ + GtkWidget *vbox1; + + GtkWidget *pop_frame; + GtkWidget *vbox2; + GtkWidget *pop_nossl_radiobtn; + GtkWidget *pop_ssltunnel_radiobtn; + GtkWidget *pop_starttls_radiobtn; + + GtkWidget *imap_frame; + GtkWidget *vbox3; + GtkWidget *imap_nossl_radiobtn; + GtkWidget *imap_ssltunnel_radiobtn; + GtkWidget *imap_starttls_radiobtn; + + GtkWidget *nntp_frame; + GtkWidget *vbox4; + GtkWidget *nntp_nossl_radiobtn; + GtkWidget *nntp_ssltunnel_radiobtn; + + GtkWidget *send_frame; + GtkWidget *vbox5; + GtkWidget *smtp_nossl_radiobtn; + GtkWidget *smtp_ssltunnel_radiobtn; + GtkWidget *smtp_starttls_radiobtn; + + GtkWidget *vbox6; + GtkWidget *use_nonblocking_ssl_chkbtn; + GtkWidget *label; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + PACK_FRAME (vbox1, pop_frame, _("POP3")); + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (pop_frame), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); + + CREATE_RADIO_BUTTONS(vbox2, + pop_nossl_radiobtn, + _("Don't use SSL"), + SSL_NONE, + pop_ssltunnel_radiobtn, + _("Use SSL for POP3 connection"), + SSL_TUNNEL, + pop_starttls_radiobtn, + _("Use STARTTLS command to start SSL session"), + SSL_STARTTLS); + + PACK_FRAME (vbox1, imap_frame, _("IMAP4")); + vbox3 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox3); + gtk_container_add (GTK_CONTAINER (imap_frame), vbox3); + gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8); + + CREATE_RADIO_BUTTONS(vbox3, + imap_nossl_radiobtn, + _("Don't use SSL"), + SSL_NONE, + imap_ssltunnel_radiobtn, + _("Use SSL for IMAP4 connection"), + SSL_TUNNEL, + imap_starttls_radiobtn, + _("Use STARTTLS command to start SSL session"), + SSL_STARTTLS); + + PACK_FRAME (vbox1, nntp_frame, _("NNTP")); + vbox4 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox4); + gtk_container_add (GTK_CONTAINER (nntp_frame), vbox4); + gtk_container_set_border_width (GTK_CONTAINER (vbox4), 8); + + nntp_nossl_radiobtn = + gtk_radio_button_new_with_label (NULL, _("Don't use SSL")); + gtk_widget_show (nntp_nossl_radiobtn); + gtk_box_pack_start (GTK_BOX (vbox4), nntp_nossl_radiobtn, + FALSE, FALSE, 0); + g_object_set_data (G_OBJECT (nntp_nossl_radiobtn), MENU_VAL_ID, + GINT_TO_POINTER (SSL_NONE)); + + CREATE_RADIO_BUTTON(vbox4, nntp_ssltunnel_radiobtn, nntp_nossl_radiobtn, + _("Use SSL for NNTP connection"), SSL_TUNNEL); + + PACK_FRAME (vbox1, send_frame, _("Send (SMTP)")); + vbox5 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox5); + gtk_container_add (GTK_CONTAINER (send_frame), vbox5); + gtk_container_set_border_width (GTK_CONTAINER (vbox5), 8); + + CREATE_RADIO_BUTTONS(vbox5, + smtp_nossl_radiobtn, + _("Don't use SSL"), + SSL_NONE, + smtp_ssltunnel_radiobtn, + _("Use SSL for SMTP connection"), + SSL_TUNNEL, + smtp_starttls_radiobtn, + _("Use STARTTLS command to start SSL session"), + SSL_STARTTLS); + + vbox6 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox6); + gtk_box_pack_start (GTK_BOX (vbox1), vbox6, FALSE, FALSE, 0); + + PACK_CHECK_BUTTON(vbox6, use_nonblocking_ssl_chkbtn, + _("Use non-blocking SSL")); + PACK_SMALL_LABEL + (vbox6, label, + _("Turn this off if you have problems in SSL connection.")); + + ssl.pop_frame = pop_frame; + ssl.pop_nossl_radiobtn = pop_nossl_radiobtn; + ssl.pop_ssltunnel_radiobtn = pop_ssltunnel_radiobtn; + ssl.pop_starttls_radiobtn = pop_starttls_radiobtn; + + ssl.imap_frame = imap_frame; + ssl.imap_nossl_radiobtn = imap_nossl_radiobtn; + ssl.imap_ssltunnel_radiobtn = imap_ssltunnel_radiobtn; + ssl.imap_starttls_radiobtn = imap_starttls_radiobtn; + + ssl.nntp_frame = nntp_frame; + ssl.nntp_nossl_radiobtn = nntp_nossl_radiobtn; + ssl.nntp_ssltunnel_radiobtn = nntp_ssltunnel_radiobtn; + + ssl.send_frame = send_frame; + ssl.smtp_nossl_radiobtn = smtp_nossl_radiobtn; + ssl.smtp_ssltunnel_radiobtn = smtp_ssltunnel_radiobtn; + ssl.smtp_starttls_radiobtn = smtp_starttls_radiobtn; + + ssl.use_nonblocking_ssl_chkbtn = use_nonblocking_ssl_chkbtn; +} + +#undef CREATE_RADIO_BUTTONS +#undef CREATE_RADIO_BUTTON + +#endif /* USE_SSL */ + +static void prefs_account_advanced_create(void) +{ + GtkWidget *vbox1; + GtkWidget *vbox2; + GtkWidget *hbox1; + GtkWidget *checkbtn_smtpport; + GtkWidget *entry_smtpport; + GtkWidget *hbox_popport; + GtkWidget *checkbtn_popport; + GtkWidget *entry_popport; + GtkWidget *hbox_imapport; + GtkWidget *checkbtn_imapport; + GtkWidget *entry_imapport; + GtkWidget *hbox_nntpport; + GtkWidget *checkbtn_nntpport; + GtkWidget *entry_nntpport; + GtkWidget *checkbtn_domain; + GtkWidget *entry_domain; + GtkWidget *imap_frame; + GtkWidget *imapdir_label; + GtkWidget *imapdir_entry; + GtkWidget *folder_frame; + GtkWidget *vbox3; + GtkWidget *table; + GtkWidget *sent_folder_chkbtn; + GtkWidget *sent_folder_entry; + GtkWidget *draft_folder_chkbtn; + GtkWidget *draft_folder_entry; + GtkWidget *trash_folder_chkbtn; + GtkWidget *trash_folder_entry; + +#define PACK_HBOX(hbox) \ +{ \ + hbox = gtk_hbox_new (FALSE, 8); \ + gtk_widget_show (hbox); \ + gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); \ +} + +#define PACK_PORT_ENTRY(box, entry) \ +{ \ + entry = gtk_entry_new (); \ + gtk_entry_set_max_length (GTK_ENTRY(entry), 5); \ + gtk_widget_show (entry); \ + gtk_box_pack_start (GTK_BOX (box), entry, FALSE, FALSE, 0); \ + gtk_widget_set_size_request (entry, 64, -1); \ +} + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW_2); + gtk_widget_show (vbox2); + gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); + + PACK_HBOX (hbox1); + PACK_CHECK_BUTTON (hbox1, checkbtn_smtpport, _("Specify SMTP port")); + PACK_PORT_ENTRY (hbox1, entry_smtpport); + SET_TOGGLE_SENSITIVITY (checkbtn_smtpport, entry_smtpport); + + PACK_HBOX (hbox_popport); + PACK_CHECK_BUTTON (hbox_popport, checkbtn_popport, + _("Specify POP3 port")); + PACK_PORT_ENTRY (hbox_popport, entry_popport); + SET_TOGGLE_SENSITIVITY (checkbtn_popport, entry_popport); + + PACK_HBOX (hbox_imapport); + PACK_CHECK_BUTTON (hbox_imapport, checkbtn_imapport, + _("Specify IMAP4 port")); + PACK_PORT_ENTRY (hbox_imapport, entry_imapport); + SET_TOGGLE_SENSITIVITY (checkbtn_imapport, entry_imapport); + + PACK_HBOX (hbox_nntpport); + PACK_CHECK_BUTTON (hbox_nntpport, checkbtn_nntpport, + _("Specify NNTP port")); + PACK_PORT_ENTRY (hbox_nntpport, entry_nntpport); + SET_TOGGLE_SENSITIVITY (checkbtn_nntpport, entry_nntpport); + + PACK_HBOX (hbox1); + PACK_CHECK_BUTTON (hbox1, checkbtn_domain, _("Specify domain name")); + + entry_domain = gtk_entry_new (); + gtk_widget_show (entry_domain); + gtk_box_pack_start (GTK_BOX (hbox1), entry_domain, TRUE, TRUE, 0); + SET_TOGGLE_SENSITIVITY (checkbtn_domain, entry_domain); + + PACK_FRAME (vbox1, imap_frame, _("IMAP4")); + + vbox3 = gtk_vbox_new (FALSE, VSPACING_NARROW); + gtk_widget_show (vbox3); + gtk_container_add (GTK_CONTAINER (imap_frame), vbox3); + gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0); + + imapdir_label = gtk_label_new (_("IMAP server directory")); + gtk_widget_show (imapdir_label); + gtk_box_pack_start (GTK_BOX (hbox1), imapdir_label, FALSE, FALSE, 0); + + imapdir_entry = gtk_entry_new(); + gtk_widget_show (imapdir_entry); + gtk_box_pack_start (GTK_BOX (hbox1), imapdir_entry, TRUE, TRUE, 0); + +#undef PACK_HBOX +#undef PACK_PORT_ENTRY + + /* special folder setting (maybe these options are redundant) */ + + PACK_FRAME (vbox1, folder_frame, _("Folder")); + + vbox3 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox3); + gtk_container_add (GTK_CONTAINER (folder_frame), vbox3); + gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8); + + table = gtk_table_new (3, 3, FALSE); + gtk_widget_show (table); + gtk_container_add (GTK_CONTAINER (vbox3), table); + gtk_table_set_row_spacings (GTK_TABLE (table), VSPACING_NARROW_2); + gtk_table_set_col_spacings (GTK_TABLE (table), 4); + +#define SET_CHECK_BTN_AND_ENTRY(label, chkbtn, entry, n) \ +{ \ + GtkWidget *button; \ + \ + chkbtn = gtk_check_button_new_with_label (label); \ + gtk_widget_show (chkbtn); \ + gtk_table_attach (GTK_TABLE (table), chkbtn, \ + 0, 1, n, n + 1, GTK_FILL, 0, 0, 0); \ + \ + entry = gtk_entry_new (); \ + gtk_widget_show (entry); \ + gtk_table_attach (GTK_TABLE (table), entry, 1, 2, n, n + 1, \ + GTK_EXPAND | GTK_SHRINK | GTK_FILL, \ + GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); \ + \ + button = gtk_button_new_with_label (_(" ... ")); \ + gtk_widget_show (button); \ + gtk_table_attach (GTK_TABLE (table), button, \ + 2, 3, n, n + 1, GTK_FILL, 0, 0, 0); \ + g_signal_connect \ + (G_OBJECT (button), "clicked", \ + G_CALLBACK (prefs_account_select_folder_cb), \ + entry); \ + \ + SET_TOGGLE_SENSITIVITY (chkbtn, entry); \ + SET_TOGGLE_SENSITIVITY (chkbtn, button); \ +} + + SET_CHECK_BTN_AND_ENTRY(_("Put sent messages in"), + sent_folder_chkbtn, sent_folder_entry, 0); + SET_CHECK_BTN_AND_ENTRY(_("Put draft messages in"), + draft_folder_chkbtn, draft_folder_entry, 1); + SET_CHECK_BTN_AND_ENTRY(_("Put deleted messages in"), + trash_folder_chkbtn, trash_folder_entry, 2); + + advanced.smtpport_chkbtn = checkbtn_smtpport; + advanced.smtpport_entry = entry_smtpport; + advanced.popport_hbox = hbox_popport; + advanced.popport_chkbtn = checkbtn_popport; + advanced.popport_entry = entry_popport; + advanced.imapport_hbox = hbox_imapport; + advanced.imapport_chkbtn = checkbtn_imapport; + advanced.imapport_entry = entry_imapport; + advanced.nntpport_hbox = hbox_nntpport; + advanced.nntpport_chkbtn = checkbtn_nntpport; + advanced.nntpport_entry = entry_nntpport; + advanced.domain_chkbtn = checkbtn_domain; + advanced.domain_entry = entry_domain; + + advanced.imap_frame = imap_frame; + advanced.imapdir_entry = imapdir_entry; + + advanced.sent_folder_chkbtn = sent_folder_chkbtn; + advanced.sent_folder_entry = sent_folder_entry; + advanced.draft_folder_chkbtn = draft_folder_chkbtn; + advanced.draft_folder_entry = draft_folder_entry; + advanced.trash_folder_chkbtn = trash_folder_chkbtn; + advanced.trash_folder_entry = trash_folder_entry; +} + +static gint prefs_account_deleted(GtkWidget *widget, GdkEventAny *event, + gpointer data) +{ + prefs_account_cancel(); + return TRUE; +} + +static gboolean prefs_account_key_pressed(GtkWidget *widget, GdkEventKey *event, + gpointer data) +{ + if (event && event->keyval == GDK_Escape) + prefs_account_cancel(); + return FALSE; +} + +static void prefs_account_ok(void) +{ + if (prefs_account_apply() == 0) + gtk_main_quit(); +} + +static gint prefs_account_apply(void) +{ + RecvProtocol protocol; + GtkWidget *menu; + GtkWidget *menuitem; + + menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(basic.protocol_optmenu)); + menuitem = gtk_menu_get_active(GTK_MENU(menu)); + protocol = GPOINTER_TO_INT + (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID)); + + if (*gtk_entry_get_text(GTK_ENTRY(basic.acname_entry)) == '\0') { + alertpanel_error(_("Account name is not entered.")); + return -1; + } + if (*gtk_entry_get_text(GTK_ENTRY(basic.addr_entry)) == '\0') { + alertpanel_error(_("Mail address is not entered.")); + return -1; + } + if ((protocol == A_POP3 || protocol == A_LOCAL) && + *gtk_entry_get_text(GTK_ENTRY(basic.smtpserv_entry)) == '\0') { + alertpanel_error(_("SMTP server is not entered.")); + return -1; + } + if ((protocol == A_POP3 || protocol == A_IMAP4) && + *gtk_entry_get_text(GTK_ENTRY(basic.uid_entry)) == '\0') { + alertpanel_error(_("User ID is not entered.")); + return -1; + } + if (protocol == A_POP3 && + *gtk_entry_get_text(GTK_ENTRY(basic.recvserv_entry)) == '\0') { + alertpanel_error(_("POP3 server is not entered.")); + return -1; + } + if (protocol == A_IMAP4 && + *gtk_entry_get_text(GTK_ENTRY(basic.recvserv_entry)) == '\0') { + alertpanel_error(_("IMAP4 server is not entered.")); + return -1; + } + if (protocol == A_NNTP && + *gtk_entry_get_text(GTK_ENTRY(basic.nntpserv_entry)) == '\0') { + alertpanel_error(_("NNTP server is not entered.")); + return -1; + } + + prefs_set_data_from_dialog(prefs_account_get_params()); + return 0; +} + +static void prefs_account_cancel(void) +{ + cancelled = TRUE; + gtk_main_quit(); +} + +static void prefs_account_select_folder_cb(GtkWidget *widget, gpointer data) +{ + FolderItem *item; + gchar *id; + + item = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL); + if (item && item->path) { + id = folder_item_get_identifier(item); + if (id) { + gtk_entry_set_text(GTK_ENTRY(data), id); + g_free(id); + } + } +} + +static void prefs_account_edit_custom_header(void) +{ + prefs_custom_header_open(prefs_account_get_tmp_prefs()); +} + +static void prefs_account_enum_set_data_from_radiobtn(PrefParam *pparam) +{ + PrefsUIData *ui_data; + GtkRadioButton *radiobtn; + GSList *group; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + radiobtn = GTK_RADIO_BUTTON(*ui_data->widget); + group = gtk_radio_button_get_group(radiobtn); + while (group != NULL) { + GtkToggleButton *btn = GTK_TOGGLE_BUTTON(group->data); + if (gtk_toggle_button_get_active(btn)) { + *((gint *)pparam->data) = GPOINTER_TO_INT + (g_object_get_data(G_OBJECT(btn), MENU_VAL_ID)); + break; + } + group = group->next; + } +} + +static void prefs_account_enum_set_radiobtn(PrefParam *pparam) +{ + PrefsUIData *ui_data; + GtkRadioButton *radiobtn; + GSList *group; + gpointer data; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + data = GINT_TO_POINTER(*((gint *)pparam->data)); + radiobtn = GTK_RADIO_BUTTON(*ui_data->widget); + group = gtk_radio_button_get_group(radiobtn); + while (group != NULL) { + GtkToggleButton *btn = GTK_TOGGLE_BUTTON(group->data); + gpointer data1; + + data1 = g_object_get_data(G_OBJECT(btn), MENU_VAL_ID); + if (data1 == data) { + gtk_toggle_button_set_active(btn, TRUE); + break; + } + group = group->next; + } +} + + +#if USE_GPGME +static void prefs_account_ascii_armored_warning(GtkWidget *widget) +{ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) && + gtk_notebook_get_current_page(GTK_NOTEBOOK(dialog.notebook)) > 0) + alertpanel_warning + (_("It's not recommended to use the old style ASCII-armored\n" + "mode for encrypted messages. It doesn't comply with the\n" + "RFC 3156 - MIME Security with OpenPGP.")); +} +#endif /* USE_GPGME */ + +static void prefs_account_protocol_set_data_from_optmenu(PrefParam *pparam) +{ + PrefsUIData *ui_data; + GtkWidget *menu; + GtkWidget *menuitem; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*ui_data->widget)); + menuitem = gtk_menu_get_active(GTK_MENU(menu)); + *((RecvProtocol *)pparam->data) = GPOINTER_TO_INT + (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID)); +} + +static void prefs_account_protocol_set_optmenu(PrefParam *pparam) +{ + PrefsUIData *ui_data; + RecvProtocol protocol; + GtkOptionMenu *optmenu; + GtkWidget *menu; + GtkWidget *menuitem; + gint index; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + optmenu = GTK_OPTION_MENU(*ui_data->widget); + + protocol = *((RecvProtocol *)pparam->data); + index = menu_find_option_menu_index + (optmenu, GINT_TO_POINTER(protocol), NULL); + if (index < 0) return; + gtk_option_menu_set_history(optmenu, index); + + menu = gtk_option_menu_get_menu(optmenu); + menu_set_insensitive_all(GTK_MENU_SHELL(menu)); + + menuitem = gtk_menu_get_active(GTK_MENU(menu)); + gtk_widget_set_sensitive(menuitem, TRUE); + gtk_menu_item_activate(GTK_MENU_ITEM(menuitem)); +} + +static void prefs_account_imap_auth_type_set_data_from_optmenu(PrefParam *pparam) +{ + PrefsUIData *ui_data; + GtkWidget *menu; + GtkWidget *menuitem; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*ui_data->widget)); + menuitem = gtk_menu_get_active(GTK_MENU(menu)); + *((RecvProtocol *)pparam->data) = GPOINTER_TO_INT + (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID)); +} + +static void prefs_account_imap_auth_type_set_optmenu(PrefParam *pparam) +{ + PrefsUIData *ui_data; + IMAPAuthType type = *((IMAPAuthType *)pparam->data); + GtkOptionMenu *optmenu; + GtkWidget *menu; + GtkWidget *menuitem; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + optmenu = GTK_OPTION_MENU(*ui_data->widget); + + switch (type) { + case IMAP_AUTH_LOGIN: + gtk_option_menu_set_history(optmenu, 1); + break; + case IMAP_AUTH_CRAM_MD5: + gtk_option_menu_set_history(optmenu, 2); + break; + case 0: + default: + gtk_option_menu_set_history(optmenu, 0); + } + + menu = gtk_option_menu_get_menu(optmenu); + menuitem = gtk_menu_get_active(GTK_MENU(menu)); + gtk_menu_item_activate(GTK_MENU_ITEM(menuitem)); +} + +static void prefs_account_smtp_auth_type_set_data_from_optmenu(PrefParam *pparam) +{ + PrefsUIData *ui_data; + GtkWidget *menu; + GtkWidget *menuitem; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*ui_data->widget)); + menuitem = gtk_menu_get_active(GTK_MENU(menu)); + *((RecvProtocol *)pparam->data) = GPOINTER_TO_INT + (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID)); +} + +static void prefs_account_smtp_auth_type_set_optmenu(PrefParam *pparam) +{ + PrefsUIData *ui_data; + SMTPAuthType type = *((SMTPAuthType *)pparam->data); + GtkOptionMenu *optmenu; + GtkWidget *menu; + GtkWidget *menuitem; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + optmenu = GTK_OPTION_MENU(*ui_data->widget); + + switch (type) { + case SMTPAUTH_PLAIN: + gtk_option_menu_set_history(optmenu, 1); + break; + case SMTPAUTH_LOGIN: + gtk_option_menu_set_history(optmenu, 2); + break; + case SMTPAUTH_CRAM_MD5: + gtk_option_menu_set_history(optmenu, 3); + break; + case SMTPAUTH_DIGEST_MD5: + gtk_option_menu_set_history(optmenu, 4); + break; + case 0: + default: + gtk_option_menu_set_history(optmenu, 0); + } + + menu = gtk_option_menu_get_menu(optmenu); + menuitem = gtk_menu_get_active(GTK_MENU(menu)); + gtk_menu_item_activate(GTK_MENU_ITEM(menuitem)); +} + +static void prefs_account_protocol_activated(GtkMenuItem *menuitem) +{ + RecvProtocol protocol; + gboolean active; + PrefsAccount *tmp_ac_prefs; + + tmp_ac_prefs = prefs_account_get_tmp_prefs(); + + protocol = GPOINTER_TO_INT + (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID)); + + switch(protocol) { + case A_NNTP: + gtk_widget_show(basic.nntpserv_label); + gtk_widget_show(basic.nntpserv_entry); + gtk_widget_show(basic.nntpauth_chkbtn); + gtk_widget_hide(basic.recvserv_label); + gtk_widget_hide(basic.recvserv_entry); + gtk_widget_hide(basic.smtpserv_label); + gtk_widget_hide(basic.smtpserv_entry); + active = gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON(basic.nntpauth_chkbtn)); + gtk_widget_set_sensitive(basic.uid_label, active); + gtk_widget_set_sensitive(basic.pass_label, active); + gtk_widget_set_sensitive(basic.uid_entry, active); + gtk_widget_set_sensitive(basic.pass_entry, active); + gtk_widget_hide(receive.pop3_frame); + gtk_widget_hide(receive.imap_frame); + gtk_widget_show(receive.nntp_frame); + gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE); + + if (!tmp_ac_prefs->account_name) { + gtk_toggle_button_set_active + (GTK_TOGGLE_BUTTON(receive.recvatgetall_chkbtn), + FALSE); + } + +#if USE_SSL + gtk_widget_hide(ssl.pop_frame); + gtk_widget_hide(ssl.imap_frame); + gtk_widget_show(ssl.nntp_frame); + gtk_widget_hide(ssl.send_frame); +#endif + gtk_widget_hide(advanced.popport_hbox); + gtk_widget_hide(advanced.imapport_hbox); + gtk_widget_show(advanced.nntpport_hbox); + gtk_widget_hide(advanced.imap_frame); + break; + case A_LOCAL: + gtk_widget_hide(basic.nntpserv_label); + gtk_widget_hide(basic.nntpserv_entry); + gtk_widget_hide(basic.nntpauth_chkbtn); + gtk_widget_set_sensitive(basic.recvserv_label, FALSE); + gtk_widget_set_sensitive(basic.recvserv_entry, FALSE); + gtk_widget_show(basic.recvserv_label); + gtk_widget_show(basic.recvserv_entry); + gtk_widget_show(basic.smtpserv_label); + gtk_widget_show(basic.smtpserv_entry); + gtk_widget_set_sensitive(basic.uid_label, FALSE); + gtk_widget_set_sensitive(basic.pass_label, FALSE); + gtk_widget_set_sensitive(basic.uid_entry, FALSE); + gtk_widget_set_sensitive(basic.pass_entry, FALSE); + gtk_widget_hide(receive.pop3_frame); + gtk_widget_hide(receive.imap_frame); + gtk_widget_hide(receive.nntp_frame); + gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, FALSE); + + if (!tmp_ac_prefs->account_name) { + gtk_toggle_button_set_active + (GTK_TOGGLE_BUTTON(receive.recvatgetall_chkbtn), + TRUE); + } + +#if USE_SSL + gtk_widget_hide(ssl.pop_frame); + gtk_widget_hide(ssl.imap_frame); + gtk_widget_hide(ssl.nntp_frame); + gtk_widget_show(ssl.send_frame); +#endif + gtk_widget_hide(advanced.popport_hbox); + gtk_widget_hide(advanced.imapport_hbox); + gtk_widget_hide(advanced.nntpport_hbox); + gtk_widget_hide(advanced.imap_frame); + break; + case A_IMAP4: + gtk_widget_hide(basic.nntpserv_label); + gtk_widget_hide(basic.nntpserv_entry); + gtk_widget_hide(basic.nntpauth_chkbtn); + gtk_widget_set_sensitive(basic.recvserv_label, TRUE); + gtk_widget_set_sensitive(basic.recvserv_entry, TRUE); + gtk_widget_show(basic.recvserv_label); + gtk_widget_show(basic.recvserv_entry); + gtk_widget_show(basic.smtpserv_label); + gtk_widget_show(basic.smtpserv_entry); + gtk_widget_set_sensitive(basic.uid_label, TRUE); + gtk_widget_set_sensitive(basic.pass_label, TRUE); + gtk_widget_set_sensitive(basic.uid_entry, TRUE); + gtk_widget_set_sensitive(basic.pass_entry, TRUE); + gtk_widget_hide(receive.pop3_frame); + gtk_widget_show(receive.imap_frame); + gtk_widget_hide(receive.nntp_frame); + gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE); + + if (!tmp_ac_prefs->account_name) { + gtk_toggle_button_set_active + (GTK_TOGGLE_BUTTON(receive.recvatgetall_chkbtn), + FALSE); + } + +#if USE_SSL + gtk_widget_hide(ssl.pop_frame); + gtk_widget_show(ssl.imap_frame); + gtk_widget_hide(ssl.nntp_frame); + gtk_widget_show(ssl.send_frame); +#endif + gtk_widget_hide(advanced.popport_hbox); + gtk_widget_show(advanced.imapport_hbox); + gtk_widget_hide(advanced.nntpport_hbox); + gtk_widget_show(advanced.imap_frame); + break; + case A_POP3: + default: + gtk_widget_hide(basic.nntpserv_label); + gtk_widget_hide(basic.nntpserv_entry); + gtk_widget_hide(basic.nntpauth_chkbtn); + gtk_widget_set_sensitive(basic.recvserv_label, TRUE); + gtk_widget_set_sensitive(basic.recvserv_entry, TRUE); + gtk_widget_show(basic.recvserv_label); + gtk_widget_show(basic.recvserv_entry); + gtk_widget_show(basic.smtpserv_label); + gtk_widget_show(basic.smtpserv_entry); + gtk_widget_set_sensitive(basic.uid_label, TRUE); + gtk_widget_set_sensitive(basic.pass_label, TRUE); + gtk_widget_set_sensitive(basic.uid_entry, TRUE); + gtk_widget_set_sensitive(basic.pass_entry, TRUE); + gtk_widget_show(receive.pop3_frame); + gtk_widget_hide(receive.imap_frame); + gtk_widget_hide(receive.nntp_frame); + gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE); + + if (!tmp_ac_prefs->account_name) { + gtk_toggle_button_set_active + (GTK_TOGGLE_BUTTON(receive.recvatgetall_chkbtn), + TRUE); + } + +#if USE_SSL + gtk_widget_show(ssl.pop_frame); + gtk_widget_hide(ssl.imap_frame); + gtk_widget_hide(ssl.nntp_frame); + gtk_widget_show(ssl.send_frame); +#endif + gtk_widget_show(advanced.popport_hbox); + gtk_widget_hide(advanced.imapport_hbox); + gtk_widget_hide(advanced.nntpport_hbox); + gtk_widget_hide(advanced.imap_frame); + break; + } + + gtk_widget_queue_resize(basic.serv_frame); +} diff --git a/src/prefs_account_dialog.h b/src/prefs_account_dialog.h new file mode 100644 index 00000000..3ec7f6e9 --- /dev/null +++ b/src/prefs_account_dialog.h @@ -0,0 +1,29 @@ +/* + * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client + * Copyright (C) 1999-2005 Hiroyuki Yamamoto + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __PREFS_ACCOUNT_DIALOG_H__ +#define __PREFS_ACCOUNT_DIALOG_H__ + +#include + +#include "prefs_account.h" + +PrefsAccount *prefs_account_open (PrefsAccount *ac_prefs); + +#endif /* __PREFS_ACCOUNT_DIALOG_H__ */ diff --git a/src/prefs_common.c b/src/prefs_common.c index 86e67906..f7ebddaa 100644 --- a/src/prefs_common.c +++ b/src/prefs_common.c @@ -25,8 +25,6 @@ #include #include -#include -#include #include #include #include @@ -37,779 +35,316 @@ #include "main.h" #include "prefs.h" -#include "prefs_ui.h" #include "prefs_common.h" -#include "prefs_display_header.h" -#include "prefs_summary_column.h" -#include "mainwindow.h" -#include "summaryview.h" -#include "messageview.h" -#include "manage_window.h" -#include "foldersel.h" -#include "inc.h" -#include "menu.h" #include "filter.h" #include "codeconv.h" #include "utils.h" -#include "gtkutils.h" -#include "alertpanel.h" #include "folder.h" #include "socket.h" PrefsCommon prefs_common; -static PrefsDialog dialog; - -static struct Receive { - GtkWidget *checkbtn_incext; - GtkWidget *entry_incext; - GtkWidget *button_incext; - - GtkWidget *checkbtn_local; - GtkWidget *checkbtn_filter_on_inc; - GtkWidget *entry_spool; - - GtkWidget *checkbtn_autochk; - GtkWidget *spinbtn_autochk; - GtkObject *spinbtn_autochk_adj; - - GtkWidget *checkbtn_chkonstartup; - GtkWidget *checkbtn_scan_after_inc; - GtkWidget *checkbtn_newmsg_notify; - GtkWidget *entry_newmsg_notify; -} receive; - -static struct Send { - GtkWidget *checkbtn_extsend; - GtkWidget *entry_extsend; - GtkWidget *button_extsend; - - GtkWidget *checkbtn_savemsg; - GtkWidget *checkbtn_filter_sent; - - GtkWidget *optmenu_charset; - GtkWidget *optmenu_encoding_method; -} p_send; - -static struct Compose { - GtkWidget *checkbtn_autosig; - GtkWidget *entry_sigsep; - - GtkWidget *checkbtn_autoextedit; - GtkWidget *spinbtn_undolevel; - GtkObject *spinbtn_undolevel_adj; - GtkWidget *spinbtn_linewrap; - GtkObject *spinbtn_linewrap_adj; - GtkWidget *checkbtn_wrapquote; - GtkWidget *checkbtn_autowrap; - GtkWidget *checkbtn_wrapatsend; - - GtkWidget *checkbtn_reply_account_autosel; - GtkWidget *checkbtn_quote; - GtkWidget *checkbtn_default_reply_list; -} compose; - -static struct Quote { - GtkWidget *entry_quotemark; - GtkWidget *text_quotefmt; - - GtkWidget *entry_fw_quotemark; - GtkWidget *text_fw_quotefmt; -} quote; - -static struct Display { - GtkWidget *fontbtn_textfont; - - GtkWidget *chkbtn_folder_unread; - GtkWidget *entry_ng_abbrev_len; - GtkWidget *spinbtn_ng_abbrev_len; - GtkObject *spinbtn_ng_abbrev_len_adj; - - GtkWidget *chkbtn_transhdr; - - GtkWidget *chkbtn_swapfrom; - GtkWidget *chkbtn_expand_thread; - GtkWidget *entry_datefmt; -} display; - -static struct Message { - GtkWidget *chkbtn_enablecol; - GtkWidget *button_edit_col; - GtkWidget *chkbtn_mbalnum; - GtkWidget *chkbtn_disphdrpane; - GtkWidget *chkbtn_disphdr; - GtkWidget *chkbtn_html; - GtkWidget *spinbtn_linespc; - GtkObject *spinbtn_linespc_adj; - - GtkWidget *chkbtn_smoothscroll; - GtkWidget *spinbtn_scrollstep; - GtkObject *spinbtn_scrollstep_adj; - GtkWidget *chkbtn_halfpage; - - GtkWidget *chkbtn_resize_image; - GtkWidget *chkbtn_inline_image; -} message; - -static struct JunkMail { - GtkWidget *chkbtn_enable_junk; - GtkWidget *entry_junk_learncmd; - GtkWidget *entry_nojunk_learncmd; - GtkWidget *entry_classify_cmd; - GtkWidget *entry_junkfolder; - GtkWidget *chkbtn_filter_on_recv; -} junk; - -#if USE_GPGME -static struct Privacy { - GtkWidget *checkbtn_auto_check_signatures; - GtkWidget *checkbtn_gpg_signature_popup; - GtkWidget *checkbtn_store_passphrase; - GtkWidget *spinbtn_store_passphrase; - GtkObject *spinbtn_store_passphrase_adj; - GtkWidget *checkbtn_passphrase_grab; - GtkWidget *checkbtn_gpg_warning; -} privacy; -#endif - -static struct Interface { - GtkWidget *checkbtn_always_show_msg; - GtkWidget *checkbtn_openunread; - GtkWidget *checkbtn_mark_as_read_on_newwin; - GtkWidget *checkbtn_openinbox; - GtkWidget *checkbtn_immedexec; - GtkWidget *optmenu_recvdialog; - GtkWidget *checkbtn_no_recv_err_panel; - GtkWidget *checkbtn_close_recv_dialog; - GtkWidget *checkbtn_comply_gnome_hig; -} interface; - -static struct Other { - GtkWidget *uri_combo; - GtkWidget *uri_entry; - GtkWidget *printcmd_entry; - GtkWidget *exteditor_combo; - GtkWidget *exteditor_entry; - - GtkWidget *checkbtn_addaddrbyclick; - GtkWidget *checkbtn_confonexit; - GtkWidget *checkbtn_cleanonexit; - GtkWidget *checkbtn_askonclean; - GtkWidget *checkbtn_warnqueued; -} other; - -static struct Advanced { - GtkWidget *checkbtn_strict_cache_check; - GtkWidget *spinbtn_iotimeout; - GtkObject *spinbtn_iotimeout_adj; -} advanced; - -static struct MessageColorButtons { - GtkWidget *quote_level1_btn; - GtkWidget *quote_level2_btn; - GtkWidget *quote_level3_btn; - GtkWidget *uri_btn; -} color_buttons; - -static struct KeybindDialog { - GtkWidget *window; - GtkWidget *combo; -} keybind; - -static GtkWidget *quote_desc_win; -static GtkWidget *quote_color_win; -static GtkWidget *color_dialog; - -static void prefs_common_charset_set_data_from_optmenu (PrefParam *pparam); -static void prefs_common_charset_set_optmenu (PrefParam *pparam); -static void prefs_common_encoding_set_data_from_optmenu (PrefParam *pparam); -static void prefs_common_encoding_set_optmenu (PrefParam *pparam); -static void prefs_common_recv_dialog_set_data_from_optmenu (PrefParam *pparam); -static void prefs_common_recv_dialog_set_optmenu (PrefParam *pparam); - -/* - parameter name, default value, pointer to the prefs variable, data type, - pointer to the widget pointer, - pointer to the function for data setting, - pointer to the function for widget setting - */ - static PrefParam param[] = { /* Receive */ - {"use_ext_inc", "FALSE", &prefs_common.use_extinc, P_BOOL, - P_WID(&receive.checkbtn_incext), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"ext_inc_path", DEFAULT_INC_PATH, &prefs_common.extinc_cmd, P_STRING, - P_WID(&receive.entry_incext), - prefs_set_data_from_entry, prefs_set_entry}, - - {"inc_local", "FALSE", &prefs_common.inc_local, P_BOOL, - P_WID(&receive.checkbtn_local), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"filter_on_inc_local", "TRUE", &prefs_common.filter_on_inc, P_BOOL, - P_WID(&receive.checkbtn_filter_on_inc), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"spool_path", DEFAULT_SPOOL_PATH, &prefs_common.spool_path, P_STRING, - P_WID(&receive.entry_spool), - prefs_set_data_from_entry, prefs_set_entry}, - - {"autochk_newmail", "FALSE", &prefs_common.autochk_newmail, P_BOOL, - P_WID(&receive.checkbtn_autochk), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"autochk_interval", "10", &prefs_common.autochk_itv, P_INT, - P_WID(&receive.spinbtn_autochk), - prefs_set_data_from_spinbtn, prefs_set_spinbtn}, - {"check_on_startup", "FALSE", &prefs_common.chk_on_startup, P_BOOL, - P_WID(&receive.checkbtn_chkonstartup), - prefs_set_data_from_toggle, prefs_set_toggle}, + {"use_ext_inc", "FALSE", &prefs_common.use_extinc, P_BOOL}, + {"ext_inc_path", DEFAULT_INC_PATH, &prefs_common.extinc_cmd, P_STRING}, + + {"inc_local", "FALSE", &prefs_common.inc_local, P_BOOL}, + {"filter_on_inc_local", "TRUE", &prefs_common.filter_on_inc, P_BOOL}, + {"spool_path", DEFAULT_SPOOL_PATH, &prefs_common.spool_path, P_STRING}, + + {"autochk_newmail", "FALSE", &prefs_common.autochk_newmail, P_BOOL}, + {"autochk_interval", "10", &prefs_common.autochk_itv, P_INT}, + {"check_on_startup", "FALSE", &prefs_common.chk_on_startup, P_BOOL}, {"scan_all_after_inc", "FALSE", &prefs_common.scan_all_after_inc, - P_BOOL, P_WID(&receive.checkbtn_scan_after_inc), - prefs_set_data_from_toggle, prefs_set_toggle}, + P_BOOL}, {"enable_newmsg_notify", "FALSE", &prefs_common.enable_newmsg_notify, - P_BOOL, P_WID(&receive.checkbtn_newmsg_notify), - prefs_set_data_from_toggle, prefs_set_toggle}, + P_BOOL}, {"newmsg_notify_command", NULL, &prefs_common.newmsg_notify_cmd, - P_STRING, P_WID(&receive.entry_newmsg_notify), - prefs_set_data_from_entry, prefs_set_entry}, + P_STRING}, /* Send */ - {"use_ext_sendmail", "FALSE", &prefs_common.use_extsend, P_BOOL, - P_WID(&p_send.checkbtn_extsend), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"ext_sendmail_cmd", DEFAULT_SENDMAIL_CMD, - &prefs_common.extsend_cmd, P_STRING, - P_WID(&p_send.entry_extsend), - prefs_set_data_from_entry, prefs_set_entry}, - {"save_message", "TRUE", &prefs_common.savemsg, P_BOOL, - P_WID(&p_send.checkbtn_savemsg), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"filter_sent_message", "FALSE", &prefs_common.filter_sent, P_BOOL, - P_WID(&p_send.checkbtn_filter_sent), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"outgoing_charset", CS_AUTO, &prefs_common.outgoing_charset, P_STRING, - P_WID(&p_send.optmenu_charset), - prefs_common_charset_set_data_from_optmenu, - prefs_common_charset_set_optmenu}, - {"encoding_method", "0", &prefs_common.encoding_method, P_ENUM, - P_WID(&p_send.optmenu_encoding_method), - prefs_common_encoding_set_data_from_optmenu, - prefs_common_encoding_set_optmenu}, + {"use_ext_sendmail", "FALSE", &prefs_common.use_extsend, P_BOOL}, + {"ext_sendmail_cmd", DEFAULT_SENDMAIL_CMD, &prefs_common.extsend_cmd, + P_STRING}, + {"save_message", "TRUE", &prefs_common.savemsg, P_BOOL}, + {"filter_sent_message", "FALSE", &prefs_common.filter_sent, P_BOOL}, + + {"outgoing_charset", CS_AUTO, &prefs_common.outgoing_charset, P_STRING}, + {"encoding_method", "0", &prefs_common.encoding_method, P_ENUM}, {"allow_jisx0201_kana", "FALSE", &prefs_common.allow_jisx0201_kana, - P_BOOL, NULL, NULL, NULL}, + P_BOOL}, /* Compose */ - {"auto_signature", "TRUE", &prefs_common.auto_sig, P_BOOL, - P_WID(&compose.checkbtn_autosig), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"signature_separator", "-- ", &prefs_common.sig_sep, P_STRING, - P_WID(&compose.entry_sigsep), - prefs_set_data_from_entry, prefs_set_entry}, - - {"auto_ext_editor", "FALSE", &prefs_common.auto_exteditor, P_BOOL, - P_WID(&compose.checkbtn_autoextedit), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"undo_level", "50", &prefs_common.undolevels, P_INT, - P_WID(&compose.spinbtn_undolevel), - prefs_set_data_from_spinbtn, prefs_set_spinbtn}, - - {"linewrap_length", "72", &prefs_common.linewrap_len, P_INT, - P_WID(&compose.spinbtn_linewrap), - prefs_set_data_from_spinbtn, prefs_set_spinbtn}, - {"linewrap_quotation", "FALSE", &prefs_common.linewrap_quote, P_BOOL, - P_WID(&compose.checkbtn_wrapquote), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"linewrap_auto", "FALSE", &prefs_common.autowrap, P_BOOL, - P_WID(&compose.checkbtn_autowrap), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"linewrap_before_sending", "FALSE", - &prefs_common.linewrap_at_send, P_BOOL, - P_WID(&compose.checkbtn_wrapatsend), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"reply_with_quote", "TRUE", &prefs_common.reply_with_quote, P_BOOL, - P_WID(&compose.checkbtn_quote), - prefs_set_data_from_toggle, prefs_set_toggle}, + {"auto_signature", "TRUE", &prefs_common.auto_sig, P_BOOL}, + {"signature_separator", "-- ", &prefs_common.sig_sep, P_STRING}, + + {"auto_ext_editor", "FALSE", &prefs_common.auto_exteditor, P_BOOL}, + + {"undo_level", "50", &prefs_common.undolevels, P_INT}, + + {"linewrap_length", "72", &prefs_common.linewrap_len, P_INT}, + {"linewrap_quotation", "FALSE", &prefs_common.linewrap_quote, P_BOOL}, + {"linewrap_auto", "FALSE", &prefs_common.autowrap, P_BOOL}, + {"linewrap_before_sending", "FALSE", &prefs_common.linewrap_at_send, + P_BOOL}, + + {"reply_with_quote", "TRUE", &prefs_common.reply_with_quote, P_BOOL}, {"reply_account_autoselect", "TRUE", - &prefs_common.reply_account_autosel, P_BOOL, - P_WID(&compose.checkbtn_reply_account_autosel), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"default_reply_list", "TRUE", &prefs_common.default_reply_list, P_BOOL, - P_WID(&compose.checkbtn_default_reply_list), - prefs_set_data_from_toggle, prefs_set_toggle}, + &prefs_common.reply_account_autosel, P_BOOL}, + {"default_reply_list", "TRUE", &prefs_common.default_reply_list, + P_BOOL}, - {"show_ruler", "TRUE", &prefs_common.show_ruler, P_BOOL, - NULL, NULL, NULL}, + {"show_ruler", "TRUE", &prefs_common.show_ruler, P_BOOL}, /* Quote */ - {"reply_quote_mark", "> ", &prefs_common.quotemark, P_STRING, - P_WID("e.entry_quotemark), - prefs_set_data_from_entry, prefs_set_entry}, + {"reply_quote_mark", "> ", &prefs_common.quotemark, P_STRING}, {"reply_quote_format", "On %d\\n%f wrote:\\n\\n%Q", - &prefs_common.quotefmt, P_STRING, P_WID("e.text_quotefmt), - prefs_set_data_from_text, prefs_set_text}, + &prefs_common.quotefmt, P_STRING}, - {"forward_quote_mark", "> ", &prefs_common.fw_quotemark, P_STRING, - P_WID("e.entry_fw_quotemark), - prefs_set_data_from_entry, prefs_set_entry}, + {"forward_quote_mark", "> ", &prefs_common.fw_quotemark, P_STRING}, {"forward_quote_format", "\\n\\nBegin forwarded message:\\n\\n" "?d{Date: %d\\n}?f{From: %f\\n}?t{To: %t\\n}?c{Cc: %c\\n}" "?n{Newsgroups: %n\\n}?s{Subject: %s\\n}\\n\\n%M", - &prefs_common.fw_quotefmt, P_STRING, P_WID("e.text_fw_quotefmt), - prefs_set_data_from_text, prefs_set_text}, + &prefs_common.fw_quotefmt, P_STRING}, /* Display */ - {"message_font_name", DEFAULT_MESSAGE_FONT, - &prefs_common.textfont, P_STRING, - P_WID(&display.fontbtn_textfont), - prefs_set_data_from_fontbtn, prefs_set_fontbtn}, + {"message_font_name", DEFAULT_MESSAGE_FONT, &prefs_common.textfont, + P_STRING}, {"display_folder_unread_num", "TRUE", - &prefs_common.display_folder_unread, P_BOOL, - P_WID(&display.chkbtn_folder_unread), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"newsgroup_abbrev_len", "16", - &prefs_common.ng_abbrev_len, P_INT, - P_WID(&display.spinbtn_ng_abbrev_len), - prefs_set_data_from_spinbtn, prefs_set_spinbtn}, - - {"translate_header", "TRUE", &prefs_common.trans_hdr, P_BOOL, - P_WID(&display.chkbtn_transhdr), - prefs_set_data_from_toggle, prefs_set_toggle}, + &prefs_common.display_folder_unread, P_BOOL}, + {"newsgroup_abbrev_len", "16", &prefs_common.ng_abbrev_len, P_INT}, + + {"translate_header", "TRUE", &prefs_common.trans_hdr, P_BOOL}, /* Display: Summary View */ - {"enable_swap_from", "FALSE", &prefs_common.swap_from, P_BOOL, - P_WID(&display.chkbtn_swapfrom), - prefs_set_data_from_toggle, prefs_set_toggle}, + {"enable_swap_from", "FALSE", &prefs_common.swap_from, P_BOOL}, {"date_format", "%y/%m/%d(%a) %H:%M", &prefs_common.date_format, - P_STRING, P_WID(&display.entry_datefmt), - prefs_set_data_from_entry, prefs_set_entry}, - {"expand_thread", "TRUE", &prefs_common.expand_thread, P_BOOL, - P_WID(&display.chkbtn_expand_thread), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"enable_rules_hint", "TRUE", &prefs_common.enable_rules_hint, P_BOOL, - NULL, NULL, NULL}, - {"bold_unread", "TRUE", &prefs_common.bold_unread, P_BOOL, - NULL, NULL, NULL}, - - {"toolbar_style", "3", &prefs_common.toolbar_style, P_ENUM, - NULL, NULL, NULL}, - {"show_statusbar", "TRUE", &prefs_common.show_statusbar, P_BOOL, - NULL, NULL, NULL}, + P_STRING}, + {"expand_thread", "TRUE", &prefs_common.expand_thread, P_BOOL}, + + {"enable_rules_hint", "TRUE", &prefs_common.enable_rules_hint, P_BOOL}, + {"bold_unread", "TRUE", &prefs_common.bold_unread, P_BOOL}, + + {"toolbar_style", "3", &prefs_common.toolbar_style, P_ENUM}, + {"show_statusbar", "TRUE", &prefs_common.show_statusbar, P_BOOL}, {"folderview_vscrollbar_policy", "0", - &prefs_common.folderview_vscrollbar_policy, P_ENUM, - NULL, NULL, NULL}, + &prefs_common.folderview_vscrollbar_policy, P_ENUM}, {"summary_col_show_mark", "TRUE", - &prefs_common.summary_col_visible[S_COL_MARK], P_BOOL, NULL, NULL, NULL}, + &prefs_common.summary_col_visible[S_COL_MARK], P_BOOL}, {"summary_col_show_unread", "TRUE", - &prefs_common.summary_col_visible[S_COL_UNREAD], P_BOOL, NULL, NULL, NULL}, + &prefs_common.summary_col_visible[S_COL_UNREAD], P_BOOL}, {"summary_col_show_mime", "TRUE", - &prefs_common.summary_col_visible[S_COL_MIME], P_BOOL, NULL, NULL, NULL}, + &prefs_common.summary_col_visible[S_COL_MIME], P_BOOL}, {"summary_col_show_subject", "TRUE", - &prefs_common.summary_col_visible[S_COL_SUBJECT], P_BOOL, NULL, NULL, NULL}, + &prefs_common.summary_col_visible[S_COL_SUBJECT], P_BOOL}, {"summary_col_show_from", "TRUE", - &prefs_common.summary_col_visible[S_COL_FROM], P_BOOL, NULL, NULL, NULL}, + &prefs_common.summary_col_visible[S_COL_FROM], P_BOOL}, {"summary_col_show_date", "TRUE", - &prefs_common.summary_col_visible[S_COL_DATE], P_BOOL, NULL, NULL, NULL}, + &prefs_common.summary_col_visible[S_COL_DATE], P_BOOL}, {"summary_col_show_size", "TRUE", - &prefs_common.summary_col_visible[S_COL_SIZE], P_BOOL, NULL, NULL, NULL}, + &prefs_common.summary_col_visible[S_COL_SIZE], P_BOOL}, {"summary_col_show_number", "FALSE", - &prefs_common.summary_col_visible[S_COL_NUMBER], P_BOOL, NULL, NULL, NULL}, + &prefs_common.summary_col_visible[S_COL_NUMBER], P_BOOL}, {"summary_col_pos_mark", "0", - &prefs_common.summary_col_pos[S_COL_MARK], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_pos[S_COL_MARK], P_INT}, {"summary_col_pos_unread", "1", - &prefs_common.summary_col_pos[S_COL_UNREAD], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_pos[S_COL_UNREAD], P_INT}, {"summary_col_pos_mime", "2", - &prefs_common.summary_col_pos[S_COL_MIME], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_pos[S_COL_MIME], P_INT}, {"summary_col_pos_subject", "3", - &prefs_common.summary_col_pos[S_COL_SUBJECT], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_pos[S_COL_SUBJECT], P_INT}, {"summary_col_pos_from", "4", - &prefs_common.summary_col_pos[S_COL_FROM], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_pos[S_COL_FROM], P_INT}, {"summary_col_pos_date", "5", - &prefs_common.summary_col_pos[S_COL_DATE], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_pos[S_COL_DATE], P_INT}, {"summary_col_pos_size", "6", - &prefs_common.summary_col_pos[S_COL_SIZE], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_pos[S_COL_SIZE], P_INT}, {"summary_col_pos_number", "7", - &prefs_common.summary_col_pos[S_COL_NUMBER], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_pos[S_COL_NUMBER], P_INT}, {"summary_col_size_mark", "10", - &prefs_common.summary_col_size[S_COL_MARK], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_size[S_COL_MARK], P_INT}, {"summary_col_size_unread", "13", - &prefs_common.summary_col_size[S_COL_UNREAD], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_size[S_COL_UNREAD], P_INT}, {"summary_col_size_mime", "10", - &prefs_common.summary_col_size[S_COL_MIME], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_size[S_COL_MIME], P_INT}, {"summary_col_size_subject", "200", - &prefs_common.summary_col_size[S_COL_SUBJECT], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_size[S_COL_SUBJECT], P_INT}, {"summary_col_size_from", "120", - &prefs_common.summary_col_size[S_COL_FROM], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_size[S_COL_FROM], P_INT}, {"summary_col_size_date", "118", - &prefs_common.summary_col_size[S_COL_DATE], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_size[S_COL_DATE], P_INT}, {"summary_col_size_size", "45", - &prefs_common.summary_col_size[S_COL_SIZE], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_size[S_COL_SIZE], P_INT}, {"summary_col_size_number", "40", - &prefs_common.summary_col_size[S_COL_NUMBER], P_INT, NULL, NULL, NULL}, + &prefs_common.summary_col_size[S_COL_NUMBER], P_INT}, /* Widget size */ - {"folderwin_x", "16", &prefs_common.folderwin_x, P_INT, - NULL, NULL, NULL}, - {"folderwin_y", "16", &prefs_common.folderwin_y, P_INT, - NULL, NULL, NULL}, - {"folderview_width", "179", &prefs_common.folderview_width, P_INT, - NULL, NULL, NULL}, - {"folderview_height", "450", &prefs_common.folderview_height, P_INT, - NULL, NULL, NULL}, - {"folderview_visible", "TRUE", &prefs_common.folderview_visible, P_BOOL, - NULL, NULL, NULL}, - - {"folder_col_folder", "150", &prefs_common.folder_col_folder, P_INT, - NULL, NULL, NULL}, - {"folder_col_new", "32", &prefs_common.folder_col_new, P_INT, - NULL, NULL, NULL}, - {"folder_col_unread", "32", &prefs_common.folder_col_unread, P_INT, - NULL, NULL, NULL}, - {"folder_col_total", "32", &prefs_common.folder_col_total, P_INT, - NULL, NULL, NULL}, - - {"summaryview_width", "600", &prefs_common.summaryview_width, P_INT, - NULL, NULL, NULL}, - {"summaryview_height", "157", &prefs_common.summaryview_height, P_INT, - NULL, NULL, NULL}, - - {"main_messagewin_x", "256", &prefs_common.main_msgwin_x, P_INT, - NULL, NULL, NULL}, - {"main_messagewin_y", "210", &prefs_common.main_msgwin_y, P_INT, - NULL, NULL, NULL}, - {"messageview_width", "600", &prefs_common.msgview_width, P_INT, - NULL, NULL, NULL}, - {"messageview_height", "300", &prefs_common.msgview_height, P_INT, - NULL, NULL, NULL}, - {"messageview_visible", "TRUE", &prefs_common.msgview_visible, P_BOOL, - NULL, NULL, NULL}, - - {"mainview_x", "64", &prefs_common.mainview_x, P_INT, - NULL, NULL, NULL}, - {"mainview_y", "64", &prefs_common.mainview_y, P_INT, - NULL, NULL, NULL}, - {"mainview_width", "600", &prefs_common.mainview_width, P_INT, - NULL, NULL, NULL}, - {"mainview_height", "600", &prefs_common.mainview_height, P_INT, - NULL, NULL, NULL}, - {"mainwin_x", "64", &prefs_common.mainwin_x, P_INT, - NULL, NULL, NULL}, - {"mainwin_y", "64", &prefs_common.mainwin_y, P_INT, - NULL, NULL, NULL}, - {"mainwin_width", "800", &prefs_common.mainwin_width, P_INT, - NULL, NULL, NULL}, - {"mainwin_height", "600", &prefs_common.mainwin_height, P_INT, - NULL, NULL, NULL}, - {"messagewin_width", "600", &prefs_common.msgwin_width, P_INT, - NULL, NULL, NULL}, - {"messagewin_height", "540", &prefs_common.msgwin_height, P_INT, - NULL, NULL, NULL}, - {"sourcewin_width", "600", &prefs_common.sourcewin_width, P_INT, - NULL, NULL, NULL}, - {"sourcewin_height", "500", &prefs_common.sourcewin_height, P_INT, - NULL, NULL, NULL}, - {"compose_width", "600", &prefs_common.compose_width, P_INT, - NULL, NULL, NULL}, - {"compose_height", "560", &prefs_common.compose_height, P_INT, - NULL, NULL, NULL}, + {"folderwin_x", "16", &prefs_common.folderwin_x, P_INT}, + {"folderwin_y", "16", &prefs_common.folderwin_y, P_INT}, + {"folderview_width", "179", &prefs_common.folderview_width, P_INT}, + {"folderview_height", "450", &prefs_common.folderview_height, P_INT}, + {"folderview_visible", "TRUE", &prefs_common.folderview_visible, + P_BOOL}, + + {"folder_col_folder", "150", &prefs_common.folder_col_folder, P_INT}, + {"folder_col_new", "32", &prefs_common.folder_col_new, P_INT}, + {"folder_col_unread", "32", &prefs_common.folder_col_unread, P_INT}, + {"folder_col_total", "32", &prefs_common.folder_col_total, P_INT}, + + {"summaryview_width", "600", &prefs_common.summaryview_width, P_INT}, + {"summaryview_height", "157", &prefs_common.summaryview_height, P_INT}, + + {"main_messagewin_x", "256", &prefs_common.main_msgwin_x, P_INT}, + {"main_messagewin_y", "210", &prefs_common.main_msgwin_y, P_INT}, + {"messageview_width", "600", &prefs_common.msgview_width, P_INT}, + {"messageview_height", "300", &prefs_common.msgview_height, P_INT}, + {"messageview_visible", "TRUE", &prefs_common.msgview_visible, P_BOOL}, + + {"mainview_x", "64", &prefs_common.mainview_x, P_INT}, + {"mainview_y", "64", &prefs_common.mainview_y, P_INT}, + {"mainview_width", "600", &prefs_common.mainview_width, P_INT}, + {"mainview_height", "600", &prefs_common.mainview_height, P_INT}, + {"mainwin_x", "64", &prefs_common.mainwin_x, P_INT}, + {"mainwin_y", "64", &prefs_common.mainwin_y, P_INT}, + {"mainwin_width", "800", &prefs_common.mainwin_width, P_INT}, + {"mainwin_height", "600", &prefs_common.mainwin_height, P_INT}, + {"messagewin_width", "600", &prefs_common.msgwin_width, P_INT}, + {"messagewin_height", "540", &prefs_common.msgwin_height, P_INT}, + {"sourcewin_width", "600", &prefs_common.sourcewin_width, P_INT}, + {"sourcewin_height", "500", &prefs_common.sourcewin_height, P_INT}, + {"compose_width", "600", &prefs_common.compose_width, P_INT}, + {"compose_height", "560", &prefs_common.compose_height, P_INT}, /* Message */ - {"enable_color", "TRUE", &prefs_common.enable_color, P_BOOL, - P_WID(&message.chkbtn_enablecol), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"quote_level1_color", "179", &prefs_common.quote_level1_col, P_INT, - NULL, NULL, NULL}, - {"quote_level2_color", "179", &prefs_common.quote_level2_col, P_INT, - NULL, NULL, NULL}, - {"quote_level3_color", "179", &prefs_common.quote_level3_col, P_INT, - NULL, NULL, NULL}, - {"uri_color", "32512", &prefs_common.uri_col, P_INT, - NULL, NULL, NULL}, - {"signature_color", "0", &prefs_common.sig_col, P_USHORT, - NULL, NULL, NULL}, + {"enable_color", "TRUE", &prefs_common.enable_color, P_BOOL}, + + {"quote_level1_color", "179", &prefs_common.quote_level1_col, P_INT}, + {"quote_level2_color", "179", &prefs_common.quote_level2_col, P_INT}, + {"quote_level3_color", "179", &prefs_common.quote_level3_col, P_INT}, + {"uri_color", "32512", &prefs_common.uri_col, P_INT}, + {"signature_color", "0", &prefs_common.sig_col, P_USHORT}, {"recycle_quote_colors", "FALSE", &prefs_common.recycle_quote_colors, - P_BOOL, NULL, NULL, NULL}, + P_BOOL}, - {"convert_mb_alnum", "FALSE", &prefs_common.conv_mb_alnum, P_BOOL, - P_WID(&message.chkbtn_mbalnum), - prefs_set_data_from_toggle, prefs_set_toggle}, + {"convert_mb_alnum", "FALSE", &prefs_common.conv_mb_alnum, P_BOOL}, {"display_header_pane", "TRUE", &prefs_common.display_header_pane, - P_BOOL, P_WID(&message.chkbtn_disphdrpane), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"display_header", "TRUE", &prefs_common.display_header, P_BOOL, - P_WID(&message.chkbtn_disphdr), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"render_html", "TRUE", &prefs_common.render_html, P_BOOL, - P_WID(&message.chkbtn_html), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"line_space", "2", &prefs_common.line_space, P_INT, - P_WID(&message.spinbtn_linespc), - prefs_set_data_from_spinbtn, prefs_set_spinbtn}, + P_BOOL}, + {"display_header", "TRUE", &prefs_common.display_header, P_BOOL}, + {"render_html", "TRUE", &prefs_common.render_html, P_BOOL}, + {"line_space", "2", &prefs_common.line_space, P_INT}, {"textview_cursor_visible", "FALSE", - &prefs_common.textview_cursor_visible, P_BOOL, - NULL, NULL, NULL}, - - {"enable_smooth_scroll", "FALSE", - &prefs_common.enable_smooth_scroll, P_BOOL, - P_WID(&message.chkbtn_smoothscroll), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"scroll_step", "1", &prefs_common.scroll_step, P_INT, - P_WID(&message.spinbtn_scrollstep), - prefs_set_data_from_spinbtn, prefs_set_spinbtn}, - {"scroll_half_page", "FALSE", &prefs_common.scroll_halfpage, P_BOOL, - P_WID(&message.chkbtn_halfpage), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"resize_image", "TRUE", &prefs_common.resize_image, P_BOOL, - P_WID(&message.chkbtn_resize_image), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"inline_image", "TRUE", &prefs_common.inline_image, P_BOOL, - P_WID(&message.chkbtn_inline_image), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"show_other_header", "FALSE", &prefs_common.show_other_header, P_BOOL, - NULL, NULL, NULL}, + &prefs_common.textview_cursor_visible, P_BOOL}, + + {"enable_smooth_scroll", "FALSE", &prefs_common.enable_smooth_scroll, + P_BOOL}, + {"scroll_step", "1", &prefs_common.scroll_step, P_INT}, + {"scroll_half_page", "FALSE", &prefs_common.scroll_halfpage, P_BOOL}, + + {"resize_image", "TRUE", &prefs_common.resize_image, P_BOOL}, + {"inline_image", "TRUE", &prefs_common.inline_image, P_BOOL}, + + {"show_other_header", "FALSE", &prefs_common.show_other_header, P_BOOL}, /* MIME viewer */ - {"mime_image_viewer", "display '%s'", - &prefs_common.mime_image_viewer, P_STRING, NULL, NULL, NULL}, - {"mime_audio_player", "play '%s'", - &prefs_common.mime_audio_player, P_STRING, NULL, NULL, NULL}, - {"mime_open_command", "gedit '%s'", - &prefs_common.mime_open_cmd, P_STRING, NULL, NULL, NULL}, + {"mime_image_viewer", "display '%s'", &prefs_common.mime_image_viewer, + P_STRING}, + {"mime_audio_player", "play '%s'", &prefs_common.mime_audio_player, + P_STRING}, + {"mime_open_command", "gedit '%s'", &prefs_common.mime_open_cmd, + P_STRING}, /* Junk mail */ - {"enable_junk", "FALSE", &prefs_common.enable_junk, P_BOOL, - P_WID(&junk.chkbtn_enable_junk), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"junk_learn_command", "bogofilter -s -I", - &prefs_common.junk_learncmd, P_STRING, - P_WID(&junk.entry_junk_learncmd), - prefs_set_data_from_entry, prefs_set_entry}, + {"enable_junk", "FALSE", &prefs_common.enable_junk, P_BOOL}, + {"junk_learn_command", "bogofilter -s -I", &prefs_common.junk_learncmd, + P_STRING}, {"nojunk_learn_command", "bogofilter -n -I", - &prefs_common.nojunk_learncmd, P_STRING, - P_WID(&junk.entry_nojunk_learncmd), - prefs_set_data_from_entry, prefs_set_entry}, + &prefs_common.nojunk_learncmd, P_STRING}, {"junk_classify_command", "bogofilter -I", - &prefs_common.junk_classify_cmd, P_STRING, - P_WID(&junk.entry_classify_cmd), - prefs_set_data_from_entry, prefs_set_entry}, - {"junk_folder", NULL, &prefs_common.junk_folder, P_STRING, - P_WID(&junk.entry_junkfolder), - prefs_set_data_from_entry, prefs_set_entry}, + &prefs_common.junk_classify_cmd, P_STRING}, + {"junk_folder", NULL, &prefs_common.junk_folder, P_STRING}, {"filter_junk_on_receive", "FALSE", &prefs_common.filter_junk_on_recv, - P_BOOL, P_WID(&junk.chkbtn_filter_on_recv), - prefs_set_data_from_toggle, prefs_set_toggle}, + P_BOOL}, #if USE_GPGME /* Privacy */ - {"auto_check_signatures", "TRUE", - &prefs_common.auto_check_signatures, P_BOOL, - P_WID(&privacy.checkbtn_auto_check_signatures), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"gpg_signature_popup", "FALSE", - &prefs_common.gpg_signature_popup, P_BOOL, - P_WID(&privacy.checkbtn_gpg_signature_popup), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"store_passphrase", "FALSE", &prefs_common.store_passphrase, P_BOOL, - P_WID(&privacy.checkbtn_store_passphrase), - prefs_set_data_from_toggle, prefs_set_toggle}, + {"auto_check_signatures", "TRUE", &prefs_common.auto_check_signatures, + P_BOOL}, + {"gpg_signature_popup", "FALSE", &prefs_common.gpg_signature_popup, + P_BOOL}, + {"store_passphrase", "FALSE", &prefs_common.store_passphrase, P_BOOL}, {"store_passphrase_timeout", "0", - &prefs_common.store_passphrase_timeout, P_INT, - P_WID(&privacy.spinbtn_store_passphrase), - prefs_set_data_from_spinbtn, prefs_set_spinbtn}, + &prefs_common.store_passphrase_timeout, P_INT}, #ifndef G_OS_WIN32 - {"passphrase_grab", "FALSE", &prefs_common.passphrase_grab, P_BOOL, - P_WID(&privacy.checkbtn_passphrase_grab), - prefs_set_data_from_toggle, prefs_set_toggle}, + {"passphrase_grab", "FALSE", &prefs_common.passphrase_grab, P_BOOL}, #endif /* G_OS_WIN32 */ - {"gpg_warning", "TRUE", &prefs_common.gpg_warning, P_BOOL, - P_WID(&privacy.checkbtn_gpg_warning), - prefs_set_data_from_toggle, prefs_set_toggle}, + {"gpg_warning", "TRUE", &prefs_common.gpg_warning, P_BOOL}, #endif /* USE_GPGME */ /* Interface */ - {"separate_folder", "FALSE", &prefs_common.sep_folder, P_BOOL, - NULL, NULL, NULL}, - {"separate_message", "FALSE", &prefs_common.sep_msg, P_BOOL, - NULL, NULL, NULL}, + {"separate_folder", "FALSE", &prefs_common.sep_folder, P_BOOL}, + {"separate_message", "FALSE", &prefs_common.sep_msg, P_BOOL}, {"always_show_message_when_selected", "FALSE", - &prefs_common.always_show_msg, - P_BOOL, P_WID(&interface.checkbtn_always_show_msg), - prefs_set_data_from_toggle, prefs_set_toggle}, + &prefs_common.always_show_msg, P_BOOL}, {"open_unread_on_enter", "FALSE", &prefs_common.open_unread_on_enter, - P_BOOL, P_WID(&interface.checkbtn_openunread), - prefs_set_data_from_toggle, prefs_set_toggle}, + P_BOOL}, {"mark_as_read_on_new_window", "FALSE", - &prefs_common.mark_as_read_on_new_window, - P_BOOL, P_WID(&interface.checkbtn_mark_as_read_on_newwin), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"open_inbox_on_inc", "FALSE", &prefs_common.open_inbox_on_inc, - P_BOOL, P_WID(&interface.checkbtn_openinbox), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"immediate_execution", "TRUE", &prefs_common.immediate_exec, P_BOOL, - P_WID(&interface.checkbtn_immedexec), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"receive_dialog_mode", "1", &prefs_common.recv_dialog_mode, P_ENUM, - P_WID(&interface.optmenu_recvdialog), - prefs_common_recv_dialog_set_data_from_optmenu, - prefs_common_recv_dialog_set_optmenu}, + &prefs_common.mark_as_read_on_new_window, P_BOOL}, + {"open_inbox_on_inc", "FALSE", &prefs_common.open_inbox_on_inc, P_BOOL}, + {"immediate_execution", "TRUE", &prefs_common.immediate_exec, P_BOOL}, + {"receive_dialog_mode", "1", &prefs_common.recv_dialog_mode, P_ENUM}, {"no_receive_error_panel", "FALSE", &prefs_common.no_recv_err_panel, - P_BOOL, P_WID(&interface.checkbtn_no_recv_err_panel), - prefs_set_data_from_toggle, prefs_set_toggle}, + P_BOOL}, {"close_receive_dialog", "TRUE", &prefs_common.close_recv_dialog, - P_BOOL, P_WID(&interface.checkbtn_close_recv_dialog), - prefs_set_data_from_toggle, prefs_set_toggle}, + P_BOOL}, #ifdef G_OS_WIN32 - {"comply_gnome_hig", "FALSE", &prefs_common.comply_gnome_hig, P_BOOL, + {"comply_gnome_hig", "FALSE", &prefs_common.comply_gnome_hig, P_BOOL}, #else - {"comply_gnome_hig", "TRUE", &prefs_common.comply_gnome_hig, P_BOOL, + {"comply_gnome_hig", "TRUE", &prefs_common.comply_gnome_hig, P_BOOL}, #endif - P_WID(&interface.checkbtn_comply_gnome_hig), - prefs_set_data_from_toggle, prefs_set_toggle}, /* Other */ - {"uri_open_command", DEFAULT_BROWSER_CMD, - &prefs_common.uri_cmd, P_STRING, - P_WID(&other.uri_entry), prefs_set_data_from_entry, prefs_set_entry}, - {"print_command", "lpr %s", &prefs_common.print_cmd, P_STRING, - P_WID(&other.printcmd_entry), - prefs_set_data_from_entry, prefs_set_entry}, - {"ext_editor_command", "gedit %s", - &prefs_common.ext_editor_cmd, P_STRING, - P_WID(&other.exteditor_entry), - prefs_set_data_from_entry, prefs_set_entry}, + {"uri_open_command", DEFAULT_BROWSER_CMD, &prefs_common.uri_cmd, + P_STRING}, + {"print_command", "lpr %s", &prefs_common.print_cmd, P_STRING}, + {"ext_editor_command", "gedit %s", &prefs_common.ext_editor_cmd, + P_STRING}, {"add_address_by_click", "FALSE", &prefs_common.add_address_by_click, - P_BOOL, P_WID(&other.checkbtn_addaddrbyclick), - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"confirm_on_exit", "FALSE", &prefs_common.confirm_on_exit, P_BOOL, - P_WID(&other.checkbtn_confonexit), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"clean_trash_on_exit", "FALSE", &prefs_common.clean_on_exit, P_BOOL, - P_WID(&other.checkbtn_cleanonexit), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"ask_on_cleaning", "TRUE", &prefs_common.ask_on_clean, P_BOOL, - P_WID(&other.checkbtn_askonclean), - prefs_set_data_from_toggle, prefs_set_toggle}, + P_BOOL}, + + {"confirm_on_exit", "FALSE", &prefs_common.confirm_on_exit, P_BOOL}, + {"clean_trash_on_exit", "FALSE", &prefs_common.clean_on_exit, P_BOOL}, + {"ask_on_cleaning", "TRUE", &prefs_common.ask_on_clean, P_BOOL}, {"warn_queued_on_exit", "TRUE", &prefs_common.warn_queued_on_exit, - P_BOOL, P_WID(&other.checkbtn_warnqueued), - prefs_set_data_from_toggle, prefs_set_toggle}, + P_BOOL}, {"logwindow_line_limit", "1000", &prefs_common.logwin_line_limit, - P_INT, NULL, NULL, NULL}, + P_INT}, /* Advanced */ {"strict_cache_check", "FALSE", &prefs_common.strict_cache_check, - P_BOOL, P_WID(&advanced.checkbtn_strict_cache_check), - prefs_set_data_from_toggle, prefs_set_toggle}, - {"io_timeout_secs", "60", &prefs_common.io_timeout_secs, - P_INT, P_WID(&advanced.spinbtn_iotimeout), - prefs_set_data_from_spinbtn, prefs_set_spinbtn}, + P_BOOL}, + {"io_timeout_secs", "60", &prefs_common.io_timeout_secs, P_INT}, - {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL} + {NULL, NULL, NULL, P_OTHER} }; -static void prefs_common_junk_filter_list_set (void); - -/* widget creating functions */ -static void prefs_common_create (void); -static void prefs_receive_create (void); -static void prefs_send_create (void); -static void prefs_compose_create (void); -static void prefs_quote_create (void); -static void prefs_display_create (void); -static void prefs_message_create (void); -static void prefs_junk_create (void); -#if USE_GPGME -static void prefs_privacy_create (void); -#endif -static void prefs_interface_create (void); -static void prefs_other_create (void); -static void prefs_advanced_create (void); - -static void date_format_ok_btn_clicked (GtkButton *button, - GtkWidget **widget); -static void date_format_cancel_btn_clicked (GtkButton *button, - GtkWidget **widget); -static gboolean date_format_key_pressed (GtkWidget *keywidget, - GdkEventKey *event, - GtkWidget **widget); -static gboolean date_format_on_delete (GtkWidget *dialogwidget, - GdkEventAny *event, - GtkWidget **widget); -static void date_format_entry_on_change (GtkEditable *editable, - GtkLabel *example); -static void date_format_select_row (GtkWidget *date_format_list, - gint row, - gint column, - GdkEventButton *event, - GtkWidget *date_format); -static GtkWidget *date_format_create (GtkButton *button, - void *data); - -static void prefs_quote_description_create (void); -static gboolean prefs_quote_description_key_pressed - (GtkWidget *widget, - GdkEventKey *event, - gpointer data); - -static void prefs_quote_colors_dialog (void); -static void prefs_quote_colors_dialog_create (void); -static gboolean prefs_quote_colors_key_pressed (GtkWidget *widget, - GdkEventKey *event, - gpointer data); -static void quote_color_set_dialog (GtkWidget *widget, - gpointer data); -static void quote_colors_set_dialog_ok (GtkWidget *widget, - gpointer data); -static void quote_colors_set_dialog_cancel (GtkWidget *widget, - gpointer data); -static gboolean quote_colors_set_dialog_key_pressed - (GtkWidget *widget, - GdkEventKey *event, - gpointer data); -static void set_button_bg_color (GtkWidget *widget, - gint color); -static void prefs_enable_message_color_toggled (void); -static void prefs_recycle_colors_toggled (GtkWidget *widget); - -static void prefs_keybind_select (void); -static gint prefs_keybind_deleted (GtkWidget *widget, - GdkEventAny *event, - gpointer data); -static gboolean prefs_keybind_key_pressed (GtkWidget *widget, - GdkEventKey *event, - gpointer data); -static void prefs_keybind_cancel (void); -static void prefs_keybind_apply_clicked (GtkWidget *widget); - -static void prefs_common_select_folder_cb (GtkWidget *widget, - gpointer data); - -static gint prefs_common_deleted (GtkWidget *widget, - GdkEventAny *event, - gpointer data); -static gboolean prefs_common_key_pressed (GtkWidget *widget, - GdkEventKey *event, - gpointer data); -static void prefs_common_ok (void); -static void prefs_common_apply (void); -static void prefs_common_cancel (void); + +PrefParam *prefs_common_get_params(void) +{ + return param; +} void prefs_common_read_config(void) { @@ -824,7 +359,7 @@ void prefs_common_read_config(void) prefs_common.online_mode = TRUE; - gtkut_stock_button_set_set_reverse(!prefs_common.comply_gnome_hig); + //gtkut_stock_button_set_set_reverse(!prefs_common.comply_gnome_hig); prefs_common_junk_filter_list_set(); path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMAND_HISTORY, @@ -873,26 +408,7 @@ void prefs_common_write_config(void) g_free(path); } -void prefs_common_open(void) -{ - inc_lock(); - - if (!dialog.window) { - prefs_common_create(); - } - - gtkut_box_set_reverse_order(GTK_BOX(dialog.confirm_area), - !prefs_common.comply_gnome_hig); - manage_window_set_transient(GTK_WINDOW(dialog.window)); - gtk_notebook_set_current_page(GTK_NOTEBOOK(dialog.notebook), 0); - gtk_widget_grab_focus(dialog.ok_btn); - - prefs_set_dialog(param); - - gtk_widget_show(dialog.window); -} - -static void prefs_common_junk_filter_list_set(void) +void prefs_common_junk_filter_list_set(void) { FilterRule *rule; FilterCond *cond; @@ -920,2829 +436,3 @@ static void prefs_common_junk_filter_list_set(void) prefs_common.junk_fltlist = g_slist_append(NULL, rule); } - -static void prefs_common_create(void) -{ - gint page = 0; - - debug_print(_("Creating common preferences window...\n")); - - prefs_dialog_create(&dialog); - gtk_window_set_title (GTK_WINDOW(dialog.window), - _("Common Preferences")); - g_signal_connect (G_OBJECT(dialog.window), "delete_event", - G_CALLBACK(prefs_common_deleted), NULL); - g_signal_connect (G_OBJECT(dialog.window), "key_press_event", - G_CALLBACK(prefs_common_key_pressed), NULL); - MANAGE_WINDOW_SIGNALS_CONNECT(dialog.window); - - g_signal_connect (G_OBJECT(dialog.ok_btn), "clicked", - G_CALLBACK(prefs_common_ok), NULL); - g_signal_connect (G_OBJECT(dialog.apply_btn), "clicked", - G_CALLBACK(prefs_common_apply), NULL); - g_signal_connect (G_OBJECT(dialog.cancel_btn), "clicked", - G_CALLBACK(prefs_common_cancel), NULL); - - /* create all widgets on notebook */ - prefs_receive_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Receive"), page++); - prefs_send_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Send"), page++); - prefs_compose_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Compose"), page++); - prefs_quote_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Quote"), page++); - prefs_display_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Display"), page++); - prefs_message_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Message"), page++); - prefs_junk_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Junk mail"), page++); -#if USE_GPGME - prefs_privacy_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Privacy"), page++); -#endif - prefs_interface_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Interface"), page++); - prefs_other_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Other"), page++); - prefs_advanced_create(); - SET_NOTEBOOK_LABEL(dialog.notebook, _("Advanced"), page++); - - gtk_widget_show_all(dialog.window); -} - -static void prefs_receive_create(void) -{ - GtkWidget *vbox1; - GtkWidget *vbox2; - GtkWidget *vbox3; - GtkWidget *frame_incext; - GtkWidget *checkbtn_incext; - GtkWidget *hbox; - GtkWidget *label_incext; - GtkWidget *entry_incext; - /* GtkWidget *button_incext; */ - - GtkWidget *frame_spool; - GtkWidget *checkbtn_local; - GtkWidget *checkbtn_filter_on_inc; - GtkWidget *label_spool; - GtkWidget *entry_spool; - - GtkWidget *hbox_autochk; - GtkWidget *checkbtn_autochk; - GtkWidget *label_autochk1; - GtkObject *spinbtn_autochk_adj; - GtkWidget *spinbtn_autochk; - GtkWidget *label_autochk2; - GtkWidget *checkbtn_chkonstartup; - GtkWidget *checkbtn_scan_after_inc; - GtkWidget *checkbtn_newmsg_notify; - GtkWidget *label_newmsg_notify; - GtkWidget *entry_newmsg_notify; - GtkWidget *label_notify_cmd_desc; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - PACK_FRAME_WITH_CHECK_BUTTON(vbox1, frame_incext, checkbtn_incext, - _("Use external program for incorporation")); - - vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW); - gtk_widget_show (vbox2); - gtk_container_add (GTK_CONTAINER (frame_incext), vbox2); - gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); - SET_TOGGLE_SENSITIVITY (checkbtn_incext, vbox2); - - hbox = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); - - label_incext = gtk_label_new (_("Command")); - gtk_widget_show (label_incext); - gtk_box_pack_start (GTK_BOX (hbox), label_incext, FALSE, FALSE, 0); - - entry_incext = gtk_entry_new (); - gtk_widget_show (entry_incext); - gtk_box_pack_start (GTK_BOX (hbox), entry_incext, TRUE, TRUE, 0); - -#if 0 - button_incext = gtk_button_new_with_label ("... "); - gtk_widget_show (button_incext); - gtk_box_pack_start (GTK_BOX (hbox), button_incext, FALSE, FALSE, 0); -#endif - - PACK_FRAME_WITH_CHECK_BUTTON(vbox1, frame_spool, checkbtn_local, - _("Incorporate from local spool")); - - vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW); - gtk_widget_show (vbox2); - gtk_container_add (GTK_CONTAINER (frame_spool), vbox2); - gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); - SET_TOGGLE_SENSITIVITY (checkbtn_local, vbox2); - - hbox = gtk_hbox_new (FALSE, 32); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON (hbox, checkbtn_filter_on_inc, - _("Filter on incorporation")); - - hbox = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); - - label_spool = gtk_label_new (_("Spool path")); - gtk_widget_show (label_spool); - gtk_box_pack_start (GTK_BOX (hbox), label_spool, FALSE, FALSE, 0); - - entry_spool = gtk_entry_new (); - gtk_widget_show (entry_spool); - gtk_box_pack_start (GTK_BOX (hbox), entry_spool, TRUE, TRUE, 0); - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); - - /* Auto-checking */ - hbox_autochk = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox_autochk); - gtk_box_pack_start (GTK_BOX (vbox2), hbox_autochk, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON (hbox_autochk, checkbtn_autochk, - _("Auto-check new mail")); - - label_autochk1 = gtk_label_new (_("every")); - gtk_widget_show (label_autochk1); - gtk_box_pack_start (GTK_BOX (hbox_autochk), label_autochk1, FALSE, FALSE, 0); - - spinbtn_autochk_adj = gtk_adjustment_new (5, 1, 100, 1, 10, 10); - spinbtn_autochk = gtk_spin_button_new - (GTK_ADJUSTMENT (spinbtn_autochk_adj), 1, 0); - gtk_widget_show (spinbtn_autochk); - gtk_box_pack_start (GTK_BOX (hbox_autochk), spinbtn_autochk, FALSE, FALSE, 0); - gtk_widget_set_size_request (spinbtn_autochk, 64, -1); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_autochk), TRUE); - - label_autochk2 = gtk_label_new (_("minute(s)")); - gtk_widget_show (label_autochk2); - gtk_box_pack_start (GTK_BOX (hbox_autochk), label_autochk2, FALSE, FALSE, 0); - - SET_TOGGLE_SENSITIVITY(checkbtn_autochk, label_autochk1); - SET_TOGGLE_SENSITIVITY(checkbtn_autochk, spinbtn_autochk); - SET_TOGGLE_SENSITIVITY(checkbtn_autochk, label_autochk2); - - PACK_CHECK_BUTTON (vbox2, checkbtn_chkonstartup, - _("Check new mail on startup")); - PACK_CHECK_BUTTON (vbox2, checkbtn_scan_after_inc, - _("Update all local folders after incorporation")); - - /* New message notify */ - PACK_CHECK_BUTTON (vbox2, checkbtn_newmsg_notify, - _("Execute command when new messages arrived")); - - PACK_VSPACER (vbox2, vbox3, VSPACING_NARROW_2); - - hbox = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); - - label_newmsg_notify = gtk_label_new (_("Command")); - gtk_widget_show (label_newmsg_notify); - gtk_box_pack_start (GTK_BOX (hbox), label_newmsg_notify, - FALSE, FALSE, 0); - - entry_newmsg_notify = gtk_entry_new (); - gtk_widget_show (entry_newmsg_notify); - gtk_box_pack_start (GTK_BOX (hbox), entry_newmsg_notify, TRUE, TRUE, 0); - - PACK_VSPACER (vbox2, vbox3, VSPACING_NARROW_2); - - PACK_SMALL_LABEL - (vbox2, label_notify_cmd_desc, - _("`%d' will be replaced with the number of new messages.")); - - SET_TOGGLE_SENSITIVITY (checkbtn_newmsg_notify, hbox); - SET_TOGGLE_SENSITIVITY (checkbtn_newmsg_notify, label_notify_cmd_desc); - - receive.checkbtn_incext = checkbtn_incext; - receive.entry_incext = entry_incext; - /* receive.button_incext = button_incext; */ - - receive.checkbtn_local = checkbtn_local; - receive.checkbtn_filter_on_inc = checkbtn_filter_on_inc; - receive.entry_spool = entry_spool; - - receive.checkbtn_autochk = checkbtn_autochk; - receive.spinbtn_autochk = spinbtn_autochk; - receive.spinbtn_autochk_adj = spinbtn_autochk_adj; - - receive.checkbtn_chkonstartup = checkbtn_chkonstartup; - receive.checkbtn_scan_after_inc = checkbtn_scan_after_inc; - receive.checkbtn_newmsg_notify = checkbtn_newmsg_notify; - receive.entry_newmsg_notify = entry_newmsg_notify; -} - -static void prefs_send_create(void) -{ - GtkWidget *vbox1; - GtkWidget *vbox2; - GtkWidget *frame_extsend; - GtkWidget *vbox_extsend; - GtkWidget *checkbtn_extsend; - GtkWidget *hbox1; - GtkWidget *label_extsend; - GtkWidget *entry_extsend; - /* GtkWidget *button_extsend; */ - GtkWidget *checkbtn_savemsg; - GtkWidget *checkbtn_filter_sent; - GtkWidget *label_outcharset; - GtkWidget *optmenu_charset; - GtkWidget *optmenu_menu; - GtkWidget *menuitem; - GtkWidget *label_charset_desc; - GtkWidget *optmenu_encoding; - GtkWidget *label_encoding; - GtkWidget *label_encoding_desc; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - PACK_FRAME_WITH_CHECK_BUTTON (vbox1, frame_extsend, checkbtn_extsend, - _("Use external program for sending")); - - vbox_extsend = gtk_vbox_new (FALSE, VSPACING_NARROW); - gtk_widget_show (vbox_extsend); - gtk_container_add (GTK_CONTAINER (frame_extsend), vbox_extsend); - gtk_container_set_border_width (GTK_CONTAINER (vbox_extsend), 8); - SET_TOGGLE_SENSITIVITY(checkbtn_extsend, vbox_extsend); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox_extsend), hbox1, FALSE, FALSE, 0); - - label_extsend = gtk_label_new (_("Command")); - gtk_widget_show (label_extsend); - gtk_box_pack_start (GTK_BOX (hbox1), label_extsend, FALSE, FALSE, 0); - - entry_extsend = gtk_entry_new (); - gtk_widget_show (entry_extsend); - gtk_box_pack_start (GTK_BOX (hbox1), entry_extsend, TRUE, TRUE, 0); - -#if 0 - button_extsend = gtk_button_new_with_label ("... "); - gtk_widget_show (button_extsend); - gtk_box_pack_start (GTK_BOX (hbox1), button_extsend, FALSE, FALSE, 0); -#endif - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON (vbox2, checkbtn_savemsg, - _("Save sent messages to outbox")); - PACK_CHECK_BUTTON (vbox2, checkbtn_filter_sent, - _("Apply filter rules to sent messages")); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); - - label_outcharset = gtk_label_new (_("Outgoing encoding")); - gtk_widget_show (label_outcharset); - gtk_box_pack_start (GTK_BOX (hbox1), label_outcharset, FALSE, FALSE, 0); - - optmenu_charset = gtk_option_menu_new (); - gtk_widget_show (optmenu_charset); - gtk_box_pack_start (GTK_BOX (hbox1), optmenu_charset, FALSE, FALSE, 0); - - optmenu_menu = gtk_menu_new (); - -#define SET_MENUITEM(str, data) \ -{ \ - MENUITEM_ADD(optmenu_menu, menuitem, str, data); \ -} - - SET_MENUITEM(_("Automatic (Recommended)"), CS_AUTO); - SET_MENUITEM(NULL, NULL); - SET_MENUITEM(_("7bit ascii (US-ASCII)"), CS_US_ASCII); - SET_MENUITEM(NULL, NULL); - SET_MENUITEM(_("Unicode (UTF-8)"), CS_UTF_8); - SET_MENUITEM(NULL, NULL); - SET_MENUITEM(_("Western European (ISO-8859-1)"), CS_ISO_8859_1); - SET_MENUITEM(_("Western European (ISO-8859-15)"), CS_ISO_8859_15); - SET_MENUITEM(NULL, NULL); - SET_MENUITEM(_("Central European (ISO-8859-2)"), CS_ISO_8859_2); - SET_MENUITEM(NULL, NULL); - SET_MENUITEM(_("Baltic (ISO-8859-13)"), CS_ISO_8859_13); - SET_MENUITEM(_("Baltic (ISO-8859-4)"), CS_ISO_8859_4); - SET_MENUITEM(NULL, NULL); - SET_MENUITEM(_("Greek (ISO-8859-7)"), CS_ISO_8859_7); - SET_MENUITEM(NULL, NULL); - SET_MENUITEM(_("Hebrew (ISO-8859-8)"), CS_ISO_8859_8); - SET_MENUITEM(_("Hebrew (Windows-1255)"), CS_WINDOWS_1255); - SET_MENUITEM(NULL, NULL); - SET_MENUITEM(_("Turkish (ISO-8859-9)"), CS_ISO_8859_9); - SET_MENUITEM(NULL, NULL); - SET_MENUITEM(_("Cyrillic (ISO-8859-5)"), CS_ISO_8859_5); - SET_MENUITEM(_("Cyrillic (KOI8-R)"), CS_KOI8_R); - SET_MENUITEM(_("Cyrillic (KOI8-U)"), CS_KOI8_U); - SET_MENUITEM(_("Cyrillic (Windows-1251)"), CS_WINDOWS_1251); - SET_MENUITEM(NULL, NULL); - SET_MENUITEM(_("Japanese (ISO-2022-JP)"), CS_ISO_2022_JP); -#if 0 - SET_MENUITEM(_("Japanese (EUC-JP)"), CS_EUC_JP); - SET_MENUITEM(_("Japanese (Shift_JIS)"), CS_SHIFT_JIS); -#endif /* 0 */ - SET_MENUITEM(NULL, NULL); - SET_MENUITEM(_("Simplified Chinese (GB2312)"), CS_GB2312); - SET_MENUITEM(_("Simplified Chinese (GBK)"), CS_GBK); - SET_MENUITEM(_("Traditional Chinese (Big5)"), CS_BIG5); -#if 0 - SET_MENUITEM(_("Traditional Chinese (EUC-TW)"), CS_EUC_TW); - SET_MENUITEM(_("Chinese (ISO-2022-CN)"), CS_ISO_2022_CN); -#endif /* 0 */ - SET_MENUITEM(NULL, NULL); - SET_MENUITEM(_("Korean (EUC-KR)"), CS_EUC_KR); - SET_MENUITEM(NULL, NULL); - SET_MENUITEM(_("Thai (TIS-620)"), CS_TIS_620); - SET_MENUITEM(_("Thai (Windows-874)"), CS_WINDOWS_874); - - gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_charset), - optmenu_menu); - - PACK_SMALL_LABEL (vbox1, label_charset_desc, - _("If `Automatic' is selected, the optimal encoding " - "for the current locale will be used.")); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); - - label_encoding = gtk_label_new (_("Transfer encoding")); - gtk_widget_show (label_encoding); - gtk_box_pack_start (GTK_BOX (hbox1), label_encoding, FALSE, FALSE, 0); - - optmenu_encoding = gtk_option_menu_new (); - gtk_widget_show (optmenu_encoding); - gtk_box_pack_start (GTK_BOX (hbox1), optmenu_encoding, FALSE, FALSE, 0); - - optmenu_menu = gtk_menu_new (); - - SET_MENUITEM(_("Automatic"), CTE_AUTO); - SET_MENUITEM("base64", CTE_BASE64); - SET_MENUITEM("quoted-printable", CTE_QUOTED_PRINTABLE); - SET_MENUITEM("8bit", CTE_8BIT); - - gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_encoding), - optmenu_menu); - - PACK_SMALL_LABEL (vbox1, label_encoding_desc, - _("Specify Content-Transfer-Encoding used when " - "message body contains non-ASCII characters.")); - - p_send.checkbtn_extsend = checkbtn_extsend; - p_send.entry_extsend = entry_extsend; - /* p_send.button_extsend = button_extsend; */ - - p_send.checkbtn_savemsg = checkbtn_savemsg; - p_send.checkbtn_filter_sent = checkbtn_filter_sent; - - p_send.optmenu_charset = optmenu_charset; - p_send.optmenu_encoding_method = optmenu_encoding; -} - -static void prefs_compose_create(void) -{ - GtkWidget *vbox1; - GtkWidget *hbox1; - GtkWidget *hbox2; - - GtkWidget *frame_sig; - GtkWidget *checkbtn_autosig; - GtkWidget *label_sigsep; - GtkWidget *entry_sigsep; - - GtkWidget *frame_editor; - GtkWidget *vbox2; - GtkWidget *checkbtn_autoextedit; - GtkWidget *vbox3; - GtkWidget *hbox3; - GtkWidget *hbox4; - GtkWidget *label_undolevel; - GtkObject *spinbtn_undolevel_adj; - GtkWidget *spinbtn_undolevel; - GtkWidget *label_linewrap; - GtkObject *spinbtn_linewrap_adj; - GtkWidget *spinbtn_linewrap; - GtkWidget *checkbtn_wrapquote; - GtkWidget *checkbtn_autowrap; - GtkWidget *checkbtn_wrapatsend; - - GtkWidget *frame_reply; - GtkWidget *checkbtn_reply_account_autosel; - GtkWidget *checkbtn_quote; - GtkWidget *checkbtn_default_reply_list; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - /* signature */ - - PACK_FRAME(vbox1, frame_sig, _("Signature")); - - hbox1 = gtk_hbox_new (FALSE, 32); - gtk_widget_show (hbox1); - gtk_container_add (GTK_CONTAINER (frame_sig), hbox1); - gtk_container_set_border_width (GTK_CONTAINER (hbox1), 8); - - hbox2 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox2); - gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0); - - label_sigsep = gtk_label_new (_("Signature separator")); - gtk_widget_show (label_sigsep); - gtk_box_pack_start (GTK_BOX (hbox2), label_sigsep, FALSE, FALSE, 0); - - entry_sigsep = gtk_entry_new (); - gtk_widget_show (entry_sigsep); - gtk_box_pack_start (GTK_BOX (hbox2), entry_sigsep, FALSE, FALSE, 0); - gtk_widget_set_size_request (entry_sigsep, 64, -1); - - PACK_CHECK_BUTTON (hbox1, checkbtn_autosig, _("Insert automatically")); - - PACK_FRAME (vbox1, frame_editor, _("Editor")); - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_container_add (GTK_CONTAINER (frame_editor), vbox2); - gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); - - PACK_CHECK_BUTTON (vbox2, checkbtn_autoextedit, - _("Automatically launch the external editor")); - - PACK_VSPACER (vbox2, vbox3, VSPACING_NARROW_2); - - /* undo */ - - hbox3 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox3); - gtk_box_pack_start (GTK_BOX (vbox2), hbox3, FALSE, FALSE, 0); - - label_undolevel = gtk_label_new (_("Undo level")); - gtk_widget_show (label_undolevel); - gtk_box_pack_start (GTK_BOX (hbox3), label_undolevel, FALSE, FALSE, 0); - - spinbtn_undolevel_adj = gtk_adjustment_new (50, 0, 100, 1, 10, 10); - spinbtn_undolevel = gtk_spin_button_new - (GTK_ADJUSTMENT (spinbtn_undolevel_adj), 1, 0); - gtk_widget_show (spinbtn_undolevel); - gtk_box_pack_start (GTK_BOX (hbox3), spinbtn_undolevel, FALSE, FALSE, 0); - gtk_widget_set_size_request (spinbtn_undolevel, 64, -1); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_undolevel), TRUE); - - PACK_VSPACER (vbox2, vbox3, VSPACING_NARROW_2); - - /* line-wrapping */ - - hbox3 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox3); - gtk_box_pack_start (GTK_BOX (vbox2), hbox3, FALSE, FALSE, 0); - - label_linewrap = gtk_label_new (_("Wrap messages at")); - gtk_widget_show (label_linewrap); - gtk_box_pack_start (GTK_BOX (hbox3), label_linewrap, FALSE, FALSE, 0); - - spinbtn_linewrap_adj = gtk_adjustment_new (72, 20, 1024, 1, 10, 10); - spinbtn_linewrap = gtk_spin_button_new - (GTK_ADJUSTMENT (spinbtn_linewrap_adj), 1, 0); - gtk_widget_show (spinbtn_linewrap); - gtk_box_pack_start (GTK_BOX (hbox3), spinbtn_linewrap, FALSE, FALSE, 0); - gtk_widget_set_size_request (spinbtn_linewrap, 64, -1); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_linewrap), TRUE); - - label_linewrap = gtk_label_new (_("characters")); - gtk_widget_show (label_linewrap); - gtk_box_pack_start (GTK_BOX (hbox3), label_linewrap, FALSE, FALSE, 0); - - PACK_VSPACER (vbox2, vbox3, VSPACING_NARROW_2); - - hbox4 = gtk_hbox_new (FALSE, 32); - gtk_widget_show (hbox4); - gtk_box_pack_start (GTK_BOX (vbox2), hbox4, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON (hbox4, checkbtn_wrapquote, _("Wrap quotation")); - - hbox4 = gtk_hbox_new (FALSE, 32); - gtk_widget_show (hbox4); - gtk_box_pack_start (GTK_BOX (vbox2), hbox4, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON (hbox4, checkbtn_autowrap, _("Wrap on input")); - PACK_CHECK_BUTTON - (hbox4, checkbtn_wrapatsend, _("Wrap before sending")); - - PACK_FRAME(vbox1, frame_reply, _("Reply")); - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_container_add (GTK_CONTAINER (frame_reply), vbox2); - gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); - - PACK_CHECK_BUTTON (vbox2, checkbtn_reply_account_autosel, - _("Automatically select account for replies")); - PACK_CHECK_BUTTON (vbox2, checkbtn_quote, - _("Quote message when replying")); - PACK_CHECK_BUTTON (vbox2, checkbtn_default_reply_list, - _("Reply button invokes mailing list reply")); - - compose.checkbtn_autosig = checkbtn_autosig; - compose.entry_sigsep = entry_sigsep; - - compose.checkbtn_autoextedit = checkbtn_autoextedit; - - compose.spinbtn_undolevel = spinbtn_undolevel; - compose.spinbtn_undolevel_adj = spinbtn_undolevel_adj; - - compose.spinbtn_linewrap = spinbtn_linewrap; - compose.spinbtn_linewrap_adj = spinbtn_linewrap_adj; - compose.checkbtn_wrapquote = checkbtn_wrapquote; - compose.checkbtn_autowrap = checkbtn_autowrap; - compose.checkbtn_wrapatsend = checkbtn_wrapatsend; - - compose.checkbtn_quote = checkbtn_quote; - compose.checkbtn_reply_account_autosel = - checkbtn_reply_account_autosel; - compose.checkbtn_default_reply_list = checkbtn_default_reply_list; -} - -static void prefs_quote_create(void) -{ - GtkWidget *vbox1; - GtkWidget *frame_quote; - GtkWidget *vbox_quote; - GtkWidget *hbox1; - GtkWidget *hbox2; - GtkWidget *label_quotemark; - GtkWidget *entry_quotemark; - GtkWidget *scrolledwin_quotefmt; - GtkWidget *text_quotefmt; - - GtkWidget *entry_fw_quotemark; - GtkWidget *text_fw_quotefmt; - - GtkWidget *btn_quotedesc; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - /* reply */ - - PACK_FRAME (vbox1, frame_quote, _("Reply format")); - - vbox_quote = gtk_vbox_new (FALSE, VSPACING_NARROW); - gtk_widget_show (vbox_quote); - gtk_container_add (GTK_CONTAINER (frame_quote), vbox_quote); - gtk_container_set_border_width (GTK_CONTAINER (vbox_quote), 8); - - hbox1 = gtk_hbox_new (FALSE, 32); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox_quote), hbox1, FALSE, FALSE, 0); - - hbox2 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox2); - gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0); - - label_quotemark = gtk_label_new (_("Quotation mark")); - gtk_widget_show (label_quotemark); - gtk_box_pack_start (GTK_BOX (hbox2), label_quotemark, FALSE, FALSE, 0); - - entry_quotemark = gtk_entry_new (); - gtk_widget_show (entry_quotemark); - gtk_box_pack_start (GTK_BOX (hbox2), entry_quotemark, FALSE, FALSE, 0); - gtk_widget_set_size_request (entry_quotemark, 64, -1); - - scrolledwin_quotefmt = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_show (scrolledwin_quotefmt); - gtk_box_pack_start (GTK_BOX (vbox_quote), scrolledwin_quotefmt, - TRUE, TRUE, 0); - gtk_scrolled_window_set_policy - (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt), - GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); - gtk_scrolled_window_set_shadow_type - (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt), GTK_SHADOW_IN); - - text_quotefmt = gtk_text_view_new (); - gtk_widget_show (text_quotefmt); - gtk_container_add(GTK_CONTAINER(scrolledwin_quotefmt), text_quotefmt); - gtk_text_view_set_editable (GTK_TEXT_VIEW (text_quotefmt), TRUE); - gtk_widget_set_size_request(text_quotefmt, -1, 60); - - /* forward */ - - PACK_FRAME (vbox1, frame_quote, _("Forward format")); - - vbox_quote = gtk_vbox_new (FALSE, VSPACING_NARROW); - gtk_widget_show (vbox_quote); - gtk_container_add (GTK_CONTAINER (frame_quote), vbox_quote); - gtk_container_set_border_width (GTK_CONTAINER (vbox_quote), 8); - - hbox1 = gtk_hbox_new (FALSE, 32); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox_quote), hbox1, FALSE, FALSE, 0); - - hbox2 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox2); - gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0); - - label_quotemark = gtk_label_new (_("Quotation mark")); - gtk_widget_show (label_quotemark); - gtk_box_pack_start (GTK_BOX (hbox2), label_quotemark, FALSE, FALSE, 0); - - entry_fw_quotemark = gtk_entry_new (); - gtk_widget_show (entry_fw_quotemark); - gtk_box_pack_start (GTK_BOX (hbox2), entry_fw_quotemark, - FALSE, FALSE, 0); - gtk_widget_set_size_request (entry_fw_quotemark, 64, -1); - - scrolledwin_quotefmt = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_show (scrolledwin_quotefmt); - gtk_box_pack_start (GTK_BOX (vbox_quote), scrolledwin_quotefmt, - TRUE, TRUE, 0); - gtk_scrolled_window_set_policy - (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt), - GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); - gtk_scrolled_window_set_shadow_type - (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt), GTK_SHADOW_IN); - - text_fw_quotefmt = gtk_text_view_new (); - gtk_widget_show (text_fw_quotefmt); - gtk_container_add(GTK_CONTAINER(scrolledwin_quotefmt), - text_fw_quotefmt); - gtk_text_view_set_editable (GTK_TEXT_VIEW (text_fw_quotefmt), TRUE); - gtk_widget_set_size_request (text_fw_quotefmt, -1, 60); - - hbox1 = gtk_hbox_new (FALSE, 32); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); - - btn_quotedesc = - gtk_button_new_with_label (_(" Description of symbols ")); - gtk_widget_show (btn_quotedesc); - gtk_box_pack_start (GTK_BOX (hbox1), btn_quotedesc, FALSE, FALSE, 0); - g_signal_connect(G_OBJECT(btn_quotedesc), "clicked", - G_CALLBACK(prefs_quote_description), NULL); - - quote.entry_quotemark = entry_quotemark; - quote.text_quotefmt = text_quotefmt; - quote.entry_fw_quotemark = entry_fw_quotemark; - quote.text_fw_quotefmt = text_fw_quotefmt; -} - -static void prefs_display_create(void) -{ - GtkWidget *vbox1; - GtkWidget *frame_font; - GtkWidget *table1; - GtkWidget *label_textfont; - GtkWidget *fontbtn_textfont; - GtkWidget *chkbtn_transhdr; - GtkWidget *chkbtn_folder_unread; - GtkWidget *hbox1; - GtkWidget *label_ng_abbrev; - GtkWidget *spinbtn_ng_abbrev_len; - GtkObject *spinbtn_ng_abbrev_len_adj; - GtkWidget *frame_summary; - GtkWidget *vbox2; - GtkWidget *chkbtn_swapfrom; - GtkWidget *chkbtn_expand_thread; - GtkWidget *vbox3; - GtkWidget *label_datefmt; - GtkWidget *button_datefmt; - GtkWidget *entry_datefmt; - GtkWidget *button_dispitem; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - PACK_FRAME(vbox1, frame_font, _("Font")); - - table1 = gtk_table_new (1, 2, FALSE); - gtk_widget_show (table1); - gtk_container_add (GTK_CONTAINER (frame_font), table1); - gtk_container_set_border_width (GTK_CONTAINER (table1), 8); - gtk_table_set_row_spacings (GTK_TABLE (table1), 8); - gtk_table_set_col_spacings (GTK_TABLE (table1), 8); - - label_textfont = gtk_label_new (_("Text")); - gtk_widget_show (label_textfont); - gtk_table_attach (GTK_TABLE (table1), label_textfont, 0, 1, 0, 1, - GTK_FILL, (GTK_EXPAND | GTK_FILL), 0, 0); - - fontbtn_textfont = gtk_font_button_new (); - gtk_widget_show (fontbtn_textfont); - gtk_table_attach (GTK_TABLE (table1), fontbtn_textfont, 1, 2, 0, 1, - (GTK_EXPAND | GTK_FILL), 0, 0, 0); - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, TRUE, 0); - - PACK_CHECK_BUTTON - (vbox2, chkbtn_transhdr, - _("Translate header name (such as `From:', `Subject:')")); - - PACK_CHECK_BUTTON (vbox2, chkbtn_folder_unread, - _("Display unread number next to folder name")); - - PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0); - - label_ng_abbrev = gtk_label_new - (_("Abbreviate newsgroups longer than")); - gtk_widget_show (label_ng_abbrev); - gtk_box_pack_start (GTK_BOX (hbox1), label_ng_abbrev, FALSE, FALSE, 0); - - spinbtn_ng_abbrev_len_adj = gtk_adjustment_new (16, 0, 999, 1, 10, 10); - spinbtn_ng_abbrev_len = gtk_spin_button_new - (GTK_ADJUSTMENT (spinbtn_ng_abbrev_len_adj), 1, 0); - gtk_widget_show (spinbtn_ng_abbrev_len); - gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_ng_abbrev_len, - FALSE, FALSE, 0); - gtk_widget_set_size_request (spinbtn_ng_abbrev_len, 56, -1); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_ng_abbrev_len), - TRUE); - - label_ng_abbrev = gtk_label_new - (_("letters")); - gtk_widget_show (label_ng_abbrev); - gtk_box_pack_start (GTK_BOX (hbox1), label_ng_abbrev, FALSE, FALSE, 0); - - /* ---- Summary ---- */ - - PACK_FRAME(vbox1, frame_summary, _("Summary View")); - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_container_add (GTK_CONTAINER (frame_summary), vbox2); - gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); - - PACK_CHECK_BUTTON - (vbox2, chkbtn_swapfrom, - _("Display recipient on `From' column if sender is yourself")); - PACK_CHECK_BUTTON - (vbox2, chkbtn_expand_thread, _("Expand threads")); - - PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0); - - label_datefmt = gtk_label_new (_("Date format")); - gtk_widget_show (label_datefmt); - gtk_box_pack_start (GTK_BOX (hbox1), label_datefmt, FALSE, FALSE, 0); - - entry_datefmt = gtk_entry_new (); - gtk_widget_show (entry_datefmt); - gtk_box_pack_start (GTK_BOX (hbox1), entry_datefmt, TRUE, TRUE, 0); - - button_datefmt = gtk_button_new_with_label ("... "); - gtk_widget_show (button_datefmt); - gtk_box_pack_start (GTK_BOX (hbox1), button_datefmt, FALSE, FALSE, 0); - g_signal_connect (G_OBJECT (button_datefmt), "clicked", - G_CALLBACK (date_format_create), NULL); - - PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0); - - button_dispitem = gtk_button_new_with_label - (_(" Set display item of summary... ")); - gtk_widget_show (button_dispitem); - gtk_box_pack_start (GTK_BOX (hbox1), button_dispitem, FALSE, TRUE, 0); - g_signal_connect (G_OBJECT (button_dispitem), "clicked", - G_CALLBACK (prefs_summary_column_open), NULL); - - display.fontbtn_textfont = fontbtn_textfont; - - display.chkbtn_transhdr = chkbtn_transhdr; - display.chkbtn_folder_unread = chkbtn_folder_unread; - display.spinbtn_ng_abbrev_len = spinbtn_ng_abbrev_len; - display.spinbtn_ng_abbrev_len_adj = spinbtn_ng_abbrev_len_adj; - - display.chkbtn_swapfrom = chkbtn_swapfrom; - display.chkbtn_expand_thread = chkbtn_expand_thread; - display.entry_datefmt = entry_datefmt; -} - -static void prefs_message_create(void) -{ - GtkWidget *vbox1; - GtkWidget *vbox2; - GtkWidget *vbox3; - GtkWidget *hbox1; - GtkWidget *chkbtn_enablecol; - GtkWidget *button_edit_col; - GtkWidget *chkbtn_mbalnum; - GtkWidget *chkbtn_disphdrpane; - GtkWidget *chkbtn_disphdr; - GtkWidget *button_edit_disphdr; - GtkWidget *chkbtn_html; - GtkWidget *hbox_linespc; - GtkWidget *label_linespc; - GtkObject *spinbtn_linespc_adj; - GtkWidget *spinbtn_linespc; - - GtkWidget *frame_scr; - GtkWidget *vbox_scr; - GtkWidget *chkbtn_smoothscroll; - GtkWidget *hbox_scr; - GtkWidget *label_scr; - GtkObject *spinbtn_scrollstep_adj; - GtkWidget *spinbtn_scrollstep; - GtkWidget *chkbtn_halfpage; - - GtkWidget *frame_image; - GtkWidget *vbox_image; - GtkWidget *chkbtn_resize_image; - GtkWidget *chkbtn_inline_image; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0); - - PACK_CHECK_BUTTON (hbox1, chkbtn_enablecol, - _("Enable coloration of message")); - g_signal_connect(G_OBJECT(chkbtn_enablecol), "toggled", - G_CALLBACK(prefs_enable_message_color_toggled), NULL); - - button_edit_col = gtk_button_new_with_label (_(" Edit... ")); - gtk_widget_show (button_edit_col); - gtk_box_pack_end (GTK_BOX (hbox1), button_edit_col, FALSE, TRUE, 0); - g_signal_connect (G_OBJECT (button_edit_col), "clicked", - G_CALLBACK (prefs_quote_colors_dialog), NULL); - - SET_TOGGLE_SENSITIVITY(chkbtn_enablecol, button_edit_col); - - PACK_CHECK_BUTTON - (vbox2, chkbtn_mbalnum, - _("Display multi-byte alphabet and numeric as\n" - "ASCII character (Japanese only)")); - gtk_label_set_justify (GTK_LABEL (GTK_BIN(chkbtn_mbalnum)->child), - GTK_JUSTIFY_LEFT); - - PACK_CHECK_BUTTON(vbox2, chkbtn_disphdrpane, - _("Display header pane above message view")); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0); - - PACK_CHECK_BUTTON(hbox1, chkbtn_disphdr, - _("Display short headers on message view")); - - button_edit_disphdr = gtk_button_new_with_label (_(" Edit... ")); - gtk_widget_show (button_edit_disphdr); - gtk_box_pack_end (GTK_BOX (hbox1), button_edit_disphdr, - FALSE, TRUE, 0); - g_signal_connect (G_OBJECT (button_edit_disphdr), "clicked", - G_CALLBACK (prefs_display_header_open), NULL); - - SET_TOGGLE_SENSITIVITY(chkbtn_disphdr, button_edit_disphdr); - - PACK_CHECK_BUTTON(vbox2, chkbtn_html, - _("Render HTML messages as text")); - -#if 0 - PACK_CHECK_BUTTON(vbox2, chkbtn_cursor, - _("Display cursor in message view")); -#endif - - PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2); - - hbox1 = gtk_hbox_new (FALSE, 32); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0); - - hbox_linespc = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (hbox1), hbox_linespc, FALSE, TRUE, 0); - - label_linespc = gtk_label_new (_("Line space")); - gtk_widget_show (label_linespc); - gtk_box_pack_start (GTK_BOX (hbox_linespc), label_linespc, - FALSE, FALSE, 0); - - spinbtn_linespc_adj = gtk_adjustment_new (2, 0, 16, 1, 1, 16); - spinbtn_linespc = gtk_spin_button_new - (GTK_ADJUSTMENT (spinbtn_linespc_adj), 1, 0); - gtk_widget_show (spinbtn_linespc); - gtk_box_pack_start (GTK_BOX (hbox_linespc), spinbtn_linespc, - FALSE, FALSE, 0); - gtk_widget_set_size_request (spinbtn_linespc, 64, -1); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_linespc), TRUE); - - label_linespc = gtk_label_new (_("pixel(s)")); - gtk_widget_show (label_linespc); - gtk_box_pack_start (GTK_BOX (hbox_linespc), label_linespc, - FALSE, FALSE, 0); - - PACK_FRAME(vbox1, frame_scr, _("Scroll")); - - vbox_scr = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox_scr); - gtk_container_add (GTK_CONTAINER (frame_scr), vbox_scr); - gtk_container_set_border_width (GTK_CONTAINER (vbox_scr), 8); - - PACK_CHECK_BUTTON(vbox_scr, chkbtn_halfpage, _("Half page")); - - hbox1 = gtk_hbox_new (FALSE, 32); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox_scr), hbox1, FALSE, TRUE, 0); - - PACK_CHECK_BUTTON(hbox1, chkbtn_smoothscroll, _("Smooth scroll")); - - hbox_scr = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox_scr); - gtk_box_pack_start (GTK_BOX (hbox1), hbox_scr, FALSE, FALSE, 0); - - label_scr = gtk_label_new (_("Step")); - gtk_widget_show (label_scr); - gtk_box_pack_start (GTK_BOX (hbox_scr), label_scr, FALSE, FALSE, 0); - - spinbtn_scrollstep_adj = gtk_adjustment_new (1, 1, 100, 1, 10, 10); - spinbtn_scrollstep = gtk_spin_button_new - (GTK_ADJUSTMENT (spinbtn_scrollstep_adj), 1, 0); - gtk_widget_show (spinbtn_scrollstep); - gtk_box_pack_start (GTK_BOX (hbox_scr), spinbtn_scrollstep, - FALSE, FALSE, 0); - gtk_widget_set_size_request (spinbtn_scrollstep, 64, -1); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_scrollstep), - TRUE); - - label_scr = gtk_label_new (_("pixel(s)")); - gtk_widget_show (label_scr); - gtk_box_pack_start (GTK_BOX (hbox_scr), label_scr, FALSE, FALSE, 0); - - SET_TOGGLE_SENSITIVITY (chkbtn_smoothscroll, hbox_scr) - - PACK_FRAME(vbox1, frame_image, _("Images")); - - vbox_image = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox_image); - gtk_container_add (GTK_CONTAINER (frame_image), vbox_image); - gtk_container_set_border_width (GTK_CONTAINER (vbox_image), 8); - - PACK_CHECK_BUTTON(vbox_image, chkbtn_resize_image, - _("Resize attached large images to fit in the window")); - PACK_CHECK_BUTTON(vbox_image, chkbtn_inline_image, - _("Display images as inline")); - - message.chkbtn_enablecol = chkbtn_enablecol; - message.button_edit_col = button_edit_col; - message.chkbtn_mbalnum = chkbtn_mbalnum; - message.chkbtn_disphdrpane = chkbtn_disphdrpane; - message.chkbtn_disphdr = chkbtn_disphdr; - message.chkbtn_html = chkbtn_html; - message.spinbtn_linespc = spinbtn_linespc; - - message.chkbtn_smoothscroll = chkbtn_smoothscroll; - message.spinbtn_scrollstep = spinbtn_scrollstep; - message.spinbtn_scrollstep_adj = spinbtn_scrollstep_adj; - message.chkbtn_halfpage = chkbtn_halfpage; - - message.chkbtn_resize_image = chkbtn_resize_image; - message.chkbtn_inline_image = chkbtn_inline_image; -} - -static void prefs_junk_create(void) -{ - GtkWidget *vbox1; - GtkWidget *vbox2; - GtkWidget *frame; - GtkWidget *hbox; - GtkWidget *chkbtn_enable_junk; - GtkWidget *label; - GtkWidget *entry_junk_learncmd; - GtkWidget *entry_nojunk_learncmd; - GtkWidget *entry_classify_cmd; - GtkWidget *vbox3; - GtkWidget *entry_junkfolder; - GtkWidget *btn_folder; - GtkWidget *chkbtn_filter_on_recv; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - PACK_FRAME_WITH_CHECK_BUTTON(vbox1, frame, chkbtn_enable_junk, - _("Enable Junk mail control")); - - vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW); - gtk_widget_show (vbox2); - gtk_container_add (GTK_CONTAINER (frame), vbox2); - gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); - SET_TOGGLE_SENSITIVITY (chkbtn_enable_junk, vbox2); - - label = gtk_label_new (_("Learning command:")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); - - hbox = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); - - label = gtk_label_new (_("Junk")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - entry_junk_learncmd = gtk_entry_new (); - gtk_widget_show (entry_junk_learncmd); - gtk_box_pack_start (GTK_BOX (hbox), entry_junk_learncmd, TRUE, TRUE, 0); - - hbox = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); - - label = gtk_label_new (_("Not Junk")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - entry_nojunk_learncmd = gtk_entry_new (); - gtk_widget_show (entry_nojunk_learncmd); - gtk_box_pack_start (GTK_BOX (hbox), entry_nojunk_learncmd, - TRUE, TRUE, 0); - - PACK_VSPACER(vbox2, vbox3, 0); - - hbox = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); - - label = gtk_label_new (_("Classifying command")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - entry_classify_cmd = gtk_entry_new (); - gtk_widget_show (entry_classify_cmd); - gtk_box_pack_start (GTK_BOX (hbox), entry_classify_cmd, TRUE, TRUE, 0); - - PACK_VSPACER(vbox2, vbox3, 0); - - hbox = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); - - label = gtk_label_new (_("Junk folder")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - entry_junkfolder = gtk_entry_new (); - gtk_widget_show (entry_junkfolder); - gtk_box_pack_start (GTK_BOX (hbox), entry_junkfolder, TRUE, TRUE, 0); - - btn_folder = gtk_button_new_with_label (_(" ... ")); - gtk_widget_show (btn_folder); - gtk_box_pack_start (GTK_BOX (hbox), btn_folder, FALSE, FALSE, 0); - g_signal_connect (G_OBJECT (btn_folder), "clicked", - G_CALLBACK (prefs_common_select_folder_cb), - entry_junkfolder); - - PACK_VSPACER(vbox2, vbox3, 0); - - PACK_SMALL_LABEL (vbox2, label, - _("The messages which are set as junk mail " - "will be moved to this folder.")); - - PACK_VSPACER(vbox2, vbox3, 0); - - PACK_CHECK_BUTTON(vbox2, chkbtn_filter_on_recv, - _("Filter messages classified as junk on receiving")); - - PACK_SMALL_LABEL - (vbox2, label, - _("Filtered messages will be moved to the junk folder and " - "deleted from the server.")); - - junk.chkbtn_enable_junk = chkbtn_enable_junk; - junk.entry_junk_learncmd = entry_junk_learncmd; - junk.entry_nojunk_learncmd = entry_nojunk_learncmd; - junk.entry_classify_cmd = entry_classify_cmd; - junk.entry_junkfolder = entry_junkfolder; - junk.chkbtn_filter_on_recv = chkbtn_filter_on_recv; -} - -#if USE_GPGME -static void prefs_privacy_create(void) -{ - GtkWidget *vbox1; - GtkWidget *vbox2; - GtkWidget *vbox3; - GtkWidget *hbox1; - GtkWidget *hbox_spc; - GtkWidget *label; - GtkWidget *checkbtn_auto_check_signatures; - GtkWidget *checkbtn_gpg_signature_popup; - GtkWidget *checkbtn_store_passphrase; - GtkObject *spinbtn_store_passphrase_adj; - GtkWidget *spinbtn_store_passphrase; - GtkWidget *checkbtn_passphrase_grab; - GtkWidget *checkbtn_gpg_warning; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON (vbox2, checkbtn_auto_check_signatures, - _("Automatically check signatures")); - - PACK_CHECK_BUTTON (vbox2, checkbtn_gpg_signature_popup, - _("Show signature check result in a popup window")); - - PACK_CHECK_BUTTON (vbox2, checkbtn_store_passphrase, - _("Store passphrase in memory temporarily")); - - vbox3 = gtk_vbox_new (FALSE, VSPACING_NARROW); - gtk_widget_show (vbox3); - gtk_box_pack_start (GTK_BOX (vbox2), vbox3, FALSE, FALSE, 0); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0); - - hbox_spc = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox_spc); - gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0); - gtk_widget_set_size_request (hbox_spc, 12, -1); - - label = gtk_label_new (_("Expired after")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); - - spinbtn_store_passphrase_adj = gtk_adjustment_new (0, 0, 1440, 1, 5, 5); - spinbtn_store_passphrase = gtk_spin_button_new - (GTK_ADJUSTMENT (spinbtn_store_passphrase_adj), 1, 0); - gtk_widget_show (spinbtn_store_passphrase); - gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_store_passphrase, FALSE, FALSE, 0); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_store_passphrase), - TRUE); - gtk_widget_set_size_request (spinbtn_store_passphrase, 64, -1); - - label = gtk_label_new (_("minute(s) ")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0); - - hbox_spc = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox_spc); - gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0); - gtk_widget_set_size_request (hbox_spc, 12, -1); - - PACK_SMALL_LABEL (hbox1, label, - _("Setting to '0' will store the passphrase " - "for the whole session.")); - - SET_TOGGLE_SENSITIVITY (checkbtn_store_passphrase, vbox3); - - PACK_VSPACER (vbox2, vbox3, VSPACING_NARROW_2); - -#ifndef G_OS_WIN32 - PACK_CHECK_BUTTON (vbox2, checkbtn_passphrase_grab, - _("Grab input while entering a passphrase")); -#endif - - PACK_CHECK_BUTTON - (vbox2, checkbtn_gpg_warning, - _("Display warning on startup if GnuPG doesn't work")); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); - - privacy.checkbtn_auto_check_signatures - = checkbtn_auto_check_signatures; - privacy.checkbtn_gpg_signature_popup - = checkbtn_gpg_signature_popup; - privacy.checkbtn_store_passphrase = checkbtn_store_passphrase; - privacy.spinbtn_store_passphrase = spinbtn_store_passphrase; - privacy.spinbtn_store_passphrase_adj = spinbtn_store_passphrase_adj; - privacy.checkbtn_passphrase_grab = checkbtn_passphrase_grab; - privacy.checkbtn_gpg_warning = checkbtn_gpg_warning; -} -#endif /* USE_GPGME */ - -static void prefs_interface_create(void) -{ - GtkWidget *vbox1; - GtkWidget *vbox2; - GtkWidget *vbox3; - GtkWidget *checkbtn_always_show_msg; - GtkWidget *checkbtn_openunread; - GtkWidget *checkbtn_mark_as_read_on_newwin; - GtkWidget *checkbtn_openinbox; - GtkWidget *checkbtn_immedexec; - GtkWidget *frame_recv; - GtkWidget *vbox_recv; - GtkWidget *hbox1; - GtkWidget *hbox_spc; - GtkWidget *label; - GtkWidget *optmenu_recvdialog; - GtkWidget *menu; - GtkWidget *menuitem; - GtkWidget *checkbtn_no_recv_err_panel; - GtkWidget *checkbtn_close_recv_dialog; - GtkWidget *checkbtn_comply_gnome_hig; - - GtkWidget *button_keybind; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON - (vbox2, checkbtn_always_show_msg, - _("Always open messages in summary when selected")); - - PACK_CHECK_BUTTON - (vbox2, checkbtn_openunread, - _("Open first unread message when entering a folder")); - - PACK_CHECK_BUTTON - (vbox2, checkbtn_mark_as_read_on_newwin, - _("Only mark message as read when opened in new window")); - - PACK_CHECK_BUTTON - (vbox2, checkbtn_openinbox, - _("Go to inbox after receiving new mail")); - - vbox3 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox3); - gtk_box_pack_start (GTK_BOX (vbox2), vbox3, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON - (vbox3, checkbtn_immedexec, - _("Execute immediately when moving or deleting messages")); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0); - - hbox_spc = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox_spc); - gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0); - gtk_widget_set_size_request (hbox_spc, 12, -1); - - PACK_SMALL_LABEL (hbox1, label, - _("Messages will be marked until execution " - "if this is turned off.")); - - PACK_FRAME (vbox1, frame_recv, _("Receive dialog")); - vbox_recv = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox_recv); - gtk_container_add (GTK_CONTAINER (frame_recv), vbox_recv); - gtk_container_set_border_width (GTK_CONTAINER (vbox_recv), 8); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox_recv), hbox1, FALSE, FALSE, 0); - - label = gtk_label_new (_("Show receive dialog")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); - - optmenu_recvdialog = gtk_option_menu_new (); - gtk_widget_show (optmenu_recvdialog); - gtk_box_pack_start (GTK_BOX (hbox1), optmenu_recvdialog, - FALSE, FALSE, 0); - - menu = gtk_menu_new (); - MENUITEM_ADD (menu, menuitem, _("Always"), RECV_DIALOG_ALWAYS); - MENUITEM_ADD (menu, menuitem, _("Only on manual receiving"), - RECV_DIALOG_MANUAL); - MENUITEM_ADD (menu, menuitem, _("Never"), RECV_DIALOG_NEVER); - - gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_recvdialog), menu); - - PACK_CHECK_BUTTON (vbox_recv, checkbtn_no_recv_err_panel, - _("Don't popup error dialog on receive error")); - - PACK_CHECK_BUTTON (vbox_recv, checkbtn_close_recv_dialog, - _("Close receive dialog when finished")); - - PACK_CHECK_BUTTON (vbox1, checkbtn_comply_gnome_hig, - _("Make the order of buttons comply with GNOME HIG")); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); - - button_keybind = gtk_button_new_with_label (_(" Set key bindings... ")); - gtk_widget_show (button_keybind); - gtk_box_pack_start (GTK_BOX (hbox1), button_keybind, FALSE, FALSE, 0); - g_signal_connect (G_OBJECT (button_keybind), "clicked", - G_CALLBACK (prefs_keybind_select), NULL); - - interface.checkbtn_always_show_msg = checkbtn_always_show_msg; - interface.checkbtn_openunread = checkbtn_openunread; - interface.checkbtn_mark_as_read_on_newwin - = checkbtn_mark_as_read_on_newwin; - interface.checkbtn_openinbox = checkbtn_openinbox; - interface.checkbtn_immedexec = checkbtn_immedexec; - interface.optmenu_recvdialog = optmenu_recvdialog; - interface.checkbtn_no_recv_err_panel = checkbtn_no_recv_err_panel; - interface.checkbtn_close_recv_dialog = checkbtn_close_recv_dialog; - - interface.checkbtn_comply_gnome_hig = checkbtn_comply_gnome_hig; -} - -static void prefs_other_create(void) -{ - GtkWidget *vbox1; - GtkWidget *ext_frame; - GtkWidget *ext_table; - GtkWidget *hbox1; - - GtkWidget *uri_label; - GtkWidget *uri_combo; - GtkWidget *uri_entry; - - GtkWidget *printcmd_label; - GtkWidget *printcmd_entry; - - GtkWidget *exteditor_label; - GtkWidget *exteditor_combo; - GtkWidget *exteditor_entry; - - GtkWidget *frame_addr; - GtkWidget *vbox_addr; - GtkWidget *checkbtn_addaddrbyclick; - - GtkWidget *frame_exit; - GtkWidget *vbox_exit; - GtkWidget *checkbtn_confonexit; - GtkWidget *checkbtn_cleanonexit; - GtkWidget *checkbtn_askonclean; - GtkWidget *checkbtn_warnqueued; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - PACK_FRAME(vbox1, ext_frame, - _("External commands (%s will be replaced with file name / URI)")); - - ext_table = gtk_table_new (3, 2, FALSE); - gtk_widget_show (ext_table); - gtk_container_add (GTK_CONTAINER (ext_frame), ext_table); - gtk_container_set_border_width (GTK_CONTAINER (ext_table), 8); - gtk_table_set_row_spacings (GTK_TABLE (ext_table), VSPACING_NARROW); - gtk_table_set_col_spacings (GTK_TABLE (ext_table), 8); - - uri_label = gtk_label_new (_("Web browser")); - gtk_widget_show(uri_label); - gtk_table_attach (GTK_TABLE (ext_table), uri_label, 0, 1, 0, 1, - GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_misc_set_alignment (GTK_MISC (uri_label), 1, 0.5); - - uri_combo = gtk_combo_new (); - gtk_widget_show (uri_combo); - gtk_table_attach (GTK_TABLE (ext_table), uri_combo, 1, 2, 0, 1, - GTK_EXPAND | GTK_FILL, 0, 0, 0); - gtkut_combo_set_items (GTK_COMBO (uri_combo), - DEFAULT_BROWSER_CMD, - "mozilla-firefox '%s'", - "mozilla -remote 'openURL(%s,new-window)'", - "mozilla '%s'", - "netscape -remote 'openURL(%s,new-window)'", - "netscape '%s'", - "gnome-moz-remote --newwin '%s'", - "rxvt -e w3m '%s'", - "rxvt -e lynx '%s'", - NULL); - uri_entry = GTK_COMBO (uri_combo)->entry; - - printcmd_label = gtk_label_new (_("Print")); - gtk_widget_show (printcmd_label); - gtk_table_attach (GTK_TABLE (ext_table), printcmd_label, 0, 1, 1, 2, - GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_misc_set_alignment (GTK_MISC (printcmd_label), 1, 0.5); - - printcmd_entry = gtk_entry_new (); - gtk_widget_show (printcmd_entry); - gtk_table_attach (GTK_TABLE (ext_table), printcmd_entry, 1, 2, 1, 2, - GTK_EXPAND | GTK_FILL, 0, 0, 0); - - exteditor_label = gtk_label_new (_("Editor")); - gtk_widget_show (exteditor_label); - gtk_table_attach (GTK_TABLE (ext_table), exteditor_label, 0, 1, 2, 3, - GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_misc_set_alignment (GTK_MISC (exteditor_label), 1, 0.5); - - exteditor_combo = gtk_combo_new (); - gtk_widget_show (exteditor_combo); - gtk_table_attach (GTK_TABLE (ext_table), exteditor_combo, 1, 2, 2, 3, - GTK_EXPAND | GTK_FILL, 0, 0, 0); - gtkut_combo_set_items (GTK_COMBO (exteditor_combo), - "gedit %s", - "kedit %s", - "emacs %s", - "xemacs %s", - "kterm -e jed %s", - "kterm -e vi %s", - NULL); - exteditor_entry = GTK_COMBO (exteditor_combo)->entry; - - PACK_FRAME (vbox1, frame_addr, _("Address book")); - - vbox_addr = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox_addr); - gtk_container_add (GTK_CONTAINER (frame_addr), vbox_addr); - gtk_container_set_border_width (GTK_CONTAINER (vbox_addr), 8); - - PACK_CHECK_BUTTON - (vbox_addr, checkbtn_addaddrbyclick, - _("Add address to destination when double-clicked")); - - PACK_FRAME (vbox1, frame_exit, _("On exit")); - - vbox_exit = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox_exit); - gtk_container_add (GTK_CONTAINER (frame_exit), vbox_exit); - gtk_container_set_border_width (GTK_CONTAINER (vbox_exit), 8); - - PACK_CHECK_BUTTON (vbox_exit, checkbtn_confonexit, - _("Confirm on exit")); - - hbox1 = gtk_hbox_new (FALSE, 32); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox_exit), hbox1, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON (hbox1, checkbtn_cleanonexit, - _("Empty trash on exit")); - PACK_CHECK_BUTTON (hbox1, checkbtn_askonclean, - _("Ask before emptying")); - SET_TOGGLE_SENSITIVITY (checkbtn_cleanonexit, checkbtn_askonclean); - - PACK_CHECK_BUTTON (vbox_exit, checkbtn_warnqueued, - _("Warn if there are queued messages")); - - other.uri_combo = uri_combo; - other.uri_entry = uri_entry; - other.printcmd_entry = printcmd_entry; - - other.exteditor_combo = exteditor_combo; - other.exteditor_entry = exteditor_entry; - - other.checkbtn_addaddrbyclick = checkbtn_addaddrbyclick; - - other.checkbtn_confonexit = checkbtn_confonexit; - other.checkbtn_cleanonexit = checkbtn_cleanonexit; - other.checkbtn_askonclean = checkbtn_askonclean; - other.checkbtn_warnqueued = checkbtn_warnqueued; -} - -static void prefs_advanced_create(void) -{ - GtkWidget *vbox1; - - GtkWidget *vbox2; - GtkWidget *checkbtn_strict_cache_check; - GtkWidget *label; - - GtkWidget *hbox1; - GtkWidget *label_iotimeout; - GtkWidget *spinbtn_iotimeout; - GtkObject *spinbtn_iotimeout_adj; - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW); - gtk_widget_show (vbox2); - gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON (vbox2, checkbtn_strict_cache_check, - _("Enable strict checking of the integrity of summary caches")); - PACK_SMALL_LABEL - (vbox2, label, - _("Enable this if the contents of folders have the possibility of modification by other applications.\n" - "This option will degrade the performance of displaying summary.")); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); - - label_iotimeout = gtk_label_new (_("Socket I/O timeout:")); - gtk_widget_show (label_iotimeout); - gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0); - - spinbtn_iotimeout_adj = gtk_adjustment_new (60, 0, 1000, 1, 10, 10); - spinbtn_iotimeout = gtk_spin_button_new - (GTK_ADJUSTMENT (spinbtn_iotimeout_adj), 1, 0); - gtk_widget_show (spinbtn_iotimeout); - gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_iotimeout, - FALSE, FALSE, 0); - gtk_widget_set_size_request (spinbtn_iotimeout, 64, -1); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_iotimeout), TRUE); - - label_iotimeout = gtk_label_new (_("second(s)")); - gtk_widget_show (label_iotimeout); - gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0); - - advanced.checkbtn_strict_cache_check = checkbtn_strict_cache_check; - - advanced.spinbtn_iotimeout = spinbtn_iotimeout; - advanced.spinbtn_iotimeout_adj = spinbtn_iotimeout_adj; -} - -static void date_format_ok_btn_clicked(GtkButton *button, GtkWidget **widget) -{ - GtkWidget *datefmt_sample = NULL; - gchar *text; - - g_return_if_fail(widget != NULL); - g_return_if_fail(*widget != NULL); - g_return_if_fail(display.entry_datefmt != NULL); - - datefmt_sample = GTK_WIDGET(g_object_get_data - (G_OBJECT(*widget), "datefmt_sample")); - g_return_if_fail(datefmt_sample != NULL); - - text = gtk_editable_get_chars(GTK_EDITABLE(datefmt_sample), 0, -1); - g_free(prefs_common.date_format); - prefs_common.date_format = text; - gtk_entry_set_text(GTK_ENTRY(display.entry_datefmt), text); - - gtk_widget_destroy(*widget); - *widget = NULL; -} - -static void date_format_cancel_btn_clicked(GtkButton *button, - GtkWidget **widget) -{ - g_return_if_fail(widget != NULL); - g_return_if_fail(*widget != NULL); - - gtk_widget_destroy(*widget); - *widget = NULL; -} - -static gboolean date_format_key_pressed(GtkWidget *keywidget, - GdkEventKey *event, - GtkWidget **widget) -{ - if (event && event->keyval == GDK_Escape) - date_format_cancel_btn_clicked(NULL, widget); - return FALSE; -} - -static gboolean date_format_on_delete(GtkWidget *dialogwidget, - GdkEventAny *event, GtkWidget **widget) -{ - g_return_val_if_fail(widget != NULL, FALSE); - g_return_val_if_fail(*widget != NULL, FALSE); - - *widget = NULL; - return FALSE; -} - -static void date_format_entry_on_change(GtkEditable *editable, - GtkLabel *example) -{ - time_t cur_time; - struct tm *cal_time; - gchar buffer[100]; - gchar *text; - - cur_time = time(NULL); - cal_time = localtime(&cur_time); - buffer[0] = 0; - text = gtk_editable_get_chars(editable, 0, -1); - if (text) - strftime(buffer, sizeof buffer, text, cal_time); - g_free(text); - - text = conv_codeset_strdup(buffer, conv_get_locale_charset_str(), - CS_UTF_8); - if (!text) - text = g_strdup(buffer); - gtk_label_set_text(example, text); - g_free(text); -} - -static void date_format_select_row(GtkWidget *date_format_list, gint row, - gint column, GdkEventButton *event, - GtkWidget *date_format) -{ - gint cur_pos; - gchar *format; - const gchar *old_format; - gchar *new_format; - GtkWidget *datefmt_sample; - - /* only on double click */ - if (!event || event->type != GDK_2BUTTON_PRESS) return; - - datefmt_sample = GTK_WIDGET(g_object_get_data - (G_OBJECT(date_format), "datefmt_sample")); - - g_return_if_fail(date_format_list != NULL); - g_return_if_fail(date_format != NULL); - g_return_if_fail(datefmt_sample != NULL); - - /* get format from clist */ - gtk_clist_get_text(GTK_CLIST(date_format_list), row, 0, &format); - - cur_pos = gtk_editable_get_position(GTK_EDITABLE(datefmt_sample)); - old_format = gtk_entry_get_text(GTK_ENTRY(datefmt_sample)); - - /* insert the format into the text entry */ - new_format = g_malloc(strlen(old_format) + 3); - - strncpy(new_format, old_format, cur_pos); - new_format[cur_pos] = '\0'; - strcat(new_format, format); - strcat(new_format, &old_format[cur_pos]); - - gtk_entry_set_text(GTK_ENTRY(datefmt_sample), new_format); - gtk_editable_set_position(GTK_EDITABLE(datefmt_sample), cur_pos + 2); - - g_free(new_format); -} - -static GtkWidget *date_format_create(GtkButton *button, void *data) -{ - static GtkWidget *datefmt_win = NULL; - GtkWidget *vbox1; - GtkWidget *scrolledwindow1; - GtkWidget *datefmt_clist; - GtkWidget *table; - GtkWidget *label1; - GtkWidget *label2; - GtkWidget *label3; - GtkWidget *confirm_area; - GtkWidget *ok_btn; - GtkWidget *cancel_btn; - GtkWidget *datefmt_entry; - - struct { - gchar *fmt; - gchar *txt; - } time_format[] = { - { "%a", NULL }, - { "%A", NULL }, - { "%b", NULL }, - { "%B", NULL }, - { "%c", NULL }, - { "%C", NULL }, - { "%d", NULL }, - { "%H", NULL }, - { "%I", NULL }, - { "%j", NULL }, - { "%m", NULL }, - { "%M", NULL }, - { "%p", NULL }, - { "%S", NULL }, - { "%w", NULL }, - { "%x", NULL }, - { "%y", NULL }, - { "%Y", NULL }, - { "%Z", NULL } - }; - - gchar *titles[2]; - gint i; - const gint TIME_FORMAT_ELEMS = - sizeof time_format / sizeof time_format[0]; - - time_format[0].txt = _("the full abbreviated weekday name"); - time_format[1].txt = _("the full weekday name"); - time_format[2].txt = _("the abbreviated month name"); - time_format[3].txt = _("the full month name"); - time_format[4].txt = _("the preferred date and time for the current locale"); - time_format[5].txt = _("the century number (year/100)"); - time_format[6].txt = _("the day of the month as a decimal number"); - time_format[7].txt = _("the hour as a decimal number using a 24-hour clock"); - time_format[8].txt = _("the hour as a decimal number using a 12-hour clock"); - time_format[9].txt = _("the day of the year as a decimal number"); - time_format[10].txt = _("the month as a decimal number"); - time_format[11].txt = _("the minute as a decimal number"); - time_format[12].txt = _("either AM or PM"); - time_format[13].txt = _("the second as a decimal number"); - time_format[14].txt = _("the day of the week as a decimal number"); - time_format[15].txt = _("the preferred date for the current locale"); - time_format[16].txt = _("the last two digits of a year"); - time_format[17].txt = _("the year as a decimal number"); - time_format[18].txt = _("the time zone or name or abbreviation"); - - if (datefmt_win) return datefmt_win; - - datefmt_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_container_set_border_width(GTK_CONTAINER(datefmt_win), 8); - gtk_window_set_title(GTK_WINDOW(datefmt_win), _("Date format")); - gtk_window_set_position(GTK_WINDOW(datefmt_win), GTK_WIN_POS_CENTER); - gtk_widget_set_size_request(datefmt_win, 440, 280); - - vbox1 = gtk_vbox_new(FALSE, 10); - gtk_widget_show(vbox1); - gtk_container_add(GTK_CONTAINER(datefmt_win), vbox1); - - scrolledwindow1 = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy - (GTK_SCROLLED_WINDOW(scrolledwindow1), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_widget_show(scrolledwindow1); - gtk_box_pack_start(GTK_BOX(vbox1), scrolledwindow1, TRUE, TRUE, 0); - - titles[0] = _("Specifier"); - titles[1] = _("Description"); - datefmt_clist = gtk_clist_new_with_titles(2, titles); - gtk_widget_show(datefmt_clist); - gtk_container_add(GTK_CONTAINER(scrolledwindow1), datefmt_clist); - /* gtk_clist_set_column_width(GTK_CLIST(datefmt_clist), 0, 80); */ - gtk_clist_set_selection_mode(GTK_CLIST(datefmt_clist), - GTK_SELECTION_BROWSE); - - for (i = 0; i < TIME_FORMAT_ELEMS; i++) { - gchar *text[2]; - /* phoney casting necessary because of gtk... */ - text[0] = (gchar *)time_format[i].fmt; - text[1] = (gchar *)time_format[i].txt; - gtk_clist_append(GTK_CLIST(datefmt_clist), text); - } - - table = gtk_table_new(2, 2, FALSE); - gtk_widget_show(table); - gtk_box_pack_start(GTK_BOX(vbox1), table, FALSE, FALSE, 0); - gtk_table_set_row_spacings(GTK_TABLE(table), 4); - gtk_table_set_col_spacings(GTK_TABLE(table), 8); - - label1 = gtk_label_new(_("Date format")); - gtk_widget_show(label1); - gtk_table_attach(GTK_TABLE(table), label1, 0, 1, 0, 1, - GTK_FILL, 0, 0, 0); - gtk_label_set_justify(GTK_LABEL(label1), GTK_JUSTIFY_LEFT); - gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5); - - datefmt_entry = gtk_entry_new(); - gtk_entry_set_max_length(GTK_ENTRY(datefmt_entry), 256); - gtk_widget_show(datefmt_entry); - gtk_table_attach(GTK_TABLE(table), datefmt_entry, 1, 2, 0, 1, - (GTK_EXPAND | GTK_FILL), 0, 0, 0); - - /* we need the "sample" entry box; add it as data so callbacks can - * get the entry box */ - g_object_set_data(G_OBJECT(datefmt_win), "datefmt_sample", - datefmt_entry); - - label2 = gtk_label_new(_("Example")); - gtk_widget_show(label2); - gtk_table_attach(GTK_TABLE(table), label2, 0, 1, 1, 2, - GTK_FILL, 0, 0, 0); - gtk_label_set_justify(GTK_LABEL(label2), GTK_JUSTIFY_LEFT); - gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5); - - label3 = gtk_label_new(""); - gtk_widget_show(label3); - gtk_table_attach(GTK_TABLE(table), label3, 1, 2, 1, 2, - (GTK_EXPAND | GTK_FILL), 0, 0, 0); - gtk_label_set_justify(GTK_LABEL(label3), GTK_JUSTIFY_LEFT); - gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5); - - gtkut_stock_button_set_create(&confirm_area, &ok_btn, GTK_STOCK_OK, - &cancel_btn, GTK_STOCK_CANCEL, NULL, NULL); - - gtk_box_pack_start(GTK_BOX(vbox1), confirm_area, FALSE, FALSE, 0); - gtk_widget_show(confirm_area); - gtk_widget_grab_default(ok_btn); - - /* set the current format */ - gtk_entry_set_text(GTK_ENTRY(datefmt_entry), prefs_common.date_format); - date_format_entry_on_change(GTK_EDITABLE(datefmt_entry), - GTK_LABEL(label3)); - - g_signal_connect(G_OBJECT(ok_btn), "clicked", - G_CALLBACK(date_format_ok_btn_clicked), &datefmt_win); - g_signal_connect(G_OBJECT(cancel_btn), "clicked", - G_CALLBACK(date_format_cancel_btn_clicked), - &datefmt_win); - g_signal_connect(G_OBJECT(datefmt_win), "key_press_event", - G_CALLBACK(date_format_key_pressed), &datefmt_win); - g_signal_connect(G_OBJECT(datefmt_win), "delete_event", - G_CALLBACK(date_format_on_delete), &datefmt_win); - g_signal_connect(G_OBJECT(datefmt_entry), "changed", - G_CALLBACK(date_format_entry_on_change), label3); - g_signal_connect(G_OBJECT(datefmt_clist), "select_row", - G_CALLBACK(date_format_select_row), datefmt_win); - - gtk_window_set_position(GTK_WINDOW(datefmt_win), GTK_WIN_POS_CENTER); - gtk_window_set_modal(GTK_WINDOW(datefmt_win), TRUE); - - gtk_widget_show(datefmt_win); - manage_window_set_transient(GTK_WINDOW(datefmt_win)); - - gtk_widget_grab_focus(ok_btn); - - return datefmt_win; -} - -void prefs_quote_colors_dialog(void) -{ - if (!quote_color_win) - prefs_quote_colors_dialog_create(); - gtk_widget_show(quote_color_win); - manage_window_set_transient(GTK_WINDOW(quote_color_win)); - - gtk_main(); - gtk_widget_hide(quote_color_win); - - main_window_reflect_prefs_all(); -} - -static void prefs_quote_colors_dialog_create(void) -{ - GtkWidget *window; - GtkWidget *vbox; - GtkWidget *table; - GtkWidget *quotelevel1_label; - GtkWidget *quotelevel2_label; - GtkWidget *quotelevel3_label; - GtkWidget *uri_label; - GtkWidget *hbbox; - GtkWidget *ok_btn; - GtkWidget *recycle_colors_btn; - GtkWidget *frame_colors; - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_container_set_border_width(GTK_CONTAINER(window), 2); - gtk_window_set_title(GTK_WINDOW(window), _("Set message colors")); - gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); - gtk_window_set_modal(GTK_WINDOW(window), TRUE); - gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); - - vbox = gtk_vbox_new (FALSE, VSPACING); - gtk_container_add (GTK_CONTAINER (window), vbox); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); - PACK_FRAME(vbox, frame_colors, _("Colors")); - - table = gtk_table_new (4, 2, FALSE); - gtk_container_add (GTK_CONTAINER (frame_colors), table); - gtk_container_set_border_width (GTK_CONTAINER (table), 8); - gtk_table_set_row_spacings (GTK_TABLE (table), 2); - gtk_table_set_col_spacings (GTK_TABLE (table), 4); - - color_buttons.quote_level1_btn = gtk_button_new(); - gtk_table_attach (GTK_TABLE (table), color_buttons.quote_level1_btn, - 0, 1, 0, 1, 0, 0, 0, 0); - gtk_widget_set_size_request (color_buttons.quote_level1_btn, 40, 30); - gtk_container_set_border_width - (GTK_CONTAINER (color_buttons.quote_level1_btn), 5); - - color_buttons.quote_level2_btn = gtk_button_new(); - gtk_table_attach (GTK_TABLE (table), color_buttons.quote_level2_btn, - 0, 1, 1, 2, 0, 0, 0, 0); - gtk_widget_set_size_request (color_buttons.quote_level2_btn, 40, 30); - gtk_container_set_border_width (GTK_CONTAINER (color_buttons.quote_level2_btn), 5); - - color_buttons.quote_level3_btn = gtk_button_new_with_label (""); - gtk_table_attach (GTK_TABLE (table), color_buttons.quote_level3_btn, - 0, 1, 2, 3, 0, 0, 0, 0); - gtk_widget_set_size_request (color_buttons.quote_level3_btn, 40, 30); - gtk_container_set_border_width - (GTK_CONTAINER (color_buttons.quote_level3_btn), 5); - - color_buttons.uri_btn = gtk_button_new_with_label (""); - gtk_table_attach (GTK_TABLE (table), color_buttons.uri_btn, - 0, 1, 3, 4, 0, 0, 0, 0); - gtk_widget_set_size_request (color_buttons.uri_btn, 40, 30); - gtk_container_set_border_width (GTK_CONTAINER (color_buttons.uri_btn), 5); - - quotelevel1_label = gtk_label_new (_("Quoted Text - First Level")); - gtk_table_attach (GTK_TABLE (table), quotelevel1_label, 1, 2, 0, 1, - (GTK_EXPAND | GTK_FILL), 0, 0, 0); - gtk_label_set_justify (GTK_LABEL (quotelevel1_label), GTK_JUSTIFY_LEFT); - gtk_misc_set_alignment (GTK_MISC (quotelevel1_label), 0, 0.5); - - quotelevel2_label = gtk_label_new (_("Quoted Text - Second Level")); - gtk_table_attach (GTK_TABLE (table), quotelevel2_label, 1, 2, 1, 2, - (GTK_EXPAND | GTK_FILL), 0, 0, 0); - gtk_label_set_justify (GTK_LABEL (quotelevel2_label), GTK_JUSTIFY_LEFT); - gtk_misc_set_alignment (GTK_MISC (quotelevel2_label), 0, 0.5); - - quotelevel3_label = gtk_label_new (_("Quoted Text - Third Level")); - gtk_table_attach (GTK_TABLE (table), quotelevel3_label, 1, 2, 2, 3, - (GTK_EXPAND | GTK_FILL), 0, 0, 0); - gtk_label_set_justify (GTK_LABEL (quotelevel3_label), GTK_JUSTIFY_LEFT); - gtk_misc_set_alignment (GTK_MISC (quotelevel3_label), 0, 0.5); - - uri_label = gtk_label_new (_("URI link")); - gtk_table_attach (GTK_TABLE (table), uri_label, 1, 2, 3, 4, - (GTK_EXPAND | GTK_FILL), 0, 0, 0); - gtk_label_set_justify (GTK_LABEL (uri_label), GTK_JUSTIFY_LEFT); - gtk_misc_set_alignment (GTK_MISC (uri_label), 0, 0.5); - - PACK_CHECK_BUTTON (vbox, recycle_colors_btn, - _("Recycle quote colors")); - - gtkut_stock_button_set_create(&hbbox, &ok_btn, GTK_STOCK_OK, - NULL, NULL, NULL, NULL); - gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0); - - gtk_widget_grab_default(ok_btn); - MANAGE_WINDOW_SIGNALS_CONNECT(window); - g_signal_connect(G_OBJECT(window), "delete_event", - G_CALLBACK(gtk_main_quit), NULL); - g_signal_connect(G_OBJECT(window), "key_press_event", - G_CALLBACK(prefs_quote_colors_key_pressed), NULL); - - g_signal_connect(G_OBJECT(color_buttons.quote_level1_btn), "clicked", - G_CALLBACK(quote_color_set_dialog), "LEVEL1"); - g_signal_connect(G_OBJECT(color_buttons.quote_level2_btn), "clicked", - G_CALLBACK(quote_color_set_dialog), "LEVEL2"); - g_signal_connect(G_OBJECT(color_buttons.quote_level3_btn), "clicked", - G_CALLBACK(quote_color_set_dialog), "LEVEL3"); - g_signal_connect(G_OBJECT(color_buttons.uri_btn), "clicked", - G_CALLBACK(quote_color_set_dialog), "URI"); - g_signal_connect(G_OBJECT(recycle_colors_btn), "toggled", - G_CALLBACK(prefs_recycle_colors_toggled), NULL); - g_signal_connect(G_OBJECT(ok_btn), "clicked", - G_CALLBACK(gtk_main_quit), NULL); - - /* show message button colors and recycle options */ - set_button_bg_color(color_buttons.quote_level1_btn, - prefs_common.quote_level1_col); - set_button_bg_color(color_buttons.quote_level2_btn, - prefs_common.quote_level2_col); - set_button_bg_color(color_buttons.quote_level3_btn, - prefs_common.quote_level3_col); - set_button_bg_color(color_buttons.uri_btn, - prefs_common.uri_col); - gtk_toggle_button_set_active((GtkToggleButton *)recycle_colors_btn, - prefs_common.recycle_quote_colors); - - gtk_widget_show_all(vbox); - quote_color_win = window; -} - -static gboolean prefs_quote_colors_key_pressed(GtkWidget *widget, - GdkEventKey *event, - gpointer data) -{ - if (event && event->keyval == GDK_Escape) - gtk_main_quit(); - return FALSE; -} - -static void quote_color_set_dialog(GtkWidget *widget, gpointer data) -{ - gchar *type = (gchar *)data; - gchar *title = NULL; - gdouble color[4] = {0.0, 0.0, 0.0, 0.0}; - gint rgbvalue = 0; - GtkColorSelectionDialog *dialog; - - if(g_ascii_strcasecmp(type, "LEVEL1") == 0) { - title = _("Pick color for quotation level 1"); - rgbvalue = prefs_common.quote_level1_col; - } else if(g_ascii_strcasecmp(type, "LEVEL2") == 0) { - title = _("Pick color for quotation level 2"); - rgbvalue = prefs_common.quote_level2_col; - } else if(g_ascii_strcasecmp(type, "LEVEL3") == 0) { - title = _("Pick color for quotation level 3"); - rgbvalue = prefs_common.quote_level3_col; - } else if(g_ascii_strcasecmp(type, "URI") == 0) { - title = _("Pick color for URI"); - rgbvalue = prefs_common.uri_col; - } else { /* Should never be called */ - g_warning("Unrecognized datatype '%s' in quote_color_set_dialog\n", type); - return; - } - - color_dialog = gtk_color_selection_dialog_new(title); - gtk_window_set_position(GTK_WINDOW(color_dialog), GTK_WIN_POS_CENTER); - gtk_window_set_modal(GTK_WINDOW(color_dialog), TRUE); - gtk_window_set_policy(GTK_WINDOW(color_dialog), FALSE, FALSE, FALSE); - manage_window_set_transient(GTK_WINDOW(color_dialog)); - - g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(color_dialog)->ok_button), - "clicked", G_CALLBACK(quote_colors_set_dialog_ok), data); - g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(color_dialog)->cancel_button), - "clicked", G_CALLBACK(quote_colors_set_dialog_cancel), data); - g_signal_connect(G_OBJECT(color_dialog), "key_press_event", - G_CALLBACK(quote_colors_set_dialog_key_pressed), data); - - /* preselect the previous color in the color selection dialog */ - color[0] = (gdouble) ((rgbvalue & 0xff0000) >> 16) / 255.0; - color[1] = (gdouble) ((rgbvalue & 0x00ff00) >> 8) / 255.0; - color[2] = (gdouble) (rgbvalue & 0x0000ff) / 255.0; - dialog = GTK_COLOR_SELECTION_DIALOG(color_dialog); - gtk_color_selection_set_color - (GTK_COLOR_SELECTION(dialog->colorsel), color); - - gtk_widget_show(color_dialog); -} - -static void quote_colors_set_dialog_ok(GtkWidget *widget, gpointer data) -{ - GtkColorSelection *colorsel = (GtkColorSelection *) - ((GtkColorSelectionDialog *)color_dialog)->colorsel; - gdouble color[4]; - gint red, green, blue, rgbvalue; - gchar *type = (gchar *)data; - - gtk_color_selection_get_color(colorsel, color); - - red = (gint) (color[0] * 255.0); - green = (gint) (color[1] * 255.0); - blue = (gint) (color[2] * 255.0); - rgbvalue = (gint) ((red * 0x10000) | (green * 0x100) | blue); - -#if 0 - fprintf(stderr, "redc = %f, greenc = %f, bluec = %f\n", color[0], color[1], color[2]); - fprintf(stderr, "red = %d, green = %d, blue = %d\n", red, green, blue); - fprintf(stderr, "Color is %x\n", rgbvalue); -#endif - - if (g_ascii_strcasecmp(type, "LEVEL1") == 0) { - prefs_common.quote_level1_col = rgbvalue; - set_button_bg_color(color_buttons.quote_level1_btn, rgbvalue); - } else if (g_ascii_strcasecmp(type, "LEVEL2") == 0) { - prefs_common.quote_level2_col = rgbvalue; - set_button_bg_color(color_buttons.quote_level2_btn, rgbvalue); - } else if (g_ascii_strcasecmp(type, "LEVEL3") == 0) { - prefs_common.quote_level3_col = rgbvalue; - set_button_bg_color(color_buttons.quote_level3_btn, rgbvalue); - } else if (g_ascii_strcasecmp(type, "URI") == 0) { - prefs_common.uri_col = rgbvalue; - set_button_bg_color(color_buttons.uri_btn, rgbvalue); - } else - fprintf( stderr, "Unrecognized datatype '%s' in quote_color_set_dialog_ok\n", type ); - - gtk_widget_destroy(color_dialog); -} - -static void quote_colors_set_dialog_cancel(GtkWidget *widget, gpointer data) -{ - gtk_widget_destroy(color_dialog); -} - -static gboolean quote_colors_set_dialog_key_pressed(GtkWidget *widget, - GdkEventKey *event, - gpointer data) -{ - if (event && event->keyval == GDK_Escape) { - gtk_widget_destroy(color_dialog); - return TRUE; - } - return FALSE; -} - -static void set_button_bg_color(GtkWidget *widget, gint rgbvalue) -{ - GtkStyle *newstyle; - GdkColor color; - - gtkut_convert_int_to_gdk_color(rgbvalue, &color); - newstyle = gtk_style_copy(gtk_widget_get_default_style()); - newstyle->bg[GTK_STATE_NORMAL] = color; - newstyle->bg[GTK_STATE_PRELIGHT] = color; - newstyle->bg[GTK_STATE_ACTIVE] = color; - - gtk_widget_set_style(GTK_WIDGET(widget), newstyle); -} - -static void prefs_enable_message_color_toggled(void) -{ - gboolean is_active; - - is_active = gtk_toggle_button_get_active - (GTK_TOGGLE_BUTTON(message.chkbtn_enablecol)); - gtk_widget_set_sensitive(message.button_edit_col, is_active); - prefs_common.enable_color = is_active; -} - -static void prefs_recycle_colors_toggled(GtkWidget *widget) -{ - gboolean is_active; - - is_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); - prefs_common.recycle_quote_colors = is_active; -} - -void prefs_quote_description(void) -{ - if (!quote_desc_win) - prefs_quote_description_create(); - - manage_window_set_transient(GTK_WINDOW(quote_desc_win)); - gtk_widget_show(quote_desc_win); - gtk_main(); - gtk_widget_hide(quote_desc_win); -} - -static void prefs_quote_description_create(void) -{ - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *vbox2; - GtkWidget *label; - GtkWidget *hbbox; - GtkWidget *ok_btn; - - quote_desc_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(quote_desc_win), - _("Description of symbols")); - gtk_container_set_border_width(GTK_CONTAINER(quote_desc_win), 8); - gtk_window_set_position(GTK_WINDOW(quote_desc_win), GTK_WIN_POS_CENTER); - gtk_window_set_modal(GTK_WINDOW(quote_desc_win), TRUE); - gtk_window_set_policy(GTK_WINDOW(quote_desc_win), FALSE, FALSE, FALSE); - - vbox = gtk_vbox_new(FALSE, 8); - gtk_container_add(GTK_CONTAINER(quote_desc_win), vbox); - - hbox = gtk_hbox_new(FALSE, 8); - gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); - - vbox2 = gtk_vbox_new(FALSE, 8); - gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 0); - -#define PACK_LABEL() \ - gtk_box_pack_start(GTK_BOX(vbox2), label, TRUE, TRUE, 0); \ - gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); \ - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); - - label = gtk_label_new - ("%d\n" /* date */ - "%f\n" /* from */ - "%N\n" /* full name of sender */ - "%F\n" /* first name of sender */ - "%I\n" /* initial of sender */ - "%s\n" /* subject */ - "%t\n" /* to */ - "%c\n" /* cc */ - "%n\n" /* newsgroups */ - "%i"); /* message id */ - PACK_LABEL(); - - label = gtk_label_new - ("?x{expr}"); /* condition */ - PACK_LABEL(); - - label = gtk_label_new - ("%M\n" /* message body */ - "%Q\n" /* quoted message body */ - "%m\n" /* message body without signature */ - "%q\n" /* quoted message body without signature */ - "%%"); /* literal percent */ - PACK_LABEL(); - - label = gtk_label_new - ("\\\\\n" /* literal backslash */ - "\\?\n" /* literal question mark */ - "\\{\n" /* literal opening curly brace */ - "\\}"); /* literal closing curly brace */ - PACK_LABEL(); - - vbox2 = gtk_vbox_new(FALSE, 8); - gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 0); - - label = gtk_label_new - (_("Date\n" - "From\n" - "Full Name of Sender\n" - "First Name of Sender\n" - "Initial of Sender\n" - "Subject\n" - "To\n" - "Cc\n" - "Newsgroups\n" - "Message-ID")); - PACK_LABEL(); - - label = gtk_label_new - (_("If x is set, displays expr")); - PACK_LABEL(); - - label = gtk_label_new - (_("Message body\n" - "Quoted message body\n" - "Message body without signature\n" - "Quoted message body without signature\n" - "Literal %")); - PACK_LABEL(); - - label = gtk_label_new - (_("Literal backslash\n" - "Literal question mark\n" - "Literal opening curly brace\n" - "Literal closing curly brace")); - PACK_LABEL(); - -#undef PACK_LABEL - - gtkut_stock_button_set_create(&hbbox, &ok_btn, GTK_STOCK_OK, - NULL, NULL, NULL, NULL); - gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0); - - gtk_widget_grab_default(ok_btn); - g_signal_connect(G_OBJECT(ok_btn), "clicked", - G_CALLBACK(gtk_main_quit), NULL); - g_signal_connect - (G_OBJECT(quote_desc_win), "key_press_event", - G_CALLBACK(prefs_quote_description_key_pressed), NULL); - g_signal_connect(G_OBJECT(quote_desc_win), "delete_event", - G_CALLBACK(gtk_main_quit), NULL); - - gtk_widget_show_all(vbox); -} - -static gboolean prefs_quote_description_key_pressed(GtkWidget *widget, - GdkEventKey *event, - gpointer data) -{ - if (event && event->keyval == GDK_Escape) - gtk_main_quit(); - return FALSE; -} - -static void prefs_keybind_select(void) -{ - GtkWidget *window; - GtkWidget *vbox1; - GtkWidget *hbox1; - GtkWidget *label; - GtkWidget *combo; - GtkWidget *confirm_area; - GtkWidget *ok_btn; - GtkWidget *cancel_btn; - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_container_set_border_width (GTK_CONTAINER (window), 8); - gtk_window_set_title (GTK_WINDOW (window), _("Key bindings")); - gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); - gtk_window_set_modal (GTK_WINDOW (window), TRUE); - gtk_window_set_policy (GTK_WINDOW (window), FALSE, FALSE, FALSE); - manage_window_set_transient (GTK_WINDOW (window)); - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_container_add (GTK_CONTAINER (window), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); - - label = gtk_label_new - (_("Select the preset of key bindings.\n" - "You can also modify each menu's shortcuts by pressing\n" - "any key(s) when placing the mouse pointer on the item.")); - gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); - - combo = gtk_combo_new (); - gtk_box_pack_start (GTK_BOX (hbox1), combo, TRUE, TRUE, 0); - gtkut_combo_set_items (GTK_COMBO (combo), - _("Default"), - "Mew / Wanderlust", - "Mutt", - _("Old Sylpheed"), - NULL); - gtk_editable_set_editable - (GTK_EDITABLE (GTK_COMBO (combo)->entry), FALSE); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); - - gtkut_stock_button_set_create (&confirm_area, &ok_btn, GTK_STOCK_OK, - &cancel_btn, GTK_STOCK_CANCEL, - NULL, NULL); - gtk_box_pack_end (GTK_BOX (hbox1), confirm_area, FALSE, FALSE, 0); - gtk_widget_grab_default (ok_btn); - - MANAGE_WINDOW_SIGNALS_CONNECT(window); - g_signal_connect (G_OBJECT (window), "delete_event", - G_CALLBACK (prefs_keybind_deleted), NULL); - g_signal_connect (G_OBJECT (window), "key_press_event", - G_CALLBACK (prefs_keybind_key_pressed), NULL); - g_signal_connect (G_OBJECT (ok_btn), "clicked", - G_CALLBACK (prefs_keybind_apply_clicked), NULL); - g_signal_connect (G_OBJECT (cancel_btn), "clicked", - G_CALLBACK (prefs_keybind_cancel), NULL); - - gtk_widget_show_all(window); - - keybind.window = window; - keybind.combo = combo; -} - -static gboolean prefs_keybind_key_pressed(GtkWidget *widget, GdkEventKey *event, - gpointer data) -{ - if (event && event->keyval == GDK_Escape) - prefs_keybind_cancel(); - return FALSE; -} - -static gint prefs_keybind_deleted(GtkWidget *widget, GdkEventAny *event, - gpointer data) -{ - prefs_keybind_cancel(); - return TRUE; -} - -static void prefs_keybind_cancel(void) -{ - gtk_widget_destroy(keybind.window); - keybind.window = NULL; - keybind.combo = NULL; -} - -struct KeyBind { - const gchar *accel_path; - const gchar *accel_key; -}; - -static void prefs_keybind_apply(struct KeyBind keybind[], gint num) -{ - gint i; - guint key; - GdkModifierType mods; - - for (i = 0; i < num; i++) { - const gchar *accel_key = - keybind[i].accel_key ? keybind[i].accel_key : ""; - gtk_accelerator_parse(accel_key, &key, &mods); - gtk_accel_map_change_entry(keybind[i].accel_path, - key, mods, TRUE); - } -} - -static void prefs_keybind_apply_clicked(GtkWidget *widget) -{ - GtkEntry *entry = GTK_ENTRY(GTK_COMBO(keybind.combo)->entry); - const gchar *text; - struct KeyBind *menurc; - gint n_menurc; - - static struct KeyBind default_menurc[] = { - {"
/File/Empty all trash", ""}, - {"
/File/Save as...", "S"}, - {"
/File/Print...", ""}, - {"
/File/Exit", "Q"}, - - {"
/Edit/Copy", "C"}, - {"
/Edit/Select all", "A"}, - {"
/Edit/Find in current message...", "F"}, - {"
/Edit/Search messages...", "F"}, - - {"
/View/Show or hide/Message view", "V"}, - {"
/View/Thread view", "T"}, - {"
/View/Go to/Prev message", "P"}, - {"
/View/Go to/Next message", "N"}, - {"
/View/Go to/Prev unread message", "P"}, - {"
/View/Go to/Next unread message", "N"}, - {"
/View/Go to/Other folder...", "G"}, - {"
/View/Open in new window", "N"}, - {"
/View/View source", "U"}, - {"
/View/Show all header", "H"}, - {"
/View/Update", "U"}, - - {"
/Message/Receive/Get new mail", "I"}, - {"
/Message/Receive/Get from all accounts", "I"}, - {"
/Message/Compose new message", "M"}, - {"
/Message/Reply", "R"}, - {"
/Message/Reply to/all", "R"}, - {"
/Message/Reply to/sender", ""}, - {"
/Message/Reply to/mailing list", "L"}, - {"
/Message/Forward", "F"}, - {"
/Message/Forward as attachment", ""}, - {"
/Message/Move...", "O"}, - {"
/Message/Copy...", "O"}, - {"
/Message/Delete", "D"}, - {"
/Message/Mark/Mark", "asterisk"}, - {"
/Message/Mark/Unmark", "U"}, - {"
/Message/Mark/Mark as unread", "exclam"}, - {"
/Message/Mark/Mark as read", ""}, - - {"
/Tools/Address book", "A"}, - {"
/Tools/Execute", "X"}, - {"
/Tools/Log window", "L"}, - - {"/File/Close", "W"}, - {"/Edit/Select all", "A"}, - }; - - static struct KeyBind mew_wl_menurc[] = { - {"
/File/Empty all trash", "D"}, - {"
/File/Save as...", "Y"}, - {"
/File/Print...", "numbersign"}, - {"
/File/Exit", "Q"}, - - {"
/Edit/Copy", "C"}, - {"
/Edit/Select all", "A"}, - {"
/Edit/Find in current message...", "F"}, - {"
/Edit/Search messages...", "S"}, - - {"
/View/Show or hide/Message view", "V"}, - {"
/View/Thread view", "T"}, - {"
/View/Go to/Prev message", "P"}, - {"
/View/Go to/Next message", "N"}, - {"
/View/Go to/Prev unread message", "P"}, - {"
/View/Go to/Next unread message", "N"}, - {"
/View/Go to/Other folder...", "G"}, - {"
/View/Open in new window", "N"}, - {"
/View/View source", "U"}, - {"
/View/Show all header", "H"}, - {"
/View/Update", "S"}, - - {"
/Message/Receive/Get new mail", "I"}, - {"
/Message/Receive/Get from all accounts", "I"}, - {"
/Message/Compose new message", "W"}, - {"
/Message/Reply", "R"}, - {"
/Message/Reply to/all", "A"}, - {"
/Message/Reply to/sender", ""}, - {"
/Message/Reply to/mailing list", "L"}, - {"
/Message/Forward", "F"}, - {"
/Message/Forward as attachment", "F"}, - {"
/Message/Move...", "O"}, - {"
/Message/Copy...", "O"}, - {"
/Message/Delete", "D"}, - {"
/Message/Mark/Mark", "asterisk"}, - {"
/Message/Mark/Unmark", "U"}, - {"
/Message/Mark/Mark as unread", "exclam"}, - {"
/Message/Mark/Mark as read", "R"}, - - {"
/Tools/Address book", "A"}, - {"
/Tools/Execute", "X"}, - {"
/Tools/Log window", "L"}, - - {"/File/Close", "W"}, - {"/Edit/Select all", ""}, - }; - - static struct KeyBind mutt_menurc[] = { - {"
/File/Empty all trash", ""}, - {"
/File/Save as...", "S"}, - {"
/File/Print...", "P"}, - {"
/File/Exit", "Q"}, - - {"
/Edit/Copy", "C"}, - {"
/Edit/Select all", "A"}, - {"
/Edit/Find in current message...", "F"}, - {"
/Edit/Search messages...", "slash"}, - - {"
/View/Show or hide/Message view", "V"}, - {"
/View/Thread view", "T"}, - {"
/View/Go to/Prev message", ""}, - {"
/View/Go to/Next message", ""}, - {"
/View/Go to/Prev unread message", ""}, - {"
/View/Go to/Next unread message", ""}, - {"
/View/Go to/Other folder...", "C"}, - {"
/View/Open in new window", "N"}, - {"
/View/View source", "U"}, - {"
/View/Show all header", "H"}, - {"
/View/Update", "U"}, - - {"
/Message/Receive/Get new mail", "I"}, - {"
/Message/Receive/Get from all accounts", "I"}, - {"
/Message/Compose new message", "M"}, - {"
/Message/Reply", "R"}, - {"
/Message/Reply to/all", "G"}, - {"
/Message/Reply to/sender", ""}, - {"
/Message/Reply to/mailing list", "L"}, - {"
/Message/Forward", "F"}, - {"
/Message/Forward as attachment", ""}, - {"
/Message/Move...", "O"}, - {"
/Message/Copy...", "C"}, - {"
/Message/Delete", "D"}, - {"
/Message/Mark/Mark", "F"}, - {"
/Message/Mark/Unmark", "U"}, - {"
/Message/Mark/Mark as unread", "N"}, - {"
/Message/Mark/Mark as read", ""}, - - {"
/Tools/Address book", "A"}, - {"
/Tools/Execute", "X"}, - {"
/Tools/Log window", "L"}, - - {"/File/Close", "W"}, - {"/Edit/Select all", ""}, - }; - - static struct KeyBind old_sylpheed_menurc[] = { - {"
/File/Empty all trash", ""}, - {"
/File/Save as...", ""}, - {"
/File/Print...", "P"}, - {"
/File/Exit", "Q"}, - - {"
/Edit/Copy", "C"}, - {"
/Edit/Select all", "A"}, - {"
/Edit/Find in current message...", "F"}, - {"
/Edit/Search messages...", "S"}, - - {"
/View/Show or hide/Message view", "V"}, - {"
/View/Thread view", "T"}, - {"
/View/Go to/Prev message", "P"}, - {"
/View/Go to/Next message", "N"}, - {"
/View/Go to/Prev unread message", "P"}, - {"
/View/Go to/Next unread message", "N"}, - {"
/View/Go to/Other folder...", "G"}, - {"
/View/Open in new window", "N"}, - {"
/View/View source", "U"}, - {"
/View/Show all header", "H"}, - {"
/View/Update", "U"}, - - {"
/Message/Receive/Get new mail", "I"}, - {"
/Message/Receive/Get from all accounts", "I"}, - {"
/Message/Compose new message", "N"}, - {"
/Message/Reply", "R"}, - {"
/Message/Reply to/all", "R"}, - {"
/Message/Reply to/sender", "R"}, - {"
/Message/Reply to/mailing list", "L"}, - {"
/Message/Forward", "F"}, - {"
/Message/Forward as attachment", "F"}, - {"
/Message/Move...", "O"}, - {"
/Message/Copy...", ""}, - {"
/Message/Delete", "D"}, - {"
/Message/Mark/Mark", "asterisk"}, - {"
/Message/Mark/Unmark", "U"}, - {"
/Message/Mark/Mark as unread", "exclam"}, - {"
/Message/Mark/Mark as read", ""}, - - {"
/Tools/Address book", "A"}, - {"
/Tools/Execute", "X"}, - {"
/Tools/Log window", "L"}, - - {"/File/Close", "W"}, - {"/Edit/Select all", ""}, - }; - - static struct KeyBind empty_menurc[] = { - {"
/File/Empty all trash", ""}, - {"
/File/Save as...", ""}, - {"
/File/Print...", ""}, - {"
/File/Exit", ""}, - - {"
/Edit/Copy", ""}, - {"
/Edit/Select all", ""}, - {"
/Edit/Find in current message...", ""}, - {"
/Edit/Search messages...", ""}, - - {"
/View/Show or hide/Message view", ""}, - {"
/View/Thread view", ""}, - {"
/View/Go to/Prev message", ""}, - {"
/View/Go to/Next message", ""}, - {"
/View/Go to/Prev unread message", ""}, - {"
/View/Go to/Next unread message", ""}, - {"
/View/Go to/Other folder...", ""}, - {"
/View/Open in new window", ""}, - {"
/View/View source", ""}, - {"
/View/Show all header", ""}, - {"
/View/Update", ""}, - - {"
/Message/Receive/Get new mail", ""}, - {"
/Message/Receive/Get from all accounts", ""}, - {"
/Message/Compose new message", ""}, - {"
/Message/Reply", ""}, - {"
/Message/Reply to/all", ""}, - {"
/Message/Reply to/sender", ""}, - {"
/Message/Reply to/mailing list", ""}, - {"
/Message/Forward", ""}, - {"
/Message/Forward as attachment", ""}, - {"
/Message/Move...", ""}, - {"
/Message/Copy...", ""}, - {"
/Message/Delete", ""}, - {"
/Message/Mark/Mark", ""}, - {"
/Message/Mark/Unmark", ""}, - {"
/Message/Mark/Mark as unread", ""}, - {"
/Message/Mark/Mark as read", ""}, - - {"
/Tools/Address book", ""}, - {"
/Tools/Execute", ""}, - {"
/Tools/Log window", ""}, - - {"/File/Close", ""}, - {"/Edit/Select all", ""}, - }; - - text = gtk_entry_get_text(entry); - - if (!strcmp(text, _("Default"))) { - menurc = default_menurc; - n_menurc = G_N_ELEMENTS(default_menurc); - } else if (!strcmp(text, "Mew / Wanderlust")) { - menurc = mew_wl_menurc; - n_menurc = G_N_ELEMENTS(mew_wl_menurc); - } else if (!strcmp(text, "Mutt")) { - menurc = mutt_menurc; - n_menurc = G_N_ELEMENTS(mutt_menurc); - } else if (!strcmp(text, _("Old Sylpheed"))) { - menurc = old_sylpheed_menurc; - n_menurc = G_N_ELEMENTS(old_sylpheed_menurc); - } else - return; - - prefs_keybind_apply(empty_menurc, G_N_ELEMENTS(empty_menurc)); - prefs_keybind_apply(menurc, n_menurc); - - gtk_widget_destroy(keybind.window); - keybind.window = NULL; - keybind.combo = NULL; -} - -static void prefs_common_charset_set_data_from_optmenu(PrefParam *pparam) -{ - GtkWidget *menu; - GtkWidget *menuitem; - gchar *charset; - - menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget)); - menuitem = gtk_menu_get_active(GTK_MENU(menu)); - charset = g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID); - g_free(*((gchar **)pparam->data)); - *((gchar **)pparam->data) = g_strdup(charset); -} - -static void prefs_common_charset_set_optmenu(PrefParam *pparam) -{ - GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget); - gint index; - - g_return_if_fail(optmenu != NULL); - g_return_if_fail(*((gchar **)pparam->data) != NULL); - - index = menu_find_option_menu_index(optmenu, *((gchar **)pparam->data), - (GCompareFunc)strcmp2); - if (index >= 0) - gtk_option_menu_set_history(optmenu, index); - else { - gtk_option_menu_set_history(optmenu, 0); - prefs_common_charset_set_data_from_optmenu(pparam); - } -} - -static void prefs_common_encoding_set_data_from_optmenu(PrefParam *pparam) -{ - GtkWidget *menu; - GtkWidget *menuitem; - - menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget)); - menuitem = gtk_menu_get_active(GTK_MENU(menu)); - *((TransferEncodingMethod *)pparam->data) = GPOINTER_TO_INT - (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID)); -} - -static void prefs_common_encoding_set_optmenu(PrefParam *pparam) -{ - TransferEncodingMethod method = - *((TransferEncodingMethod *)pparam->data); - GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget); - gint index; - - g_return_if_fail(optmenu != NULL); - - index = menu_find_option_menu_index(optmenu, GINT_TO_POINTER(method), - NULL); - if (index >= 0) - gtk_option_menu_set_history(optmenu, index); - else { - gtk_option_menu_set_history(optmenu, 0); - prefs_common_encoding_set_data_from_optmenu(pparam); - } -} - -static void prefs_common_recv_dialog_set_data_from_optmenu(PrefParam *pparam) -{ - GtkWidget *menu; - GtkWidget *menuitem; - - menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget)); - menuitem = gtk_menu_get_active(GTK_MENU(menu)); - *((RecvDialogMode *)pparam->data) = GPOINTER_TO_INT - (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID)); -} - -static void prefs_common_recv_dialog_set_optmenu(PrefParam *pparam) -{ - RecvDialogMode mode = *((RecvDialogMode *)pparam->data); - GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget); - GtkWidget *menu; - GtkWidget *menuitem; - gint index; - - index = menu_find_option_menu_index(optmenu, GINT_TO_POINTER(mode), - NULL); - if (index >= 0) - gtk_option_menu_set_history(optmenu, index); - else { - gtk_option_menu_set_history(optmenu, 0); - prefs_common_recv_dialog_set_data_from_optmenu(pparam); - } - - menu = gtk_option_menu_get_menu(optmenu); - menuitem = gtk_menu_get_active(GTK_MENU(menu)); - gtk_menu_item_activate(GTK_MENU_ITEM(menuitem)); -} - -static void prefs_common_select_folder_cb(GtkWidget *widget, gpointer data) -{ - FolderItem *item; - gchar *id; - - item = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL); - if (item && item->path) { - id = folder_item_get_identifier(item); - if (id) { - gtk_entry_set_text(GTK_ENTRY(data), id); - g_free(id); - } - } -} - -static gint prefs_common_deleted(GtkWidget *widget, GdkEventAny *event, - gpointer data) -{ - prefs_common_cancel(); - return TRUE; -} - -static gboolean prefs_common_key_pressed(GtkWidget *widget, GdkEventKey *event, - gpointer data) -{ - if (event && event->keyval == GDK_Escape) - prefs_common_cancel(); - return FALSE; -} - -static void prefs_common_ok(void) -{ - prefs_common_apply(); - gtk_widget_hide(dialog.window); - if (quote_desc_win && GTK_WIDGET_VISIBLE(quote_desc_win)) - gtk_widget_hide(quote_desc_win); - - inc_unlock(); -} - -static void prefs_common_apply(void) -{ - prefs_set_data_from_dialog(param); - prefs_common_junk_filter_list_set(); - gtkut_stock_button_set_set_reverse(!prefs_common.comply_gnome_hig); - main_window_reflect_prefs_all(); - sock_set_io_timeout(prefs_common.io_timeout_secs); - prefs_common_write_config(); - - inc_autocheck_timer_remove(); - inc_autocheck_timer_set(); -} - -static void prefs_common_cancel(void) -{ - gtk_widget_hide(dialog.window); - inc_unlock(); -} diff --git a/src/prefs_common.h b/src/prefs_common.h index 56889b3c..9a42ac3f 100644 --- a/src/prefs_common.h +++ b/src/prefs_common.h @@ -26,12 +26,13 @@ #include +typedef struct _PrefsCommon PrefsCommon; + +#include "prefs.h" #include "mainwindow.h" #include "summaryview.h" -#include "codeconv.h" -#include "textview.h" - -typedef struct _PrefsCommon PrefsCommon; +//#include "codeconv.h" +//#include "textview.h" typedef enum { RECV_DIALOG_ALWAYS, @@ -249,10 +250,11 @@ struct _PrefsCommon extern PrefsCommon prefs_common; -void prefs_common_read_config (void); -void prefs_common_write_config (void); -void prefs_common_open (void); +PrefParam *prefs_common_get_params (void); + +void prefs_common_read_config (void); +void prefs_common_write_config (void); -void prefs_quote_description (void); +void prefs_common_junk_filter_list_set (void); #endif /* __PREFS_COMMON_H__ */ diff --git a/src/prefs_common_dialog.c b/src/prefs_common_dialog.c new file mode 100644 index 00000000..1df7d05f --- /dev/null +++ b/src/prefs_common_dialog.c @@ -0,0 +1,3520 @@ +/* + * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client + * Copyright (C) 1999-2005 Hiroyuki Yamamoto + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "defs.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "main.h" +#include "prefs.h" +#include "prefs_ui.h" +#include "prefs_common.h" +#include "prefs_common_dialog.h" +#include "prefs_display_header.h" +#include "prefs_summary_column.h" +#include "mainwindow.h" +#include "summaryview.h" +#include "messageview.h" +#include "manage_window.h" +#include "foldersel.h" +#include "inc.h" +#include "menu.h" +#include "codeconv.h" +#include "utils.h" +#include "gtkutils.h" +#include "alertpanel.h" +#include "folder.h" +#include "socket.h" + +static PrefsDialog dialog; + +static struct Receive { + GtkWidget *checkbtn_incext; + GtkWidget *entry_incext; + GtkWidget *button_incext; + + GtkWidget *checkbtn_local; + GtkWidget *checkbtn_filter_on_inc; + GtkWidget *entry_spool; + + GtkWidget *checkbtn_autochk; + GtkWidget *spinbtn_autochk; + GtkObject *spinbtn_autochk_adj; + + GtkWidget *checkbtn_chkonstartup; + GtkWidget *checkbtn_scan_after_inc; + GtkWidget *checkbtn_newmsg_notify; + GtkWidget *entry_newmsg_notify; +} receive; + +static struct Send { + GtkWidget *checkbtn_extsend; + GtkWidget *entry_extsend; + GtkWidget *button_extsend; + + GtkWidget *checkbtn_savemsg; + GtkWidget *checkbtn_filter_sent; + + GtkWidget *optmenu_charset; + GtkWidget *optmenu_encoding_method; +} p_send; + +static struct Compose { + GtkWidget *checkbtn_autosig; + GtkWidget *entry_sigsep; + + GtkWidget *checkbtn_autoextedit; + GtkWidget *spinbtn_undolevel; + GtkObject *spinbtn_undolevel_adj; + GtkWidget *spinbtn_linewrap; + GtkObject *spinbtn_linewrap_adj; + GtkWidget *checkbtn_wrapquote; + GtkWidget *checkbtn_autowrap; + GtkWidget *checkbtn_wrapatsend; + + GtkWidget *checkbtn_reply_account_autosel; + GtkWidget *checkbtn_quote; + GtkWidget *checkbtn_default_reply_list; +} compose; + +static struct Quote { + GtkWidget *entry_quotemark; + GtkWidget *text_quotefmt; + + GtkWidget *entry_fw_quotemark; + GtkWidget *text_fw_quotefmt; +} quote; + +static struct Display { + GtkWidget *fontbtn_textfont; + + GtkWidget *chkbtn_folder_unread; + GtkWidget *entry_ng_abbrev_len; + GtkWidget *spinbtn_ng_abbrev_len; + GtkObject *spinbtn_ng_abbrev_len_adj; + + GtkWidget *chkbtn_transhdr; + + GtkWidget *chkbtn_swapfrom; + GtkWidget *chkbtn_expand_thread; + GtkWidget *entry_datefmt; +} display; + +static struct Message { + GtkWidget *chkbtn_enablecol; + GtkWidget *button_edit_col; + GtkWidget *chkbtn_mbalnum; + GtkWidget *chkbtn_disphdrpane; + GtkWidget *chkbtn_disphdr; + GtkWidget *chkbtn_html; + GtkWidget *spinbtn_linespc; + GtkObject *spinbtn_linespc_adj; + + GtkWidget *chkbtn_smoothscroll; + GtkWidget *spinbtn_scrollstep; + GtkObject *spinbtn_scrollstep_adj; + GtkWidget *chkbtn_halfpage; + + GtkWidget *chkbtn_resize_image; + GtkWidget *chkbtn_inline_image; +} message; + +static struct JunkMail { + GtkWidget *chkbtn_enable_junk; + GtkWidget *entry_junk_learncmd; + GtkWidget *entry_nojunk_learncmd; + GtkWidget *entry_classify_cmd; + GtkWidget *entry_junkfolder; + GtkWidget *chkbtn_filter_on_recv; +} junk; + +#if USE_GPGME +static struct Privacy { + GtkWidget *checkbtn_auto_check_signatures; + GtkWidget *checkbtn_gpg_signature_popup; + GtkWidget *checkbtn_store_passphrase; + GtkWidget *spinbtn_store_passphrase; + GtkObject *spinbtn_store_passphrase_adj; + GtkWidget *checkbtn_passphrase_grab; + GtkWidget *checkbtn_gpg_warning; +} privacy; +#endif + +static struct Interface { + GtkWidget *checkbtn_always_show_msg; + GtkWidget *checkbtn_openunread; + GtkWidget *checkbtn_mark_as_read_on_newwin; + GtkWidget *checkbtn_openinbox; + GtkWidget *checkbtn_immedexec; + GtkWidget *optmenu_recvdialog; + GtkWidget *checkbtn_no_recv_err_panel; + GtkWidget *checkbtn_close_recv_dialog; + GtkWidget *checkbtn_comply_gnome_hig; +} interface; + +static struct Other { + GtkWidget *uri_combo; + GtkWidget *uri_entry; + GtkWidget *printcmd_entry; + GtkWidget *exteditor_combo; + GtkWidget *exteditor_entry; + + GtkWidget *checkbtn_addaddrbyclick; + GtkWidget *checkbtn_confonexit; + GtkWidget *checkbtn_cleanonexit; + GtkWidget *checkbtn_askonclean; + GtkWidget *checkbtn_warnqueued; +} other; + +static struct Advanced { + GtkWidget *checkbtn_strict_cache_check; + GtkWidget *spinbtn_iotimeout; + GtkObject *spinbtn_iotimeout_adj; +} advanced; + +static struct MessageColorButtons { + GtkWidget *quote_level1_btn; + GtkWidget *quote_level2_btn; + GtkWidget *quote_level3_btn; + GtkWidget *uri_btn; +} color_buttons; + +static struct KeybindDialog { + GtkWidget *window; + GtkWidget *combo; +} keybind; + +static GtkWidget *quote_desc_win; +static GtkWidget *quote_color_win; +static GtkWidget *color_dialog; + +static void prefs_common_charset_set_data_from_optmenu (PrefParam *pparam); +static void prefs_common_charset_set_optmenu (PrefParam *pparam); +static void prefs_common_encoding_set_data_from_optmenu (PrefParam *pparam); +static void prefs_common_encoding_set_optmenu (PrefParam *pparam); +static void prefs_common_recv_dialog_set_data_from_optmenu (PrefParam *pparam); +static void prefs_common_recv_dialog_set_optmenu (PrefParam *pparam); + +static PrefsUIData ui_data[] = { + /* Receive */ + {"use_ext_inc", &receive.checkbtn_incext, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"ext_inc_path", &receive.entry_incext, + prefs_set_data_from_entry, prefs_set_entry}, + + {"inc_local", &receive.checkbtn_local, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"filter_on_inc_local", &receive.checkbtn_filter_on_inc, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"spool_path", &receive.entry_spool, + prefs_set_data_from_entry, prefs_set_entry}, + + {"autochk_newmail", &receive.checkbtn_autochk, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"autochk_interval", &receive.spinbtn_autochk, + prefs_set_data_from_spinbtn, prefs_set_spinbtn}, + {"check_on_startup", &receive.checkbtn_chkonstartup, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"scan_all_after_inc", &receive.checkbtn_scan_after_inc, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"enable_newmsg_notify", &receive.checkbtn_newmsg_notify, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"newmsg_notify_command", &receive.entry_newmsg_notify, + prefs_set_data_from_entry, prefs_set_entry}, + + /* Send */ + {"use_ext_sendmail", &p_send.checkbtn_extsend, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"ext_sendmail_cmd", &p_send.entry_extsend, + prefs_set_data_from_entry, prefs_set_entry}, + {"save_message", &p_send.checkbtn_savemsg, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"filter_sent_message", &p_send.checkbtn_filter_sent, + prefs_set_data_from_toggle, prefs_set_toggle}, + + {"outgoing_charset", &p_send.optmenu_charset, + prefs_common_charset_set_data_from_optmenu, + prefs_common_charset_set_optmenu}, + {"encoding_method", &p_send.optmenu_encoding_method, + prefs_common_encoding_set_data_from_optmenu, + prefs_common_encoding_set_optmenu}, + + /* {"allow_jisx0201_kana", NULL, NULL, NULL}, */ + + /* Compose */ + {"auto_signature", &compose.checkbtn_autosig, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"signature_separator", &compose.entry_sigsep, + prefs_set_data_from_entry, prefs_set_entry}, + + {"auto_ext_editor", &compose.checkbtn_autoextedit, + prefs_set_data_from_toggle, prefs_set_toggle}, + + {"undo_level", &compose.spinbtn_undolevel, + prefs_set_data_from_spinbtn, prefs_set_spinbtn}, + + {"linewrap_length", &compose.spinbtn_linewrap, + prefs_set_data_from_spinbtn, prefs_set_spinbtn}, + {"linewrap_quotation", &compose.checkbtn_wrapquote, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"linewrap_auto", &compose.checkbtn_autowrap, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"linewrap_before_sending", &compose.checkbtn_wrapatsend, + prefs_set_data_from_toggle, prefs_set_toggle}, + + {"reply_with_quote", &compose.checkbtn_quote, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"reply_account_autoselect", + &compose.checkbtn_reply_account_autosel, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"default_reply_list", &compose.checkbtn_default_reply_list, + prefs_set_data_from_toggle, prefs_set_toggle}, + + /* {"show_ruler", NULL, NULL, NULL}, */ + + /* Quote */ + {"reply_quote_mark", "e.entry_quotemark, + prefs_set_data_from_entry, prefs_set_entry}, + {"reply_quote_format", "e.text_quotefmt, + prefs_set_data_from_text, prefs_set_text}, + + {"forward_quote_mark", "e.entry_fw_quotemark, + prefs_set_data_from_entry, prefs_set_entry}, + {"forward_quote_format", "e.text_fw_quotefmt, + prefs_set_data_from_text, prefs_set_text}, + + /* Display */ + {"message_font_name", &display.fontbtn_textfont, + prefs_set_data_from_fontbtn, prefs_set_fontbtn}, + + {"display_folder_unread_num", &display.chkbtn_folder_unread, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"newsgroup_abbrev_len", &display.spinbtn_ng_abbrev_len, + prefs_set_data_from_spinbtn, prefs_set_spinbtn}, + + {"translate_header", &display.chkbtn_transhdr, + prefs_set_data_from_toggle, prefs_set_toggle}, + + /* Display: Summary View */ + {"enable_swap_from", &display.chkbtn_swapfrom, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"date_format", &display.entry_datefmt, + prefs_set_data_from_entry, prefs_set_entry}, + {"expand_thread", &display.chkbtn_expand_thread, + prefs_set_data_from_toggle, prefs_set_toggle}, + +#if 0 + {"enable_rules_hint", NULL, NULL, NULL}, + {"bold_unread", NULL, NULL, NULL}, + + {"toolbar_style", NULL, NULL, NULL}, + {"show_statusbar", NULL, NULL, NULL}, + + {"folderview_vscrollbar_policy", NULL, NULL, NULL}, + + {"summary_col_show_mark", NULL, NULL, NULL}, + {"summary_col_show_unread", NULL, NULL, NULL}, + {"summary_col_show_mime", NULL, NULL, NULL}, + {"summary_col_show_subject", NULL, NULL, NULL}, + {"summary_col_show_from", NULL, NULL, NULL}, + {"summary_col_show_date", NULL, NULL, NULL}, + {"summary_col_show_size", NULL, NULL, NULL}, + {"summary_col_show_number", NULL, NULL, NULL}, + + {"summary_col_pos_mark", NULL, NULL, NULL}, + {"summary_col_pos_unread", NULL, NULL, NULL}, + {"summary_col_pos_mime", NULL, NULL, NULL}, + {"summary_col_pos_subject", NULL, NULL, NULL}, + {"summary_col_pos_from", NULL, NULL, NULL}, + {"summary_col_pos_date", NULL, NULL, NULL}, + {"summary_col_pos_size", NULL, NULL, NULL}, + {"summary_col_pos_number", NULL, NULL, NULL}, + + {"summary_col_size_mark", NULL, NULL, NULL}, + {"summary_col_size_unread", NULL, NULL, NULL}, + {"summary_col_size_mime", NULL, NULL, NULL}, + {"summary_col_size_subject", NULL, NULL, NULL}, + {"summary_col_size_from", NULL, NULL, NULL}, + {"summary_col_size_date", NULL, NULL, NULL}, + {"summary_col_size_size", NULL, NULL, NULL}, + {"summary_col_size_number", NULL, NULL, NULL}, + + /* Widget size */ + {"folderwin_x", NULL, NULL, NULL}, + {"folderwin_y", NULL, NULL, NULL}, + {"folderview_width", NULL, NULL, NULL}, + {"folderview_height", NULL, NULL, NULL}, + {"folderview_visible", NULL, NULL, NULL}, + + {"folder_col_folder", NULL, NULL, NULL}, + {"folder_col_new", NULL, NULL, NULL}, + {"folder_col_unread", NULL, NULL, NULL}, + {"folder_col_total", NULL, NULL, NULL}, + + {"summaryview_width", NULL, NULL, NULL}, + {"summaryview_height", NULL, NULL, NULL}, + + {"main_messagewin_x", NULL, NULL, NULL}, + {"main_messagewin_y", NULL, NULL, NULL}, + {"messageview_width", NULL, NULL, NULL}, + {"messageview_height", NULL, NULL, NULL}, + {"messageview_visible", NULL, NULL, NULL}, + + {"mainview_x", NULL, NULL, NULL}, + {"mainview_y", NULL, NULL, NULL}, + {"mainview_width", NULL, NULL, NULL}, + {"mainview_height", NULL, NULL, NULL}, + {"mainwin_x", NULL, NULL, NULL}, + {"mainwin_y", NULL, NULL, NULL}, + {"mainwin_width", NULL, NULL, NULL}, + {"mainwin_height", NULL, NULL, NULL}, + {"messagewin_width", NULL, NULL, NULL}, + {"messagewin_height", NULL, NULL, NULL}, + {"sourcewin_width", NULL, NULL, NULL}, + {"sourcewin_height", NULL, NULL, NULL}, + {"compose_width", NULL, NULL, NULL}, + {"compose_height", NULL, NULL, NULL}, +#endif /* 0 */ + + /* Message */ + {"enable_color", &message.chkbtn_enablecol, + prefs_set_data_from_toggle, prefs_set_toggle}, + +#if 0 + {"quote_level1_color", NULL, NULL, NULL}, + {"quote_level2_color", NULL, NULL, NULL}, + {"quote_level3_color", NULL, NULL, NULL}, + {"uri_color", NULL, NULL, NULL}, + {"signature_color", NULL, NULL, NULL}, + {"recycle_quote_colors", NULL, NULL, NULL}, +#endif + + {"convert_mb_alnum", &message.chkbtn_mbalnum, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"display_header_pane", &message.chkbtn_disphdrpane, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"display_header", &message.chkbtn_disphdr, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"render_html", &message.chkbtn_html, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"line_space", &message.spinbtn_linespc, + prefs_set_data_from_spinbtn, prefs_set_spinbtn}, + + /* {"textview_cursor_visible", NULL, NULL, NULL}, */ + + {"enable_smooth_scroll", &message.chkbtn_smoothscroll, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"scroll_step", &message.spinbtn_scrollstep, + prefs_set_data_from_spinbtn, prefs_set_spinbtn}, + {"scroll_half_page", &message.chkbtn_halfpage, + prefs_set_data_from_toggle, prefs_set_toggle}, + + {"resize_image", &message.chkbtn_resize_image, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"inline_image", &message.chkbtn_inline_image, + prefs_set_data_from_toggle, prefs_set_toggle}, + +#if 0 + {"show_other_header", NULL, NULL, NULL}, + + /* MIME viewer */ + {"mime_image_viewer", NULL, NULL, NULL}, + {"mime_audio_player", NULL, NULL, NULL}, + {"mime_open_command", NULL, NULL, NULL}, +#endif + + /* Junk mail */ + {"enable_junk", &junk.chkbtn_enable_junk, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"junk_learn_command", &junk.entry_junk_learncmd, + prefs_set_data_from_entry, prefs_set_entry}, + {"nojunk_learn_command", &junk.entry_nojunk_learncmd, + prefs_set_data_from_entry, prefs_set_entry}, + {"junk_classify_command", &junk.entry_classify_cmd, + prefs_set_data_from_entry, prefs_set_entry}, + {"junk_folder", &junk.entry_junkfolder, + prefs_set_data_from_entry, prefs_set_entry}, + {"filter_junk_on_receive", &junk.chkbtn_filter_on_recv, + prefs_set_data_from_toggle, prefs_set_toggle}, + +#if USE_GPGME + /* Privacy */ + {"auto_check_signatures", + &privacy.checkbtn_auto_check_signatures, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"gpg_signature_popup", &privacy.checkbtn_gpg_signature_popup, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"store_passphrase", &privacy.checkbtn_store_passphrase, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"store_passphrase_timeout", &privacy.spinbtn_store_passphrase, + prefs_set_data_from_spinbtn, prefs_set_spinbtn}, +#ifndef G_OS_WIN32 + {"passphrase_grab", &privacy.checkbtn_passphrase_grab, + prefs_set_data_from_toggle, prefs_set_toggle}, +#endif /* G_OS_WIN32 */ + {"gpg_warning", &privacy.checkbtn_gpg_warning, + prefs_set_data_from_toggle, prefs_set_toggle}, +#endif /* USE_GPGME */ + + /* Interface */ +#if 0 + {"separate_folder", NULL, NULL, NULL}, + {"separate_message", NULL, NULL, NULL}, +#endif + + {"always_show_message_when_selected", + &interface.checkbtn_always_show_msg, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"open_unread_on_enter", &interface.checkbtn_openunread, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"mark_as_read_on_new_window", + &interface.checkbtn_mark_as_read_on_newwin, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"open_inbox_on_inc", &interface.checkbtn_openinbox, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"immediate_execution", &interface.checkbtn_immedexec, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"receive_dialog_mode", &interface.optmenu_recvdialog, + prefs_common_recv_dialog_set_data_from_optmenu, + prefs_common_recv_dialog_set_optmenu}, + {"no_receive_error_panel", &interface.checkbtn_no_recv_err_panel, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"close_receive_dialog", &interface.checkbtn_close_recv_dialog, + prefs_set_data_from_toggle, prefs_set_toggle}, + + {"comply_gnome_hig", &interface.checkbtn_comply_gnome_hig, + prefs_set_data_from_toggle, prefs_set_toggle}, + + /* Other */ + {"uri_open_command", &other.uri_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"print_command", &other.printcmd_entry, + prefs_set_data_from_entry, prefs_set_entry}, + {"ext_editor_command", &other.exteditor_entry, + prefs_set_data_from_entry, prefs_set_entry}, + + {"add_address_by_click", &other.checkbtn_addaddrbyclick, + prefs_set_data_from_toggle, prefs_set_toggle}, + + {"confirm_on_exit", &other.checkbtn_confonexit, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"clean_trash_on_exit", &other.checkbtn_cleanonexit, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"ask_on_cleaning", &other.checkbtn_askonclean, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"warn_queued_on_exit", &other.checkbtn_warnqueued, + prefs_set_data_from_toggle, prefs_set_toggle}, + + /* {"logwindow_line_limit", NULL, NULL, NULL}, */ + + /* Advanced */ + {"strict_cache_check", &advanced.checkbtn_strict_cache_check, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"io_timeout_secs", &advanced.spinbtn_iotimeout, + prefs_set_data_from_spinbtn, prefs_set_spinbtn}, + + {NULL, NULL, NULL, NULL} +}; + +/* widget creating functions */ +static void prefs_common_create (void); +static void prefs_receive_create (void); +static void prefs_send_create (void); +static void prefs_compose_create (void); +static void prefs_quote_create (void); +static void prefs_display_create (void); +static void prefs_message_create (void); +static void prefs_junk_create (void); +#if USE_GPGME +static void prefs_privacy_create (void); +#endif +static void prefs_interface_create (void); +static void prefs_other_create (void); +static void prefs_advanced_create (void); + +static void date_format_ok_btn_clicked (GtkButton *button, + GtkWidget **widget); +static void date_format_cancel_btn_clicked (GtkButton *button, + GtkWidget **widget); +static gboolean date_format_key_pressed (GtkWidget *keywidget, + GdkEventKey *event, + GtkWidget **widget); +static gboolean date_format_on_delete (GtkWidget *dialogwidget, + GdkEventAny *event, + GtkWidget **widget); +static void date_format_entry_on_change (GtkEditable *editable, + GtkLabel *example); +static void date_format_select_row (GtkWidget *date_format_list, + gint row, + gint column, + GdkEventButton *event, + GtkWidget *date_format); +static GtkWidget *date_format_create (GtkButton *button, + void *data); + +static void prefs_quote_description_create (void); +static gboolean prefs_quote_description_key_pressed + (GtkWidget *widget, + GdkEventKey *event, + gpointer data); + +static void prefs_quote_colors_dialog (void); +static void prefs_quote_colors_dialog_create (void); +static gboolean prefs_quote_colors_key_pressed (GtkWidget *widget, + GdkEventKey *event, + gpointer data); +static void quote_color_set_dialog (GtkWidget *widget, + gpointer data); +static void quote_colors_set_dialog_ok (GtkWidget *widget, + gpointer data); +static void quote_colors_set_dialog_cancel (GtkWidget *widget, + gpointer data); +static gboolean quote_colors_set_dialog_key_pressed + (GtkWidget *widget, + GdkEventKey *event, + gpointer data); +static void set_button_bg_color (GtkWidget *widget, + gint color); +static void prefs_enable_message_color_toggled (void); +static void prefs_recycle_colors_toggled (GtkWidget *widget); + +static void prefs_keybind_select (void); +static gint prefs_keybind_deleted (GtkWidget *widget, + GdkEventAny *event, + gpointer data); +static gboolean prefs_keybind_key_pressed (GtkWidget *widget, + GdkEventKey *event, + gpointer data); +static void prefs_keybind_cancel (void); +static void prefs_keybind_apply_clicked (GtkWidget *widget); + +static void prefs_common_select_folder_cb (GtkWidget *widget, + gpointer data); + +static gint prefs_common_deleted (GtkWidget *widget, + GdkEventAny *event, + gpointer data); +static gboolean prefs_common_key_pressed (GtkWidget *widget, + GdkEventKey *event, + gpointer data); +static void prefs_common_ok (void); +static void prefs_common_apply (void); +static void prefs_common_cancel (void); + + +void prefs_common_open(void) +{ + static gboolean ui_registered = FALSE; + + inc_lock(); + + if (!ui_registered) { + prefs_register_ui(prefs_common_get_params(), ui_data); + ui_registered = TRUE; + } + + if (!dialog.window) { + prefs_common_create(); + } + + gtkut_box_set_reverse_order(GTK_BOX(dialog.confirm_area), + !prefs_common.comply_gnome_hig); + manage_window_set_transient(GTK_WINDOW(dialog.window)); + gtk_notebook_set_current_page(GTK_NOTEBOOK(dialog.notebook), 0); + gtk_widget_grab_focus(dialog.ok_btn); + + prefs_set_dialog(prefs_common_get_params()); + + gtk_widget_show(dialog.window); +} + +static void prefs_common_create(void) +{ + gint page = 0; + + debug_print(_("Creating common preferences window...\n")); + + prefs_dialog_create(&dialog); + gtk_window_set_title (GTK_WINDOW(dialog.window), + _("Common Preferences")); + g_signal_connect (G_OBJECT(dialog.window), "delete_event", + G_CALLBACK(prefs_common_deleted), NULL); + g_signal_connect (G_OBJECT(dialog.window), "key_press_event", + G_CALLBACK(prefs_common_key_pressed), NULL); + MANAGE_WINDOW_SIGNALS_CONNECT(dialog.window); + + g_signal_connect (G_OBJECT(dialog.ok_btn), "clicked", + G_CALLBACK(prefs_common_ok), NULL); + g_signal_connect (G_OBJECT(dialog.apply_btn), "clicked", + G_CALLBACK(prefs_common_apply), NULL); + g_signal_connect (G_OBJECT(dialog.cancel_btn), "clicked", + G_CALLBACK(prefs_common_cancel), NULL); + + /* create all widgets on notebook */ + prefs_receive_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Receive"), page++); + prefs_send_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Send"), page++); + prefs_compose_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Compose"), page++); + prefs_quote_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Quote"), page++); + prefs_display_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Display"), page++); + prefs_message_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Message"), page++); + prefs_junk_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Junk mail"), page++); +#if USE_GPGME + prefs_privacy_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Privacy"), page++); +#endif + prefs_interface_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Interface"), page++); + prefs_other_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Other"), page++); + prefs_advanced_create(); + SET_NOTEBOOK_LABEL(dialog.notebook, _("Advanced"), page++); + + gtk_widget_show_all(dialog.window); +} + +static void prefs_receive_create(void) +{ + GtkWidget *vbox1; + GtkWidget *vbox2; + GtkWidget *vbox3; + GtkWidget *frame_incext; + GtkWidget *checkbtn_incext; + GtkWidget *hbox; + GtkWidget *label_incext; + GtkWidget *entry_incext; + /* GtkWidget *button_incext; */ + + GtkWidget *frame_spool; + GtkWidget *checkbtn_local; + GtkWidget *checkbtn_filter_on_inc; + GtkWidget *label_spool; + GtkWidget *entry_spool; + + GtkWidget *hbox_autochk; + GtkWidget *checkbtn_autochk; + GtkWidget *label_autochk1; + GtkObject *spinbtn_autochk_adj; + GtkWidget *spinbtn_autochk; + GtkWidget *label_autochk2; + GtkWidget *checkbtn_chkonstartup; + GtkWidget *checkbtn_scan_after_inc; + GtkWidget *checkbtn_newmsg_notify; + GtkWidget *label_newmsg_notify; + GtkWidget *entry_newmsg_notify; + GtkWidget *label_notify_cmd_desc; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + PACK_FRAME_WITH_CHECK_BUTTON(vbox1, frame_incext, checkbtn_incext, + _("Use external program for incorporation")); + + vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (frame_incext), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); + SET_TOGGLE_SENSITIVITY (checkbtn_incext, vbox2); + + hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); + + label_incext = gtk_label_new (_("Command")); + gtk_widget_show (label_incext); + gtk_box_pack_start (GTK_BOX (hbox), label_incext, FALSE, FALSE, 0); + + entry_incext = gtk_entry_new (); + gtk_widget_show (entry_incext); + gtk_box_pack_start (GTK_BOX (hbox), entry_incext, TRUE, TRUE, 0); + +#if 0 + button_incext = gtk_button_new_with_label ("... "); + gtk_widget_show (button_incext); + gtk_box_pack_start (GTK_BOX (hbox), button_incext, FALSE, FALSE, 0); +#endif + + PACK_FRAME_WITH_CHECK_BUTTON(vbox1, frame_spool, checkbtn_local, + _("Incorporate from local spool")); + + vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (frame_spool), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); + SET_TOGGLE_SENSITIVITY (checkbtn_local, vbox2); + + hbox = gtk_hbox_new (FALSE, 32); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); + + PACK_CHECK_BUTTON (hbox, checkbtn_filter_on_inc, + _("Filter on incorporation")); + + hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); + + label_spool = gtk_label_new (_("Spool path")); + gtk_widget_show (label_spool); + gtk_box_pack_start (GTK_BOX (hbox), label_spool, FALSE, FALSE, 0); + + entry_spool = gtk_entry_new (); + gtk_widget_show (entry_spool); + gtk_box_pack_start (GTK_BOX (hbox), entry_spool, TRUE, TRUE, 0); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); + + /* Auto-checking */ + hbox_autochk = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox_autochk); + gtk_box_pack_start (GTK_BOX (vbox2), hbox_autochk, FALSE, FALSE, 0); + + PACK_CHECK_BUTTON (hbox_autochk, checkbtn_autochk, + _("Auto-check new mail")); + + label_autochk1 = gtk_label_new (_("every")); + gtk_widget_show (label_autochk1); + gtk_box_pack_start (GTK_BOX (hbox_autochk), label_autochk1, FALSE, FALSE, 0); + + spinbtn_autochk_adj = gtk_adjustment_new (5, 1, 100, 1, 10, 10); + spinbtn_autochk = gtk_spin_button_new + (GTK_ADJUSTMENT (spinbtn_autochk_adj), 1, 0); + gtk_widget_show (spinbtn_autochk); + gtk_box_pack_start (GTK_BOX (hbox_autochk), spinbtn_autochk, FALSE, FALSE, 0); + gtk_widget_set_size_request (spinbtn_autochk, 64, -1); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_autochk), TRUE); + + label_autochk2 = gtk_label_new (_("minute(s)")); + gtk_widget_show (label_autochk2); + gtk_box_pack_start (GTK_BOX (hbox_autochk), label_autochk2, FALSE, FALSE, 0); + + SET_TOGGLE_SENSITIVITY(checkbtn_autochk, label_autochk1); + SET_TOGGLE_SENSITIVITY(checkbtn_autochk, spinbtn_autochk); + SET_TOGGLE_SENSITIVITY(checkbtn_autochk, label_autochk2); + + PACK_CHECK_BUTTON (vbox2, checkbtn_chkonstartup, + _("Check new mail on startup")); + PACK_CHECK_BUTTON (vbox2, checkbtn_scan_after_inc, + _("Update all local folders after incorporation")); + + /* New message notify */ + PACK_CHECK_BUTTON (vbox2, checkbtn_newmsg_notify, + _("Execute command when new messages arrived")); + + PACK_VSPACER (vbox2, vbox3, VSPACING_NARROW_2); + + hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); + + label_newmsg_notify = gtk_label_new (_("Command")); + gtk_widget_show (label_newmsg_notify); + gtk_box_pack_start (GTK_BOX (hbox), label_newmsg_notify, + FALSE, FALSE, 0); + + entry_newmsg_notify = gtk_entry_new (); + gtk_widget_show (entry_newmsg_notify); + gtk_box_pack_start (GTK_BOX (hbox), entry_newmsg_notify, TRUE, TRUE, 0); + + PACK_VSPACER (vbox2, vbox3, VSPACING_NARROW_2); + + PACK_SMALL_LABEL + (vbox2, label_notify_cmd_desc, + _("`%d' will be replaced with the number of new messages.")); + + SET_TOGGLE_SENSITIVITY (checkbtn_newmsg_notify, hbox); + SET_TOGGLE_SENSITIVITY (checkbtn_newmsg_notify, label_notify_cmd_desc); + + receive.checkbtn_incext = checkbtn_incext; + receive.entry_incext = entry_incext; + /* receive.button_incext = button_incext; */ + + receive.checkbtn_local = checkbtn_local; + receive.checkbtn_filter_on_inc = checkbtn_filter_on_inc; + receive.entry_spool = entry_spool; + + receive.checkbtn_autochk = checkbtn_autochk; + receive.spinbtn_autochk = spinbtn_autochk; + receive.spinbtn_autochk_adj = spinbtn_autochk_adj; + + receive.checkbtn_chkonstartup = checkbtn_chkonstartup; + receive.checkbtn_scan_after_inc = checkbtn_scan_after_inc; + receive.checkbtn_newmsg_notify = checkbtn_newmsg_notify; + receive.entry_newmsg_notify = entry_newmsg_notify; +} + +static void prefs_send_create(void) +{ + GtkWidget *vbox1; + GtkWidget *vbox2; + GtkWidget *frame_extsend; + GtkWidget *vbox_extsend; + GtkWidget *checkbtn_extsend; + GtkWidget *hbox1; + GtkWidget *label_extsend; + GtkWidget *entry_extsend; + /* GtkWidget *button_extsend; */ + GtkWidget *checkbtn_savemsg; + GtkWidget *checkbtn_filter_sent; + GtkWidget *label_outcharset; + GtkWidget *optmenu_charset; + GtkWidget *optmenu_menu; + GtkWidget *menuitem; + GtkWidget *label_charset_desc; + GtkWidget *optmenu_encoding; + GtkWidget *label_encoding; + GtkWidget *label_encoding_desc; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + PACK_FRAME_WITH_CHECK_BUTTON (vbox1, frame_extsend, checkbtn_extsend, + _("Use external program for sending")); + + vbox_extsend = gtk_vbox_new (FALSE, VSPACING_NARROW); + gtk_widget_show (vbox_extsend); + gtk_container_add (GTK_CONTAINER (frame_extsend), vbox_extsend); + gtk_container_set_border_width (GTK_CONTAINER (vbox_extsend), 8); + SET_TOGGLE_SENSITIVITY(checkbtn_extsend, vbox_extsend); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox_extsend), hbox1, FALSE, FALSE, 0); + + label_extsend = gtk_label_new (_("Command")); + gtk_widget_show (label_extsend); + gtk_box_pack_start (GTK_BOX (hbox1), label_extsend, FALSE, FALSE, 0); + + entry_extsend = gtk_entry_new (); + gtk_widget_show (entry_extsend); + gtk_box_pack_start (GTK_BOX (hbox1), entry_extsend, TRUE, TRUE, 0); + +#if 0 + button_extsend = gtk_button_new_with_label ("... "); + gtk_widget_show (button_extsend); + gtk_box_pack_start (GTK_BOX (hbox1), button_extsend, FALSE, FALSE, 0); +#endif + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); + + PACK_CHECK_BUTTON (vbox2, checkbtn_savemsg, + _("Save sent messages to outbox")); + PACK_CHECK_BUTTON (vbox2, checkbtn_filter_sent, + _("Apply filter rules to sent messages")); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); + + label_outcharset = gtk_label_new (_("Outgoing encoding")); + gtk_widget_show (label_outcharset); + gtk_box_pack_start (GTK_BOX (hbox1), label_outcharset, FALSE, FALSE, 0); + + optmenu_charset = gtk_option_menu_new (); + gtk_widget_show (optmenu_charset); + gtk_box_pack_start (GTK_BOX (hbox1), optmenu_charset, FALSE, FALSE, 0); + + optmenu_menu = gtk_menu_new (); + +#define SET_MENUITEM(str, data) \ +{ \ + MENUITEM_ADD(optmenu_menu, menuitem, str, data); \ +} + + SET_MENUITEM(_("Automatic (Recommended)"), CS_AUTO); + SET_MENUITEM(NULL, NULL); + SET_MENUITEM(_("7bit ascii (US-ASCII)"), CS_US_ASCII); + SET_MENUITEM(NULL, NULL); + SET_MENUITEM(_("Unicode (UTF-8)"), CS_UTF_8); + SET_MENUITEM(NULL, NULL); + SET_MENUITEM(_("Western European (ISO-8859-1)"), CS_ISO_8859_1); + SET_MENUITEM(_("Western European (ISO-8859-15)"), CS_ISO_8859_15); + SET_MENUITEM(NULL, NULL); + SET_MENUITEM(_("Central European (ISO-8859-2)"), CS_ISO_8859_2); + SET_MENUITEM(NULL, NULL); + SET_MENUITEM(_("Baltic (ISO-8859-13)"), CS_ISO_8859_13); + SET_MENUITEM(_("Baltic (ISO-8859-4)"), CS_ISO_8859_4); + SET_MENUITEM(NULL, NULL); + SET_MENUITEM(_("Greek (ISO-8859-7)"), CS_ISO_8859_7); + SET_MENUITEM(NULL, NULL); + SET_MENUITEM(_("Hebrew (ISO-8859-8)"), CS_ISO_8859_8); + SET_MENUITEM(_("Hebrew (Windows-1255)"), CS_WINDOWS_1255); + SET_MENUITEM(NULL, NULL); + SET_MENUITEM(_("Turkish (ISO-8859-9)"), CS_ISO_8859_9); + SET_MENUITEM(NULL, NULL); + SET_MENUITEM(_("Cyrillic (ISO-8859-5)"), CS_ISO_8859_5); + SET_MENUITEM(_("Cyrillic (KOI8-R)"), CS_KOI8_R); + SET_MENUITEM(_("Cyrillic (KOI8-U)"), CS_KOI8_U); + SET_MENUITEM(_("Cyrillic (Windows-1251)"), CS_WINDOWS_1251); + SET_MENUITEM(NULL, NULL); + SET_MENUITEM(_("Japanese (ISO-2022-JP)"), CS_ISO_2022_JP); +#if 0 + SET_MENUITEM(_("Japanese (EUC-JP)"), CS_EUC_JP); + SET_MENUITEM(_("Japanese (Shift_JIS)"), CS_SHIFT_JIS); +#endif /* 0 */ + SET_MENUITEM(NULL, NULL); + SET_MENUITEM(_("Simplified Chinese (GB2312)"), CS_GB2312); + SET_MENUITEM(_("Simplified Chinese (GBK)"), CS_GBK); + SET_MENUITEM(_("Traditional Chinese (Big5)"), CS_BIG5); +#if 0 + SET_MENUITEM(_("Traditional Chinese (EUC-TW)"), CS_EUC_TW); + SET_MENUITEM(_("Chinese (ISO-2022-CN)"), CS_ISO_2022_CN); +#endif /* 0 */ + SET_MENUITEM(NULL, NULL); + SET_MENUITEM(_("Korean (EUC-KR)"), CS_EUC_KR); + SET_MENUITEM(NULL, NULL); + SET_MENUITEM(_("Thai (TIS-620)"), CS_TIS_620); + SET_MENUITEM(_("Thai (Windows-874)"), CS_WINDOWS_874); + + gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_charset), + optmenu_menu); + + PACK_SMALL_LABEL (vbox1, label_charset_desc, + _("If `Automatic' is selected, the optimal encoding " + "for the current locale will be used.")); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); + + label_encoding = gtk_label_new (_("Transfer encoding")); + gtk_widget_show (label_encoding); + gtk_box_pack_start (GTK_BOX (hbox1), label_encoding, FALSE, FALSE, 0); + + optmenu_encoding = gtk_option_menu_new (); + gtk_widget_show (optmenu_encoding); + gtk_box_pack_start (GTK_BOX (hbox1), optmenu_encoding, FALSE, FALSE, 0); + + optmenu_menu = gtk_menu_new (); + + SET_MENUITEM(_("Automatic"), CTE_AUTO); + SET_MENUITEM("base64", CTE_BASE64); + SET_MENUITEM("quoted-printable", CTE_QUOTED_PRINTABLE); + SET_MENUITEM("8bit", CTE_8BIT); + + gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_encoding), + optmenu_menu); + + PACK_SMALL_LABEL (vbox1, label_encoding_desc, + _("Specify Content-Transfer-Encoding used when " + "message body contains non-ASCII characters.")); + + p_send.checkbtn_extsend = checkbtn_extsend; + p_send.entry_extsend = entry_extsend; + /* p_send.button_extsend = button_extsend; */ + + p_send.checkbtn_savemsg = checkbtn_savemsg; + p_send.checkbtn_filter_sent = checkbtn_filter_sent; + + p_send.optmenu_charset = optmenu_charset; + p_send.optmenu_encoding_method = optmenu_encoding; +} + +static void prefs_compose_create(void) +{ + GtkWidget *vbox1; + GtkWidget *hbox1; + GtkWidget *hbox2; + + GtkWidget *frame_sig; + GtkWidget *checkbtn_autosig; + GtkWidget *label_sigsep; + GtkWidget *entry_sigsep; + + GtkWidget *frame_editor; + GtkWidget *vbox2; + GtkWidget *checkbtn_autoextedit; + GtkWidget *vbox3; + GtkWidget *hbox3; + GtkWidget *hbox4; + GtkWidget *label_undolevel; + GtkObject *spinbtn_undolevel_adj; + GtkWidget *spinbtn_undolevel; + GtkWidget *label_linewrap; + GtkObject *spinbtn_linewrap_adj; + GtkWidget *spinbtn_linewrap; + GtkWidget *checkbtn_wrapquote; + GtkWidget *checkbtn_autowrap; + GtkWidget *checkbtn_wrapatsend; + + GtkWidget *frame_reply; + GtkWidget *checkbtn_reply_account_autosel; + GtkWidget *checkbtn_quote; + GtkWidget *checkbtn_default_reply_list; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + /* signature */ + + PACK_FRAME(vbox1, frame_sig, _("Signature")); + + hbox1 = gtk_hbox_new (FALSE, 32); + gtk_widget_show (hbox1); + gtk_container_add (GTK_CONTAINER (frame_sig), hbox1); + gtk_container_set_border_width (GTK_CONTAINER (hbox1), 8); + + hbox2 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox2); + gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0); + + label_sigsep = gtk_label_new (_("Signature separator")); + gtk_widget_show (label_sigsep); + gtk_box_pack_start (GTK_BOX (hbox2), label_sigsep, FALSE, FALSE, 0); + + entry_sigsep = gtk_entry_new (); + gtk_widget_show (entry_sigsep); + gtk_box_pack_start (GTK_BOX (hbox2), entry_sigsep, FALSE, FALSE, 0); + gtk_widget_set_size_request (entry_sigsep, 64, -1); + + PACK_CHECK_BUTTON (hbox1, checkbtn_autosig, _("Insert automatically")); + + PACK_FRAME (vbox1, frame_editor, _("Editor")); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (frame_editor), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); + + PACK_CHECK_BUTTON (vbox2, checkbtn_autoextedit, + _("Automatically launch the external editor")); + + PACK_VSPACER (vbox2, vbox3, VSPACING_NARROW_2); + + /* undo */ + + hbox3 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox3); + gtk_box_pack_start (GTK_BOX (vbox2), hbox3, FALSE, FALSE, 0); + + label_undolevel = gtk_label_new (_("Undo level")); + gtk_widget_show (label_undolevel); + gtk_box_pack_start (GTK_BOX (hbox3), label_undolevel, FALSE, FALSE, 0); + + spinbtn_undolevel_adj = gtk_adjustment_new (50, 0, 100, 1, 10, 10); + spinbtn_undolevel = gtk_spin_button_new + (GTK_ADJUSTMENT (spinbtn_undolevel_adj), 1, 0); + gtk_widget_show (spinbtn_undolevel); + gtk_box_pack_start (GTK_BOX (hbox3), spinbtn_undolevel, FALSE, FALSE, 0); + gtk_widget_set_size_request (spinbtn_undolevel, 64, -1); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_undolevel), TRUE); + + PACK_VSPACER (vbox2, vbox3, VSPACING_NARROW_2); + + /* line-wrapping */ + + hbox3 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox3); + gtk_box_pack_start (GTK_BOX (vbox2), hbox3, FALSE, FALSE, 0); + + label_linewrap = gtk_label_new (_("Wrap messages at")); + gtk_widget_show (label_linewrap); + gtk_box_pack_start (GTK_BOX (hbox3), label_linewrap, FALSE, FALSE, 0); + + spinbtn_linewrap_adj = gtk_adjustment_new (72, 20, 1024, 1, 10, 10); + spinbtn_linewrap = gtk_spin_button_new + (GTK_ADJUSTMENT (spinbtn_linewrap_adj), 1, 0); + gtk_widget_show (spinbtn_linewrap); + gtk_box_pack_start (GTK_BOX (hbox3), spinbtn_linewrap, FALSE, FALSE, 0); + gtk_widget_set_size_request (spinbtn_linewrap, 64, -1); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_linewrap), TRUE); + + label_linewrap = gtk_label_new (_("characters")); + gtk_widget_show (label_linewrap); + gtk_box_pack_start (GTK_BOX (hbox3), label_linewrap, FALSE, FALSE, 0); + + PACK_VSPACER (vbox2, vbox3, VSPACING_NARROW_2); + + hbox4 = gtk_hbox_new (FALSE, 32); + gtk_widget_show (hbox4); + gtk_box_pack_start (GTK_BOX (vbox2), hbox4, FALSE, FALSE, 0); + + PACK_CHECK_BUTTON (hbox4, checkbtn_wrapquote, _("Wrap quotation")); + + hbox4 = gtk_hbox_new (FALSE, 32); + gtk_widget_show (hbox4); + gtk_box_pack_start (GTK_BOX (vbox2), hbox4, FALSE, FALSE, 0); + + PACK_CHECK_BUTTON (hbox4, checkbtn_autowrap, _("Wrap on input")); + PACK_CHECK_BUTTON + (hbox4, checkbtn_wrapatsend, _("Wrap before sending")); + + PACK_FRAME(vbox1, frame_reply, _("Reply")); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (frame_reply), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); + + PACK_CHECK_BUTTON (vbox2, checkbtn_reply_account_autosel, + _("Automatically select account for replies")); + PACK_CHECK_BUTTON (vbox2, checkbtn_quote, + _("Quote message when replying")); + PACK_CHECK_BUTTON (vbox2, checkbtn_default_reply_list, + _("Reply button invokes mailing list reply")); + + compose.checkbtn_autosig = checkbtn_autosig; + compose.entry_sigsep = entry_sigsep; + + compose.checkbtn_autoextedit = checkbtn_autoextedit; + + compose.spinbtn_undolevel = spinbtn_undolevel; + compose.spinbtn_undolevel_adj = spinbtn_undolevel_adj; + + compose.spinbtn_linewrap = spinbtn_linewrap; + compose.spinbtn_linewrap_adj = spinbtn_linewrap_adj; + compose.checkbtn_wrapquote = checkbtn_wrapquote; + compose.checkbtn_autowrap = checkbtn_autowrap; + compose.checkbtn_wrapatsend = checkbtn_wrapatsend; + + compose.checkbtn_quote = checkbtn_quote; + compose.checkbtn_reply_account_autosel = + checkbtn_reply_account_autosel; + compose.checkbtn_default_reply_list = checkbtn_default_reply_list; +} + +static void prefs_quote_create(void) +{ + GtkWidget *vbox1; + GtkWidget *frame_quote; + GtkWidget *vbox_quote; + GtkWidget *hbox1; + GtkWidget *hbox2; + GtkWidget *label_quotemark; + GtkWidget *entry_quotemark; + GtkWidget *scrolledwin_quotefmt; + GtkWidget *text_quotefmt; + + GtkWidget *entry_fw_quotemark; + GtkWidget *text_fw_quotefmt; + + GtkWidget *btn_quotedesc; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + /* reply */ + + PACK_FRAME (vbox1, frame_quote, _("Reply format")); + + vbox_quote = gtk_vbox_new (FALSE, VSPACING_NARROW); + gtk_widget_show (vbox_quote); + gtk_container_add (GTK_CONTAINER (frame_quote), vbox_quote); + gtk_container_set_border_width (GTK_CONTAINER (vbox_quote), 8); + + hbox1 = gtk_hbox_new (FALSE, 32); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox_quote), hbox1, FALSE, FALSE, 0); + + hbox2 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox2); + gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0); + + label_quotemark = gtk_label_new (_("Quotation mark")); + gtk_widget_show (label_quotemark); + gtk_box_pack_start (GTK_BOX (hbox2), label_quotemark, FALSE, FALSE, 0); + + entry_quotemark = gtk_entry_new (); + gtk_widget_show (entry_quotemark); + gtk_box_pack_start (GTK_BOX (hbox2), entry_quotemark, FALSE, FALSE, 0); + gtk_widget_set_size_request (entry_quotemark, 64, -1); + + scrolledwin_quotefmt = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwin_quotefmt); + gtk_box_pack_start (GTK_BOX (vbox_quote), scrolledwin_quotefmt, + TRUE, TRUE, 0); + gtk_scrolled_window_set_policy + (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt), + GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); + gtk_scrolled_window_set_shadow_type + (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt), GTK_SHADOW_IN); + + text_quotefmt = gtk_text_view_new (); + gtk_widget_show (text_quotefmt); + gtk_container_add(GTK_CONTAINER(scrolledwin_quotefmt), text_quotefmt); + gtk_text_view_set_editable (GTK_TEXT_VIEW (text_quotefmt), TRUE); + gtk_widget_set_size_request(text_quotefmt, -1, 60); + + /* forward */ + + PACK_FRAME (vbox1, frame_quote, _("Forward format")); + + vbox_quote = gtk_vbox_new (FALSE, VSPACING_NARROW); + gtk_widget_show (vbox_quote); + gtk_container_add (GTK_CONTAINER (frame_quote), vbox_quote); + gtk_container_set_border_width (GTK_CONTAINER (vbox_quote), 8); + + hbox1 = gtk_hbox_new (FALSE, 32); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox_quote), hbox1, FALSE, FALSE, 0); + + hbox2 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox2); + gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0); + + label_quotemark = gtk_label_new (_("Quotation mark")); + gtk_widget_show (label_quotemark); + gtk_box_pack_start (GTK_BOX (hbox2), label_quotemark, FALSE, FALSE, 0); + + entry_fw_quotemark = gtk_entry_new (); + gtk_widget_show (entry_fw_quotemark); + gtk_box_pack_start (GTK_BOX (hbox2), entry_fw_quotemark, + FALSE, FALSE, 0); + gtk_widget_set_size_request (entry_fw_quotemark, 64, -1); + + scrolledwin_quotefmt = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwin_quotefmt); + gtk_box_pack_start (GTK_BOX (vbox_quote), scrolledwin_quotefmt, + TRUE, TRUE, 0); + gtk_scrolled_window_set_policy + (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt), + GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); + gtk_scrolled_window_set_shadow_type + (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt), GTK_SHADOW_IN); + + text_fw_quotefmt = gtk_text_view_new (); + gtk_widget_show (text_fw_quotefmt); + gtk_container_add(GTK_CONTAINER(scrolledwin_quotefmt), + text_fw_quotefmt); + gtk_text_view_set_editable (GTK_TEXT_VIEW (text_fw_quotefmt), TRUE); + gtk_widget_set_size_request (text_fw_quotefmt, -1, 60); + + hbox1 = gtk_hbox_new (FALSE, 32); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); + + btn_quotedesc = + gtk_button_new_with_label (_(" Description of symbols ")); + gtk_widget_show (btn_quotedesc); + gtk_box_pack_start (GTK_BOX (hbox1), btn_quotedesc, FALSE, FALSE, 0); + g_signal_connect(G_OBJECT(btn_quotedesc), "clicked", + G_CALLBACK(prefs_quote_description), NULL); + + quote.entry_quotemark = entry_quotemark; + quote.text_quotefmt = text_quotefmt; + quote.entry_fw_quotemark = entry_fw_quotemark; + quote.text_fw_quotefmt = text_fw_quotefmt; +} + +static void prefs_display_create(void) +{ + GtkWidget *vbox1; + GtkWidget *frame_font; + GtkWidget *table1; + GtkWidget *label_textfont; + GtkWidget *fontbtn_textfont; + GtkWidget *chkbtn_transhdr; + GtkWidget *chkbtn_folder_unread; + GtkWidget *hbox1; + GtkWidget *label_ng_abbrev; + GtkWidget *spinbtn_ng_abbrev_len; + GtkObject *spinbtn_ng_abbrev_len_adj; + GtkWidget *frame_summary; + GtkWidget *vbox2; + GtkWidget *chkbtn_swapfrom; + GtkWidget *chkbtn_expand_thread; + GtkWidget *vbox3; + GtkWidget *label_datefmt; + GtkWidget *button_datefmt; + GtkWidget *entry_datefmt; + GtkWidget *button_dispitem; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + PACK_FRAME(vbox1, frame_font, _("Font")); + + table1 = gtk_table_new (1, 2, FALSE); + gtk_widget_show (table1); + gtk_container_add (GTK_CONTAINER (frame_font), table1); + gtk_container_set_border_width (GTK_CONTAINER (table1), 8); + gtk_table_set_row_spacings (GTK_TABLE (table1), 8); + gtk_table_set_col_spacings (GTK_TABLE (table1), 8); + + label_textfont = gtk_label_new (_("Text")); + gtk_widget_show (label_textfont); + gtk_table_attach (GTK_TABLE (table1), label_textfont, 0, 1, 0, 1, + GTK_FILL, (GTK_EXPAND | GTK_FILL), 0, 0); + + fontbtn_textfont = gtk_font_button_new (); + gtk_widget_show (fontbtn_textfont); + gtk_table_attach (GTK_TABLE (table1), fontbtn_textfont, 1, 2, 0, 1, + (GTK_EXPAND | GTK_FILL), 0, 0, 0); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, TRUE, 0); + + PACK_CHECK_BUTTON + (vbox2, chkbtn_transhdr, + _("Translate header name (such as `From:', `Subject:')")); + + PACK_CHECK_BUTTON (vbox2, chkbtn_folder_unread, + _("Display unread number next to folder name")); + + PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0); + + label_ng_abbrev = gtk_label_new + (_("Abbreviate newsgroups longer than")); + gtk_widget_show (label_ng_abbrev); + gtk_box_pack_start (GTK_BOX (hbox1), label_ng_abbrev, FALSE, FALSE, 0); + + spinbtn_ng_abbrev_len_adj = gtk_adjustment_new (16, 0, 999, 1, 10, 10); + spinbtn_ng_abbrev_len = gtk_spin_button_new + (GTK_ADJUSTMENT (spinbtn_ng_abbrev_len_adj), 1, 0); + gtk_widget_show (spinbtn_ng_abbrev_len); + gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_ng_abbrev_len, + FALSE, FALSE, 0); + gtk_widget_set_size_request (spinbtn_ng_abbrev_len, 56, -1); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_ng_abbrev_len), + TRUE); + + label_ng_abbrev = gtk_label_new + (_("letters")); + gtk_widget_show (label_ng_abbrev); + gtk_box_pack_start (GTK_BOX (hbox1), label_ng_abbrev, FALSE, FALSE, 0); + + /* ---- Summary ---- */ + + PACK_FRAME(vbox1, frame_summary, _("Summary View")); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (frame_summary), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); + + PACK_CHECK_BUTTON + (vbox2, chkbtn_swapfrom, + _("Display recipient on `From' column if sender is yourself")); + PACK_CHECK_BUTTON + (vbox2, chkbtn_expand_thread, _("Expand threads")); + + PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0); + + label_datefmt = gtk_label_new (_("Date format")); + gtk_widget_show (label_datefmt); + gtk_box_pack_start (GTK_BOX (hbox1), label_datefmt, FALSE, FALSE, 0); + + entry_datefmt = gtk_entry_new (); + gtk_widget_show (entry_datefmt); + gtk_box_pack_start (GTK_BOX (hbox1), entry_datefmt, TRUE, TRUE, 0); + + button_datefmt = gtk_button_new_with_label ("... "); + gtk_widget_show (button_datefmt); + gtk_box_pack_start (GTK_BOX (hbox1), button_datefmt, FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (button_datefmt), "clicked", + G_CALLBACK (date_format_create), NULL); + + PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0); + + button_dispitem = gtk_button_new_with_label + (_(" Set display item of summary... ")); + gtk_widget_show (button_dispitem); + gtk_box_pack_start (GTK_BOX (hbox1), button_dispitem, FALSE, TRUE, 0); + g_signal_connect (G_OBJECT (button_dispitem), "clicked", + G_CALLBACK (prefs_summary_column_open), NULL); + + display.fontbtn_textfont = fontbtn_textfont; + + display.chkbtn_transhdr = chkbtn_transhdr; + display.chkbtn_folder_unread = chkbtn_folder_unread; + display.spinbtn_ng_abbrev_len = spinbtn_ng_abbrev_len; + display.spinbtn_ng_abbrev_len_adj = spinbtn_ng_abbrev_len_adj; + + display.chkbtn_swapfrom = chkbtn_swapfrom; + display.chkbtn_expand_thread = chkbtn_expand_thread; + display.entry_datefmt = entry_datefmt; +} + +static void prefs_message_create(void) +{ + GtkWidget *vbox1; + GtkWidget *vbox2; + GtkWidget *vbox3; + GtkWidget *hbox1; + GtkWidget *chkbtn_enablecol; + GtkWidget *button_edit_col; + GtkWidget *chkbtn_mbalnum; + GtkWidget *chkbtn_disphdrpane; + GtkWidget *chkbtn_disphdr; + GtkWidget *button_edit_disphdr; + GtkWidget *chkbtn_html; + GtkWidget *hbox_linespc; + GtkWidget *label_linespc; + GtkObject *spinbtn_linespc_adj; + GtkWidget *spinbtn_linespc; + + GtkWidget *frame_scr; + GtkWidget *vbox_scr; + GtkWidget *chkbtn_smoothscroll; + GtkWidget *hbox_scr; + GtkWidget *label_scr; + GtkObject *spinbtn_scrollstep_adj; + GtkWidget *spinbtn_scrollstep; + GtkWidget *chkbtn_halfpage; + + GtkWidget *frame_image; + GtkWidget *vbox_image; + GtkWidget *chkbtn_resize_image; + GtkWidget *chkbtn_inline_image; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0); + + PACK_CHECK_BUTTON (hbox1, chkbtn_enablecol, + _("Enable coloration of message")); + g_signal_connect(G_OBJECT(chkbtn_enablecol), "toggled", + G_CALLBACK(prefs_enable_message_color_toggled), NULL); + + button_edit_col = gtk_button_new_with_label (_(" Edit... ")); + gtk_widget_show (button_edit_col); + gtk_box_pack_end (GTK_BOX (hbox1), button_edit_col, FALSE, TRUE, 0); + g_signal_connect (G_OBJECT (button_edit_col), "clicked", + G_CALLBACK (prefs_quote_colors_dialog), NULL); + + SET_TOGGLE_SENSITIVITY(chkbtn_enablecol, button_edit_col); + + PACK_CHECK_BUTTON + (vbox2, chkbtn_mbalnum, + _("Display multi-byte alphabet and numeric as\n" + "ASCII character (Japanese only)")); + gtk_label_set_justify (GTK_LABEL (GTK_BIN(chkbtn_mbalnum)->child), + GTK_JUSTIFY_LEFT); + + PACK_CHECK_BUTTON(vbox2, chkbtn_disphdrpane, + _("Display header pane above message view")); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0); + + PACK_CHECK_BUTTON(hbox1, chkbtn_disphdr, + _("Display short headers on message view")); + + button_edit_disphdr = gtk_button_new_with_label (_(" Edit... ")); + gtk_widget_show (button_edit_disphdr); + gtk_box_pack_end (GTK_BOX (hbox1), button_edit_disphdr, + FALSE, TRUE, 0); + g_signal_connect (G_OBJECT (button_edit_disphdr), "clicked", + G_CALLBACK (prefs_display_header_open), NULL); + + SET_TOGGLE_SENSITIVITY(chkbtn_disphdr, button_edit_disphdr); + + PACK_CHECK_BUTTON(vbox2, chkbtn_html, + _("Render HTML messages as text")); + +#if 0 + PACK_CHECK_BUTTON(vbox2, chkbtn_cursor, + _("Display cursor in message view")); +#endif + + PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2); + + hbox1 = gtk_hbox_new (FALSE, 32); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0); + + hbox_linespc = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (hbox1), hbox_linespc, FALSE, TRUE, 0); + + label_linespc = gtk_label_new (_("Line space")); + gtk_widget_show (label_linespc); + gtk_box_pack_start (GTK_BOX (hbox_linespc), label_linespc, + FALSE, FALSE, 0); + + spinbtn_linespc_adj = gtk_adjustment_new (2, 0, 16, 1, 1, 16); + spinbtn_linespc = gtk_spin_button_new + (GTK_ADJUSTMENT (spinbtn_linespc_adj), 1, 0); + gtk_widget_show (spinbtn_linespc); + gtk_box_pack_start (GTK_BOX (hbox_linespc), spinbtn_linespc, + FALSE, FALSE, 0); + gtk_widget_set_size_request (spinbtn_linespc, 64, -1); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_linespc), TRUE); + + label_linespc = gtk_label_new (_("pixel(s)")); + gtk_widget_show (label_linespc); + gtk_box_pack_start (GTK_BOX (hbox_linespc), label_linespc, + FALSE, FALSE, 0); + + PACK_FRAME(vbox1, frame_scr, _("Scroll")); + + vbox_scr = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox_scr); + gtk_container_add (GTK_CONTAINER (frame_scr), vbox_scr); + gtk_container_set_border_width (GTK_CONTAINER (vbox_scr), 8); + + PACK_CHECK_BUTTON(vbox_scr, chkbtn_halfpage, _("Half page")); + + hbox1 = gtk_hbox_new (FALSE, 32); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox_scr), hbox1, FALSE, TRUE, 0); + + PACK_CHECK_BUTTON(hbox1, chkbtn_smoothscroll, _("Smooth scroll")); + + hbox_scr = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox_scr); + gtk_box_pack_start (GTK_BOX (hbox1), hbox_scr, FALSE, FALSE, 0); + + label_scr = gtk_label_new (_("Step")); + gtk_widget_show (label_scr); + gtk_box_pack_start (GTK_BOX (hbox_scr), label_scr, FALSE, FALSE, 0); + + spinbtn_scrollstep_adj = gtk_adjustment_new (1, 1, 100, 1, 10, 10); + spinbtn_scrollstep = gtk_spin_button_new + (GTK_ADJUSTMENT (spinbtn_scrollstep_adj), 1, 0); + gtk_widget_show (spinbtn_scrollstep); + gtk_box_pack_start (GTK_BOX (hbox_scr), spinbtn_scrollstep, + FALSE, FALSE, 0); + gtk_widget_set_size_request (spinbtn_scrollstep, 64, -1); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_scrollstep), + TRUE); + + label_scr = gtk_label_new (_("pixel(s)")); + gtk_widget_show (label_scr); + gtk_box_pack_start (GTK_BOX (hbox_scr), label_scr, FALSE, FALSE, 0); + + SET_TOGGLE_SENSITIVITY (chkbtn_smoothscroll, hbox_scr) + + PACK_FRAME(vbox1, frame_image, _("Images")); + + vbox_image = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox_image); + gtk_container_add (GTK_CONTAINER (frame_image), vbox_image); + gtk_container_set_border_width (GTK_CONTAINER (vbox_image), 8); + + PACK_CHECK_BUTTON(vbox_image, chkbtn_resize_image, + _("Resize attached large images to fit in the window")); + PACK_CHECK_BUTTON(vbox_image, chkbtn_inline_image, + _("Display images as inline")); + + message.chkbtn_enablecol = chkbtn_enablecol; + message.button_edit_col = button_edit_col; + message.chkbtn_mbalnum = chkbtn_mbalnum; + message.chkbtn_disphdrpane = chkbtn_disphdrpane; + message.chkbtn_disphdr = chkbtn_disphdr; + message.chkbtn_html = chkbtn_html; + message.spinbtn_linespc = spinbtn_linespc; + + message.chkbtn_smoothscroll = chkbtn_smoothscroll; + message.spinbtn_scrollstep = spinbtn_scrollstep; + message.spinbtn_scrollstep_adj = spinbtn_scrollstep_adj; + message.chkbtn_halfpage = chkbtn_halfpage; + + message.chkbtn_resize_image = chkbtn_resize_image; + message.chkbtn_inline_image = chkbtn_inline_image; +} + +static void prefs_junk_create(void) +{ + GtkWidget *vbox1; + GtkWidget *vbox2; + GtkWidget *frame; + GtkWidget *hbox; + GtkWidget *chkbtn_enable_junk; + GtkWidget *label; + GtkWidget *entry_junk_learncmd; + GtkWidget *entry_nojunk_learncmd; + GtkWidget *entry_classify_cmd; + GtkWidget *vbox3; + GtkWidget *entry_junkfolder; + GtkWidget *btn_folder; + GtkWidget *chkbtn_filter_on_recv; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + PACK_FRAME_WITH_CHECK_BUTTON(vbox1, frame, chkbtn_enable_junk, + _("Enable Junk mail control")); + + vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (frame), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); + SET_TOGGLE_SENSITIVITY (chkbtn_enable_junk, vbox2); + + label = gtk_label_new (_("Learning command:")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0); + gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); + + hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); + + label = gtk_label_new (_("Junk")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + + entry_junk_learncmd = gtk_entry_new (); + gtk_widget_show (entry_junk_learncmd); + gtk_box_pack_start (GTK_BOX (hbox), entry_junk_learncmd, TRUE, TRUE, 0); + + hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); + + label = gtk_label_new (_("Not Junk")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + + entry_nojunk_learncmd = gtk_entry_new (); + gtk_widget_show (entry_nojunk_learncmd); + gtk_box_pack_start (GTK_BOX (hbox), entry_nojunk_learncmd, + TRUE, TRUE, 0); + + PACK_VSPACER(vbox2, vbox3, 0); + + hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); + + label = gtk_label_new (_("Classifying command")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + + entry_classify_cmd = gtk_entry_new (); + gtk_widget_show (entry_classify_cmd); + gtk_box_pack_start (GTK_BOX (hbox), entry_classify_cmd, TRUE, TRUE, 0); + + PACK_VSPACER(vbox2, vbox3, 0); + + hbox = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); + + label = gtk_label_new (_("Junk folder")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + + entry_junkfolder = gtk_entry_new (); + gtk_widget_show (entry_junkfolder); + gtk_box_pack_start (GTK_BOX (hbox), entry_junkfolder, TRUE, TRUE, 0); + + btn_folder = gtk_button_new_with_label (_(" ... ")); + gtk_widget_show (btn_folder); + gtk_box_pack_start (GTK_BOX (hbox), btn_folder, FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (btn_folder), "clicked", + G_CALLBACK (prefs_common_select_folder_cb), + entry_junkfolder); + + PACK_VSPACER(vbox2, vbox3, 0); + + PACK_SMALL_LABEL (vbox2, label, + _("The messages which are set as junk mail " + "will be moved to this folder.")); + + PACK_VSPACER(vbox2, vbox3, 0); + + PACK_CHECK_BUTTON(vbox2, chkbtn_filter_on_recv, + _("Filter messages classified as junk on receiving")); + + PACK_SMALL_LABEL + (vbox2, label, + _("Filtered messages will be moved to the junk folder and " + "deleted from the server.")); + + junk.chkbtn_enable_junk = chkbtn_enable_junk; + junk.entry_junk_learncmd = entry_junk_learncmd; + junk.entry_nojunk_learncmd = entry_nojunk_learncmd; + junk.entry_classify_cmd = entry_classify_cmd; + junk.entry_junkfolder = entry_junkfolder; + junk.chkbtn_filter_on_recv = chkbtn_filter_on_recv; +} + +#if USE_GPGME +static void prefs_privacy_create(void) +{ + GtkWidget *vbox1; + GtkWidget *vbox2; + GtkWidget *vbox3; + GtkWidget *hbox1; + GtkWidget *hbox_spc; + GtkWidget *label; + GtkWidget *checkbtn_auto_check_signatures; + GtkWidget *checkbtn_gpg_signature_popup; + GtkWidget *checkbtn_store_passphrase; + GtkObject *spinbtn_store_passphrase_adj; + GtkWidget *spinbtn_store_passphrase; + GtkWidget *checkbtn_passphrase_grab; + GtkWidget *checkbtn_gpg_warning; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); + + PACK_CHECK_BUTTON (vbox2, checkbtn_auto_check_signatures, + _("Automatically check signatures")); + + PACK_CHECK_BUTTON (vbox2, checkbtn_gpg_signature_popup, + _("Show signature check result in a popup window")); + + PACK_CHECK_BUTTON (vbox2, checkbtn_store_passphrase, + _("Store passphrase in memory temporarily")); + + vbox3 = gtk_vbox_new (FALSE, VSPACING_NARROW); + gtk_widget_show (vbox3); + gtk_box_pack_start (GTK_BOX (vbox2), vbox3, FALSE, FALSE, 0); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0); + + hbox_spc = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox_spc); + gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0); + gtk_widget_set_size_request (hbox_spc, 12, -1); + + label = gtk_label_new (_("Expired after")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); + + spinbtn_store_passphrase_adj = gtk_adjustment_new (0, 0, 1440, 1, 5, 5); + spinbtn_store_passphrase = gtk_spin_button_new + (GTK_ADJUSTMENT (spinbtn_store_passphrase_adj), 1, 0); + gtk_widget_show (spinbtn_store_passphrase); + gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_store_passphrase, FALSE, FALSE, 0); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_store_passphrase), + TRUE); + gtk_widget_set_size_request (spinbtn_store_passphrase, 64, -1); + + label = gtk_label_new (_("minute(s) ")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0); + + hbox_spc = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox_spc); + gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0); + gtk_widget_set_size_request (hbox_spc, 12, -1); + + PACK_SMALL_LABEL (hbox1, label, + _("Setting to '0' will store the passphrase " + "for the whole session.")); + + SET_TOGGLE_SENSITIVITY (checkbtn_store_passphrase, vbox3); + + PACK_VSPACER (vbox2, vbox3, VSPACING_NARROW_2); + +#ifndef G_OS_WIN32 + PACK_CHECK_BUTTON (vbox2, checkbtn_passphrase_grab, + _("Grab input while entering a passphrase")); +#endif + + PACK_CHECK_BUTTON + (vbox2, checkbtn_gpg_warning, + _("Display warning on startup if GnuPG doesn't work")); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); + + privacy.checkbtn_auto_check_signatures + = checkbtn_auto_check_signatures; + privacy.checkbtn_gpg_signature_popup + = checkbtn_gpg_signature_popup; + privacy.checkbtn_store_passphrase = checkbtn_store_passphrase; + privacy.spinbtn_store_passphrase = spinbtn_store_passphrase; + privacy.spinbtn_store_passphrase_adj = spinbtn_store_passphrase_adj; + privacy.checkbtn_passphrase_grab = checkbtn_passphrase_grab; + privacy.checkbtn_gpg_warning = checkbtn_gpg_warning; +} +#endif /* USE_GPGME */ + +static void prefs_interface_create(void) +{ + GtkWidget *vbox1; + GtkWidget *vbox2; + GtkWidget *vbox3; + GtkWidget *checkbtn_always_show_msg; + GtkWidget *checkbtn_openunread; + GtkWidget *checkbtn_mark_as_read_on_newwin; + GtkWidget *checkbtn_openinbox; + GtkWidget *checkbtn_immedexec; + GtkWidget *frame_recv; + GtkWidget *vbox_recv; + GtkWidget *hbox1; + GtkWidget *hbox_spc; + GtkWidget *label; + GtkWidget *optmenu_recvdialog; + GtkWidget *menu; + GtkWidget *menuitem; + GtkWidget *checkbtn_no_recv_err_panel; + GtkWidget *checkbtn_close_recv_dialog; + GtkWidget *checkbtn_comply_gnome_hig; + + GtkWidget *button_keybind; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); + + PACK_CHECK_BUTTON + (vbox2, checkbtn_always_show_msg, + _("Always open messages in summary when selected")); + + PACK_CHECK_BUTTON + (vbox2, checkbtn_openunread, + _("Open first unread message when entering a folder")); + + PACK_CHECK_BUTTON + (vbox2, checkbtn_mark_as_read_on_newwin, + _("Only mark message as read when opened in new window")); + + PACK_CHECK_BUTTON + (vbox2, checkbtn_openinbox, + _("Go to inbox after receiving new mail")); + + vbox3 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox3); + gtk_box_pack_start (GTK_BOX (vbox2), vbox3, FALSE, FALSE, 0); + + PACK_CHECK_BUTTON + (vbox3, checkbtn_immedexec, + _("Execute immediately when moving or deleting messages")); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0); + + hbox_spc = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox_spc); + gtk_box_pack_start (GTK_BOX (hbox1), hbox_spc, FALSE, FALSE, 0); + gtk_widget_set_size_request (hbox_spc, 12, -1); + + PACK_SMALL_LABEL (hbox1, label, + _("Messages will be marked until execution " + "if this is turned off.")); + + PACK_FRAME (vbox1, frame_recv, _("Receive dialog")); + vbox_recv = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox_recv); + gtk_container_add (GTK_CONTAINER (frame_recv), vbox_recv); + gtk_container_set_border_width (GTK_CONTAINER (vbox_recv), 8); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox_recv), hbox1, FALSE, FALSE, 0); + + label = gtk_label_new (_("Show receive dialog")); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); + + optmenu_recvdialog = gtk_option_menu_new (); + gtk_widget_show (optmenu_recvdialog); + gtk_box_pack_start (GTK_BOX (hbox1), optmenu_recvdialog, + FALSE, FALSE, 0); + + menu = gtk_menu_new (); + MENUITEM_ADD (menu, menuitem, _("Always"), RECV_DIALOG_ALWAYS); + MENUITEM_ADD (menu, menuitem, _("Only on manual receiving"), + RECV_DIALOG_MANUAL); + MENUITEM_ADD (menu, menuitem, _("Never"), RECV_DIALOG_NEVER); + + gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_recvdialog), menu); + + PACK_CHECK_BUTTON (vbox_recv, checkbtn_no_recv_err_panel, + _("Don't popup error dialog on receive error")); + + PACK_CHECK_BUTTON (vbox_recv, checkbtn_close_recv_dialog, + _("Close receive dialog when finished")); + + PACK_CHECK_BUTTON (vbox1, checkbtn_comply_gnome_hig, + _("Make the order of buttons comply with GNOME HIG")); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); + + button_keybind = gtk_button_new_with_label (_(" Set key bindings... ")); + gtk_widget_show (button_keybind); + gtk_box_pack_start (GTK_BOX (hbox1), button_keybind, FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (button_keybind), "clicked", + G_CALLBACK (prefs_keybind_select), NULL); + + interface.checkbtn_always_show_msg = checkbtn_always_show_msg; + interface.checkbtn_openunread = checkbtn_openunread; + interface.checkbtn_mark_as_read_on_newwin + = checkbtn_mark_as_read_on_newwin; + interface.checkbtn_openinbox = checkbtn_openinbox; + interface.checkbtn_immedexec = checkbtn_immedexec; + interface.optmenu_recvdialog = optmenu_recvdialog; + interface.checkbtn_no_recv_err_panel = checkbtn_no_recv_err_panel; + interface.checkbtn_close_recv_dialog = checkbtn_close_recv_dialog; + + interface.checkbtn_comply_gnome_hig = checkbtn_comply_gnome_hig; +} + +static void prefs_other_create(void) +{ + GtkWidget *vbox1; + GtkWidget *ext_frame; + GtkWidget *ext_table; + GtkWidget *hbox1; + + GtkWidget *uri_label; + GtkWidget *uri_combo; + GtkWidget *uri_entry; + + GtkWidget *printcmd_label; + GtkWidget *printcmd_entry; + + GtkWidget *exteditor_label; + GtkWidget *exteditor_combo; + GtkWidget *exteditor_entry; + + GtkWidget *frame_addr; + GtkWidget *vbox_addr; + GtkWidget *checkbtn_addaddrbyclick; + + GtkWidget *frame_exit; + GtkWidget *vbox_exit; + GtkWidget *checkbtn_confonexit; + GtkWidget *checkbtn_cleanonexit; + GtkWidget *checkbtn_askonclean; + GtkWidget *checkbtn_warnqueued; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + PACK_FRAME(vbox1, ext_frame, + _("External commands (%s will be replaced with file name / URI)")); + + ext_table = gtk_table_new (3, 2, FALSE); + gtk_widget_show (ext_table); + gtk_container_add (GTK_CONTAINER (ext_frame), ext_table); + gtk_container_set_border_width (GTK_CONTAINER (ext_table), 8); + gtk_table_set_row_spacings (GTK_TABLE (ext_table), VSPACING_NARROW); + gtk_table_set_col_spacings (GTK_TABLE (ext_table), 8); + + uri_label = gtk_label_new (_("Web browser")); + gtk_widget_show(uri_label); + gtk_table_attach (GTK_TABLE (ext_table), uri_label, 0, 1, 0, 1, + GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment (GTK_MISC (uri_label), 1, 0.5); + + uri_combo = gtk_combo_new (); + gtk_widget_show (uri_combo); + gtk_table_attach (GTK_TABLE (ext_table), uri_combo, 1, 2, 0, 1, + GTK_EXPAND | GTK_FILL, 0, 0, 0); + gtkut_combo_set_items (GTK_COMBO (uri_combo), + DEFAULT_BROWSER_CMD, + "mozilla-firefox '%s'", + "mozilla -remote 'openURL(%s,new-window)'", + "mozilla '%s'", + "netscape -remote 'openURL(%s,new-window)'", + "netscape '%s'", + "gnome-moz-remote --newwin '%s'", + "rxvt -e w3m '%s'", + "rxvt -e lynx '%s'", + NULL); + uri_entry = GTK_COMBO (uri_combo)->entry; + + printcmd_label = gtk_label_new (_("Print")); + gtk_widget_show (printcmd_label); + gtk_table_attach (GTK_TABLE (ext_table), printcmd_label, 0, 1, 1, 2, + GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment (GTK_MISC (printcmd_label), 1, 0.5); + + printcmd_entry = gtk_entry_new (); + gtk_widget_show (printcmd_entry); + gtk_table_attach (GTK_TABLE (ext_table), printcmd_entry, 1, 2, 1, 2, + GTK_EXPAND | GTK_FILL, 0, 0, 0); + + exteditor_label = gtk_label_new (_("Editor")); + gtk_widget_show (exteditor_label); + gtk_table_attach (GTK_TABLE (ext_table), exteditor_label, 0, 1, 2, 3, + GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment (GTK_MISC (exteditor_label), 1, 0.5); + + exteditor_combo = gtk_combo_new (); + gtk_widget_show (exteditor_combo); + gtk_table_attach (GTK_TABLE (ext_table), exteditor_combo, 1, 2, 2, 3, + GTK_EXPAND | GTK_FILL, 0, 0, 0); + gtkut_combo_set_items (GTK_COMBO (exteditor_combo), + "gedit %s", + "kedit %s", + "emacs %s", + "xemacs %s", + "kterm -e jed %s", + "kterm -e vi %s", + NULL); + exteditor_entry = GTK_COMBO (exteditor_combo)->entry; + + PACK_FRAME (vbox1, frame_addr, _("Address book")); + + vbox_addr = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox_addr); + gtk_container_add (GTK_CONTAINER (frame_addr), vbox_addr); + gtk_container_set_border_width (GTK_CONTAINER (vbox_addr), 8); + + PACK_CHECK_BUTTON + (vbox_addr, checkbtn_addaddrbyclick, + _("Add address to destination when double-clicked")); + + PACK_FRAME (vbox1, frame_exit, _("On exit")); + + vbox_exit = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox_exit); + gtk_container_add (GTK_CONTAINER (frame_exit), vbox_exit); + gtk_container_set_border_width (GTK_CONTAINER (vbox_exit), 8); + + PACK_CHECK_BUTTON (vbox_exit, checkbtn_confonexit, + _("Confirm on exit")); + + hbox1 = gtk_hbox_new (FALSE, 32); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox_exit), hbox1, FALSE, FALSE, 0); + + PACK_CHECK_BUTTON (hbox1, checkbtn_cleanonexit, + _("Empty trash on exit")); + PACK_CHECK_BUTTON (hbox1, checkbtn_askonclean, + _("Ask before emptying")); + SET_TOGGLE_SENSITIVITY (checkbtn_cleanonexit, checkbtn_askonclean); + + PACK_CHECK_BUTTON (vbox_exit, checkbtn_warnqueued, + _("Warn if there are queued messages")); + + other.uri_combo = uri_combo; + other.uri_entry = uri_entry; + other.printcmd_entry = printcmd_entry; + + other.exteditor_combo = exteditor_combo; + other.exteditor_entry = exteditor_entry; + + other.checkbtn_addaddrbyclick = checkbtn_addaddrbyclick; + + other.checkbtn_confonexit = checkbtn_confonexit; + other.checkbtn_cleanonexit = checkbtn_cleanonexit; + other.checkbtn_askonclean = checkbtn_askonclean; + other.checkbtn_warnqueued = checkbtn_warnqueued; +} + +static void prefs_advanced_create(void) +{ + GtkWidget *vbox1; + + GtkWidget *vbox2; + GtkWidget *checkbtn_strict_cache_check; + GtkWidget *label; + + GtkWidget *hbox1; + GtkWidget *label_iotimeout; + GtkWidget *spinbtn_iotimeout; + GtkObject *spinbtn_iotimeout_adj; + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); + + vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW); + gtk_widget_show (vbox2); + gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); + + PACK_CHECK_BUTTON (vbox2, checkbtn_strict_cache_check, + _("Enable strict checking of the integrity of summary caches")); + PACK_SMALL_LABEL + (vbox2, label, + _("Enable this if the contents of folders have the possibility of modification by other applications.\n" + "This option will degrade the performance of displaying summary.")); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); + + label_iotimeout = gtk_label_new (_("Socket I/O timeout:")); + gtk_widget_show (label_iotimeout); + gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0); + + spinbtn_iotimeout_adj = gtk_adjustment_new (60, 0, 1000, 1, 10, 10); + spinbtn_iotimeout = gtk_spin_button_new + (GTK_ADJUSTMENT (spinbtn_iotimeout_adj), 1, 0); + gtk_widget_show (spinbtn_iotimeout); + gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_iotimeout, + FALSE, FALSE, 0); + gtk_widget_set_size_request (spinbtn_iotimeout, 64, -1); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_iotimeout), TRUE); + + label_iotimeout = gtk_label_new (_("second(s)")); + gtk_widget_show (label_iotimeout); + gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0); + + advanced.checkbtn_strict_cache_check = checkbtn_strict_cache_check; + + advanced.spinbtn_iotimeout = spinbtn_iotimeout; + advanced.spinbtn_iotimeout_adj = spinbtn_iotimeout_adj; +} + +static void date_format_ok_btn_clicked(GtkButton *button, GtkWidget **widget) +{ + GtkWidget *datefmt_sample = NULL; + gchar *text; + + g_return_if_fail(widget != NULL); + g_return_if_fail(*widget != NULL); + g_return_if_fail(display.entry_datefmt != NULL); + + datefmt_sample = GTK_WIDGET(g_object_get_data + (G_OBJECT(*widget), "datefmt_sample")); + g_return_if_fail(datefmt_sample != NULL); + + text = gtk_editable_get_chars(GTK_EDITABLE(datefmt_sample), 0, -1); + g_free(prefs_common.date_format); + prefs_common.date_format = text; + gtk_entry_set_text(GTK_ENTRY(display.entry_datefmt), text); + + gtk_widget_destroy(*widget); + *widget = NULL; +} + +static void date_format_cancel_btn_clicked(GtkButton *button, + GtkWidget **widget) +{ + g_return_if_fail(widget != NULL); + g_return_if_fail(*widget != NULL); + + gtk_widget_destroy(*widget); + *widget = NULL; +} + +static gboolean date_format_key_pressed(GtkWidget *keywidget, + GdkEventKey *event, + GtkWidget **widget) +{ + if (event && event->keyval == GDK_Escape) + date_format_cancel_btn_clicked(NULL, widget); + return FALSE; +} + +static gboolean date_format_on_delete(GtkWidget *dialogwidget, + GdkEventAny *event, GtkWidget **widget) +{ + g_return_val_if_fail(widget != NULL, FALSE); + g_return_val_if_fail(*widget != NULL, FALSE); + + *widget = NULL; + return FALSE; +} + +static void date_format_entry_on_change(GtkEditable *editable, + GtkLabel *example) +{ + time_t cur_time; + struct tm *cal_time; + gchar buffer[100]; + gchar *text; + + cur_time = time(NULL); + cal_time = localtime(&cur_time); + buffer[0] = 0; + text = gtk_editable_get_chars(editable, 0, -1); + if (text) + strftime(buffer, sizeof buffer, text, cal_time); + g_free(text); + + text = conv_codeset_strdup(buffer, conv_get_locale_charset_str(), + CS_UTF_8); + if (!text) + text = g_strdup(buffer); + gtk_label_set_text(example, text); + g_free(text); +} + +static void date_format_select_row(GtkWidget *date_format_list, gint row, + gint column, GdkEventButton *event, + GtkWidget *date_format) +{ + gint cur_pos; + gchar *format; + const gchar *old_format; + gchar *new_format; + GtkWidget *datefmt_sample; + + /* only on double click */ + if (!event || event->type != GDK_2BUTTON_PRESS) return; + + datefmt_sample = GTK_WIDGET(g_object_get_data + (G_OBJECT(date_format), "datefmt_sample")); + + g_return_if_fail(date_format_list != NULL); + g_return_if_fail(date_format != NULL); + g_return_if_fail(datefmt_sample != NULL); + + /* get format from clist */ + gtk_clist_get_text(GTK_CLIST(date_format_list), row, 0, &format); + + cur_pos = gtk_editable_get_position(GTK_EDITABLE(datefmt_sample)); + old_format = gtk_entry_get_text(GTK_ENTRY(datefmt_sample)); + + /* insert the format into the text entry */ + new_format = g_malloc(strlen(old_format) + 3); + + strncpy(new_format, old_format, cur_pos); + new_format[cur_pos] = '\0'; + strcat(new_format, format); + strcat(new_format, &old_format[cur_pos]); + + gtk_entry_set_text(GTK_ENTRY(datefmt_sample), new_format); + gtk_editable_set_position(GTK_EDITABLE(datefmt_sample), cur_pos + 2); + + g_free(new_format); +} + +static GtkWidget *date_format_create(GtkButton *button, void *data) +{ + static GtkWidget *datefmt_win = NULL; + GtkWidget *vbox1; + GtkWidget *scrolledwindow1; + GtkWidget *datefmt_clist; + GtkWidget *table; + GtkWidget *label1; + GtkWidget *label2; + GtkWidget *label3; + GtkWidget *confirm_area; + GtkWidget *ok_btn; + GtkWidget *cancel_btn; + GtkWidget *datefmt_entry; + + struct { + gchar *fmt; + gchar *txt; + } time_format[] = { + { "%a", NULL }, + { "%A", NULL }, + { "%b", NULL }, + { "%B", NULL }, + { "%c", NULL }, + { "%C", NULL }, + { "%d", NULL }, + { "%H", NULL }, + { "%I", NULL }, + { "%j", NULL }, + { "%m", NULL }, + { "%M", NULL }, + { "%p", NULL }, + { "%S", NULL }, + { "%w", NULL }, + { "%x", NULL }, + { "%y", NULL }, + { "%Y", NULL }, + { "%Z", NULL } + }; + + gchar *titles[2]; + gint i; + const gint TIME_FORMAT_ELEMS = + sizeof time_format / sizeof time_format[0]; + + time_format[0].txt = _("the full abbreviated weekday name"); + time_format[1].txt = _("the full weekday name"); + time_format[2].txt = _("the abbreviated month name"); + time_format[3].txt = _("the full month name"); + time_format[4].txt = _("the preferred date and time for the current locale"); + time_format[5].txt = _("the century number (year/100)"); + time_format[6].txt = _("the day of the month as a decimal number"); + time_format[7].txt = _("the hour as a decimal number using a 24-hour clock"); + time_format[8].txt = _("the hour as a decimal number using a 12-hour clock"); + time_format[9].txt = _("the day of the year as a decimal number"); + time_format[10].txt = _("the month as a decimal number"); + time_format[11].txt = _("the minute as a decimal number"); + time_format[12].txt = _("either AM or PM"); + time_format[13].txt = _("the second as a decimal number"); + time_format[14].txt = _("the day of the week as a decimal number"); + time_format[15].txt = _("the preferred date for the current locale"); + time_format[16].txt = _("the last two digits of a year"); + time_format[17].txt = _("the year as a decimal number"); + time_format[18].txt = _("the time zone or name or abbreviation"); + + if (datefmt_win) return datefmt_win; + + datefmt_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_container_set_border_width(GTK_CONTAINER(datefmt_win), 8); + gtk_window_set_title(GTK_WINDOW(datefmt_win), _("Date format")); + gtk_window_set_position(GTK_WINDOW(datefmt_win), GTK_WIN_POS_CENTER); + gtk_widget_set_size_request(datefmt_win, 440, 280); + + vbox1 = gtk_vbox_new(FALSE, 10); + gtk_widget_show(vbox1); + gtk_container_add(GTK_CONTAINER(datefmt_win), vbox1); + + scrolledwindow1 = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy + (GTK_SCROLLED_WINDOW(scrolledwindow1), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_widget_show(scrolledwindow1); + gtk_box_pack_start(GTK_BOX(vbox1), scrolledwindow1, TRUE, TRUE, 0); + + titles[0] = _("Specifier"); + titles[1] = _("Description"); + datefmt_clist = gtk_clist_new_with_titles(2, titles); + gtk_widget_show(datefmt_clist); + gtk_container_add(GTK_CONTAINER(scrolledwindow1), datefmt_clist); + /* gtk_clist_set_column_width(GTK_CLIST(datefmt_clist), 0, 80); */ + gtk_clist_set_selection_mode(GTK_CLIST(datefmt_clist), + GTK_SELECTION_BROWSE); + + for (i = 0; i < TIME_FORMAT_ELEMS; i++) { + gchar *text[2]; + /* phoney casting necessary because of gtk... */ + text[0] = (gchar *)time_format[i].fmt; + text[1] = (gchar *)time_format[i].txt; + gtk_clist_append(GTK_CLIST(datefmt_clist), text); + } + + table = gtk_table_new(2, 2, FALSE); + gtk_widget_show(table); + gtk_box_pack_start(GTK_BOX(vbox1), table, FALSE, FALSE, 0); + gtk_table_set_row_spacings(GTK_TABLE(table), 4); + gtk_table_set_col_spacings(GTK_TABLE(table), 8); + + label1 = gtk_label_new(_("Date format")); + gtk_widget_show(label1); + gtk_table_attach(GTK_TABLE(table), label1, 0, 1, 0, 1, + GTK_FILL, 0, 0, 0); + gtk_label_set_justify(GTK_LABEL(label1), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5); + + datefmt_entry = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(datefmt_entry), 256); + gtk_widget_show(datefmt_entry); + gtk_table_attach(GTK_TABLE(table), datefmt_entry, 1, 2, 0, 1, + (GTK_EXPAND | GTK_FILL), 0, 0, 0); + + /* we need the "sample" entry box; add it as data so callbacks can + * get the entry box */ + g_object_set_data(G_OBJECT(datefmt_win), "datefmt_sample", + datefmt_entry); + + label2 = gtk_label_new(_("Example")); + gtk_widget_show(label2); + gtk_table_attach(GTK_TABLE(table), label2, 0, 1, 1, 2, + GTK_FILL, 0, 0, 0); + gtk_label_set_justify(GTK_LABEL(label2), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5); + + label3 = gtk_label_new(""); + gtk_widget_show(label3); + gtk_table_attach(GTK_TABLE(table), label3, 1, 2, 1, 2, + (GTK_EXPAND | GTK_FILL), 0, 0, 0); + gtk_label_set_justify(GTK_LABEL(label3), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5); + + gtkut_stock_button_set_create(&confirm_area, &ok_btn, GTK_STOCK_OK, + &cancel_btn, GTK_STOCK_CANCEL, NULL, NULL); + + gtk_box_pack_start(GTK_BOX(vbox1), confirm_area, FALSE, FALSE, 0); + gtk_widget_show(confirm_area); + gtk_widget_grab_default(ok_btn); + + /* set the current format */ + gtk_entry_set_text(GTK_ENTRY(datefmt_entry), prefs_common.date_format); + date_format_entry_on_change(GTK_EDITABLE(datefmt_entry), + GTK_LABEL(label3)); + + g_signal_connect(G_OBJECT(ok_btn), "clicked", + G_CALLBACK(date_format_ok_btn_clicked), &datefmt_win); + g_signal_connect(G_OBJECT(cancel_btn), "clicked", + G_CALLBACK(date_format_cancel_btn_clicked), + &datefmt_win); + g_signal_connect(G_OBJECT(datefmt_win), "key_press_event", + G_CALLBACK(date_format_key_pressed), &datefmt_win); + g_signal_connect(G_OBJECT(datefmt_win), "delete_event", + G_CALLBACK(date_format_on_delete), &datefmt_win); + g_signal_connect(G_OBJECT(datefmt_entry), "changed", + G_CALLBACK(date_format_entry_on_change), label3); + g_signal_connect(G_OBJECT(datefmt_clist), "select_row", + G_CALLBACK(date_format_select_row), datefmt_win); + + gtk_window_set_position(GTK_WINDOW(datefmt_win), GTK_WIN_POS_CENTER); + gtk_window_set_modal(GTK_WINDOW(datefmt_win), TRUE); + + gtk_widget_show(datefmt_win); + manage_window_set_transient(GTK_WINDOW(datefmt_win)); + + gtk_widget_grab_focus(ok_btn); + + return datefmt_win; +} + +void prefs_quote_colors_dialog(void) +{ + if (!quote_color_win) + prefs_quote_colors_dialog_create(); + gtk_widget_show(quote_color_win); + manage_window_set_transient(GTK_WINDOW(quote_color_win)); + + gtk_main(); + gtk_widget_hide(quote_color_win); + + main_window_reflect_prefs_all(); +} + +static void prefs_quote_colors_dialog_create(void) +{ + GtkWidget *window; + GtkWidget *vbox; + GtkWidget *table; + GtkWidget *quotelevel1_label; + GtkWidget *quotelevel2_label; + GtkWidget *quotelevel3_label; + GtkWidget *uri_label; + GtkWidget *hbbox; + GtkWidget *ok_btn; + GtkWidget *recycle_colors_btn; + GtkWidget *frame_colors; + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_container_set_border_width(GTK_CONTAINER(window), 2); + gtk_window_set_title(GTK_WINDOW(window), _("Set message colors")); + gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); + gtk_window_set_modal(GTK_WINDOW(window), TRUE); + gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); + + vbox = gtk_vbox_new (FALSE, VSPACING); + gtk_container_add (GTK_CONTAINER (window), vbox); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); + PACK_FRAME(vbox, frame_colors, _("Colors")); + + table = gtk_table_new (4, 2, FALSE); + gtk_container_add (GTK_CONTAINER (frame_colors), table); + gtk_container_set_border_width (GTK_CONTAINER (table), 8); + gtk_table_set_row_spacings (GTK_TABLE (table), 2); + gtk_table_set_col_spacings (GTK_TABLE (table), 4); + + color_buttons.quote_level1_btn = gtk_button_new(); + gtk_table_attach (GTK_TABLE (table), color_buttons.quote_level1_btn, + 0, 1, 0, 1, 0, 0, 0, 0); + gtk_widget_set_size_request (color_buttons.quote_level1_btn, 40, 30); + gtk_container_set_border_width + (GTK_CONTAINER (color_buttons.quote_level1_btn), 5); + + color_buttons.quote_level2_btn = gtk_button_new(); + gtk_table_attach (GTK_TABLE (table), color_buttons.quote_level2_btn, + 0, 1, 1, 2, 0, 0, 0, 0); + gtk_widget_set_size_request (color_buttons.quote_level2_btn, 40, 30); + gtk_container_set_border_width (GTK_CONTAINER (color_buttons.quote_level2_btn), 5); + + color_buttons.quote_level3_btn = gtk_button_new_with_label (""); + gtk_table_attach (GTK_TABLE (table), color_buttons.quote_level3_btn, + 0, 1, 2, 3, 0, 0, 0, 0); + gtk_widget_set_size_request (color_buttons.quote_level3_btn, 40, 30); + gtk_container_set_border_width + (GTK_CONTAINER (color_buttons.quote_level3_btn), 5); + + color_buttons.uri_btn = gtk_button_new_with_label (""); + gtk_table_attach (GTK_TABLE (table), color_buttons.uri_btn, + 0, 1, 3, 4, 0, 0, 0, 0); + gtk_widget_set_size_request (color_buttons.uri_btn, 40, 30); + gtk_container_set_border_width (GTK_CONTAINER (color_buttons.uri_btn), 5); + + quotelevel1_label = gtk_label_new (_("Quoted Text - First Level")); + gtk_table_attach (GTK_TABLE (table), quotelevel1_label, 1, 2, 0, 1, + (GTK_EXPAND | GTK_FILL), 0, 0, 0); + gtk_label_set_justify (GTK_LABEL (quotelevel1_label), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (quotelevel1_label), 0, 0.5); + + quotelevel2_label = gtk_label_new (_("Quoted Text - Second Level")); + gtk_table_attach (GTK_TABLE (table), quotelevel2_label, 1, 2, 1, 2, + (GTK_EXPAND | GTK_FILL), 0, 0, 0); + gtk_label_set_justify (GTK_LABEL (quotelevel2_label), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (quotelevel2_label), 0, 0.5); + + quotelevel3_label = gtk_label_new (_("Quoted Text - Third Level")); + gtk_table_attach (GTK_TABLE (table), quotelevel3_label, 1, 2, 2, 3, + (GTK_EXPAND | GTK_FILL), 0, 0, 0); + gtk_label_set_justify (GTK_LABEL (quotelevel3_label), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (quotelevel3_label), 0, 0.5); + + uri_label = gtk_label_new (_("URI link")); + gtk_table_attach (GTK_TABLE (table), uri_label, 1, 2, 3, 4, + (GTK_EXPAND | GTK_FILL), 0, 0, 0); + gtk_label_set_justify (GTK_LABEL (uri_label), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (uri_label), 0, 0.5); + + PACK_CHECK_BUTTON (vbox, recycle_colors_btn, + _("Recycle quote colors")); + + gtkut_stock_button_set_create(&hbbox, &ok_btn, GTK_STOCK_OK, + NULL, NULL, NULL, NULL); + gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0); + + gtk_widget_grab_default(ok_btn); + MANAGE_WINDOW_SIGNALS_CONNECT(window); + g_signal_connect(G_OBJECT(window), "delete_event", + G_CALLBACK(gtk_main_quit), NULL); + g_signal_connect(G_OBJECT(window), "key_press_event", + G_CALLBACK(prefs_quote_colors_key_pressed), NULL); + + g_signal_connect(G_OBJECT(color_buttons.quote_level1_btn), "clicked", + G_CALLBACK(quote_color_set_dialog), "LEVEL1"); + g_signal_connect(G_OBJECT(color_buttons.quote_level2_btn), "clicked", + G_CALLBACK(quote_color_set_dialog), "LEVEL2"); + g_signal_connect(G_OBJECT(color_buttons.quote_level3_btn), "clicked", + G_CALLBACK(quote_color_set_dialog), "LEVEL3"); + g_signal_connect(G_OBJECT(color_buttons.uri_btn), "clicked", + G_CALLBACK(quote_color_set_dialog), "URI"); + g_signal_connect(G_OBJECT(recycle_colors_btn), "toggled", + G_CALLBACK(prefs_recycle_colors_toggled), NULL); + g_signal_connect(G_OBJECT(ok_btn), "clicked", + G_CALLBACK(gtk_main_quit), NULL); + + /* show message button colors and recycle options */ + set_button_bg_color(color_buttons.quote_level1_btn, + prefs_common.quote_level1_col); + set_button_bg_color(color_buttons.quote_level2_btn, + prefs_common.quote_level2_col); + set_button_bg_color(color_buttons.quote_level3_btn, + prefs_common.quote_level3_col); + set_button_bg_color(color_buttons.uri_btn, + prefs_common.uri_col); + gtk_toggle_button_set_active((GtkToggleButton *)recycle_colors_btn, + prefs_common.recycle_quote_colors); + + gtk_widget_show_all(vbox); + quote_color_win = window; +} + +static gboolean prefs_quote_colors_key_pressed(GtkWidget *widget, + GdkEventKey *event, + gpointer data) +{ + if (event && event->keyval == GDK_Escape) + gtk_main_quit(); + return FALSE; +} + +static void quote_color_set_dialog(GtkWidget *widget, gpointer data) +{ + gchar *type = (gchar *)data; + gchar *title = NULL; + gdouble color[4] = {0.0, 0.0, 0.0, 0.0}; + gint rgbvalue = 0; + GtkColorSelectionDialog *dialog; + + if(g_ascii_strcasecmp(type, "LEVEL1") == 0) { + title = _("Pick color for quotation level 1"); + rgbvalue = prefs_common.quote_level1_col; + } else if(g_ascii_strcasecmp(type, "LEVEL2") == 0) { + title = _("Pick color for quotation level 2"); + rgbvalue = prefs_common.quote_level2_col; + } else if(g_ascii_strcasecmp(type, "LEVEL3") == 0) { + title = _("Pick color for quotation level 3"); + rgbvalue = prefs_common.quote_level3_col; + } else if(g_ascii_strcasecmp(type, "URI") == 0) { + title = _("Pick color for URI"); + rgbvalue = prefs_common.uri_col; + } else { /* Should never be called */ + g_warning("Unrecognized datatype '%s' in quote_color_set_dialog\n", type); + return; + } + + color_dialog = gtk_color_selection_dialog_new(title); + gtk_window_set_position(GTK_WINDOW(color_dialog), GTK_WIN_POS_CENTER); + gtk_window_set_modal(GTK_WINDOW(color_dialog), TRUE); + gtk_window_set_policy(GTK_WINDOW(color_dialog), FALSE, FALSE, FALSE); + manage_window_set_transient(GTK_WINDOW(color_dialog)); + + g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(color_dialog)->ok_button), + "clicked", G_CALLBACK(quote_colors_set_dialog_ok), data); + g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(color_dialog)->cancel_button), + "clicked", G_CALLBACK(quote_colors_set_dialog_cancel), data); + g_signal_connect(G_OBJECT(color_dialog), "key_press_event", + G_CALLBACK(quote_colors_set_dialog_key_pressed), data); + + /* preselect the previous color in the color selection dialog */ + color[0] = (gdouble) ((rgbvalue & 0xff0000) >> 16) / 255.0; + color[1] = (gdouble) ((rgbvalue & 0x00ff00) >> 8) / 255.0; + color[2] = (gdouble) (rgbvalue & 0x0000ff) / 255.0; + dialog = GTK_COLOR_SELECTION_DIALOG(color_dialog); + gtk_color_selection_set_color + (GTK_COLOR_SELECTION(dialog->colorsel), color); + + gtk_widget_show(color_dialog); +} + +static void quote_colors_set_dialog_ok(GtkWidget *widget, gpointer data) +{ + GtkColorSelection *colorsel = (GtkColorSelection *) + ((GtkColorSelectionDialog *)color_dialog)->colorsel; + gdouble color[4]; + gint red, green, blue, rgbvalue; + gchar *type = (gchar *)data; + + gtk_color_selection_get_color(colorsel, color); + + red = (gint) (color[0] * 255.0); + green = (gint) (color[1] * 255.0); + blue = (gint) (color[2] * 255.0); + rgbvalue = (gint) ((red * 0x10000) | (green * 0x100) | blue); + +#if 0 + fprintf(stderr, "redc = %f, greenc = %f, bluec = %f\n", color[0], color[1], color[2]); + fprintf(stderr, "red = %d, green = %d, blue = %d\n", red, green, blue); + fprintf(stderr, "Color is %x\n", rgbvalue); +#endif + + if (g_ascii_strcasecmp(type, "LEVEL1") == 0) { + prefs_common.quote_level1_col = rgbvalue; + set_button_bg_color(color_buttons.quote_level1_btn, rgbvalue); + } else if (g_ascii_strcasecmp(type, "LEVEL2") == 0) { + prefs_common.quote_level2_col = rgbvalue; + set_button_bg_color(color_buttons.quote_level2_btn, rgbvalue); + } else if (g_ascii_strcasecmp(type, "LEVEL3") == 0) { + prefs_common.quote_level3_col = rgbvalue; + set_button_bg_color(color_buttons.quote_level3_btn, rgbvalue); + } else if (g_ascii_strcasecmp(type, "URI") == 0) { + prefs_common.uri_col = rgbvalue; + set_button_bg_color(color_buttons.uri_btn, rgbvalue); + } else + fprintf( stderr, "Unrecognized datatype '%s' in quote_color_set_dialog_ok\n", type ); + + gtk_widget_destroy(color_dialog); +} + +static void quote_colors_set_dialog_cancel(GtkWidget *widget, gpointer data) +{ + gtk_widget_destroy(color_dialog); +} + +static gboolean quote_colors_set_dialog_key_pressed(GtkWidget *widget, + GdkEventKey *event, + gpointer data) +{ + if (event && event->keyval == GDK_Escape) { + gtk_widget_destroy(color_dialog); + return TRUE; + } + return FALSE; +} + +static void set_button_bg_color(GtkWidget *widget, gint rgbvalue) +{ + GtkStyle *newstyle; + GdkColor color; + + gtkut_convert_int_to_gdk_color(rgbvalue, &color); + newstyle = gtk_style_copy(gtk_widget_get_default_style()); + newstyle->bg[GTK_STATE_NORMAL] = color; + newstyle->bg[GTK_STATE_PRELIGHT] = color; + newstyle->bg[GTK_STATE_ACTIVE] = color; + + gtk_widget_set_style(GTK_WIDGET(widget), newstyle); +} + +static void prefs_enable_message_color_toggled(void) +{ + gboolean is_active; + + is_active = gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON(message.chkbtn_enablecol)); + gtk_widget_set_sensitive(message.button_edit_col, is_active); + prefs_common.enable_color = is_active; +} + +static void prefs_recycle_colors_toggled(GtkWidget *widget) +{ + gboolean is_active; + + is_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + prefs_common.recycle_quote_colors = is_active; +} + +void prefs_quote_description(void) +{ + if (!quote_desc_win) + prefs_quote_description_create(); + + manage_window_set_transient(GTK_WINDOW(quote_desc_win)); + gtk_widget_show(quote_desc_win); + gtk_main(); + gtk_widget_hide(quote_desc_win); +} + +static void prefs_quote_description_create(void) +{ + GtkWidget *vbox; + GtkWidget *hbox; + GtkWidget *vbox2; + GtkWidget *label; + GtkWidget *hbbox; + GtkWidget *ok_btn; + + quote_desc_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(quote_desc_win), + _("Description of symbols")); + gtk_container_set_border_width(GTK_CONTAINER(quote_desc_win), 8); + gtk_window_set_position(GTK_WINDOW(quote_desc_win), GTK_WIN_POS_CENTER); + gtk_window_set_modal(GTK_WINDOW(quote_desc_win), TRUE); + gtk_window_set_policy(GTK_WINDOW(quote_desc_win), FALSE, FALSE, FALSE); + + vbox = gtk_vbox_new(FALSE, 8); + gtk_container_add(GTK_CONTAINER(quote_desc_win), vbox); + + hbox = gtk_hbox_new(FALSE, 8); + gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); + + vbox2 = gtk_vbox_new(FALSE, 8); + gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 0); + +#define PACK_LABEL() \ + gtk_box_pack_start(GTK_BOX(vbox2), label, TRUE, TRUE, 0); \ + gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); \ + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + + label = gtk_label_new + ("%d\n" /* date */ + "%f\n" /* from */ + "%N\n" /* full name of sender */ + "%F\n" /* first name of sender */ + "%I\n" /* initial of sender */ + "%s\n" /* subject */ + "%t\n" /* to */ + "%c\n" /* cc */ + "%n\n" /* newsgroups */ + "%i"); /* message id */ + PACK_LABEL(); + + label = gtk_label_new + ("?x{expr}"); /* condition */ + PACK_LABEL(); + + label = gtk_label_new + ("%M\n" /* message body */ + "%Q\n" /* quoted message body */ + "%m\n" /* message body without signature */ + "%q\n" /* quoted message body without signature */ + "%%"); /* literal percent */ + PACK_LABEL(); + + label = gtk_label_new + ("\\\\\n" /* literal backslash */ + "\\?\n" /* literal question mark */ + "\\{\n" /* literal opening curly brace */ + "\\}"); /* literal closing curly brace */ + PACK_LABEL(); + + vbox2 = gtk_vbox_new(FALSE, 8); + gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 0); + + label = gtk_label_new + (_("Date\n" + "From\n" + "Full Name of Sender\n" + "First Name of Sender\n" + "Initial of Sender\n" + "Subject\n" + "To\n" + "Cc\n" + "Newsgroups\n" + "Message-ID")); + PACK_LABEL(); + + label = gtk_label_new + (_("If x is set, displays expr")); + PACK_LABEL(); + + label = gtk_label_new + (_("Message body\n" + "Quoted message body\n" + "Message body without signature\n" + "Quoted message body without signature\n" + "Literal %")); + PACK_LABEL(); + + label = gtk_label_new + (_("Literal backslash\n" + "Literal question mark\n" + "Literal opening curly brace\n" + "Literal closing curly brace")); + PACK_LABEL(); + +#undef PACK_LABEL + + gtkut_stock_button_set_create(&hbbox, &ok_btn, GTK_STOCK_OK, + NULL, NULL, NULL, NULL); + gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0); + + gtk_widget_grab_default(ok_btn); + g_signal_connect(G_OBJECT(ok_btn), "clicked", + G_CALLBACK(gtk_main_quit), NULL); + g_signal_connect + (G_OBJECT(quote_desc_win), "key_press_event", + G_CALLBACK(prefs_quote_description_key_pressed), NULL); + g_signal_connect(G_OBJECT(quote_desc_win), "delete_event", + G_CALLBACK(gtk_main_quit), NULL); + + gtk_widget_show_all(vbox); +} + +static gboolean prefs_quote_description_key_pressed(GtkWidget *widget, + GdkEventKey *event, + gpointer data) +{ + if (event && event->keyval == GDK_Escape) + gtk_main_quit(); + return FALSE; +} + +static void prefs_keybind_select(void) +{ + GtkWidget *window; + GtkWidget *vbox1; + GtkWidget *hbox1; + GtkWidget *label; + GtkWidget *combo; + GtkWidget *confirm_area; + GtkWidget *ok_btn; + GtkWidget *cancel_btn; + + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_container_set_border_width (GTK_CONTAINER (window), 8); + gtk_window_set_title (GTK_WINDOW (window), _("Key bindings")); + gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); + gtk_window_set_modal (GTK_WINDOW (window), TRUE); + gtk_window_set_policy (GTK_WINDOW (window), FALSE, FALSE, FALSE); + manage_window_set_transient (GTK_WINDOW (window)); + + vbox1 = gtk_vbox_new (FALSE, VSPACING); + gtk_container_add (GTK_CONTAINER (window), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); + + label = gtk_label_new + (_("Select the preset of key bindings.\n" + "You can also modify each menu's shortcuts by pressing\n" + "any key(s) when placing the mouse pointer on the item.")); + gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); + + combo = gtk_combo_new (); + gtk_box_pack_start (GTK_BOX (hbox1), combo, TRUE, TRUE, 0); + gtkut_combo_set_items (GTK_COMBO (combo), + _("Default"), + "Mew / Wanderlust", + "Mutt", + _("Old Sylpheed"), + NULL); + gtk_editable_set_editable + (GTK_EDITABLE (GTK_COMBO (combo)->entry), FALSE); + + hbox1 = gtk_hbox_new (FALSE, 8); + gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); + + gtkut_stock_button_set_create (&confirm_area, &ok_btn, GTK_STOCK_OK, + &cancel_btn, GTK_STOCK_CANCEL, + NULL, NULL); + gtk_box_pack_end (GTK_BOX (hbox1), confirm_area, FALSE, FALSE, 0); + gtk_widget_grab_default (ok_btn); + + MANAGE_WINDOW_SIGNALS_CONNECT(window); + g_signal_connect (G_OBJECT (window), "delete_event", + G_CALLBACK (prefs_keybind_deleted), NULL); + g_signal_connect (G_OBJECT (window), "key_press_event", + G_CALLBACK (prefs_keybind_key_pressed), NULL); + g_signal_connect (G_OBJECT (ok_btn), "clicked", + G_CALLBACK (prefs_keybind_apply_clicked), NULL); + g_signal_connect (G_OBJECT (cancel_btn), "clicked", + G_CALLBACK (prefs_keybind_cancel), NULL); + + gtk_widget_show_all(window); + + keybind.window = window; + keybind.combo = combo; +} + +static gboolean prefs_keybind_key_pressed(GtkWidget *widget, GdkEventKey *event, + gpointer data) +{ + if (event && event->keyval == GDK_Escape) + prefs_keybind_cancel(); + return FALSE; +} + +static gint prefs_keybind_deleted(GtkWidget *widget, GdkEventAny *event, + gpointer data) +{ + prefs_keybind_cancel(); + return TRUE; +} + +static void prefs_keybind_cancel(void) +{ + gtk_widget_destroy(keybind.window); + keybind.window = NULL; + keybind.combo = NULL; +} + +struct KeyBind { + const gchar *accel_path; + const gchar *accel_key; +}; + +static void prefs_keybind_apply(struct KeyBind keybind[], gint num) +{ + gint i; + guint key; + GdkModifierType mods; + + for (i = 0; i < num; i++) { + const gchar *accel_key = + keybind[i].accel_key ? keybind[i].accel_key : ""; + gtk_accelerator_parse(accel_key, &key, &mods); + gtk_accel_map_change_entry(keybind[i].accel_path, + key, mods, TRUE); + } +} + +static void prefs_keybind_apply_clicked(GtkWidget *widget) +{ + GtkEntry *entry = GTK_ENTRY(GTK_COMBO(keybind.combo)->entry); + const gchar *text; + struct KeyBind *menurc; + gint n_menurc; + + static struct KeyBind default_menurc[] = { + {"
/File/Empty all trash", ""}, + {"
/File/Save as...", "S"}, + {"
/File/Print...", ""}, + {"
/File/Exit", "Q"}, + + {"
/Edit/Copy", "C"}, + {"
/Edit/Select all", "A"}, + {"
/Edit/Find in current message...", "F"}, + {"
/Edit/Search messages...", "F"}, + + {"
/View/Show or hide/Message view", "V"}, + {"
/View/Thread view", "T"}, + {"
/View/Go to/Prev message", "P"}, + {"
/View/Go to/Next message", "N"}, + {"
/View/Go to/Prev unread message", "P"}, + {"
/View/Go to/Next unread message", "N"}, + {"
/View/Go to/Other folder...", "G"}, + {"
/View/Open in new window", "N"}, + {"
/View/View source", "U"}, + {"
/View/Show all header", "H"}, + {"
/View/Update", "U"}, + + {"
/Message/Receive/Get new mail", "I"}, + {"
/Message/Receive/Get from all accounts", "I"}, + {"
/Message/Compose new message", "M"}, + {"
/Message/Reply", "R"}, + {"
/Message/Reply to/all", "R"}, + {"
/Message/Reply to/sender", ""}, + {"
/Message/Reply to/mailing list", "L"}, + {"
/Message/Forward", "F"}, + {"
/Message/Forward as attachment", ""}, + {"
/Message/Move...", "O"}, + {"
/Message/Copy...", "O"}, + {"
/Message/Delete", "D"}, + {"
/Message/Mark/Mark", "asterisk"}, + {"
/Message/Mark/Unmark", "U"}, + {"
/Message/Mark/Mark as unread", "exclam"}, + {"
/Message/Mark/Mark as read", ""}, + + {"
/Tools/Address book", "A"}, + {"
/Tools/Execute", "X"}, + {"
/Tools/Log window", "L"}, + + {"/File/Close", "W"}, + {"/Edit/Select all", "A"}, + }; + + static struct KeyBind mew_wl_menurc[] = { + {"
/File/Empty all trash", "D"}, + {"
/File/Save as...", "Y"}, + {"
/File/Print...", "numbersign"}, + {"
/File/Exit", "Q"}, + + {"
/Edit/Copy", "C"}, + {"
/Edit/Select all", "A"}, + {"
/Edit/Find in current message...", "F"}, + {"
/Edit/Search messages...", "S"}, + + {"
/View/Show or hide/Message view", "V"}, + {"
/View/Thread view", "T"}, + {"
/View/Go to/Prev message", "P"}, + {"
/View/Go to/Next message", "N"}, + {"
/View/Go to/Prev unread message", "P"}, + {"
/View/Go to/Next unread message", "N"}, + {"
/View/Go to/Other folder...", "G"}, + {"
/View/Open in new window", "N"}, + {"
/View/View source", "U"}, + {"
/View/Show all header", "H"}, + {"
/View/Update", "S"}, + + {"
/Message/Receive/Get new mail", "I"}, + {"
/Message/Receive/Get from all accounts", "I"}, + {"
/Message/Compose new message", "W"}, + {"
/Message/Reply", "R"}, + {"
/Message/Reply to/all", "A"}, + {"
/Message/Reply to/sender", ""}, + {"
/Message/Reply to/mailing list", "L"}, + {"
/Message/Forward", "F"}, + {"
/Message/Forward as attachment", "F"}, + {"
/Message/Move...", "O"}, + {"
/Message/Copy...", "O"}, + {"
/Message/Delete", "D"}, + {"
/Message/Mark/Mark", "asterisk"}, + {"
/Message/Mark/Unmark", "U"}, + {"
/Message/Mark/Mark as unread", "exclam"}, + {"
/Message/Mark/Mark as read", "R"}, + + {"
/Tools/Address book", "A"}, + {"
/Tools/Execute", "X"}, + {"
/Tools/Log window", "L"}, + + {"/File/Close", "W"}, + {"/Edit/Select all", ""}, + }; + + static struct KeyBind mutt_menurc[] = { + {"
/File/Empty all trash", ""}, + {"
/File/Save as...", "S"}, + {"
/File/Print...", "P"}, + {"
/File/Exit", "Q"}, + + {"
/Edit/Copy", "C"}, + {"
/Edit/Select all", "A"}, + {"
/Edit/Find in current message...", "F"}, + {"
/Edit/Search messages...", "slash"}, + + {"
/View/Show or hide/Message view", "V"}, + {"
/View/Thread view", "T"}, + {"
/View/Go to/Prev message", ""}, + {"
/View/Go to/Next message", ""}, + {"
/View/Go to/Prev unread message", ""}, + {"
/View/Go to/Next unread message", ""}, + {"
/View/Go to/Other folder...", "C"}, + {"
/View/Open in new window", "N"}, + {"
/View/View source", "U"}, + {"
/View/Show all header", "H"}, + {"
/View/Update", "U"}, + + {"
/Message/Receive/Get new mail", "I"}, + {"
/Message/Receive/Get from all accounts", "I"}, + {"
/Message/Compose new message", "M"}, + {"
/Message/Reply", "R"}, + {"
/Message/Reply to/all", "G"}, + {"
/Message/Reply to/sender", ""}, + {"
/Message/Reply to/mailing list", "L"}, + {"
/Message/Forward", "F"}, + {"
/Message/Forward as attachment", ""}, + {"
/Message/Move...", "O"}, + {"
/Message/Copy...", "C"}, + {"
/Message/Delete", "D"}, + {"
/Message/Mark/Mark", "F"}, + {"
/Message/Mark/Unmark", "U"}, + {"
/Message/Mark/Mark as unread", "N"}, + {"
/Message/Mark/Mark as read", ""}, + + {"
/Tools/Address book", "A"}, + {"
/Tools/Execute", "X"}, + {"
/Tools/Log window", "L"}, + + {"/File/Close", "W"}, + {"/Edit/Select all", ""}, + }; + + static struct KeyBind old_sylpheed_menurc[] = { + {"
/File/Empty all trash", ""}, + {"
/File/Save as...", ""}, + {"
/File/Print...", "P"}, + {"
/File/Exit", "Q"}, + + {"
/Edit/Copy", "C"}, + {"
/Edit/Select all", "A"}, + {"
/Edit/Find in current message...", "F"}, + {"
/Edit/Search messages...", "S"}, + + {"
/View/Show or hide/Message view", "V"}, + {"
/View/Thread view", "T"}, + {"
/View/Go to/Prev message", "P"}, + {"
/View/Go to/Next message", "N"}, + {"
/View/Go to/Prev unread message", "P"}, + {"
/View/Go to/Next unread message", "N"}, + {"
/View/Go to/Other folder...", "G"}, + {"
/View/Open in new window", "N"}, + {"
/View/View source", "U"}, + {"
/View/Show all header", "H"}, + {"
/View/Update", "U"}, + + {"
/Message/Receive/Get new mail", "I"}, + {"
/Message/Receive/Get from all accounts", "I"}, + {"
/Message/Compose new message", "N"}, + {"
/Message/Reply", "R"}, + {"
/Message/Reply to/all", "R"}, + {"
/Message/Reply to/sender", "R"}, + {"
/Message/Reply to/mailing list", "L"}, + {"
/Message/Forward", "F"}, + {"
/Message/Forward as attachment", "F"}, + {"
/Message/Move...", "O"}, + {"
/Message/Copy...", ""}, + {"
/Message/Delete", "D"}, + {"
/Message/Mark/Mark", "asterisk"}, + {"
/Message/Mark/Unmark", "U"}, + {"
/Message/Mark/Mark as unread", "exclam"}, + {"
/Message/Mark/Mark as read", ""}, + + {"
/Tools/Address book", "A"}, + {"
/Tools/Execute", "X"}, + {"
/Tools/Log window", "L"}, + + {"/File/Close", "W"}, + {"/Edit/Select all", ""}, + }; + + static struct KeyBind empty_menurc[] = { + {"
/File/Empty all trash", ""}, + {"
/File/Save as...", ""}, + {"
/File/Print...", ""}, + {"
/File/Exit", ""}, + + {"
/Edit/Copy", ""}, + {"
/Edit/Select all", ""}, + {"
/Edit/Find in current message...", ""}, + {"
/Edit/Search messages...", ""}, + + {"
/View/Show or hide/Message view", ""}, + {"
/View/Thread view", ""}, + {"
/View/Go to/Prev message", ""}, + {"
/View/Go to/Next message", ""}, + {"
/View/Go to/Prev unread message", ""}, + {"
/View/Go to/Next unread message", ""}, + {"
/View/Go to/Other folder...", ""}, + {"
/View/Open in new window", ""}, + {"
/View/View source", ""}, + {"
/View/Show all header", ""}, + {"
/View/Update", ""}, + + {"
/Message/Receive/Get new mail", ""}, + {"
/Message/Receive/Get from all accounts", ""}, + {"
/Message/Compose new message", ""}, + {"
/Message/Reply", ""}, + {"
/Message/Reply to/all", ""}, + {"
/Message/Reply to/sender", ""}, + {"
/Message/Reply to/mailing list", ""}, + {"
/Message/Forward", ""}, + {"
/Message/Forward as attachment", ""}, + {"
/Message/Move...", ""}, + {"
/Message/Copy...", ""}, + {"
/Message/Delete", ""}, + {"
/Message/Mark/Mark", ""}, + {"
/Message/Mark/Unmark", ""}, + {"
/Message/Mark/Mark as unread", ""}, + {"
/Message/Mark/Mark as read", ""}, + + {"
/Tools/Address book", ""}, + {"
/Tools/Execute", ""}, + {"
/Tools/Log window", ""}, + + {"/File/Close", ""}, + {"/Edit/Select all", ""}, + }; + + text = gtk_entry_get_text(entry); + + if (!strcmp(text, _("Default"))) { + menurc = default_menurc; + n_menurc = G_N_ELEMENTS(default_menurc); + } else if (!strcmp(text, "Mew / Wanderlust")) { + menurc = mew_wl_menurc; + n_menurc = G_N_ELEMENTS(mew_wl_menurc); + } else if (!strcmp(text, "Mutt")) { + menurc = mutt_menurc; + n_menurc = G_N_ELEMENTS(mutt_menurc); + } else if (!strcmp(text, _("Old Sylpheed"))) { + menurc = old_sylpheed_menurc; + n_menurc = G_N_ELEMENTS(old_sylpheed_menurc); + } else + return; + + prefs_keybind_apply(empty_menurc, G_N_ELEMENTS(empty_menurc)); + prefs_keybind_apply(menurc, n_menurc); + + gtk_widget_destroy(keybind.window); + keybind.window = NULL; + keybind.combo = NULL; +} + +static void prefs_common_charset_set_data_from_optmenu(PrefParam *pparam) +{ + PrefsUIData *ui_data; + GtkWidget *menu; + GtkWidget *menuitem; + gchar *charset; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*ui_data->widget)); + menuitem = gtk_menu_get_active(GTK_MENU(menu)); + charset = g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID); + g_free(*((gchar **)pparam->data)); + *((gchar **)pparam->data) = g_strdup(charset); +} + +static void prefs_common_charset_set_optmenu(PrefParam *pparam) +{ + PrefsUIData *ui_data; + GtkOptionMenu *optmenu; + gint index; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + optmenu = GTK_OPTION_MENU(*ui_data->widget); + g_return_if_fail(optmenu != NULL); + g_return_if_fail(*((gchar **)pparam->data) != NULL); + + index = menu_find_option_menu_index(optmenu, *((gchar **)pparam->data), + (GCompareFunc)strcmp2); + if (index >= 0) + gtk_option_menu_set_history(optmenu, index); + else { + gtk_option_menu_set_history(optmenu, 0); + prefs_common_charset_set_data_from_optmenu(pparam); + } +} + +static void prefs_common_encoding_set_data_from_optmenu(PrefParam *pparam) +{ + PrefsUIData *ui_data; + GtkWidget *menu; + GtkWidget *menuitem; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*ui_data->widget)); + menuitem = gtk_menu_get_active(GTK_MENU(menu)); + *((TransferEncodingMethod *)pparam->data) = GPOINTER_TO_INT + (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID)); +} + +static void prefs_common_encoding_set_optmenu(PrefParam *pparam) +{ + PrefsUIData *ui_data; + TransferEncodingMethod method = + *((TransferEncodingMethod *)pparam->data); + GtkOptionMenu *optmenu; + gint index; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + optmenu = GTK_OPTION_MENU(*ui_data->widget); + g_return_if_fail(optmenu != NULL); + + index = menu_find_option_menu_index(optmenu, GINT_TO_POINTER(method), + NULL); + if (index >= 0) + gtk_option_menu_set_history(optmenu, index); + else { + gtk_option_menu_set_history(optmenu, 0); + prefs_common_encoding_set_data_from_optmenu(pparam); + } +} + +static void prefs_common_recv_dialog_set_data_from_optmenu(PrefParam *pparam) +{ + PrefsUIData *ui_data; + GtkWidget *menu; + GtkWidget *menuitem; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*ui_data->widget)); + menuitem = gtk_menu_get_active(GTK_MENU(menu)); + *((RecvDialogMode *)pparam->data) = GPOINTER_TO_INT + (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID)); +} + +static void prefs_common_recv_dialog_set_optmenu(PrefParam *pparam) +{ + PrefsUIData *ui_data; + RecvDialogMode mode = *((RecvDialogMode *)pparam->data); + GtkOptionMenu *optmenu; + GtkWidget *menu; + GtkWidget *menuitem; + gint index; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + + optmenu = GTK_OPTION_MENU(*ui_data->widget); + g_return_if_fail(optmenu != NULL); + + index = menu_find_option_menu_index(optmenu, GINT_TO_POINTER(mode), + NULL); + if (index >= 0) + gtk_option_menu_set_history(optmenu, index); + else { + gtk_option_menu_set_history(optmenu, 0); + prefs_common_recv_dialog_set_data_from_optmenu(pparam); + } + + menu = gtk_option_menu_get_menu(optmenu); + menuitem = gtk_menu_get_active(GTK_MENU(menu)); + gtk_menu_item_activate(GTK_MENU_ITEM(menuitem)); +} + +static void prefs_common_select_folder_cb(GtkWidget *widget, gpointer data) +{ + FolderItem *item; + gchar *id; + + item = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL); + if (item && item->path) { + id = folder_item_get_identifier(item); + if (id) { + gtk_entry_set_text(GTK_ENTRY(data), id); + g_free(id); + } + } +} + +static gint prefs_common_deleted(GtkWidget *widget, GdkEventAny *event, + gpointer data) +{ + prefs_common_cancel(); + return TRUE; +} + +static gboolean prefs_common_key_pressed(GtkWidget *widget, GdkEventKey *event, + gpointer data) +{ + if (event && event->keyval == GDK_Escape) + prefs_common_cancel(); + return FALSE; +} + +static void prefs_common_ok(void) +{ + prefs_common_apply(); + gtk_widget_hide(dialog.window); + if (quote_desc_win && GTK_WIDGET_VISIBLE(quote_desc_win)) + gtk_widget_hide(quote_desc_win); + + inc_unlock(); +} + +static void prefs_common_apply(void) +{ + prefs_set_data_from_dialog(prefs_common_get_params()); + prefs_common_junk_filter_list_set(); + gtkut_stock_button_set_set_reverse(!prefs_common.comply_gnome_hig); + main_window_reflect_prefs_all(); + sock_set_io_timeout(prefs_common.io_timeout_secs); + prefs_common_write_config(); + + inc_autocheck_timer_remove(); + inc_autocheck_timer_set(); +} + +static void prefs_common_cancel(void) +{ + gtk_widget_hide(dialog.window); + inc_unlock(); +} diff --git a/src/prefs_common_dialog.h b/src/prefs_common_dialog.h new file mode 100644 index 00000000..152a6c54 --- /dev/null +++ b/src/prefs_common_dialog.h @@ -0,0 +1,33 @@ +/* + * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client + * Copyright (C) 1999-2005 Hiroyuki Yamamoto + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __PREFS_COMMON_DIALOG_H__ +#define __PREFS_COMMON_DIALOG_H__ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +void prefs_common_open (void); + +void prefs_quote_description (void); + +#endif /* __PREFS_COMMON_DIALOG_H__ */ diff --git a/src/prefs_template.c b/src/prefs_template.c index e3eeb1fe..f473cf84 100644 --- a/src/prefs_template.c +++ b/src/prefs_template.c @@ -36,6 +36,7 @@ #include "alertpanel.h" #include "manage_window.h" #include "prefs_common.h" +#include "prefs_common_dialog.h" #include "compose.h" #include "addr_compl.h" #include "quote_fmt.h" diff --git a/src/prefs_ui.c b/src/prefs_ui.c index 5f516c79..6ddc9ade 100644 --- a/src/prefs_ui.c +++ b/src/prefs_ui.c @@ -105,29 +105,52 @@ void prefs_button_toggled(GtkToggleButton *toggle_btn, GtkWidget *widget) gtk_widget_set_sensitive(widget, is_active); } +void prefs_register_ui(PrefParam *param, PrefsUIData *ui_data) +{ + GHashTable *param_table; + PrefParam *param_; + gint i; + + param_table = prefs_param_table_get(param); + + for (i = 0; ui_data[i].name != NULL; i++) { + param_ = g_hash_table_lookup(param_table, ui_data[i].name); + if (param_) { + param_->ui_data = &ui_data[i]; + } + } + + prefs_param_table_destroy(param_table); +} + void prefs_set_dialog(PrefParam *param) { + PrefsUIData *ui_data; gint i; for (i = 0; param[i].name != NULL; i++) { - if (param[i].widget_set_func) - param[i].widget_set_func(¶m[i]); + ui_data = (PrefsUIData *)param[i].ui_data; + if (ui_data && ui_data->widget_set_func) + ui_data->widget_set_func(¶m[i]); } } void prefs_set_data_from_dialog(PrefParam *param) { + PrefsUIData *ui_data; gint i; for (i = 0; param[i].name != NULL; i++) { - if (param[i].data_set_func) - param[i].data_set_func(¶m[i]); + ui_data = (PrefsUIData *)param[i].ui_data; + if (ui_data && ui_data->data_set_func) + ui_data->data_set_func(¶m[i]); } } void prefs_set_dialog_to_default(PrefParam *param) { gint i; + PrefsUIData *ui_data; PrefParam tmpparam; gchar *str_data = NULL; gint int_data; @@ -136,7 +159,8 @@ void prefs_set_dialog_to_default(PrefParam *param) DummyEnum enum_data; for (i = 0; param[i].name != NULL; i++) { - if (!param[i].widget_set_func) continue; + ui_data = (PrefsUIData *)param[i].ui_data; + if (!ui_data || !ui_data->widget_set_func) continue; tmpparam = param[i]; @@ -195,7 +219,7 @@ void prefs_set_dialog_to_default(PrefParam *param) case P_OTHER: break; } - tmpparam.widget_set_func(&tmpparam); + ui_data->widget_set_func(&tmpparam); g_free(str_data); str_data = NULL; } @@ -203,12 +227,15 @@ void prefs_set_dialog_to_default(PrefParam *param) void prefs_set_data_from_entry(PrefParam *pparam) { + PrefsUIData *ui_data; gchar **str; const gchar *entry_str; - g_return_if_fail(*pparam->widget != NULL); + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); - entry_str = gtk_entry_get_text(GTK_ENTRY(*pparam->widget)); + entry_str = gtk_entry_get_text(GTK_ENTRY(*ui_data->widget)); switch (pparam->type) { case P_STRING: @@ -230,22 +257,25 @@ void prefs_set_data_from_entry(PrefParam *pparam) void prefs_set_entry(PrefParam *pparam) { + PrefsUIData *ui_data; gchar **str; - g_return_if_fail(*pparam->widget != NULL); + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); switch (pparam->type) { case P_STRING: str = (gchar **)pparam->data; - gtk_entry_set_text(GTK_ENTRY(*pparam->widget), + gtk_entry_set_text(GTK_ENTRY(*ui_data->widget), *str ? *str : ""); break; case P_INT: - gtk_entry_set_text(GTK_ENTRY(*pparam->widget), + gtk_entry_set_text(GTK_ENTRY(*ui_data->widget), itos(*((gint *)pparam->data))); break; case P_USHORT: - gtk_entry_set_text(GTK_ENTRY(*pparam->widget), + gtk_entry_set_text(GTK_ENTRY(*ui_data->widget), itos(*((gushort *)pparam->data))); break; default: @@ -256,23 +286,26 @@ void prefs_set_entry(PrefParam *pparam) void prefs_set_data_from_text(PrefParam *pparam) { + PrefsUIData *ui_data; gchar **str; gchar *text = NULL, *tp = NULL; gchar *tmp, *tmpp; - g_return_if_fail(*pparam->widget != NULL); - g_return_if_fail(GTK_IS_EDITABLE(*pparam->widget) || - GTK_IS_TEXT_VIEW(*pparam->widget)); + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); + g_return_if_fail(GTK_IS_EDITABLE(*ui_data->widget) || + GTK_IS_TEXT_VIEW(*ui_data->widget)); switch (pparam->type) { case P_STRING: str = (gchar **)pparam->data; g_free(*str); - if (GTK_IS_EDITABLE(*pparam->widget)) { + if (GTK_IS_EDITABLE(*ui_data->widget)) { tp = text = gtk_editable_get_chars - (GTK_EDITABLE(*pparam->widget), 0, -1); - } else if (GTK_IS_TEXT_VIEW(*pparam->widget)) { - GtkTextView *textview = GTK_TEXT_VIEW(*pparam->widget); + (GTK_EDITABLE(*ui_data->widget), 0, -1); + } else if (GTK_IS_TEXT_VIEW(*ui_data->widget)) { + GtkTextView *textview = GTK_TEXT_VIEW(*ui_data->widget); GtkTextBuffer *buffer; GtkTextIter start, end; @@ -313,13 +346,16 @@ void prefs_set_data_from_text(PrefParam *pparam) void prefs_set_text(PrefParam *pparam) { + PrefsUIData *ui_data; gchar *buf, *sp, *bufp; gchar **str; GtkTextView *text; GtkTextBuffer *buffer; GtkTextIter iter; - g_return_if_fail(*pparam->widget != NULL); + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); switch (pparam->type) { case P_STRING: @@ -341,7 +377,7 @@ void prefs_set_text(PrefParam *pparam) } else buf = ""; - text = GTK_TEXT_VIEW(*pparam->widget); + text = GTK_TEXT_VIEW(*ui_data->widget); buffer = gtk_text_view_get_buffer(text); gtk_text_buffer_set_text(buffer, "", 0); gtk_text_buffer_get_start_iter(buffer, &iter); @@ -355,36 +391,48 @@ void prefs_set_text(PrefParam *pparam) void prefs_set_data_from_toggle(PrefParam *pparam) { + PrefsUIData *ui_data; + + ui_data = (PrefsUIData *)pparam->ui_data; g_return_if_fail(pparam->type == P_BOOL); - g_return_if_fail(*pparam->widget != NULL); + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); *((gboolean *)pparam->data) = - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(*pparam->widget)); + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(*ui_data->widget)); } void prefs_set_toggle(PrefParam *pparam) { + PrefsUIData *ui_data; + + ui_data = (PrefsUIData *)pparam->ui_data; g_return_if_fail(pparam->type == P_BOOL); - g_return_if_fail(*pparam->widget != NULL); + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(*pparam->widget), + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(*ui_data->widget), *((gboolean *)pparam->data)); } void prefs_set_data_from_spinbtn(PrefParam *pparam) { - g_return_if_fail(*pparam->widget != NULL); + PrefsUIData *ui_data; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); switch (pparam->type) { case P_INT: *((gint *)pparam->data) = gtk_spin_button_get_value_as_int - (GTK_SPIN_BUTTON(*pparam->widget)); + (GTK_SPIN_BUTTON(*ui_data->widget)); break; case P_USHORT: *((gushort *)pparam->data) = (gushort)gtk_spin_button_get_value_as_int - (GTK_SPIN_BUTTON(*pparam->widget)); + (GTK_SPIN_BUTTON(*ui_data->widget)); break; default: g_warning("Invalid PrefType for GtkSpinButton widget: %d\n", @@ -394,15 +442,19 @@ void prefs_set_data_from_spinbtn(PrefParam *pparam) void prefs_set_spinbtn(PrefParam *pparam) { - g_return_if_fail(*pparam->widget != NULL); + PrefsUIData *ui_data; + + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); switch (pparam->type) { case P_INT: - gtk_spin_button_set_value(GTK_SPIN_BUTTON(*pparam->widget), + gtk_spin_button_set_value(GTK_SPIN_BUTTON(*ui_data->widget), (gfloat)*((gint *)pparam->data)); break; case P_USHORT: - gtk_spin_button_set_value(GTK_SPIN_BUTTON(*pparam->widget), + gtk_spin_button_set_value(GTK_SPIN_BUTTON(*ui_data->widget), (gfloat)*((gushort *)pparam->data)); break; default: @@ -413,13 +465,16 @@ void prefs_set_spinbtn(PrefParam *pparam) void prefs_set_data_from_fontbtn(PrefParam *pparam) { + PrefsUIData *ui_data; gchar **str; const gchar *font_str; - g_return_if_fail(*pparam->widget != NULL); + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); font_str = gtk_font_button_get_font_name - (GTK_FONT_BUTTON(*pparam->widget)); + (GTK_FONT_BUTTON(*ui_data->widget)); switch (pparam->type) { case P_STRING: @@ -435,14 +490,17 @@ void prefs_set_data_from_fontbtn(PrefParam *pparam) void prefs_set_fontbtn(PrefParam *pparam) { + PrefsUIData *ui_data; gchar **str; - g_return_if_fail(*pparam->widget != NULL); + ui_data = (PrefsUIData *)pparam->ui_data; + g_return_if_fail(ui_data != NULL); + g_return_if_fail(*ui_data->widget != NULL); switch (pparam->type) { case P_STRING: str = (gchar **)pparam->data; - gtk_font_button_set_font_name(GTK_FONT_BUTTON(*pparam->widget), + gtk_font_button_set_font_name(GTK_FONT_BUTTON(*ui_data->widget), *str ? *str : ""); break; default: diff --git a/src/prefs_ui.h b/src/prefs_ui.h index 9d921aae..2c3110bf 100644 --- a/src/prefs_ui.h +++ b/src/prefs_ui.h @@ -31,6 +31,7 @@ #include typedef struct _PrefsDialog PrefsDialog; +typedef struct _PrefsUIData PrefsUIData; #include "prefs.h" #include "gtkutils.h" @@ -41,6 +42,14 @@ typedef struct _PrefsDialog PrefsDialog; #define VBOX_BORDER 16 #define DEFAULT_ENTRY_WIDTH 80 +struct _PrefsUIData +{ + gchar *name; + GtkWidget **widget; + DataSetFunc data_set_func; + WidgetSetFunc widget_set_func; +}; + struct _PrefsDialog { GtkWidget *window; @@ -126,6 +135,9 @@ void prefs_dialog_destroy (PrefsDialog *dialog); void prefs_button_toggled (GtkToggleButton *toggle_btn, GtkWidget *widget); +void prefs_register_ui (PrefParam *param, + PrefsUIData *ui_data); + void prefs_set_dialog (PrefParam *param); void prefs_set_data_from_dialog (PrefParam *param); void prefs_set_dialog_to_default(PrefParam *param); -- cgit v1.2.3