2 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2015 Hiroyuki Yamamoto and the Claws Mail team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "claws-features.h"
27 #include <glib/gi18n.h>
29 #include <gdk/gdkkeysyms.h>
30 #include <gtk/filesel.h>
32 #include <sys/types.h>
37 #if !GTK_CHECK_VERSION(3, 0, 0)
38 #include "gtkcmoptionmenu.h"
41 #include "prefs_gtk.h"
42 #include "prefs_account.h"
43 #include "prefs_common.h"
44 #include "prefs_customheader.h"
46 #include "mainwindow.h"
47 #include "manage_window.h"
49 #include "foldersel.h"
54 #include "alertpanel.h"
55 #include "colorlabel.h"
58 #include "remotefolder.h"
61 #include "quote_fmt.h"
64 #include "inputdialog.h"
65 #include "ssl_certificate.h"
66 #include "passwordstore.h"
68 static gboolean cancelled
;
69 static gboolean new_account
;
71 static PrefsAccount tmp_ac_prefs
;
73 static GtkWidget
*sigfile_radiobtn
;
74 static GtkWidget
*sigcmd_radiobtn
;
75 static GtkWidget
*entry_sigpath
;
76 static GtkWidget
*signature_browse_button
;
77 static GtkWidget
*signature_edit_button
;
80 static GtkWidget
*entry_in_cert_file
;
81 static GtkWidget
*entry_out_cert_file
;
82 static GtkWidget
*in_ssl_cert_browse_button
;
83 static GtkWidget
*out_ssl_cert_browse_button
;
86 static GSList
*prefs_pages
= NULL
;
88 typedef struct BasicPage
94 GtkWidget
*acname_entry
;
95 GtkWidget
*default_checkbtn
;
97 GtkWidget
*name_entry
;
98 GtkWidget
*addr_entry
;
101 GtkWidget
*serv_frame
;
102 GtkWidget
*serv_table
;
103 gpointer
*protocol_optmenu
;
104 GtkWidget
*recvserv_label
;
105 GtkWidget
*smtpserv_label
;
106 GtkWidget
*nntpserv_label
;
107 GtkWidget
*localmbox_label
;
108 GtkWidget
*mailcmd_label
;
109 GtkWidget
*recvserv_entry
;
110 GtkWidget
*smtpserv_entry
;
111 GtkWidget
*nntpserv_entry
;
112 GtkWidget
*nntpauth_checkbtn
;
113 GtkWidget
*nntpauth_onconnect_checkbtn
;
114 GtkWidget
*localmbox_entry
;
115 GtkWidget
*mailcmd_checkbtn
;
116 GtkWidget
*mailcmd_entry
;
117 GtkWidget
*uid_label
;
118 GtkWidget
*pass_label
;
119 GtkWidget
*uid_entry
;
120 GtkWidget
*pass_entry
;
121 GtkWidget
*auto_configure_btn
;
122 GtkWidget
*auto_configure_cancel_btn
;
123 GtkWidget
*auto_configure_lbl
;
126 typedef struct ReceivePage
132 GtkWidget
*pop3_frame
;
133 GtkWidget
*use_apop_checkbtn
;
134 GtkWidget
*rmmail_checkbtn
;
135 GtkWidget
*leave_time_spinbtn
;
136 GtkWidget
*leave_hour_spinbtn
;
137 GtkWidget
*size_limit_checkbtn
;
138 GtkWidget
*size_limit_spinbtn
;
139 GtkWidget
*inbox_label
;
140 GtkWidget
*inbox_entry
;
141 GtkWidget
*inbox_btn
;
143 GtkWidget
*local_frame
;
144 GtkWidget
*local_inbox_label
;
145 GtkWidget
*local_inbox_entry
;
146 GtkWidget
*local_inbox_btn
;
148 GtkWidget
*filter_on_recv_checkbtn
;
149 GtkWidget
*filterhook_on_recv_checkbtn
;
150 GtkWidget
*recvatgetall_checkbtn
;
152 GtkWidget
*imap_frame
;
153 GtkWidget
*imap_auth_type_optmenu
;
154 GtkWidget
*imapdir_label
;
155 GtkWidget
*imapdir_entry
;
156 GtkWidget
*subsonly_checkbtn
;
157 GtkWidget
*low_bandwidth_checkbtn
;
159 GtkWidget
*frame_maxarticle
;
160 GtkWidget
*maxarticle_label
;
161 GtkWidget
*maxarticle_spinbtn
;
162 GtkAdjustment
*maxarticle_spinbtn_adj
;
165 typedef struct SendPage
171 GtkWidget
*msgid_checkbtn
;
172 GtkWidget
*xmailer_checkbtn
;
173 GtkWidget
*customhdr_checkbtn
;
174 GtkWidget
*msgid_with_addr_checkbtn
;
175 GtkWidget
*smtp_auth_checkbtn
;
176 GtkWidget
*smtp_auth_type_optmenu
;
177 GtkWidget
*smtp_uid_entry
;
178 GtkWidget
*smtp_pass_entry
;
179 GtkWidget
*pop_bfr_smtp_checkbtn
;
180 GtkWidget
*pop_bfr_smtp_tm_spinbtn
;
181 GtkWidget
*pop_auth_timeout_lbl
;
182 GtkWidget
*pop_auth_minutes_lbl
;
185 typedef struct ComposePage
191 GtkWidget
*sigfile_radiobtn
;
192 GtkWidget
*entry_sigpath
;
193 GtkWidget
*checkbtn_autosig
;
194 GtkWidget
*entry_sigsep
;
195 GtkWidget
*autocc_checkbtn
;
196 GtkWidget
*autocc_entry
;
197 GtkWidget
*autobcc_checkbtn
;
198 GtkWidget
*autobcc_entry
;
199 GtkWidget
*autoreplyto_checkbtn
;
200 GtkWidget
*autoreplyto_entry
;
202 GtkWidget
*checkbtn_enable_default_dictionary
;
203 GtkWidget
*combo_default_dictionary
;
204 GtkWidget
*checkbtn_enable_default_alt_dictionary
;
205 GtkWidget
*combo_default_alt_dictionary
;
209 typedef struct TemplatesPage
215 GtkWidget
*checkbtn_compose_with_format
;
216 GtkWidget
*compose_subject_format
;
217 GtkWidget
*compose_body_format
;
218 GtkWidget
*checkbtn_reply_with_format
;
219 GtkWidget
*reply_quotemark
;
220 GtkWidget
*reply_body_format
;
221 GtkWidget
*checkbtn_forward_with_format
;
222 GtkWidget
*forward_quotemark
;
223 GtkWidget
*forward_body_format
;
226 typedef struct PrivacyPage
232 GtkWidget
*default_privacy_system
;
233 GtkWidget
*default_encrypt_checkbtn
;
234 GtkWidget
*default_encrypt_reply_checkbtn
;
235 GtkWidget
*default_sign_checkbtn
;
236 GtkWidget
*default_sign_reply_checkbtn
;
237 GtkWidget
*save_clear_text_checkbtn
;
238 GtkWidget
*encrypt_to_self_checkbtn
;
241 typedef struct SSLPage
247 GtkWidget
*pop_frame
;
248 GtkWidget
*pop_nossl_radiobtn
;
249 GtkWidget
*pop_ssltunnel_radiobtn
;
250 GtkWidget
*pop_starttls_radiobtn
;
252 GtkWidget
*imap_frame
;
253 GtkWidget
*imap_nossl_radiobtn
;
254 GtkWidget
*imap_ssltunnel_radiobtn
;
255 GtkWidget
*imap_starttls_radiobtn
;
257 GtkWidget
*nntp_frame
;
258 GtkWidget
*nntp_nossl_radiobtn
;
259 GtkWidget
*nntp_ssltunnel_radiobtn
;
261 GtkWidget
*send_frame
;
262 GtkWidget
*smtp_nossl_radiobtn
;
263 GtkWidget
*smtp_ssltunnel_radiobtn
;
264 GtkWidget
*smtp_starttls_radiobtn
;
266 GtkWidget
*entry_in_cert_file
;
267 GtkWidget
*entry_in_cert_pass
;
268 GtkWidget
*entry_out_cert_file
;
269 GtkWidget
*entry_out_cert_pass
;
271 GtkWidget
*ssl_certs_auto_accept_checkbtn
;
272 GtkWidget
*use_nonblocking_ssl_checkbtn
;
275 typedef struct AdvancedPage
281 GtkWidget
*smtpport_checkbtn
;
282 GtkWidget
*smtpport_spinbtn
;
283 GtkWidget
*popport_hbox
;
284 GtkWidget
*popport_checkbtn
;
285 GtkWidget
*popport_spinbtn
;
286 GtkWidget
*imapport_hbox
;
287 GtkWidget
*imapport_checkbtn
;
288 GtkWidget
*imapport_spinbtn
;
289 GtkWidget
*nntpport_hbox
;
290 GtkWidget
*nntpport_checkbtn
;
291 GtkWidget
*nntpport_spinbtn
;
292 GtkWidget
*domain_checkbtn
;
293 GtkWidget
*domain_entry
;
294 #if !GTK_CHECK_VERSION(3, 0, 0)
295 GtkWidget
*crosspost_checkbtn
;
296 GtkWidget
*crosspost_colormenu
;
300 GtkWidget
*tunnelcmd_checkbtn
;
301 GtkWidget
*tunnelcmd_entry
;
304 GtkWidget
*sent_folder_checkbtn
;
305 GtkWidget
*sent_folder_entry
;
306 GtkWidget
*queue_folder_checkbtn
;
307 GtkWidget
*queue_folder_entry
;
308 GtkWidget
*draft_folder_checkbtn
;
309 GtkWidget
*draft_folder_entry
;
310 GtkWidget
*trash_folder_checkbtn
;
311 GtkWidget
*trash_folder_entry
;
314 static BasicPage basic_page
;
315 static ReceivePage receive_page
;
316 static SendPage send_page
;
317 static ComposePage compose_page
;
318 static TemplatesPage templates_page
;
319 static PrivacyPage privacy_page
;
321 static SSLPage ssl_page
;
323 static AdvancedPage advanced_page
;
325 struct BasicProtocol
{
328 GtkWidget
*descrlabel
;
329 GtkWidget
*no_imap_warn_icon
;
330 GtkWidget
*no_imap_warn_label
;
333 static char *protocol_names
[] = {
337 N_("Local mbox file"),
338 N_("None (SMTP only)")
341 static void prefs_account_protocol_set_data_from_optmenu(PrefParam
*pparam
);
342 static void prefs_account_protocol_set_optmenu (PrefParam
*pparam
);
343 static void prefs_account_protocol_changed (GtkComboBox
*combobox
,
346 static void prefs_account_set_string_from_combobox (PrefParam
*pparam
);
347 static void prefs_account_set_privacy_combobox_from_string (PrefParam
*pparam
);
349 static void prefs_account_imap_auth_type_set_data_from_optmenu
351 static void prefs_account_imap_auth_type_set_optmenu (PrefParam
*pparam
);
352 static void prefs_account_smtp_auth_type_set_data_from_optmenu
354 static void prefs_account_smtp_auth_type_set_optmenu (PrefParam
*pparam
);
356 static void prefs_account_enum_set_data_from_radiobtn (PrefParam
*pparam
);
357 static void prefs_account_enum_set_radiobtn (PrefParam
*pparam
);
359 #if !GTK_CHECK_VERSION(3, 0, 0)
360 static void crosspost_color_toggled(void);
361 static void prefs_account_crosspost_set_data_from_colormenu(PrefParam
*pparam
);
362 static void prefs_account_crosspost_set_colormenu(PrefParam
*pparam
);
365 static void prefs_account_nntpauth_toggled(GtkToggleButton
*button
,
367 static void prefs_account_mailcmd_toggled(GtkToggleButton
*button
,
369 static void prefs_account_filter_on_recv_toggled(GtkToggleButton
*button
,
373 static void prefs_account_compose_default_dictionary_set_string_from_optmenu
375 static void prefs_account_compose_default_dictionary_set_optmenu_from_string
379 static gchar
*privacy_prefs
;
381 static PrefParam basic_param
[] = {
382 {"account_name", NULL
, &tmp_ac_prefs
.account_name
, P_STRING
,
383 &basic_page
.acname_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
385 {"is_default", "FALSE", &tmp_ac_prefs
.is_default
, P_BOOL
,
386 &basic_page
.default_checkbtn
,
387 prefs_set_data_from_toggle
, prefs_set_toggle
},
389 {"name", NULL
, &tmp_ac_prefs
.name
, P_STRING
,
390 &basic_page
.name_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
392 {"address", NULL
, &tmp_ac_prefs
.address
, P_STRING
,
393 &basic_page
.addr_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
395 {"organization", NULL
, &tmp_ac_prefs
.organization
, P_STRING
,
396 &basic_page
.org_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
398 {"protocol", NULL
, &tmp_ac_prefs
.protocol
, P_ENUM
,
399 (GtkWidget
**)&basic_page
.protocol_optmenu
,
400 prefs_account_protocol_set_data_from_optmenu
,
401 prefs_account_protocol_set_optmenu
},
403 {"receive_server", NULL
, &tmp_ac_prefs
.recv_server
, P_STRING
,
404 &basic_page
.recvserv_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
406 {"smtp_server", NULL
, &tmp_ac_prefs
.smtp_server
, P_STRING
,
407 &basic_page
.smtpserv_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
409 {"nntp_server", NULL
, &tmp_ac_prefs
.nntp_server
, P_STRING
,
410 &basic_page
.nntpserv_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
412 {"local_mbox", "/var/mail", &tmp_ac_prefs
.local_mbox
, P_STRING
,
413 &basic_page
.localmbox_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
415 {"use_mail_command", "FALSE", &tmp_ac_prefs
.use_mail_command
, P_BOOL
,
416 &basic_page
.mailcmd_checkbtn
, prefs_set_data_from_toggle
, prefs_set_toggle
},
418 {"mail_command", DEFAULT_SENDMAIL_CMD
, &tmp_ac_prefs
.mail_command
, P_STRING
,
419 &basic_page
.mailcmd_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
421 {"use_nntp_auth", "FALSE", &tmp_ac_prefs
.use_nntp_auth
, P_BOOL
,
422 &basic_page
.nntpauth_checkbtn
,
423 prefs_set_data_from_toggle
, prefs_set_toggle
},
425 {"use_nntp_auth_onconnect", "FALSE", &tmp_ac_prefs
.use_nntp_auth_onconnect
, P_BOOL
,
426 &basic_page
.nntpauth_onconnect_checkbtn
,
427 prefs_set_data_from_toggle
, prefs_set_toggle
},
429 {"user_id", "ENV_USER", &tmp_ac_prefs
.userid
, P_STRING
,
430 &basic_page
.uid_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
432 {"password", NULL
, &tmp_ac_prefs
.passwd
, P_PASSWORD
,
435 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
438 static PrefParam receive_param
[] = {
439 {"use_apop_auth", "FALSE", &tmp_ac_prefs
.use_apop_auth
, P_BOOL
,
440 &receive_page
.use_apop_checkbtn
,
441 prefs_set_data_from_toggle
, prefs_set_toggle
},
443 {"remove_mail", "TRUE", &tmp_ac_prefs
.rmmail
, P_BOOL
,
444 &receive_page
.rmmail_checkbtn
,
445 prefs_set_data_from_toggle
, prefs_set_toggle
},
448 {"message_leave_time", "7", &tmp_ac_prefs
.msg_leave_time
, P_INT
,
449 &receive_page
.leave_time_spinbtn
,
450 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
452 {"message_leave_time", "30", &tmp_ac_prefs
.msg_leave_time
, P_INT
,
453 &receive_page
.leave_time_spinbtn
,
454 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
456 {"message_leave_hour", "0", &tmp_ac_prefs
.msg_leave_hour
, P_INT
,
457 &receive_page
.leave_hour_spinbtn
,
458 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
460 {"enable_size_limit", "FALSE", &tmp_ac_prefs
.enable_size_limit
, P_BOOL
,
461 &receive_page
.size_limit_checkbtn
,
462 prefs_set_data_from_toggle
, prefs_set_toggle
},
463 {"size_limit", "1024", &tmp_ac_prefs
.size_limit
, P_INT
,
464 &receive_page
.size_limit_spinbtn
,
465 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
467 {"filter_on_receive", "TRUE", &tmp_ac_prefs
.filter_on_recv
, P_BOOL
,
468 &receive_page
.filter_on_recv_checkbtn
,
469 prefs_set_data_from_toggle
, prefs_set_toggle
},
471 {"filterhook_on_receive", "TRUE", &tmp_ac_prefs
.filterhook_on_recv
, P_BOOL
,
472 &receive_page
.filterhook_on_recv_checkbtn
,
473 prefs_set_data_from_toggle
, prefs_set_toggle
},
475 {"imap_auth_method", "0", &tmp_ac_prefs
.imap_auth_type
, P_ENUM
,
476 &receive_page
.imap_auth_type_optmenu
,
477 prefs_account_imap_auth_type_set_data_from_optmenu
,
478 prefs_account_imap_auth_type_set_optmenu
},
480 {"receive_at_get_all", "TRUE", &tmp_ac_prefs
.recv_at_getall
, P_BOOL
,
481 &receive_page
.recvatgetall_checkbtn
,
482 prefs_set_data_from_toggle
, prefs_set_toggle
},
484 {"max_news_articles", "300", &tmp_ac_prefs
.max_articles
, P_INT
,
485 &receive_page
.maxarticle_spinbtn
,
486 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
488 {"inbox", "#mh/Mailbox/inbox", &tmp_ac_prefs
.inbox
, P_STRING
,
489 &receive_page
.inbox_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
491 {"local_inbox", "#mh/Mailbox/inbox", &tmp_ac_prefs
.local_inbox
, P_STRING
,
492 &receive_page
.local_inbox_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
494 {"imap_directory", NULL
, &tmp_ac_prefs
.imap_dir
, P_STRING
,
495 &receive_page
.imapdir_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
497 {"imap_subsonly", "TRUE", &tmp_ac_prefs
.imap_subsonly
, P_BOOL
,
498 &receive_page
.subsonly_checkbtn
,
499 prefs_set_data_from_toggle
, prefs_set_toggle
},
501 {"low_bandwidth", "FALSE", &tmp_ac_prefs
.low_bandwidth
, P_BOOL
,
502 &receive_page
.low_bandwidth_checkbtn
,
503 prefs_set_data_from_toggle
, prefs_set_toggle
},
505 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
508 static PrefParam send_param
[] = {
509 {"generate_msgid", "TRUE", &tmp_ac_prefs
.gen_msgid
, P_BOOL
,
510 &send_page
.msgid_checkbtn
,
511 prefs_set_data_from_toggle
, prefs_set_toggle
},
513 {"generate_xmailer", "TRUE", &tmp_ac_prefs
.gen_xmailer
, P_BOOL
,
514 &send_page
.xmailer_checkbtn
,
515 prefs_set_data_from_toggle
, prefs_set_toggle
},
517 {"add_custom_header", "FALSE", &tmp_ac_prefs
.add_customhdr
, P_BOOL
,
518 &send_page
.customhdr_checkbtn
,
519 prefs_set_data_from_toggle
, prefs_set_toggle
},
521 {"msgid_with_addr", "FALSE", &tmp_ac_prefs
.msgid_with_addr
, P_BOOL
,
522 &send_page
.msgid_with_addr_checkbtn
,
523 prefs_set_data_from_toggle
, prefs_set_toggle
},
525 {"use_smtp_auth", "FALSE", &tmp_ac_prefs
.use_smtp_auth
, P_BOOL
,
526 &send_page
.smtp_auth_checkbtn
,
527 prefs_set_data_from_toggle
, prefs_set_toggle
},
529 {"smtp_auth_method", "0", &tmp_ac_prefs
.smtp_auth_type
, P_ENUM
,
530 &send_page
.smtp_auth_type_optmenu
,
531 prefs_account_smtp_auth_type_set_data_from_optmenu
,
532 prefs_account_smtp_auth_type_set_optmenu
},
534 {"smtp_user_id", NULL
, &tmp_ac_prefs
.smtp_userid
, P_STRING
,
535 &send_page
.smtp_uid_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
536 {"smtp_password", NULL
, &tmp_ac_prefs
.smtp_passwd
, P_PASSWORD
,
539 {"pop_before_smtp", "FALSE", &tmp_ac_prefs
.pop_before_smtp
, P_BOOL
,
540 &send_page
.pop_bfr_smtp_checkbtn
,
541 prefs_set_data_from_toggle
, prefs_set_toggle
},
543 {"pop_before_smtp_timeout", "5", &tmp_ac_prefs
.pop_before_smtp_timeout
, P_INT
,
544 &send_page
.pop_bfr_smtp_tm_spinbtn
,
545 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
547 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
550 static PrefParam compose_param
[] = {
551 {"signature_type", "0", &tmp_ac_prefs
.sig_type
, P_ENUM
,
552 &compose_page
.sigfile_radiobtn
,
553 prefs_account_enum_set_data_from_radiobtn
,
554 prefs_account_enum_set_radiobtn
},
555 {"signature_path", "~" G_DIR_SEPARATOR_S DEFAULT_SIGNATURE
,
556 &tmp_ac_prefs
.sig_path
, P_STRING
, &compose_page
.entry_sigpath
,
557 prefs_set_data_from_entry
, prefs_set_entry
},
559 {"auto_signature", "TRUE", &tmp_ac_prefs
.auto_sig
, P_BOOL
,
560 &compose_page
.checkbtn_autosig
,
561 prefs_set_data_from_toggle
, prefs_set_toggle
},
563 {"signature_separator", "-- ", &tmp_ac_prefs
.sig_sep
, P_STRING
,
564 &compose_page
.entry_sigsep
,
565 prefs_set_data_from_entry
, prefs_set_entry
},
567 {"set_autocc", "FALSE", &tmp_ac_prefs
.set_autocc
, P_BOOL
,
568 &compose_page
.autocc_checkbtn
,
569 prefs_set_data_from_toggle
, prefs_set_toggle
},
571 {"auto_cc", NULL
, &tmp_ac_prefs
.auto_cc
, P_STRING
,
572 &compose_page
.autocc_entry
,
573 prefs_set_data_from_entry
, prefs_set_entry
},
575 {"set_autobcc", "FALSE", &tmp_ac_prefs
.set_autobcc
, P_BOOL
,
576 &compose_page
.autobcc_checkbtn
,
577 prefs_set_data_from_toggle
, prefs_set_toggle
},
579 {"auto_bcc", NULL
, &tmp_ac_prefs
.auto_bcc
, P_STRING
,
580 &compose_page
.autobcc_entry
,
581 prefs_set_data_from_entry
, prefs_set_entry
},
583 {"set_autoreplyto", "FALSE", &tmp_ac_prefs
.set_autoreplyto
, P_BOOL
,
584 &compose_page
.autoreplyto_checkbtn
,
585 prefs_set_data_from_toggle
, prefs_set_toggle
},
587 {"auto_replyto", NULL
, &tmp_ac_prefs
.auto_replyto
, P_STRING
,
588 &compose_page
.autoreplyto_entry
,
589 prefs_set_data_from_entry
, prefs_set_entry
},
592 {"enable_default_dictionary", "", &tmp_ac_prefs
.enable_default_dictionary
, P_BOOL
,
593 &compose_page
.checkbtn_enable_default_dictionary
,
594 prefs_set_data_from_toggle
, prefs_set_toggle
},
596 {"default_dictionary", NULL
, &tmp_ac_prefs
.default_dictionary
, P_STRING
,
597 &compose_page
.combo_default_dictionary
,
598 prefs_account_compose_default_dictionary_set_string_from_optmenu
,
599 prefs_account_compose_default_dictionary_set_optmenu_from_string
},
601 {"enable_default_alt_dictionary", "", &tmp_ac_prefs
.enable_default_alt_dictionary
, P_BOOL
,
602 &compose_page
.checkbtn_enable_default_alt_dictionary
,
603 prefs_set_data_from_toggle
, prefs_set_toggle
},
605 {"default_alt_dictionary", NULL
, &tmp_ac_prefs
.default_alt_dictionary
, P_STRING
,
606 &compose_page
.combo_default_alt_dictionary
,
607 prefs_account_compose_default_dictionary_set_string_from_optmenu
,
608 prefs_account_compose_default_dictionary_set_optmenu_from_string
},
610 {"enable_default_dictionary", "", &tmp_ac_prefs
.enable_default_dictionary
, P_BOOL
,
613 {"default_dictionary", NULL
, &tmp_ac_prefs
.default_dictionary
, P_STRING
,
616 {"enable_default_alt_dictionary", "", &tmp_ac_prefs
.enable_default_alt_dictionary
, P_BOOL
,
619 {"default_alt_dictionary", NULL
, &tmp_ac_prefs
.default_alt_dictionary
, P_STRING
,
623 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
626 static PrefParam templates_param
[] = {
627 {"compose_with_format", "FALSE", &tmp_ac_prefs
.compose_with_format
, P_BOOL
,
628 &templates_page
.checkbtn_compose_with_format
,
629 prefs_set_data_from_toggle
, prefs_set_toggle
},
631 {"compose_subject_format", NULL
, &tmp_ac_prefs
.compose_subject_format
, P_STRING
,
632 &templates_page
.compose_subject_format
,
633 prefs_set_escaped_data_from_entry
, prefs_set_entry_from_escaped
},
635 {"compose_body_format", NULL
, &tmp_ac_prefs
.compose_body_format
, P_STRING
,
636 &templates_page
.compose_body_format
,
637 prefs_set_escaped_data_from_text
, prefs_set_text_from_escaped
},
639 {"reply_with_format", "FALSE", &tmp_ac_prefs
.reply_with_format
, P_BOOL
,
640 &templates_page
.checkbtn_reply_with_format
,
641 prefs_set_data_from_toggle
, prefs_set_toggle
},
643 {"reply_quotemark", NULL
, &tmp_ac_prefs
.reply_quotemark
, P_STRING
,
644 &templates_page
.reply_quotemark
,
645 prefs_set_data_from_entry
, prefs_set_entry_from_escaped
},
647 {"reply_body_format", NULL
, &tmp_ac_prefs
.reply_body_format
, P_STRING
,
648 &templates_page
.reply_body_format
,
649 prefs_set_escaped_data_from_text
, prefs_set_text_from_escaped
},
651 {"forward_with_format", "FALSE", &tmp_ac_prefs
.forward_with_format
, P_BOOL
,
652 &templates_page
.checkbtn_forward_with_format
,
653 prefs_set_data_from_toggle
, prefs_set_toggle
},
655 {"forward_quotemark", NULL
, &tmp_ac_prefs
.forward_quotemark
, P_STRING
,
656 &templates_page
.forward_quotemark
,
657 prefs_set_data_from_entry
, prefs_set_entry_from_escaped
},
659 {"forward_body_format", NULL
, &tmp_ac_prefs
.forward_body_format
, P_STRING
,
660 &templates_page
.forward_body_format
,
661 prefs_set_escaped_data_from_text
, prefs_set_text_from_escaped
},
663 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
666 static PrefParam privacy_param
[] = {
667 {"default_privacy_system", "", &tmp_ac_prefs
.default_privacy_system
, P_STRING
,
668 &privacy_page
.default_privacy_system
,
669 prefs_account_set_string_from_combobox
,
670 prefs_account_set_privacy_combobox_from_string
},
672 {"default_encrypt", "FALSE", &tmp_ac_prefs
.default_encrypt
, P_BOOL
,
673 &privacy_page
.default_encrypt_checkbtn
,
674 prefs_set_data_from_toggle
, prefs_set_toggle
},
676 {"default_encrypt_reply", "TRUE", &tmp_ac_prefs
.default_encrypt_reply
, P_BOOL
,
677 &privacy_page
.default_encrypt_reply_checkbtn
,
678 prefs_set_data_from_toggle
, prefs_set_toggle
},
680 {"default_sign", "FALSE", &tmp_ac_prefs
.default_sign
, P_BOOL
,
681 &privacy_page
.default_sign_checkbtn
,
682 prefs_set_data_from_toggle
, prefs_set_toggle
},
684 {"default_sign_reply", "TRUE", &tmp_ac_prefs
.default_sign_reply
, P_BOOL
,
685 &privacy_page
.default_sign_reply_checkbtn
,
686 prefs_set_data_from_toggle
, prefs_set_toggle
},
688 /* Bug 2367: disturbing for Win32 users with no keypair */
689 {"default_sign_reply", "FALSE", &tmp_ac_prefs
.default_sign_reply
, P_BOOL
,
690 &privacy_page
.default_sign_reply_checkbtn
,
691 prefs_set_data_from_toggle
, prefs_set_toggle
},
693 {"save_clear_text", "FALSE", &tmp_ac_prefs
.save_encrypted_as_clear_text
, P_BOOL
,
694 &privacy_page
.save_clear_text_checkbtn
,
695 prefs_set_data_from_toggle
, prefs_set_toggle
},
697 {"encrypt_to_self", "FALSE", &tmp_ac_prefs
.encrypt_to_self
, P_BOOL
,
698 &privacy_page
.encrypt_to_self_checkbtn
,
699 prefs_set_data_from_toggle
, prefs_set_toggle
},
701 {"privacy_prefs", "", &privacy_prefs
, P_STRING
,
704 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
707 static PrefParam ssl_param
[] = {
709 {"ssl_pop", "0", &tmp_ac_prefs
.ssl_pop
, P_ENUM
,
710 &ssl_page
.pop_nossl_radiobtn
,
711 prefs_account_enum_set_data_from_radiobtn
,
712 prefs_account_enum_set_radiobtn
},
714 {"ssl_imap", "0", &tmp_ac_prefs
.ssl_imap
, P_ENUM
,
715 &ssl_page
.imap_nossl_radiobtn
,
716 prefs_account_enum_set_data_from_radiobtn
,
717 prefs_account_enum_set_radiobtn
},
719 {"ssl_nntp", "0", &tmp_ac_prefs
.ssl_nntp
, P_ENUM
,
720 &ssl_page
.nntp_nossl_radiobtn
,
721 prefs_account_enum_set_data_from_radiobtn
,
722 prefs_account_enum_set_radiobtn
},
724 {"ssl_smtp", "0", &tmp_ac_prefs
.ssl_smtp
, P_ENUM
,
725 &ssl_page
.smtp_nossl_radiobtn
,
726 prefs_account_enum_set_data_from_radiobtn
,
727 prefs_account_enum_set_radiobtn
},
729 {"ssl_certs_auto_accept", "0", &tmp_ac_prefs
.ssl_certs_auto_accept
, P_BOOL
,
730 &ssl_page
.ssl_certs_auto_accept_checkbtn
,
731 prefs_set_data_from_toggle
, prefs_set_toggle
},
733 {"use_nonblocking_ssl", "1", &tmp_ac_prefs
.use_nonblocking_ssl
, P_BOOL
,
734 &ssl_page
.use_nonblocking_ssl_checkbtn
,
735 prefs_set_data_from_toggle
, prefs_set_toggle
},
737 {"in_ssl_client_cert_file", "", &tmp_ac_prefs
.in_ssl_client_cert_file
, P_STRING
,
738 &ssl_page
.entry_in_cert_file
, prefs_set_data_from_entry
, prefs_set_entry
},
740 {"in_ssl_client_cert_pass", "", &tmp_ac_prefs
.in_ssl_client_cert_pass
, P_PASSWORD
,
743 {"out_ssl_client_cert_file", "", &tmp_ac_prefs
.out_ssl_client_cert_file
, P_STRING
,
744 &ssl_page
.entry_out_cert_file
, prefs_set_data_from_entry
, prefs_set_entry
},
746 {"out_ssl_client_cert_pass", "", &tmp_ac_prefs
.out_ssl_client_cert_pass
, P_PASSWORD
,
749 {"ssl_pop", "0", &tmp_ac_prefs
.ssl_pop
, P_ENUM
,
752 {"ssl_imap", "0", &tmp_ac_prefs
.ssl_imap
, P_ENUM
,
755 {"ssl_nntp", "0", &tmp_ac_prefs
.ssl_nntp
, P_ENUM
,
758 {"ssl_smtp", "0", &tmp_ac_prefs
.ssl_smtp
, P_ENUM
,
761 {"in_ssl_client_cert_file", "", &tmp_ac_prefs
.in_ssl_client_cert_file
, P_STRING
,
764 {"in_ssl_client_cert_pass", "", &tmp_ac_prefs
.in_ssl_client_cert_pass
, P_PASSWORD
,
767 {"out_ssl_client_cert_file", "", &tmp_ac_prefs
.out_ssl_client_cert_file
, P_STRING
,
770 {"out_ssl_client_cert_pass", "", &tmp_ac_prefs
.out_ssl_client_cert_pass
, P_PASSWORD
,
773 {"ssl_certs_auto_accept", "0", &tmp_ac_prefs
.ssl_certs_auto_accept
, P_BOOL
,
776 {"use_nonblocking_ssl", "1", &tmp_ac_prefs
.use_nonblocking_ssl
, P_BOOL
,
778 #endif /* USE_GNUTLS */
780 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
783 static PrefParam advanced_param
[] = {
784 {"set_smtpport", "FALSE", &tmp_ac_prefs
.set_smtpport
, P_BOOL
,
785 &advanced_page
.smtpport_checkbtn
,
786 prefs_set_data_from_toggle
, prefs_set_toggle
},
788 {"smtp_port", "25", &tmp_ac_prefs
.smtpport
, P_USHORT
,
789 &advanced_page
.smtpport_spinbtn
,
790 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
792 {"set_popport", "FALSE", &tmp_ac_prefs
.set_popport
, P_BOOL
,
793 &advanced_page
.popport_checkbtn
,
794 prefs_set_data_from_toggle
, prefs_set_toggle
},
796 {"pop_port", "110", &tmp_ac_prefs
.popport
, P_USHORT
,
797 &advanced_page
.popport_spinbtn
,
798 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
800 {"set_imapport", "FALSE", &tmp_ac_prefs
.set_imapport
, P_BOOL
,
801 &advanced_page
.imapport_checkbtn
,
802 prefs_set_data_from_toggle
, prefs_set_toggle
},
804 {"imap_port", "143", &tmp_ac_prefs
.imapport
, P_USHORT
,
805 &advanced_page
.imapport_spinbtn
,
806 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
808 {"set_nntpport", "FALSE", &tmp_ac_prefs
.set_nntpport
, P_BOOL
,
809 &advanced_page
.nntpport_checkbtn
,
810 prefs_set_data_from_toggle
, prefs_set_toggle
},
812 {"nntp_port", "119", &tmp_ac_prefs
.nntpport
, P_USHORT
,
813 &advanced_page
.nntpport_spinbtn
,
814 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
816 {"set_domain", "FALSE", &tmp_ac_prefs
.set_domain
, P_BOOL
,
817 &advanced_page
.domain_checkbtn
,
818 prefs_set_data_from_toggle
, prefs_set_toggle
},
820 {"domain", NULL
, &tmp_ac_prefs
.domain
, P_STRING
,
821 &advanced_page
.domain_entry
,
822 prefs_set_data_from_entry
, prefs_set_entry
},
825 {"gnutls_set_priority", "FALSE", &tmp_ac_prefs
.set_gnutls_priority
, P_BOOL
,
828 {"gnutls_priority", NULL
, &tmp_ac_prefs
.gnutls_priority
, P_STRING
,
833 {"set_tunnelcmd", "FALSE", &tmp_ac_prefs
.set_tunnelcmd
, P_BOOL
,
834 &advanced_page
.tunnelcmd_checkbtn
,
835 prefs_set_data_from_toggle
, prefs_set_toggle
},
837 {"tunnelcmd", NULL
, &tmp_ac_prefs
.tunnelcmd
, P_STRING
,
838 &advanced_page
.tunnelcmd_entry
,
839 prefs_set_data_from_entry
, prefs_set_entry
},
841 #if !GTK_CHECK_VERSION(3, 0, 0)
842 {"mark_crosspost_read", "FALSE", &tmp_ac_prefs
.mark_crosspost_read
, P_BOOL
,
843 &advanced_page
.crosspost_checkbtn
,
844 prefs_set_data_from_toggle
, prefs_set_toggle
},
846 {"crosspost_color", NULL
, &tmp_ac_prefs
.crosspost_col
, P_ENUM
,
847 &advanced_page
.crosspost_colormenu
,
848 prefs_account_crosspost_set_data_from_colormenu
,
849 prefs_account_crosspost_set_colormenu
},
852 {"set_sent_folder", "FALSE", &tmp_ac_prefs
.set_sent_folder
, P_BOOL
,
853 &advanced_page
.sent_folder_checkbtn
,
854 prefs_set_data_from_toggle
, prefs_set_toggle
},
855 {"sent_folder", NULL
, &tmp_ac_prefs
.sent_folder
, P_STRING
,
856 &advanced_page
.sent_folder_entry
,
857 prefs_set_data_from_entry
, prefs_set_entry
},
859 {"set_queue_folder", "FALSE", &tmp_ac_prefs
.set_queue_folder
, P_BOOL
,
860 &advanced_page
.queue_folder_checkbtn
,
861 prefs_set_data_from_toggle
, prefs_set_toggle
},
862 {"queue_folder", NULL
, &tmp_ac_prefs
.queue_folder
, P_STRING
,
863 &advanced_page
.queue_folder_entry
,
864 prefs_set_data_from_entry
, prefs_set_entry
},
866 {"set_draft_folder", "FALSE", &tmp_ac_prefs
.set_draft_folder
, P_BOOL
,
867 &advanced_page
.draft_folder_checkbtn
,
868 prefs_set_data_from_toggle
, prefs_set_toggle
},
869 {"draft_folder", NULL
, &tmp_ac_prefs
.draft_folder
, P_STRING
,
870 &advanced_page
.draft_folder_entry
,
871 prefs_set_data_from_entry
, prefs_set_entry
},
873 {"set_trash_folder", "FALSE", &tmp_ac_prefs
.set_trash_folder
, P_BOOL
,
874 &advanced_page
.trash_folder_checkbtn
,
875 prefs_set_data_from_toggle
, prefs_set_toggle
},
876 {"trash_folder", NULL
, &tmp_ac_prefs
.trash_folder
, P_STRING
,
877 &advanced_page
.trash_folder_entry
,
878 prefs_set_data_from_entry
, prefs_set_entry
},
881 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
884 static gint
prefs_account_get_new_id (void);
886 static void prefs_account_select_folder_cb (GtkWidget
*widget
,
889 static void prefs_account_sigfile_radiobtn_cb (GtkWidget
*widget
,
892 static void prefs_account_sigcmd_radiobtn_cb (GtkWidget
*widget
,
895 static void prefs_account_signature_browse_cb (GtkWidget
*widget
,
898 static void prefs_account_in_cert_browse_cb (GtkWidget
*widget
,
901 static void prefs_account_out_cert_browse_cb (GtkWidget
*widget
,
904 static void prefs_account_signature_edit_cb (GtkWidget
*widget
,
907 static void pop_bfr_smtp_tm_set_sens (GtkWidget
*widget
,
910 #if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
911 static void auto_configure_cb (GtkWidget
*widget
,
915 static void prefs_account_edit_custom_header (void);
918 #define COMBOBOX_PRIVACY_PLUGIN_ID 3
920 /* Enable/disable necessary preference widgets based on current privacy
922 static void privacy_system_activated(GtkWidget
*combobox
)
924 gtk_widget_set_sensitive (privacy_page
.save_clear_text_checkbtn
,
925 !gtk_toggle_button_get_active(
926 GTK_TOGGLE_BUTTON(privacy_page
.encrypt_to_self_checkbtn
)));
929 /* Populate the privacy system choice combobox with valid choices */
930 static void update_privacy_system_menu() {
933 GSList
*system_ids
, *cur
;
935 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
936 GTK_COMBO_BOX(privacy_page
.default_privacy_system
)));
938 /* First add "None", as that one is always available. :) */
939 gtk_list_store_append(menu
, &iter
);
940 gtk_list_store_set(menu
, &iter
,
941 COMBOBOX_TEXT
, _("None"),
944 COMBOBOX_PRIVACY_PLUGIN_ID
, "",
947 /* Now go through list of available privacy systems and add an entry
949 system_ids
= privacy_get_system_ids();
950 for (cur
= system_ids
; cur
!= NULL
; cur
= g_slist_next(cur
)) {
951 gchar
*id
= (gchar
*) cur
->data
;
954 name
= privacy_system_get_name(id
);
955 gtk_list_store_append(menu
, &iter
);
956 gtk_list_store_set(menu
, &iter
,
960 COMBOBOX_PRIVACY_PLUGIN_ID
, id
,
967 static void basic_create_widget_func(PrefsPage
* _page
,
971 BasicPage
*page
= (BasicPage
*) _page
;
972 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
977 GtkWidget
*acname_entry
;
978 GtkWidget
*default_checkbtn
;
981 GtkWidget
*name_entry
;
982 GtkWidget
*addr_entry
;
983 GtkWidget
*org_entry
;
985 GtkWidget
*serv_frame
;
987 GtkWidget
*optmenubox
;
990 GtkWidget
*no_imap_warn_icon
;
991 GtkWidget
*no_imap_warn_label
;
992 GtkWidget
*serv_table
;
993 GtkWidget
*recvserv_label
;
994 GtkWidget
*smtpserv_label
;
995 GtkWidget
*nntpserv_label
;
996 GtkWidget
*localmbox_label
;
997 GtkWidget
*mailcmd_label
;
998 GtkWidget
*recvserv_entry
;
999 GtkWidget
*smtpserv_entry
;
1000 GtkWidget
*nntpserv_entry
;
1001 GtkWidget
*nntpauth_checkbtn
;
1002 GtkWidget
*nntpauth_onconnect_checkbtn
;
1003 GtkWidget
*localmbox_entry
;
1004 GtkWidget
*mailcmd_checkbtn
;
1005 GtkWidget
*mailcmd_entry
;
1006 GtkWidget
*uid_label
;
1007 GtkWidget
*pass_label
;
1008 GtkWidget
*uid_entry
;
1009 GtkWidget
*pass_entry
;
1010 GtkWidget
*auto_configure_btn
;
1011 GtkWidget
*auto_configure_cancel_btn
;
1012 GtkWidget
*auto_configure_lbl
;
1017 struct BasicProtocol
*protocol_optmenu
;
1020 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
1021 gtk_widget_show (vbox1
);
1022 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
1024 hbox
= gtk_hbox_new (FALSE
, 8);
1025 gtk_widget_show (hbox
);
1026 gtk_box_pack_start (GTK_BOX (vbox1
), hbox
, FALSE
, FALSE
, 0);
1028 label
= gtk_label_new (_("Name of account"));
1029 gtk_widget_show (label
);
1030 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
1032 acname_entry
= gtk_entry_new ();
1033 gtk_widget_show (acname_entry
);
1034 gtk_widget_set_size_request (acname_entry
, DEFAULT_ENTRY_WIDTH
, -1);
1035 gtk_box_pack_start (GTK_BOX (hbox
), acname_entry
, TRUE
, TRUE
, 0);
1037 default_checkbtn
= gtk_check_button_new_with_label (_("Set as default"));
1038 gtk_widget_show (default_checkbtn
);
1039 #ifndef GENERIC_UMPC
1040 gtk_box_pack_end (GTK_BOX (hbox
), default_checkbtn
, TRUE
, FALSE
, 0);
1042 gtk_box_pack_start (GTK_BOX (vbox1
), default_checkbtn
, FALSE
, FALSE
, 0);
1045 PACK_FRAME (vbox1
, frame1
, _("Personal information"));
1047 table1
= gtk_table_new (3, 2, FALSE
);
1048 gtk_widget_show (table1
);
1049 gtk_container_add (GTK_CONTAINER (frame1
), table1
);
1050 gtk_container_set_border_width (GTK_CONTAINER (table1
), 8);
1051 gtk_table_set_row_spacings (GTK_TABLE (table1
), VSPACING_NARROW
);
1052 gtk_table_set_col_spacings (GTK_TABLE (table1
), 8);
1054 label
= gtk_label_new (_("Full name"));
1055 gtk_widget_show (label
);
1056 gtk_table_attach (GTK_TABLE (table1
), label
, 0, 1, 0, 1,
1058 gtk_misc_set_alignment (GTK_MISC (label
), 1, 0.5);
1060 label
= gtk_label_new (_("Mail address"));
1061 gtk_widget_show (label
);
1062 gtk_table_attach (GTK_TABLE (table1
), label
, 0, 1, 1, 2,
1064 gtk_misc_set_alignment (GTK_MISC (label
), 1, 0.5);
1066 label
= gtk_label_new (_("Organization"));
1067 gtk_widget_show (label
);
1068 gtk_table_attach (GTK_TABLE (table1
), label
, 0, 1, 2, 3,
1070 gtk_misc_set_alignment (GTK_MISC (label
), 1, 0.5);
1072 name_entry
= gtk_entry_new ();
1073 gtk_widget_show (name_entry
);
1074 gtk_table_attach (GTK_TABLE (table1
), name_entry
, 1, 2, 0, 1,
1075 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1076 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1078 addr_entry
= gtk_entry_new ();
1079 gtk_widget_show (addr_entry
);
1080 gtk_table_attach (GTK_TABLE (table1
), addr_entry
, 1, 2, 1, 2,
1081 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1082 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1084 org_entry
= gtk_entry_new ();
1085 gtk_widget_show (org_entry
);
1086 gtk_table_attach (GTK_TABLE (table1
), org_entry
, 1, 2, 2, 3,
1087 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1088 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1090 vbox2
= gtkut_get_options_frame(vbox1
, &serv_frame
, _("Server information"));
1092 hbox
= gtk_hbox_new (FALSE
, 8);
1093 gtk_widget_show (hbox
);
1094 gtk_box_pack_start (GTK_BOX (vbox2
), hbox
, FALSE
, FALSE
, 0);
1096 label
= gtk_label_new (_("Protocol"));
1097 gtk_widget_show (label
);
1098 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
1100 /* Create GtkHBox for protocol combobox and label */
1101 optmenubox
= gtk_hbox_new(FALSE
, 20);
1102 gtk_widget_show(optmenubox
);
1103 gtk_box_pack_start (GTK_BOX (hbox
), optmenubox
, FALSE
, FALSE
, 0);
1105 /* Create and populate the combobox */
1106 optmenu
= gtkut_sc_combobox_create(NULL
, FALSE
);
1107 gtk_box_pack_start(GTK_BOX (optmenubox
), optmenu
, FALSE
, FALSE
, 0);
1109 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu
)));
1110 for( i
= 0; i
< NUM_RECV_PROTOCOLS
; i
++ )
1111 if( protocol_names
[i
] != NULL
)
1112 COMBOBOX_ADD (menu
, _(protocol_names
[i
]), i
);
1114 g_signal_connect(G_OBJECT(optmenu
), "changed",
1115 G_CALLBACK(prefs_account_protocol_changed
), NULL
);
1117 /* Create protocol label, empty for now */
1118 optlabel
= gtk_label_new("");
1119 gtk_label_set_use_markup(GTK_LABEL(optlabel
), TRUE
);
1120 gtk_label_set_justify(GTK_LABEL(optlabel
), GTK_JUSTIFY_CENTER
);
1121 gtk_box_pack_start(GTK_BOX (optmenubox
), optlabel
, FALSE
, FALSE
, 0);
1123 auto_configure_btn
= gtk_button_new_with_label(_("Auto-configure"));
1124 gtk_box_pack_start(GTK_BOX (optmenubox
), auto_configure_btn
, FALSE
, FALSE
, 0);
1125 auto_configure_cancel_btn
= gtk_button_new_with_label(_("Cancel"));
1126 gtk_box_pack_start(GTK_BOX (optmenubox
), auto_configure_cancel_btn
, FALSE
, FALSE
, 0);
1127 auto_configure_lbl
= gtk_label_new("");
1128 gtk_label_set_justify(GTK_LABEL(auto_configure_lbl
), GTK_JUSTIFY_LEFT
);
1129 gtk_box_pack_start(GTK_BOX (optmenubox
), auto_configure_lbl
, FALSE
, FALSE
, 0);
1130 #if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
1131 gtk_widget_show(auto_configure_btn
);
1132 gtk_widget_show(auto_configure_lbl
);
1133 g_signal_connect (G_OBJECT (auto_configure_btn
), "clicked",
1134 G_CALLBACK (auto_configure_cb
), NULL
);
1135 g_signal_connect (G_OBJECT (auto_configure_cancel_btn
), "clicked",
1136 G_CALLBACK (auto_configure_cb
), NULL
);
1139 no_imap_warn_icon
= gtk_image_new_from_stock
1140 (GTK_STOCK_DIALOG_WARNING
, GTK_ICON_SIZE_SMALL_TOOLBAR
);
1141 no_imap_warn_label
= gtk_label_new(g_strconcat("<span weight=\"bold\">",
1142 _("Warning: this version of Claws Mail\n"
1143 "has been built without IMAP and News support."), "</span>", NULL
));
1144 gtk_label_set_use_markup(GTK_LABEL(no_imap_warn_label
), TRUE
);
1146 gtk_box_pack_start(GTK_BOX (optmenubox
), no_imap_warn_icon
, FALSE
, FALSE
, 0);
1147 gtk_box_pack_start(GTK_BOX (optmenubox
), no_imap_warn_label
, FALSE
, FALSE
, 0);
1148 /* Set up a struct to store pointers to necessary widgets */
1149 protocol_optmenu
= g_new(struct BasicProtocol
, 1);
1150 protocol_optmenu
->combobox
= optmenu
;
1151 protocol_optmenu
->label
= optlabel
;
1152 protocol_optmenu
->descrlabel
= label
;
1153 protocol_optmenu
->no_imap_warn_icon
= no_imap_warn_icon
;
1154 protocol_optmenu
->no_imap_warn_label
= no_imap_warn_label
;
1156 serv_table
= gtk_table_new (6, 4, FALSE
);
1157 gtk_widget_show (serv_table
);
1158 gtk_box_pack_start (GTK_BOX (vbox2
), serv_table
, FALSE
, FALSE
, 0);
1159 gtk_table_set_row_spacings (GTK_TABLE (serv_table
), VSPACING_NARROW
);
1160 gtk_table_set_row_spacing (GTK_TABLE (serv_table
), 3, 0);
1161 gtk_table_set_col_spacings (GTK_TABLE (serv_table
), 8);
1163 nntpserv_entry
= gtk_entry_new ();
1164 gtk_widget_show (nntpserv_entry
);
1165 gtk_table_attach (GTK_TABLE (serv_table
), nntpserv_entry
, 1, 4, 0, 1,
1166 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1167 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1168 /* gtk_table_set_row_spacing (GTK_TABLE (serv_table), 0, 0); */
1170 nntpauth_checkbtn
= gtk_check_button_new_with_label
1171 (_("This server requires authentication"));
1172 gtk_widget_show (nntpauth_checkbtn
);
1174 gtk_table_attach (GTK_TABLE (serv_table
), nntpauth_checkbtn
, 0, 2, 6, 7,
1177 nntpauth_onconnect_checkbtn
= gtk_check_button_new_with_label
1178 (_("Authenticate on connect"));
1179 gtk_widget_show (nntpauth_onconnect_checkbtn
);
1181 gtk_table_attach (GTK_TABLE (serv_table
), nntpauth_onconnect_checkbtn
, 2, 4, 6, 7,
1184 recvserv_entry
= gtk_entry_new ();
1185 gtk_widget_show (recvserv_entry
);
1186 gtk_table_attach (GTK_TABLE (serv_table
), recvserv_entry
, 1, 4, 2, 3,
1187 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1188 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1190 localmbox_entry
= gtk_entry_new ();
1191 gtk_widget_show (localmbox_entry
);
1192 gtk_table_attach (GTK_TABLE (serv_table
), localmbox_entry
, 1, 4, 3, 4,
1193 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1194 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1196 smtpserv_entry
= gtk_entry_new ();
1197 gtk_widget_show (smtpserv_entry
);
1198 gtk_table_attach (GTK_TABLE (serv_table
), smtpserv_entry
, 1, 4, 4, 5,
1199 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1200 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1202 mailcmd_entry
= gtk_entry_new ();
1203 gtk_widget_show (mailcmd_entry
);
1204 gtk_table_attach (GTK_TABLE (serv_table
), mailcmd_entry
, 1, 4, 6, 7,
1205 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1206 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1208 uid_entry
= gtk_entry_new ();
1209 gtk_widget_show (uid_entry
);
1210 gtk_widget_set_size_request (uid_entry
, DEFAULT_ENTRY_WIDTH
, -1);
1211 pass_entry
= gtk_entry_new ();
1212 gtk_widget_show (pass_entry
);
1213 gtk_widget_set_size_request (pass_entry
, DEFAULT_ENTRY_WIDTH
, -1);
1214 #ifndef GENERIC_UMPC
1215 gtk_table_attach (GTK_TABLE (serv_table
), uid_entry
, 1, 2, 7, 8,
1216 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1217 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1219 gtk_table_attach (GTK_TABLE (serv_table
), pass_entry
, 3, 4, 7, 8,
1220 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1221 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1223 gtk_table_attach (GTK_TABLE (serv_table
), uid_entry
, 1, 4, 7, 8,
1224 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1225 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1226 gtk_table_attach (GTK_TABLE (serv_table
), pass_entry
, 1, 4, 8, 9,
1227 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1228 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1230 gtk_entry_set_visibility (GTK_ENTRY (pass_entry
), FALSE
);
1232 nntpserv_label
= gtk_label_new (_("News server"));
1233 gtk_widget_show (nntpserv_label
);
1234 gtk_table_attach (GTK_TABLE (serv_table
), nntpserv_label
, 0, 1, 0, 1,
1236 gtk_misc_set_alignment (GTK_MISC (nntpserv_label
), 1, 0.5);
1238 recvserv_label
= gtk_label_new (_("Server for receiving"));
1239 gtk_widget_show (recvserv_label
);
1240 gtk_table_attach (GTK_TABLE (serv_table
), recvserv_label
, 0, 1, 2, 3,
1242 gtk_misc_set_alignment (GTK_MISC (recvserv_label
), 1, 0.5);
1244 localmbox_label
= gtk_label_new (_("Local mailbox"));
1245 gtk_widget_show (localmbox_label
);
1246 gtk_table_attach (GTK_TABLE (serv_table
), localmbox_label
, 0, 1, 3, 4,
1248 gtk_misc_set_alignment (GTK_MISC (localmbox_label
), 1, 0.5);
1249 /* gtk_table_set_row_spacing (GTK_TABLE (serv_table), 2, 0); */
1251 smtpserv_label
= gtk_label_new (_("SMTP server (send)"));
1252 gtk_widget_show (smtpserv_label
);
1253 gtk_table_attach (GTK_TABLE (serv_table
), smtpserv_label
, 0, 1, 4, 5,
1255 gtk_misc_set_alignment (GTK_MISC (smtpserv_label
), 1, 0.5);
1256 /* gtk_table_set_row_spacing (GTK_TABLE (serv_table), 2, 0); */
1258 mailcmd_checkbtn
= gtk_check_button_new_with_label
1259 (_("Use mail command rather than SMTP server"));
1260 gtk_widget_show (mailcmd_checkbtn
);
1261 gtk_table_attach (GTK_TABLE (serv_table
), mailcmd_checkbtn
, 0, 4, 5, 6,
1262 GTK_EXPAND
| GTK_FILL
,
1264 g_signal_connect(G_OBJECT(mailcmd_checkbtn
), "toggled",
1265 G_CALLBACK(prefs_account_mailcmd_toggled
),
1268 mailcmd_label
= gtk_label_new (_("command to send mails"));
1269 gtk_widget_show (mailcmd_label
);
1270 gtk_table_attach (GTK_TABLE (serv_table
), mailcmd_label
, 0, 1, 6, 7,
1272 gtk_misc_set_alignment (GTK_MISC (mailcmd_label
), 1, 0.5);
1273 /* gtk_table_set_row_spacing (GTK_TABLE (serv_table), 2, 0); */
1275 uid_label
= gtk_label_new (_("User ID"));
1276 gtk_widget_show (uid_label
);
1277 gtk_table_attach (GTK_TABLE (serv_table
), uid_label
, 0, 1, 7, 8,
1279 gtk_misc_set_alignment (GTK_MISC (uid_label
), 1, 0.5);
1281 pass_label
= gtk_label_new (_("Password"));
1282 gtk_widget_show (pass_label
);
1283 #ifndef GENERIC_UMPC
1284 gtk_table_attach (GTK_TABLE (serv_table
), pass_label
, 2, 3, 7, 8,
1287 gtk_misc_set_alignment (GTK_MISC (pass_label
), 1, 0.5);
1288 gtk_table_attach (GTK_TABLE (serv_table
), pass_label
, 0, 1, 8, 9,
1291 SET_TOGGLE_SENSITIVITY (nntpauth_checkbtn
, uid_label
);
1292 SET_TOGGLE_SENSITIVITY (nntpauth_checkbtn
, pass_label
);
1293 SET_TOGGLE_SENSITIVITY (nntpauth_checkbtn
, uid_entry
);
1294 SET_TOGGLE_SENSITIVITY (nntpauth_checkbtn
, pass_entry
);
1295 SET_TOGGLE_SENSITIVITY (nntpauth_checkbtn
, nntpauth_onconnect_checkbtn
);
1297 page
->acname_entry
= acname_entry
;
1298 page
->default_checkbtn
= default_checkbtn
;
1300 page
->name_entry
= name_entry
;
1301 page
->addr_entry
= addr_entry
;
1302 page
->org_entry
= org_entry
;
1304 page
->serv_frame
= serv_frame
;
1305 page
->serv_table
= serv_table
;
1306 page
->protocol_optmenu
= (gpointer
)protocol_optmenu
;
1307 page
->recvserv_label
= recvserv_label
;
1308 page
->recvserv_entry
= recvserv_entry
;
1309 page
->smtpserv_label
= smtpserv_label
;
1310 page
->smtpserv_entry
= smtpserv_entry
;
1311 page
->nntpserv_label
= nntpserv_label
;
1312 page
->nntpserv_entry
= nntpserv_entry
;
1313 page
->nntpauth_checkbtn
= nntpauth_checkbtn
;
1314 page
->nntpauth_onconnect_checkbtn
= nntpauth_onconnect_checkbtn
;
1315 page
->localmbox_label
= localmbox_label
;
1316 page
->localmbox_entry
= localmbox_entry
;
1317 page
->mailcmd_checkbtn
= mailcmd_checkbtn
;
1318 page
->mailcmd_label
= mailcmd_label
;
1319 page
->mailcmd_entry
= mailcmd_entry
;
1320 page
->uid_label
= uid_label
;
1321 page
->pass_label
= pass_label
;
1322 page
->uid_entry
= uid_entry
;
1323 page
->pass_entry
= pass_entry
;
1324 page
->auto_configure_btn
= auto_configure_btn
;
1325 page
->auto_configure_cancel_btn
= auto_configure_cancel_btn
;
1326 page
->auto_configure_lbl
= auto_configure_lbl
;
1329 PrefsAccount
*def_ac
;
1331 prefs_set_dialog_to_default(basic_param
);
1332 buf
= g_strdup_printf(_("Account%d"), ac_prefs
->account_id
);
1333 gtk_entry_set_text(GTK_ENTRY(basic_page
.acname_entry
), buf
);
1335 def_ac
= account_get_default();
1337 FolderItem
*item
= folder_get_default_inbox_for_class(F_MH
);
1338 gtk_entry_set_text(GTK_ENTRY(basic_page
.name_entry
),
1339 def_ac
->name
? def_ac
->name
: "");
1340 gtk_entry_set_text(GTK_ENTRY(basic_page
.addr_entry
),
1341 def_ac
->address
? def_ac
->address
: "");
1342 gtk_entry_set_text(GTK_ENTRY(basic_page
.org_entry
),
1343 def_ac
->organization
? def_ac
->organization
: "");
1345 item
= folder_get_default_inbox();
1348 gchar
*id
= folder_item_get_identifier(item
);
1349 gtk_entry_set_text(GTK_ENTRY(receive_page
.inbox_entry
),
1351 gtk_entry_set_text(GTK_ENTRY(receive_page
.local_inbox_entry
),
1357 prefs_set_dialog(basic_param
);
1359 /* Passwords are handled outside of PrefParams. */
1360 buf
= passwd_store_get_account(ac_prefs
->account_id
,
1362 gtk_entry_set_text(GTK_ENTRY(page
->pass_entry
), buf
!= NULL
? buf
: "");
1364 memset(buf
, 0, strlen(buf
));
1371 page
->page
.widget
= vbox1
;
1374 static void receive_create_widget_func(PrefsPage
* _page
,
1378 ReceivePage
*page
= (ReceivePage
*) _page
;
1379 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
1384 GtkWidget
*use_apop_checkbtn
;
1385 GtkWidget
*rmmail_checkbtn
;
1386 GtkWidget
*hbox_spc
;
1387 GtkWidget
*leave_time_label
;
1388 GtkWidget
*leave_time_spinbtn
;
1389 GtkWidget
*leave_hour_label
;
1390 GtkWidget
*leave_hour_spinbtn
;
1392 GtkWidget
*size_limit_checkbtn
;
1393 GtkWidget
*size_limit_spinbtn
;
1395 GtkWidget
*filter_on_recv_checkbtn
;
1396 GtkWidget
*filterhook_on_recv_checkbtn
;
1398 GtkWidget
*inbox_label
;
1399 GtkWidget
*inbox_entry
;
1400 GtkWidget
*inbox_btn
;
1401 GtkWidget
*imap_frame
;
1402 GtkWidget
*imapdir_label
;
1403 GtkWidget
*imapdir_entry
;
1404 GtkWidget
*subsonly_checkbtn
;
1405 GtkWidget
*low_bandwidth_checkbtn
;
1406 GtkWidget
*local_frame
;
1407 GtkWidget
*local_vbox
;
1408 GtkWidget
*local_hbox
;
1409 GtkWidget
*local_inbox_label
;
1410 GtkWidget
*local_inbox_entry
;
1411 GtkWidget
*local_inbox_btn
;
1416 GtkWidget
*recvatgetall_checkbtn
;
1420 GtkWidget
*maxarticle_label
;
1421 GtkWidget
*maxarticle_spinbtn
;
1422 GtkAdjustment
*maxarticle_spinbtn_adj
;
1424 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
1425 gtk_widget_show (vbox1
);
1426 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
1428 local_vbox
= gtkut_get_options_frame(vbox1
, &local_frame
, _("Local"));
1430 local_hbox
= gtk_hbox_new (FALSE
, 8);
1431 gtk_widget_show (local_hbox
);
1432 gtk_box_pack_start (GTK_BOX (local_vbox
), local_hbox
, FALSE
, FALSE
, 0);
1434 local_inbox_label
= gtk_label_new (_("Default Inbox"));
1435 gtk_widget_show (local_inbox_label
);
1436 gtk_box_pack_start (GTK_BOX (local_hbox
), local_inbox_label
, FALSE
, FALSE
, 0);
1438 local_inbox_entry
= gtk_entry_new ();
1439 gtk_widget_show (local_inbox_entry
);
1440 CLAWS_SET_TIP(local_inbox_entry
,
1441 _("Unfiltered messages will be stored in this folder"));
1442 gtk_widget_set_size_request (local_inbox_entry
, DEFAULT_ENTRY_WIDTH
, -1);
1443 gtk_box_pack_start (GTK_BOX (local_hbox
), local_inbox_entry
, TRUE
, TRUE
, 0);
1445 local_inbox_btn
= gtkut_get_browse_file_btn(_("Bro_wse"));
1446 gtk_widget_show (local_inbox_btn
);
1447 CLAWS_SET_TIP(local_inbox_btn
,
1448 _("Unfiltered messages will be stored in this folder"));
1449 gtk_box_pack_start (GTK_BOX (local_hbox
), local_inbox_btn
, FALSE
, FALSE
, 0);
1450 g_signal_connect (G_OBJECT (local_inbox_btn
), "clicked",
1451 G_CALLBACK (prefs_account_select_folder_cb
),
1454 vbox2
= gtkut_get_options_frame(vbox1
, &frame1
, _("POP"));
1455 PACK_CHECK_BUTTON (vbox2
, use_apop_checkbtn
,
1456 _("Use secure authentication (APOP)"));
1458 PACK_CHECK_BUTTON (vbox2
, rmmail_checkbtn
,
1459 _("Remove messages on server when received"));
1461 hbox1
= gtk_hbox_new (FALSE
, 8);
1462 gtk_widget_show (hbox1
);
1463 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 0);
1465 hbox_spc
= gtk_hbox_new (FALSE
, 0);
1466 gtk_widget_show (hbox_spc
);
1467 gtk_box_pack_start (GTK_BOX (hbox1
), hbox_spc
, FALSE
, FALSE
, 0);
1468 gtk_widget_set_size_request (hbox_spc
, 12, -1);
1470 leave_time_label
= gtk_label_new (_("Remove after"));
1471 gtk_widget_show (leave_time_label
);
1472 gtk_box_pack_start (GTK_BOX (hbox1
), leave_time_label
, FALSE
, FALSE
, 0);
1474 leave_time_spinbtn
= gtk_spin_button_new_with_range(0, 365, 1);
1475 gtk_widget_show (leave_time_spinbtn
);
1476 CLAWS_SET_TIP(leave_time_spinbtn
,
1477 _("0 days and 0 hours : remove immediately"));
1478 gtk_box_pack_start (GTK_BOX (hbox1
), leave_time_spinbtn
, FALSE
, FALSE
, 0);
1480 leave_time_label
= gtk_label_new (_("days"));
1481 gtk_widget_show (leave_time_label
);
1482 gtk_box_pack_start (GTK_BOX (hbox1
), leave_time_label
, FALSE
, FALSE
, 0);
1484 leave_hour_spinbtn
= gtk_spin_button_new_with_range(0, 23, 1);
1485 gtk_widget_show (leave_hour_spinbtn
);
1486 CLAWS_SET_TIP(leave_hour_spinbtn
,
1487 _("0 days and 0 hours : remove immediately"));
1488 gtk_box_pack_start (GTK_BOX (hbox1
), leave_hour_spinbtn
, FALSE
, FALSE
, 0);
1490 leave_hour_label
= gtk_label_new (_("hours"));
1491 gtk_widget_show (leave_hour_label
);
1492 gtk_box_pack_start (GTK_BOX (hbox1
), leave_hour_label
, FALSE
, FALSE
, 0);
1494 SET_TOGGLE_SENSITIVITY (rmmail_checkbtn
, hbox1
);
1496 hbox1
= gtk_hbox_new (FALSE
, 8);
1497 gtk_widget_show (hbox1
);
1498 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 0);
1500 PACK_CHECK_BUTTON (hbox1
, size_limit_checkbtn
, _("Receive size limit"));
1502 CLAWS_SET_TIP(size_limit_checkbtn
,
1503 _("Messages over this limit will be partially retrieved. "
1504 "When selecting them you will be able to download them fully "
1505 "or delete them."));
1507 size_limit_spinbtn
= gtk_spin_button_new_with_range(0, 100000, 1);
1508 gtk_widget_show (size_limit_spinbtn
);
1509 gtk_box_pack_start (GTK_BOX (hbox1
), size_limit_spinbtn
, FALSE
, FALSE
, 0);
1511 label
= gtk_label_new (_("KB"));
1512 gtk_widget_show (label
);
1513 gtk_box_pack_start (GTK_BOX (hbox1
), label
, FALSE
, FALSE
, 0);
1515 SET_TOGGLE_SENSITIVITY (size_limit_checkbtn
, size_limit_spinbtn
);
1517 PACK_VSPACER(vbox2
, vbox3
, VSPACING_NARROW_2
);
1519 hbox1
= gtk_hbox_new (FALSE
, 8);
1520 gtk_widget_show (hbox1
);
1521 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 0);
1523 inbox_label
= gtk_label_new (_("Default Inbox"));
1524 gtk_widget_show (inbox_label
);
1525 gtk_box_pack_start (GTK_BOX (hbox1
), inbox_label
, FALSE
, FALSE
, 0);
1527 inbox_entry
= gtk_entry_new ();
1528 gtk_widget_show (inbox_entry
);
1529 CLAWS_SET_TIP(inbox_entry
,
1530 _("Unfiltered messages will be stored in this folder"));
1531 gtk_widget_set_size_request (inbox_entry
, DEFAULT_ENTRY_WIDTH
, -1);
1532 gtk_box_pack_start (GTK_BOX (hbox1
), inbox_entry
, TRUE
, TRUE
, 0);
1534 inbox_btn
= gtkut_get_browse_file_btn(_("Bro_wse"));
1535 gtk_widget_show (inbox_btn
);
1536 CLAWS_SET_TIP(inbox_btn
,
1537 _("Unfiltered messages will be stored in this folder"));
1538 gtk_box_pack_start (GTK_BOX (hbox1
), inbox_btn
, FALSE
, FALSE
, 0);
1539 g_signal_connect (G_OBJECT (inbox_btn
), "clicked",
1540 G_CALLBACK (prefs_account_select_folder_cb
),
1543 vbox2
= gtkut_get_options_frame(vbox1
, &frame2
, _("NNTP"));
1545 hbox2
= gtk_hbox_new (FALSE
, 8);
1546 gtk_widget_show (hbox2
);
1547 gtk_box_pack_start (GTK_BOX (vbox2
), hbox2
, FALSE
, FALSE
, 0);
1549 maxarticle_label
= gtk_label_new
1550 (_("Maximum number of articles to download"));
1551 gtk_widget_show (maxarticle_label
);
1552 gtk_box_pack_start (GTK_BOX (hbox2
), maxarticle_label
, FALSE
, FALSE
, 0);
1554 maxarticle_spinbtn_adj
=
1555 GTK_ADJUSTMENT(gtk_adjustment_new (300, 0, 10000, 10, 100, 0));
1556 maxarticle_spinbtn
= gtk_spin_button_new
1557 (GTK_ADJUSTMENT (maxarticle_spinbtn_adj
), 10, 0);
1558 gtk_widget_show (maxarticle_spinbtn
);
1559 CLAWS_SET_TIP(maxarticle_spinbtn
,
1560 _("unlimited if 0 is specified"));
1561 gtk_box_pack_start (GTK_BOX (hbox2
), maxarticle_spinbtn
,
1563 gtk_widget_set_size_request (maxarticle_spinbtn
, 64, -1);
1564 gtk_spin_button_set_numeric
1565 (GTK_SPIN_BUTTON (maxarticle_spinbtn
), TRUE
);
1567 vbox2
= gtkut_get_options_frame(vbox1
, &imap_frame
, _("IMAP"));
1569 hbox1
= gtk_hbox_new (FALSE
, 8);
1570 gtk_widget_show (hbox1
);
1571 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 0);
1573 label
= gtk_label_new (_("Authentication method"));
1574 gtk_widget_show (label
);
1575 gtk_box_pack_start (GTK_BOX (hbox1
), label
, FALSE
, FALSE
, 0);
1578 optmenu
= gtkut_sc_combobox_create(NULL
, FALSE
);
1579 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu
)));
1580 gtk_widget_show (optmenu
);
1581 gtk_box_pack_start (GTK_BOX (hbox1
), optmenu
, FALSE
, FALSE
, 0);
1583 COMBOBOX_ADD (menu
, _("Automatic"), 0);
1584 COMBOBOX_ADD (menu
, NULL
, 0);
1585 COMBOBOX_ADD (menu
, _("Plain text"), IMAP_AUTH_PLAINTEXT
);
1586 COMBOBOX_ADD (menu
, "CRAM-MD5", IMAP_AUTH_CRAM_MD5
);
1587 COMBOBOX_ADD (menu
, "ANONYMOUS", IMAP_AUTH_ANON
);
1588 COMBOBOX_ADD (menu
, "GSSAPI", IMAP_AUTH_GSSAPI
);
1589 COMBOBOX_ADD (menu
, "DIGEST-MD5", IMAP_AUTH_DIGEST_MD5
);
1590 COMBOBOX_ADD (menu
, "SCRAM-SHA-1", IMAP_AUTH_SCRAM_SHA1
);
1591 COMBOBOX_ADD (menu
, "PLAIN", IMAP_AUTH_PLAIN
);
1592 COMBOBOX_ADD (menu
, "LOGIN", IMAP_AUTH_LOGIN
);
1594 hbox1
= gtk_hbox_new (FALSE
, 8);
1595 gtk_widget_show (hbox1
);
1596 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 4);
1598 imapdir_label
= gtk_label_new (_("IMAP server directory"));
1599 gtk_widget_show (imapdir_label
);
1600 gtk_box_pack_start (GTK_BOX (hbox1
), imapdir_label
, FALSE
, FALSE
, 0);
1602 imapdir_label
= gtk_label_new(_("(usually empty)"));
1603 gtk_widget_show (imapdir_label
);
1604 gtkut_widget_set_small_font_size (imapdir_label
);
1605 gtk_box_pack_start (GTK_BOX (hbox1
), imapdir_label
, FALSE
, FALSE
, 0);
1607 imapdir_entry
= gtk_entry_new();
1608 gtk_widget_show (imapdir_entry
);
1609 gtk_box_pack_start (GTK_BOX (hbox1
), imapdir_entry
, FALSE
, FALSE
, 0);
1611 hbox1
= gtk_hbox_new (FALSE
, 8);
1612 gtk_widget_show (hbox1
);
1613 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 4);
1615 PACK_CHECK_BUTTON (hbox1
, subsonly_checkbtn
,
1616 _("Show subscribed folders only"));
1618 hbox1
= gtk_hbox_new (FALSE
, 8);
1619 gtk_widget_show (hbox1
);
1620 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 4);
1622 PACK_CHECK_BUTTON (hbox1
, low_bandwidth_checkbtn
,
1623 _("Bandwidth-efficient mode (prevents retrieving remote tags)"));
1624 CLAWS_SET_TIP(low_bandwidth_checkbtn
,
1625 _("This mode uses less bandwidth, but can be slower with some servers."));
1627 hbox1
= gtk_hbox_new (FALSE
, 8);
1628 gtk_widget_show (hbox1
);
1629 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 4);
1631 PACK_CHECK_BUTTON (vbox1
, filter_on_recv_checkbtn
,
1632 _("Filter messages on receiving"));
1634 g_signal_connect(G_OBJECT(filter_on_recv_checkbtn
), "toggled",
1635 G_CALLBACK(prefs_account_filter_on_recv_toggled
),
1638 PACK_CHECK_BUTTON (vbox1
, filterhook_on_recv_checkbtn
,
1639 _("Allow filtering using plugins on receiving"));
1642 (vbox1
, recvatgetall_checkbtn
,
1643 _("'Get Mail' checks for new messages on this account"));
1645 page
->pop3_frame
= frame1
;
1646 page
->use_apop_checkbtn
= use_apop_checkbtn
;
1647 page
->rmmail_checkbtn
= rmmail_checkbtn
;
1648 page
->leave_time_spinbtn
= leave_time_spinbtn
;
1649 page
->leave_hour_spinbtn
= leave_hour_spinbtn
;
1650 page
->size_limit_checkbtn
= size_limit_checkbtn
;
1651 page
->size_limit_spinbtn
= size_limit_spinbtn
;
1652 page
->filter_on_recv_checkbtn
= filter_on_recv_checkbtn
;
1653 page
->filterhook_on_recv_checkbtn
= filterhook_on_recv_checkbtn
;
1654 page
->inbox_label
= inbox_label
;
1655 page
->inbox_entry
= inbox_entry
;
1656 page
->inbox_btn
= inbox_btn
;
1658 page
->imap_frame
= imap_frame
;
1659 page
->imap_auth_type_optmenu
= optmenu
;
1661 page
->imapdir_label
= imapdir_label
;
1662 page
->imapdir_entry
= imapdir_entry
;
1663 page
->subsonly_checkbtn
= subsonly_checkbtn
;
1664 page
->low_bandwidth_checkbtn
= low_bandwidth_checkbtn
;
1665 page
->local_frame
= local_frame
;
1666 page
->local_inbox_label
= local_inbox_label
;
1667 page
->local_inbox_entry
= local_inbox_entry
;
1668 page
->local_inbox_btn
= local_inbox_btn
;
1670 page
->recvatgetall_checkbtn
= recvatgetall_checkbtn
;
1672 page
->frame_maxarticle
= frame2
;
1673 page
->maxarticle_spinbtn
= maxarticle_spinbtn
;
1674 page
->maxarticle_spinbtn_adj
= maxarticle_spinbtn_adj
;
1676 tmp_ac_prefs
= *ac_prefs
;
1679 prefs_set_dialog_to_default(receive_param
);
1681 prefs_set_dialog(receive_param
);
1685 page
->page
.widget
= vbox1
;
1688 static void send_create_widget_func(PrefsPage
* _page
,
1692 SendPage
*page
= (SendPage
*) _page
;
1693 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
1698 GtkWidget
*msgid_checkbtn
;
1699 GtkWidget
*xmailer_checkbtn
;
1701 GtkWidget
*customhdr_checkbtn
;
1702 GtkWidget
*customhdr_edit_btn
;
1703 GtkWidget
*checkbtn_msgid_with_addr
;
1705 GtkWidget
*smtp_auth_checkbtn
;
1710 GtkWidget
*hbox_spc
;
1712 GtkWidget
*smtp_uid_entry
;
1713 GtkWidget
*smtp_pass_entry
;
1714 GtkWidget
*vbox_spc
;
1715 GtkWidget
*pop_bfr_smtp_checkbtn
;
1716 GtkWidget
*pop_bfr_smtp_tm_spinbtn
;
1717 GtkWidget
*pop_auth_timeout_lbl
;
1718 GtkWidget
*pop_auth_minutes_lbl
;
1721 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
1722 gtk_widget_show (vbox1
);
1723 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
1725 vbox2
= gtkut_get_options_frame(vbox1
, &frame
, _("Header"));
1727 PACK_CHECK_BUTTON (vbox2
, msgid_checkbtn
, _("Generate Message-ID"));
1729 PACK_CHECK_BUTTON (vbox2
, checkbtn_msgid_with_addr
,
1730 _("Send account mail address in Message-ID"));
1732 PACK_CHECK_BUTTON (vbox2
, xmailer_checkbtn
,
1733 _("Add user agent header"));
1735 hbox
= gtk_hbox_new (FALSE
, 12);
1736 gtk_widget_show (hbox
);
1737 gtk_box_pack_start (GTK_BOX (vbox2
), hbox
, FALSE
, FALSE
, 0);
1739 PACK_CHECK_BUTTON (hbox
, customhdr_checkbtn
,
1740 _("Add user-defined header"));
1742 customhdr_edit_btn
= gtk_button_new_from_stock (GTK_STOCK_EDIT
);
1743 gtk_widget_show (customhdr_edit_btn
);
1744 gtk_box_pack_start (GTK_BOX (hbox
), customhdr_edit_btn
,
1746 g_signal_connect (G_OBJECT (customhdr_edit_btn
), "clicked",
1747 G_CALLBACK (prefs_account_edit_custom_header
),
1750 SET_TOGGLE_SENSITIVITY (customhdr_checkbtn
, customhdr_edit_btn
);
1752 vbox3
= gtkut_get_options_frame(vbox1
, &frame
, _("Authentication"));
1754 PACK_CHECK_BUTTON (vbox3
, smtp_auth_checkbtn
,
1755 _("SMTP Authentication (SMTP AUTH)"));
1757 vbox4
= gtk_vbox_new (FALSE
, 0);
1758 gtk_widget_show (vbox4
);
1759 gtk_box_pack_start (GTK_BOX (vbox3
), vbox4
, FALSE
, FALSE
, 0);
1761 hbox
= gtk_hbox_new (FALSE
, 8);
1762 gtk_widget_show (hbox
);
1763 gtk_box_pack_start (GTK_BOX (vbox4
), hbox
, FALSE
, FALSE
, 0);
1765 hbox_spc
= gtk_hbox_new (FALSE
, 0);
1766 gtk_widget_show (hbox_spc
);
1767 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
1768 gtk_widget_set_size_request (hbox_spc
, 12, -1);
1770 label
= gtk_label_new (_("Authentication method"));
1771 gtk_widget_show (label
);
1772 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
1774 optmenu
= gtkut_sc_combobox_create(NULL
, FALSE
);
1775 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu
)));
1776 gtk_widget_show (optmenu
);
1777 gtk_box_pack_start (GTK_BOX (hbox
), optmenu
, FALSE
, FALSE
, 0);
1779 COMBOBOX_ADD (menu
, _("Automatic"), 0);
1780 COMBOBOX_ADD (menu
, NULL
, 0);
1781 COMBOBOX_ADD (menu
, "PLAIN", SMTPAUTH_PLAIN
);
1782 COMBOBOX_ADD (menu
, "LOGIN", SMTPAUTH_LOGIN
);
1783 COMBOBOX_ADD (menu
, "CRAM-MD5", SMTPAUTH_CRAM_MD5
);
1784 COMBOBOX_ADD (menu
, "DIGEST-MD5", SMTPAUTH_DIGEST_MD5
);
1785 gtk_list_store_set(menu
, &iter
, COMBOBOX_SENS
, FALSE
, -1);
1787 PACK_VSPACER(vbox4
, vbox_spc
, VSPACING_NARROW_2
);
1789 hbox
= gtk_hbox_new (FALSE
, 8);
1790 gtk_widget_show (hbox
);
1791 gtk_box_pack_start (GTK_BOX (vbox4
), hbox
, FALSE
, FALSE
, 0);
1793 hbox_spc
= gtk_hbox_new (FALSE
, 0);
1794 gtk_widget_show (hbox_spc
);
1795 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
1796 gtk_widget_set_size_request (hbox_spc
, 12, -1);
1798 label
= gtk_label_new (_("User ID"));
1799 gtk_widget_show (label
);
1800 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
1802 smtp_uid_entry
= gtk_entry_new ();
1803 gtk_widget_show (smtp_uid_entry
);
1804 gtk_widget_set_size_request (smtp_uid_entry
, DEFAULT_ENTRY_WIDTH
, -1);
1805 gtk_box_pack_start (GTK_BOX (hbox
), smtp_uid_entry
, TRUE
, TRUE
, 0);
1808 PACK_VSPACER(vbox4
, vbox_spc
, VSPACING_NARROW_2
);
1809 hbox
= gtk_hbox_new (FALSE
, 8);
1810 gtk_widget_show (hbox
);
1811 gtk_box_pack_start (GTK_BOX (vbox4
), hbox
, FALSE
, FALSE
, 0);
1813 hbox_spc
= gtk_hbox_new (FALSE
, 0);
1814 gtk_widget_show (hbox_spc
);
1815 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
1816 gtk_widget_set_size_request (hbox_spc
, 12, -1);
1818 label
= gtk_label_new (_("Password"));
1819 gtk_widget_show (label
);
1820 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
1822 smtp_pass_entry
= gtk_entry_new ();
1823 gtk_widget_show (smtp_pass_entry
);
1824 gtk_widget_set_size_request (smtp_pass_entry
, DEFAULT_ENTRY_WIDTH
, -1);
1825 gtk_box_pack_start (GTK_BOX (hbox
), smtp_pass_entry
, TRUE
, TRUE
, 0);
1827 gtk_entry_set_visibility (GTK_ENTRY (smtp_pass_entry
), FALSE
);
1828 PACK_VSPACER(vbox4
, vbox_spc
, VSPACING_NARROW_2
);
1830 hbox
= gtk_hbox_new (FALSE
, 8);
1831 gtk_widget_show (hbox
);
1832 gtk_box_pack_start (GTK_BOX (vbox4
), hbox
, FALSE
, FALSE
, 0);
1834 hbox_spc
= gtk_hbox_new (FALSE
, 0);
1835 gtk_widget_show (hbox_spc
);
1836 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
1837 gtk_widget_set_size_request (hbox_spc
, 12, -1);
1839 label
= gtk_label_new
1840 (_("If you leave these entries empty, the same "
1841 "user ID and password as receiving will be used."));
1842 gtk_widget_show (label
);
1843 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
1844 gtk_label_set_justify (GTK_LABEL (label
), GTK_JUSTIFY_LEFT
);
1845 gtk_label_set_line_wrap (GTK_LABEL (label
), TRUE
);
1846 gtkut_widget_set_small_font_size (label
);
1848 SET_TOGGLE_SENSITIVITY (smtp_auth_checkbtn
, vbox4
);
1850 PACK_CHECK_BUTTON (vbox3
, pop_bfr_smtp_checkbtn
,
1851 _("Authenticate with POP before sending"));
1853 g_signal_connect (G_OBJECT (pop_bfr_smtp_checkbtn
), "clicked",
1854 G_CALLBACK (pop_bfr_smtp_tm_set_sens
),
1857 hbox
= gtk_hbox_new (FALSE
, 8);
1858 gtk_widget_show (hbox
);
1859 gtk_box_pack_start (GTK_BOX (vbox3
), hbox
, FALSE
, FALSE
, 0);
1861 hbox_spc
= gtk_hbox_new (FALSE
, 0);
1862 gtk_widget_show (hbox_spc
);
1863 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
1864 gtk_widget_set_size_request (hbox_spc
, 12, -1);
1866 pop_auth_timeout_lbl
= gtk_label_new(_("POP authentication timeout: "));
1867 gtk_widget_show (pop_auth_timeout_lbl
);
1868 gtk_box_pack_start (GTK_BOX (hbox
), pop_auth_timeout_lbl
, FALSE
, FALSE
, 0);
1870 pop_bfr_smtp_tm_spinbtn
= gtk_spin_button_new_with_range(0, 1440, 1);
1871 gtk_widget_show (pop_bfr_smtp_tm_spinbtn
);
1872 gtk_box_pack_start (GTK_BOX (hbox
), pop_bfr_smtp_tm_spinbtn
, FALSE
, FALSE
, 0);
1874 pop_auth_minutes_lbl
= gtk_label_new(_("minutes"));
1875 gtk_widget_show (pop_auth_minutes_lbl
);
1876 gtk_box_pack_start (GTK_BOX (hbox
), pop_auth_minutes_lbl
, FALSE
, FALSE
, 0);
1878 page
->msgid_checkbtn
= msgid_checkbtn
;
1879 page
->xmailer_checkbtn
= xmailer_checkbtn
;
1880 page
->customhdr_checkbtn
= customhdr_checkbtn
;
1881 page
->msgid_with_addr_checkbtn
= checkbtn_msgid_with_addr
;
1883 page
->smtp_auth_checkbtn
= smtp_auth_checkbtn
;
1884 page
->smtp_auth_type_optmenu
= optmenu
;
1885 page
->smtp_uid_entry
= smtp_uid_entry
;
1886 page
->smtp_pass_entry
= smtp_pass_entry
;
1887 page
->pop_bfr_smtp_checkbtn
= pop_bfr_smtp_checkbtn
;
1888 page
->pop_bfr_smtp_tm_spinbtn
= pop_bfr_smtp_tm_spinbtn
;
1889 page
->pop_auth_timeout_lbl
= pop_auth_timeout_lbl
;
1890 page
->pop_auth_minutes_lbl
= pop_auth_minutes_lbl
;
1892 tmp_ac_prefs
= *ac_prefs
;
1895 prefs_set_dialog_to_default(send_param
);
1897 prefs_set_dialog(send_param
);
1899 /* Passwords are handled outside of PrefParams. */
1900 buf
= passwd_store_get_account(ac_prefs
->account_id
,
1902 gtk_entry_set_text(GTK_ENTRY(page
->smtp_pass_entry
), buf
!= NULL
? buf
: "");
1904 memset(buf
, 0, strlen(buf
));
1909 pop_bfr_smtp_tm_set_sens (NULL
, NULL
);
1913 page
->page
.widget
= vbox1
;
1916 static void compose_create_widget_func(PrefsPage
* _page
,
1920 ComposePage
*page
= (ComposePage
*) _page
;
1921 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
1924 GtkWidget
*sig_hbox
;
1927 GtkWidget
*frame_sig
;
1928 GtkWidget
*vbox_sig
;
1929 GtkWidget
*label_sigpath
;
1930 GtkWidget
*checkbtn_autosig
;
1931 GtkWidget
*label_sigsep
;
1932 GtkWidget
*entry_sigsep
;
1935 GtkWidget
*autocc_checkbtn
;
1936 GtkWidget
*autocc_entry
;
1937 GtkWidget
*autobcc_checkbtn
;
1938 GtkWidget
*autobcc_entry
;
1939 GtkWidget
*autoreplyto_checkbtn
;
1940 GtkWidget
*autoreplyto_entry
;
1942 GtkWidget
*frame_dict
;
1943 GtkWidget
*table_dict
;
1944 GtkWidget
*checkbtn_enable_default_dictionary
= NULL
;
1945 GtkWidget
*combo_default_dictionary
= NULL
;
1946 GtkWidget
*checkbtn_enable_default_alt_dictionary
= NULL
;
1947 GtkWidget
*combo_default_alt_dictionary
= NULL
;
1950 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
1951 gtk_widget_show (vbox1
);
1952 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
1954 vbox_sig
= gtkut_get_options_frame(vbox1
, &frame_sig
, _("Signature"));
1956 PACK_CHECK_BUTTON (vbox_sig
, checkbtn_autosig
,
1957 _("Automatically insert signature"));
1959 hbox1
= gtk_hbox_new (FALSE
, 8);
1960 gtk_widget_show (hbox1
);
1961 gtk_box_pack_start (GTK_BOX (vbox_sig
), hbox1
, TRUE
, TRUE
, 0);
1962 label_sigsep
= gtk_label_new (_("Signature separator"));
1963 gtk_widget_show (label_sigsep
);
1964 gtk_box_pack_start (GTK_BOX (hbox1
), label_sigsep
, FALSE
, FALSE
, 0);
1966 entry_sigsep
= gtk_entry_new ();
1967 gtk_widget_show (entry_sigsep
);
1968 gtk_box_pack_start (GTK_BOX (hbox1
), entry_sigsep
, FALSE
, FALSE
, 0);
1970 gtk_widget_set_size_request (entry_sigsep
, 64, -1);
1972 sig_hbox
= gtk_hbox_new (FALSE
, 8);
1973 gtk_widget_show (sig_hbox
);
1974 gtk_box_pack_start (GTK_BOX (vbox_sig
), sig_hbox
, FALSE
, FALSE
, 0);
1976 sigfile_radiobtn
= gtk_radio_button_new_with_label (NULL
, _("File"));
1977 gtk_widget_show (sigfile_radiobtn
);
1978 gtk_box_pack_start (GTK_BOX (sig_hbox
), sigfile_radiobtn
,
1980 g_object_set_data (G_OBJECT (sigfile_radiobtn
),
1982 GINT_TO_POINTER (SIG_FILE
));
1983 g_signal_connect(G_OBJECT(sigfile_radiobtn
), "clicked",
1984 G_CALLBACK(prefs_account_sigfile_radiobtn_cb
), NULL
);
1986 sigcmd_radiobtn
= gtk_radio_button_new_with_label_from_widget
1987 (GTK_RADIO_BUTTON(sigfile_radiobtn
), _("Command output"));
1988 gtk_widget_show (sigcmd_radiobtn
);
1989 gtk_box_pack_start (GTK_BOX (sig_hbox
), sigcmd_radiobtn
,
1991 g_object_set_data (G_OBJECT (sigcmd_radiobtn
),
1993 GINT_TO_POINTER (SIG_COMMAND
));
1994 g_signal_connect(G_OBJECT(sigcmd_radiobtn
), "clicked",
1995 G_CALLBACK(prefs_account_sigcmd_radiobtn_cb
), NULL
);
1997 hbox2
= gtk_hbox_new (FALSE
, 8);
1998 gtk_widget_show (hbox2
);
1999 gtk_box_pack_start (GTK_BOX (vbox_sig
), hbox2
, TRUE
, TRUE
, 0);
2000 label_sigpath
= gtk_label_new (_("Signature"));
2001 gtk_widget_show (label_sigpath
);
2002 gtk_box_pack_start (GTK_BOX (hbox2
), label_sigpath
, FALSE
, FALSE
, 0);
2004 entry_sigpath
= gtk_entry_new ();
2005 gtk_widget_show (entry_sigpath
);
2006 gtk_box_pack_start (GTK_BOX (hbox2
), entry_sigpath
, TRUE
, TRUE
, 0);
2008 signature_browse_button
= gtkut_get_browse_file_btn(_("Bro_wse"));
2009 gtk_widget_show (signature_browse_button
);
2010 gtk_box_pack_start (GTK_BOX (hbox2
), signature_browse_button
, FALSE
, FALSE
, 0);
2011 g_signal_connect(G_OBJECT(signature_browse_button
), "clicked",
2012 G_CALLBACK(prefs_account_signature_browse_cb
), NULL
);
2014 signature_edit_button
= gtk_button_new_from_stock (GTK_STOCK_EDIT
);
2015 gtk_widget_show (signature_edit_button
);
2016 gtk_box_pack_start (GTK_BOX (hbox2
), signature_edit_button
, FALSE
, FALSE
, 0);
2017 g_signal_connect(G_OBJECT(signature_edit_button
), "clicked",
2018 G_CALLBACK(prefs_account_signature_edit_cb
), entry_sigpath
);
2020 PACK_FRAME (vbox1
, frame
, _("Automatically set the following addresses"));
2022 table
= gtk_table_new (3, 2, FALSE
);
2023 gtk_widget_show (table
);
2024 gtk_container_add (GTK_CONTAINER (frame
), table
);
2025 gtk_container_set_border_width (GTK_CONTAINER (table
), 8);
2026 gtk_table_set_row_spacings (GTK_TABLE (table
), VSPACING_NARROW_2
);
2027 gtk_table_set_col_spacings (GTK_TABLE (table
), 8);
2029 autocc_checkbtn
= gtk_check_button_new_with_label (
2030 prefs_common_translated_header_name("Cc"));
2031 gtk_widget_show (autocc_checkbtn
);
2032 gtk_table_attach (GTK_TABLE (table
), autocc_checkbtn
, 0, 1, 0, 1,
2035 autocc_entry
= gtk_entry_new ();
2036 gtk_widget_show (autocc_entry
);
2037 gtk_table_attach (GTK_TABLE (table
), autocc_entry
, 1, 2, 0, 1,
2038 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
2039 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
2041 SET_TOGGLE_SENSITIVITY (autocc_checkbtn
, autocc_entry
);
2043 autobcc_checkbtn
= gtk_check_button_new_with_label (
2044 prefs_common_translated_header_name("Bcc"));
2045 gtk_widget_show (autobcc_checkbtn
);
2046 gtk_table_attach (GTK_TABLE (table
), autobcc_checkbtn
, 0, 1, 1, 2,
2049 autobcc_entry
= gtk_entry_new ();
2050 gtk_widget_show (autobcc_entry
);
2051 gtk_table_attach (GTK_TABLE (table
), autobcc_entry
, 1, 2, 1, 2,
2052 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
2053 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
2055 SET_TOGGLE_SENSITIVITY (autobcc_checkbtn
, autobcc_entry
);
2057 autoreplyto_checkbtn
= gtk_check_button_new_with_label (
2058 prefs_common_translated_header_name("Reply-To"));
2059 gtk_widget_show (autoreplyto_checkbtn
);
2060 gtk_table_attach (GTK_TABLE (table
), autoreplyto_checkbtn
, 0, 1, 2, 3,
2063 autoreplyto_entry
= gtk_entry_new ();
2064 gtk_widget_show (autoreplyto_entry
);
2065 gtk_table_attach (GTK_TABLE (table
), autoreplyto_entry
, 1, 2, 2, 3,
2066 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
2067 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
2069 SET_TOGGLE_SENSITIVITY (autoreplyto_checkbtn
, autoreplyto_entry
);
2072 PACK_FRAME (vbox1
, frame_dict
, _("Spell check dictionaries"));
2074 table_dict
= gtk_table_new (2, 2, FALSE
);
2075 gtk_widget_show (table_dict
);
2076 gtk_container_add (GTK_CONTAINER (frame_dict
), table_dict
);
2077 gtk_container_set_border_width (GTK_CONTAINER (table_dict
), 8);
2078 gtk_table_set_row_spacings (GTK_TABLE (table_dict
), VSPACING_NARROW_2
);
2079 gtk_table_set_col_spacings (GTK_TABLE (table_dict
), 8);
2081 /* Default dictionary */
2082 checkbtn_enable_default_dictionary
= gtk_check_button_new_with_label(_("Default dictionary"));
2083 gtk_table_attach(GTK_TABLE(table_dict
), checkbtn_enable_default_dictionary
, 0, 1,
2084 0, 1, GTK_SHRINK
| GTK_FILL
, GTK_SHRINK
, 0, 0);
2085 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_dictionary
),
2086 tmp_ac_prefs
.enable_default_dictionary
);
2088 combo_default_dictionary
= gtkaspell_dictionary_combo_new(TRUE
);
2089 gtk_table_attach(GTK_TABLE(table_dict
), combo_default_dictionary
, 1, 2,
2090 0, 1, GTK_EXPAND
| GTK_FILL
, GTK_SHRINK
, 0, 0);
2092 SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_dictionary
, combo_default_dictionary
);
2094 /* Default dictionary */
2095 checkbtn_enable_default_alt_dictionary
= gtk_check_button_new_with_label(_("Default alternate dictionary"));
2096 gtk_table_attach(GTK_TABLE(table_dict
), checkbtn_enable_default_alt_dictionary
, 0, 1,
2097 1, 2, GTK_SHRINK
| GTK_FILL
, GTK_SHRINK
, 0, 0);
2098 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_alt_dictionary
),
2099 tmp_ac_prefs
.enable_default_alt_dictionary
);
2101 combo_default_alt_dictionary
= gtkaspell_dictionary_combo_new(FALSE
);
2102 gtk_table_attach(GTK_TABLE(table_dict
), combo_default_alt_dictionary
, 1, 2,
2103 1, 2, GTK_EXPAND
| GTK_FILL
, GTK_SHRINK
, 0, 0);
2105 SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_alt_dictionary
, combo_default_alt_dictionary
);
2107 gtk_widget_show_all(table_dict
);
2110 page
->sigfile_radiobtn
= sigfile_radiobtn
;
2111 page
->entry_sigpath
= entry_sigpath
;
2112 page
->checkbtn_autosig
= checkbtn_autosig
;
2113 page
->entry_sigsep
= entry_sigsep
;
2115 page
->autocc_checkbtn
= autocc_checkbtn
;
2116 page
->autocc_entry
= autocc_entry
;
2117 page
->autobcc_checkbtn
= autobcc_checkbtn
;
2118 page
->autobcc_entry
= autobcc_entry
;
2119 page
->autoreplyto_checkbtn
= autoreplyto_checkbtn
;
2120 page
->autoreplyto_entry
= autoreplyto_entry
;
2122 page
->checkbtn_enable_default_dictionary
= checkbtn_enable_default_dictionary
;
2123 page
->combo_default_dictionary
= combo_default_dictionary
;
2124 page
->checkbtn_enable_default_alt_dictionary
= checkbtn_enable_default_alt_dictionary
;
2125 page
->combo_default_alt_dictionary
= combo_default_alt_dictionary
;
2129 /* reset gtkaspell menus */
2130 if (compose_page
.combo_default_dictionary
!= NULL
) {
2131 gtk_combo_box_set_model(GTK_COMBO_BOX(compose_page
.combo_default_dictionary
),
2132 gtkaspell_dictionary_store_new());
2133 gtk_combo_box_set_model(GTK_COMBO_BOX(compose_page
.combo_default_alt_dictionary
),
2134 gtkaspell_dictionary_store_new_with_refresh(
2139 tmp_ac_prefs
= *ac_prefs
;
2142 prefs_set_dialog_to_default(compose_param
);
2144 prefs_set_dialog(compose_param
);
2148 page
->page
.widget
= vbox1
;
2151 static void templates_create_widget_func(PrefsPage
* _page
,
2155 TemplatesPage
*page
= (TemplatesPage
*) _page
;
2156 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
2159 GtkWidget
*notebook
;
2161 vbox
= gtk_vbox_new(FALSE
, 0);
2162 gtk_widget_show(vbox
);
2164 notebook
= gtk_notebook_new();
2165 gtk_widget_show(notebook
);
2166 gtk_box_pack_start(GTK_BOX(vbox
), notebook
, TRUE
, TRUE
, 0);
2168 /* compose format */
2169 vbox2
= gtk_vbox_new (FALSE
, VSPACING
);
2170 gtk_widget_show (vbox2
);
2171 gtk_container_set_border_width (GTK_CONTAINER (vbox2
), VBOX_BORDER
);
2173 quotefmt_create_new_msg_fmt_widgets(
2176 &page
->checkbtn_compose_with_format
,
2178 &page
->compose_subject_format
,
2179 &page
->compose_body_format
,
2181 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox2
, gtk_label_new(_("Compose")));
2184 vbox2
= gtk_vbox_new (FALSE
, VSPACING
);
2185 gtk_widget_show (vbox2
);
2186 gtk_container_set_border_width (GTK_CONTAINER (vbox2
), VBOX_BORDER
);
2188 quotefmt_create_reply_fmt_widgets(
2191 &page
->checkbtn_reply_with_format
,
2193 &page
->reply_quotemark
,
2194 &page
->reply_body_format
,
2196 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox2
, gtk_label_new(_("Reply")));
2198 /* forward format */
2199 vbox2
= gtk_vbox_new (FALSE
, VSPACING
);
2200 gtk_widget_show (vbox2
);
2201 gtk_container_set_border_width (GTK_CONTAINER (vbox2
), VBOX_BORDER
);
2203 quotefmt_create_forward_fmt_widgets(
2206 &page
->checkbtn_forward_with_format
,
2208 &page
->forward_quotemark
,
2209 &page
->forward_body_format
,
2211 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox2
, gtk_label_new(_("Forward")));
2213 tmp_ac_prefs
= *ac_prefs
;
2216 prefs_set_dialog_to_default(templates_param
);
2218 prefs_set_dialog(templates_param
);
2222 page
->page
.widget
= vbox
;
2225 static void privacy_create_widget_func(PrefsPage
* _page
,
2229 PrivacyPage
*page
= (PrivacyPage
*) _page
;
2230 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
2236 GtkWidget
*default_privacy_system
;
2238 GtkCellRenderer
*rend
;
2239 GtkWidget
*default_encrypt_checkbtn
;
2240 GtkWidget
*default_encrypt_reply_checkbtn
;
2241 GtkWidget
*default_sign_checkbtn
;
2242 GtkWidget
*default_sign_reply_checkbtn
;
2243 GtkWidget
*save_clear_text_checkbtn
;
2244 GtkWidget
*encrypt_to_self_checkbtn
;
2246 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
2247 gtk_widget_show (vbox1
);
2248 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
2250 vbox2
= gtk_vbox_new (FALSE
, 0);
2251 gtk_widget_show (vbox2
);
2252 gtk_box_pack_start (GTK_BOX (vbox1
), vbox2
, FALSE
, FALSE
, 0);
2254 hbox1
= gtk_hbox_new(FALSE
, 8);
2255 gtk_widget_show (hbox1
);
2256 gtk_container_add (GTK_CONTAINER(vbox2
), hbox1
);
2258 label
= gtk_label_new(_("Default privacy system"));
2259 gtk_widget_show(label
);
2260 gtk_box_pack_start (GTK_BOX (hbox1
), label
, FALSE
, FALSE
, 0);
2262 /* Can't use gtkut_sc_combobox_create() here, because model for this
2263 * combobox needs an extra string column to store privacy plugin id. */
2264 menu
= gtk_list_store_new(4,
2268 G_TYPE_STRING
); /* This is where we store the privacy plugin id. */
2269 default_privacy_system
= gtk_combo_box_new_with_model(GTK_TREE_MODEL(menu
));
2271 rend
= gtk_cell_renderer_text_new();
2272 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(default_privacy_system
), rend
, TRUE
);
2273 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(default_privacy_system
), rend
,
2274 "text", COMBOBOX_TEXT
,
2275 "sensitive", COMBOBOX_SENS
,
2277 gtk_combo_box_set_focus_on_click(GTK_COMBO_BOX(default_privacy_system
), FALSE
);
2279 gtk_widget_show (default_privacy_system
);
2280 gtk_box_pack_start (GTK_BOX(hbox1
), default_privacy_system
, FALSE
, TRUE
, 0);
2282 g_signal_connect(G_OBJECT(default_privacy_system
), "changed",
2283 G_CALLBACK(privacy_system_activated
),
2286 PACK_CHECK_BUTTON (vbox2
, default_sign_checkbtn
,
2287 _("Always sign messages"));
2288 PACK_CHECK_BUTTON (vbox2
, default_encrypt_checkbtn
,
2289 _("Always encrypt messages"));
2290 PACK_CHECK_BUTTON (vbox2
, default_sign_reply_checkbtn
,
2291 _("Always sign messages when replying to a "
2293 PACK_CHECK_BUTTON (vbox2
, default_encrypt_reply_checkbtn
,
2294 _("Always encrypt messages when replying to an "
2295 "encrypted message"));
2296 PACK_CHECK_BUTTON (vbox2
, encrypt_to_self_checkbtn
,
2297 _("Encrypt sent messages with your own key in addition to recipient's"));
2298 PACK_CHECK_BUTTON (vbox2
, save_clear_text_checkbtn
,
2299 _("Save sent encrypted messages as clear text"));
2301 SET_TOGGLE_SENSITIVITY_REVERSE(encrypt_to_self_checkbtn
, save_clear_text_checkbtn
);
2302 SET_TOGGLE_SENSITIVITY_REVERSE(save_clear_text_checkbtn
, encrypt_to_self_checkbtn
);
2304 page
->default_privacy_system
= default_privacy_system
;
2305 page
->default_encrypt_checkbtn
= default_encrypt_checkbtn
;
2306 page
->default_encrypt_reply_checkbtn
= default_encrypt_reply_checkbtn
;
2307 page
->default_sign_reply_checkbtn
= default_sign_reply_checkbtn
;
2308 page
->default_sign_checkbtn
= default_sign_checkbtn
;
2309 page
->save_clear_text_checkbtn
= save_clear_text_checkbtn
;
2310 page
->encrypt_to_self_checkbtn
= encrypt_to_self_checkbtn
;
2312 update_privacy_system_menu();
2314 tmp_ac_prefs
= *ac_prefs
;
2317 prefs_set_dialog_to_default(privacy_param
);
2319 prefs_set_dialog(privacy_param
);
2323 page
->page
.widget
= vbox1
;
2328 #define CREATE_RADIO_BUTTON(box, btn, btn_p, label, data) \
2330 btn = gtk_radio_button_new_with_label_from_widget \
2331 (GTK_RADIO_BUTTON (btn_p), label); \
2332 gtk_widget_show (btn); \
2333 gtk_box_pack_start (GTK_BOX (box), btn, FALSE, FALSE, 0); \
2334 g_object_set_data (G_OBJECT (btn), \
2336 GINT_TO_POINTER (data)); \
2339 #define CREATE_RADIO_BUTTONS(box, \
2340 btn1, btn1_label, btn1_data, \
2341 btn2, btn2_label, btn2_data, \
2342 btn3, btn3_label, btn3_data) \
2344 btn1 = gtk_radio_button_new_with_label(NULL, btn1_label); \
2345 gtk_widget_show (btn1); \
2346 gtk_box_pack_start (GTK_BOX (box), btn1, FALSE, FALSE, 0); \
2347 g_object_set_data (G_OBJECT (btn1), \
2349 GINT_TO_POINTER (btn1_data)); \
2351 CREATE_RADIO_BUTTON(box, btn2, btn1, btn2_label, btn2_data); \
2352 CREATE_RADIO_BUTTON(box, btn3, btn1, btn3_label, btn3_data); \
2355 static void pop_ssltunnel_toggled(GtkToggleButton
*button
,
2358 gboolean active
= gtk_toggle_button_get_active(button
);
2360 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
2361 advanced_page
.popport_checkbtn
)) == TRUE
)
2363 gtk_spin_button_set_value(GTK_SPIN_BUTTON(advanced_page
.popport_spinbtn
),
2364 active
? 995 : 110);
2367 static void imap_ssltunnel_toggled(GtkToggleButton
*button
,
2370 gboolean active
= gtk_toggle_button_get_active(button
);
2372 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
2373 advanced_page
.imapport_checkbtn
)) == TRUE
)
2375 gtk_spin_button_set_value(GTK_SPIN_BUTTON(advanced_page
.imapport_spinbtn
),
2376 active
? 993 : 143);
2379 static void nntp_ssltunnel_toggled(GtkToggleButton
*button
,
2382 gboolean active
= gtk_toggle_button_get_active(button
);
2384 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
2385 advanced_page
.nntpport_checkbtn
)) == TRUE
)
2387 gtk_spin_button_set_value(GTK_SPIN_BUTTON(advanced_page
.nntpport_spinbtn
),
2388 active
? 563 : 119);
2391 static void smtp_ssltunnel_toggled(GtkToggleButton
*button
,
2394 gboolean active
= gtk_toggle_button_get_active(button
);
2396 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
2397 advanced_page
.smtpport_checkbtn
)) == TRUE
)
2399 gtk_spin_button_set_value(GTK_SPIN_BUTTON(advanced_page
.smtpport_spinbtn
),
2403 static void ssl_create_widget_func(PrefsPage
* _page
,
2407 SSLPage
*page
= (SSLPage
*) _page
;
2408 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
2412 GtkWidget
*pop_frame
;
2414 GtkWidget
*pop_nossl_radiobtn
;
2415 GtkWidget
*pop_ssltunnel_radiobtn
;
2416 GtkWidget
*pop_starttls_radiobtn
;
2418 GtkWidget
*imap_frame
;
2420 GtkWidget
*imap_nossl_radiobtn
;
2421 GtkWidget
*imap_ssltunnel_radiobtn
;
2422 GtkWidget
*imap_starttls_radiobtn
;
2424 GtkWidget
*nntp_frame
;
2426 GtkWidget
*nntp_nossl_radiobtn
;
2427 GtkWidget
*nntp_ssltunnel_radiobtn
;
2429 GtkWidget
*send_frame
;
2431 GtkWidget
*smtp_nossl_radiobtn
;
2432 GtkWidget
*smtp_ssltunnel_radiobtn
;
2433 GtkWidget
*smtp_starttls_radiobtn
;
2435 GtkWidget
*cert_frame
;
2436 GtkWidget
*cert_table
;
2437 GtkWidget
*entry_in_cert_pass
;
2438 GtkWidget
*entry_out_cert_pass
;
2441 GtkWidget
*ssl_certs_auto_accept_checkbtn
;
2442 GtkWidget
*use_nonblocking_ssl_checkbtn
;
2444 GtkWidget
*hbox_spc
;
2448 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
2449 gtk_widget_show (vbox1
);
2450 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
2452 vbox2
= gtkut_get_options_frame(vbox1
, &pop_frame
, _("POP"));
2454 CREATE_RADIO_BUTTONS(vbox2
,
2456 _("Don't use SSL/TLS"),
2458 pop_ssltunnel_radiobtn
,
2461 pop_starttls_radiobtn
,
2462 _("Use STARTTLS command to start encrypted session"),
2464 g_signal_connect(G_OBJECT(pop_ssltunnel_radiobtn
), "toggled",
2465 G_CALLBACK(pop_ssltunnel_toggled
), NULL
);
2467 vbox3
= gtkut_get_options_frame(vbox1
, &imap_frame
, _("IMAP"));
2469 CREATE_RADIO_BUTTONS(vbox3
,
2470 imap_nossl_radiobtn
,
2471 _("Don't use SSL/TLS"),
2473 imap_ssltunnel_radiobtn
,
2476 imap_starttls_radiobtn
,
2477 _("Use STARTTLS command to start encrypted session"),
2479 g_signal_connect(G_OBJECT(imap_ssltunnel_radiobtn
), "toggled",
2480 G_CALLBACK(imap_ssltunnel_toggled
), NULL
);
2482 vbox4
= gtkut_get_options_frame(vbox1
, &nntp_frame
, _("NNTP"));
2484 nntp_nossl_radiobtn
=
2485 gtk_radio_button_new_with_label (NULL
, _("Don't use SSL/TLS"));
2486 gtk_widget_show (nntp_nossl_radiobtn
);
2487 gtk_box_pack_start (GTK_BOX (vbox4
), nntp_nossl_radiobtn
,
2489 g_object_set_data (G_OBJECT (nntp_nossl_radiobtn
),
2491 GINT_TO_POINTER (SSL_NONE
));
2493 CREATE_RADIO_BUTTON(vbox4
, nntp_ssltunnel_radiobtn
, nntp_nossl_radiobtn
,
2494 _("Use SSL/TLS"), SSL_TUNNEL
);
2495 g_signal_connect(G_OBJECT(nntp_ssltunnel_radiobtn
), "toggled",
2496 G_CALLBACK(nntp_ssltunnel_toggled
), NULL
);
2498 vbox5
= gtkut_get_options_frame(vbox1
, &send_frame
, _("Send (SMTP)"));
2500 CREATE_RADIO_BUTTONS(vbox5
,
2501 smtp_nossl_radiobtn
,
2502 _("Don't use SSL/TLS (but, if necessary, use STARTTLS)"),
2504 smtp_ssltunnel_radiobtn
,
2507 smtp_starttls_radiobtn
,
2508 _("Use STARTTLS command to start encrypted session"),
2510 g_signal_connect(G_OBJECT(smtp_ssltunnel_radiobtn
), "toggled",
2511 G_CALLBACK(smtp_ssltunnel_toggled
), NULL
);
2513 PACK_FRAME(vbox1
, cert_frame
, _("Client certificates"));
2515 cert_table
= gtk_table_new(4,3, FALSE
);
2516 gtk_container_add(GTK_CONTAINER(cert_frame
), cert_table
);
2517 gtk_container_set_border_width(GTK_CONTAINER(cert_table
), 8);
2518 gtk_table_set_row_spacings(GTK_TABLE(cert_table
), VSPACING_NARROW_2
);
2519 gtk_table_set_col_spacings(GTK_TABLE(cert_table
), 8);
2521 label
= gtk_label_new(_("Certificate for receiving"));
2522 gtk_misc_set_alignment(GTK_MISC(label
), 1, 0.5);
2523 entry_in_cert_file
= gtk_entry_new();
2524 in_ssl_cert_browse_button
= gtkut_get_browse_file_btn(_("Browse"));
2525 CLAWS_SET_TIP(label
,
2526 _("Client certificate file as a PKCS12 or PEM file"));
2527 CLAWS_SET_TIP(entry_in_cert_file
,
2528 _("Client certificate file as a PKCS12 or PEM file"));
2529 gtk_table_attach(GTK_TABLE(cert_table
), label
, 0, 1, 0, 1, GTK_FILL
, 0, 0, 0);
2530 gtk_table_attach(GTK_TABLE(cert_table
), entry_in_cert_file
, 1, 2, 0, 1,
2531 GTK_EXPAND
|GTK_FILL
, 0, 0, 0);
2532 gtk_table_attach(GTK_TABLE(cert_table
), in_ssl_cert_browse_button
, 2, 3, 0, 1,
2535 label
= gtk_label_new(_("Password"));
2536 gtk_misc_set_alignment(GTK_MISC(label
), 1, 0.5);
2537 entry_in_cert_pass
= gtk_entry_new();
2538 gtk_entry_set_visibility(GTK_ENTRY(entry_in_cert_pass
), FALSE
);
2539 gtk_table_attach(GTK_TABLE(cert_table
), label
, 0, 1, 1, 2, GTK_FILL
, 0, 0, 0);
2540 gtk_table_attach(GTK_TABLE(cert_table
), entry_in_cert_pass
, 1, 2, 1, 2,
2543 label
= gtk_label_new(_("Certificate for sending"));
2544 gtk_misc_set_alignment(GTK_MISC(label
), 1, 0.5);
2545 entry_out_cert_file
= gtk_entry_new();
2546 out_ssl_cert_browse_button
= gtkut_get_browse_file_btn(_("Browse"));
2547 CLAWS_SET_TIP(label
,
2548 _("Client certificate file as a PKCS12 or PEM file"));
2549 CLAWS_SET_TIP(entry_out_cert_file
,
2550 _("Client certificate file as a PKCS12 or PEM file"));
2551 gtk_table_attach(GTK_TABLE(cert_table
), label
, 0, 1, 2, 3, GTK_FILL
, 0, 0, 0);
2552 gtk_table_attach(GTK_TABLE(cert_table
), entry_out_cert_file
, 1, 2, 2, 3,
2553 GTK_EXPAND
|GTK_FILL
, 0, 0, 0);
2554 gtk_table_attach(GTK_TABLE(cert_table
), out_ssl_cert_browse_button
, 2, 3, 2, 3,
2557 label
= gtk_label_new(_("Password"));
2558 gtk_misc_set_alignment(GTK_MISC(label
), 1, 0.5);
2559 entry_out_cert_pass
= gtk_entry_new();
2560 gtk_entry_set_visibility(GTK_ENTRY(entry_out_cert_pass
), FALSE
);
2561 gtk_table_attach(GTK_TABLE(cert_table
), label
, 0, 1, 3, 4, GTK_FILL
, 0, 0, 0);
2562 gtk_table_attach(GTK_TABLE(cert_table
), entry_out_cert_pass
, 1, 2, 3, 4,
2564 gtk_widget_show_all(cert_table
);
2566 g_signal_connect(G_OBJECT(in_ssl_cert_browse_button
), "clicked",
2567 G_CALLBACK(prefs_account_in_cert_browse_cb
), NULL
);
2568 g_signal_connect(G_OBJECT(out_ssl_cert_browse_button
), "clicked",
2569 G_CALLBACK(prefs_account_out_cert_browse_cb
), NULL
);
2571 vbox7
= gtk_vbox_new (FALSE
, 0);
2572 gtk_widget_show (vbox7
);
2573 gtk_box_pack_start (GTK_BOX (vbox1
), vbox7
, FALSE
, FALSE
, 0);
2575 PACK_CHECK_BUTTON(vbox7
, ssl_certs_auto_accept_checkbtn
,
2576 _("Automatically accept valid SSL/TLS certificates"));
2578 PACK_CHECK_BUTTON(vbox7
, use_nonblocking_ssl_checkbtn
,
2579 _("Use non-blocking SSL/TLS"));
2581 hbox
= gtk_hbox_new (FALSE
, 0);
2582 gtk_widget_show (hbox
);
2583 gtk_box_pack_start (GTK_BOX (vbox7
), hbox
, FALSE
, FALSE
, 0);
2585 hbox_spc
= gtk_hbox_new (FALSE
, 0);
2586 gtk_widget_show (hbox_spc
);
2587 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
2588 gtk_widget_set_size_request (hbox_spc
, 16, -1);
2590 label
= gtk_label_new
2591 (_("Turn this off if you have SSL/TLS connection problems"));
2592 gtk_widget_show (label
);
2593 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
2594 gtkut_widget_set_small_font_size (label
);
2596 page
->pop_frame
= pop_frame
;
2597 page
->pop_nossl_radiobtn
= pop_nossl_radiobtn
;
2598 page
->pop_ssltunnel_radiobtn
= pop_ssltunnel_radiobtn
;
2599 page
->pop_starttls_radiobtn
= pop_starttls_radiobtn
;
2601 page
->imap_frame
= imap_frame
;
2602 page
->imap_nossl_radiobtn
= imap_nossl_radiobtn
;
2603 page
->imap_ssltunnel_radiobtn
= imap_ssltunnel_radiobtn
;
2604 page
->imap_starttls_radiobtn
= imap_starttls_radiobtn
;
2606 page
->nntp_frame
= nntp_frame
;
2607 page
->nntp_nossl_radiobtn
= nntp_nossl_radiobtn
;
2608 page
->nntp_ssltunnel_radiobtn
= nntp_ssltunnel_radiobtn
;
2610 page
->send_frame
= send_frame
;
2611 page
->smtp_nossl_radiobtn
= smtp_nossl_radiobtn
;
2612 page
->smtp_ssltunnel_radiobtn
= smtp_ssltunnel_radiobtn
;
2613 page
->smtp_starttls_radiobtn
= smtp_starttls_radiobtn
;
2615 page
->entry_in_cert_file
= entry_in_cert_file
;
2616 page
->entry_in_cert_pass
= entry_in_cert_pass
;
2617 page
->entry_out_cert_file
= entry_out_cert_file
;
2618 page
->entry_out_cert_pass
= entry_out_cert_pass
;
2620 page
->ssl_certs_auto_accept_checkbtn
= ssl_certs_auto_accept_checkbtn
;
2621 page
->use_nonblocking_ssl_checkbtn
= use_nonblocking_ssl_checkbtn
;
2623 tmp_ac_prefs
= *ac_prefs
;
2626 prefs_set_dialog_to_default(ssl_param
);
2628 prefs_set_dialog(ssl_param
);
2630 /* Passwords are handled outside of PrefParams. */
2631 buf
= passwd_store_get_account(ac_prefs
->account_id
,
2632 PWS_ACCOUNT_RECV_CERT
);
2633 gtk_entry_set_text(GTK_ENTRY(page
->entry_in_cert_pass
), buf
!= NULL
? buf
: "");
2635 memset(buf
, 0, strlen(buf
));
2639 buf
= passwd_store_get_account(ac_prefs
->account_id
,
2640 PWS_ACCOUNT_SEND_CERT
);
2641 gtk_entry_set_text(GTK_ENTRY(page
->entry_out_cert_pass
), buf
!= NULL
? buf
: "");
2643 memset(buf
, 0, strlen(buf
));
2650 page
->page
.widget
= vbox1
;
2653 #undef CREATE_RADIO_BUTTONS
2654 #undef CREATE_RADIO_BUTTON
2655 #endif /* USE_GNUTLS */
2657 static void advanced_create_widget_func(PrefsPage
* _page
,
2661 AdvancedPage
*page
= (AdvancedPage
*) _page
;
2662 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
2667 GtkWidget
*checkbtn_smtpport
;
2668 GtkWidget
*spinbtn_smtpport
;
2669 GtkWidget
*hbox_popport
;
2670 GtkWidget
*checkbtn_popport
;
2671 GtkWidget
*spinbtn_popport
;
2672 GtkWidget
*hbox_imapport
;
2673 GtkWidget
*checkbtn_imapport
;
2674 GtkWidget
*spinbtn_imapport
;
2675 GtkWidget
*hbox_nntpport
;
2676 GtkWidget
*checkbtn_nntpport
;
2677 GtkWidget
*spinbtn_nntpport
;
2678 GtkWidget
*checkbtn_domain
;
2679 GtkWidget
*entry_domain
;
2681 #if !GTK_CHECK_VERSION(3, 0, 0)
2682 GtkWidget
*checkbtn_crosspost
;
2683 GtkWidget
*colormenu_crosspost
;
2687 GtkWidget
*checkbtn_tunnelcmd
;
2688 GtkWidget
*entry_tunnelcmd
;
2690 GtkWidget
*folder_frame
;
2693 GtkWidget
*sent_folder_checkbtn
;
2694 GtkWidget
*sent_folder_entry
;
2695 GtkWidget
*queue_folder_checkbtn
;
2696 GtkWidget
*queue_folder_entry
;
2697 GtkWidget
*draft_folder_checkbtn
;
2698 GtkWidget
*draft_folder_entry
;
2699 GtkWidget
*trash_folder_checkbtn
;
2700 GtkWidget
*trash_folder_entry
;
2701 GtkSizeGroup
*size_group
= gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL
);
2703 #define PACK_HBOX(hbox) \
2705 hbox = gtk_hbox_new (FALSE, 8); \
2706 gtk_widget_show (hbox); \
2707 gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); \
2710 #define PACK_PORT_SPINBTN(box, spinbtn) \
2712 spinbtn = gtk_spin_button_new_with_range(0, 65535, 1); \
2713 gtk_widget_show (spinbtn); \
2714 gtk_box_pack_start (GTK_BOX (box), spinbtn, FALSE, FALSE, 0); \
2717 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
2718 gtk_widget_show (vbox1
);
2719 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
2721 vbox2
= gtk_vbox_new (FALSE
, VSPACING_NARROW_2
);
2722 gtk_widget_show (vbox2
);
2723 gtk_box_pack_start (GTK_BOX (vbox1
), vbox2
, FALSE
, FALSE
, 0);
2726 PACK_CHECK_BUTTON (hbox1
, checkbtn_smtpport
, _("SMTP port"));
2727 PACK_PORT_SPINBTN (hbox1
, spinbtn_smtpport
);
2728 SET_TOGGLE_SENSITIVITY (checkbtn_smtpport
, spinbtn_smtpport
);
2729 gtk_size_group_add_widget(size_group
, checkbtn_smtpport
);
2731 PACK_HBOX (hbox_popport
);
2732 PACK_CHECK_BUTTON (hbox_popport
, checkbtn_popport
,
2734 PACK_PORT_SPINBTN (hbox_popport
, spinbtn_popport
);
2735 SET_TOGGLE_SENSITIVITY (checkbtn_popport
, spinbtn_popport
);
2736 gtk_size_group_add_widget(size_group
, checkbtn_popport
);
2738 PACK_HBOX (hbox_imapport
);
2739 PACK_CHECK_BUTTON (hbox_imapport
, checkbtn_imapport
,
2741 PACK_PORT_SPINBTN (hbox_imapport
, spinbtn_imapport
);
2742 SET_TOGGLE_SENSITIVITY (checkbtn_imapport
, spinbtn_imapport
);
2743 gtk_size_group_add_widget(size_group
, checkbtn_imapport
);
2745 PACK_HBOX (hbox_nntpport
);
2746 PACK_CHECK_BUTTON (hbox_nntpport
, checkbtn_nntpport
,
2748 PACK_PORT_SPINBTN (hbox_nntpport
, spinbtn_nntpport
);
2749 SET_TOGGLE_SENSITIVITY (checkbtn_nntpport
, spinbtn_nntpport
);
2750 gtk_size_group_add_widget(size_group
, checkbtn_nntpport
);
2753 PACK_CHECK_BUTTON (hbox1
, checkbtn_domain
, _("Domain name"));
2754 gtk_size_group_add_widget(size_group
, checkbtn_domain
);
2756 tip_domain
= _("The domain name will be used in the generated "
2757 "Message-ID, and when connecting to SMTP servers.");
2759 CLAWS_SET_TIP(checkbtn_domain
, tip_domain
);
2761 entry_domain
= gtk_entry_new ();
2762 gtk_widget_show (entry_domain
);
2763 gtk_box_pack_start (GTK_BOX (hbox1
), entry_domain
, TRUE
, TRUE
, 0);
2764 SET_TOGGLE_SENSITIVITY (checkbtn_domain
, entry_domain
);
2765 CLAWS_SET_TIP(entry_domain
, tip_domain
);
2769 PACK_CHECK_BUTTON (hbox1
, checkbtn_tunnelcmd
,
2770 _("Use command to communicate with server"));
2771 entry_tunnelcmd
= gtk_entry_new ();
2772 gtk_widget_show (entry_tunnelcmd
);
2773 gtk_box_pack_start (GTK_BOX (hbox1
), entry_tunnelcmd
, TRUE
, TRUE
, 0);
2774 SET_TOGGLE_SENSITIVITY (checkbtn_tunnelcmd
, entry_tunnelcmd
);
2777 #if !GTK_CHECK_VERSION(3, 0, 0)
2778 PACK_CHECK_BUTTON (hbox1
, checkbtn_crosspost
,
2779 _("Mark cross-posted messages as read and color:"));
2780 g_signal_connect (G_OBJECT (checkbtn_crosspost
), "toggled",
2781 G_CALLBACK (crosspost_color_toggled
),
2784 colormenu_crosspost
= gtk_cmoption_menu_new();
2785 gtk_widget_show (colormenu_crosspost
);
2786 gtk_box_pack_start (GTK_BOX (hbox1
), colormenu_crosspost
, FALSE
, FALSE
, 0);
2788 menu
= colorlabel_create_color_menu();
2789 gtk_cmoption_menu_set_menu (GTK_CMOPTION_MENU(colormenu_crosspost
), menu
);
2790 SET_TOGGLE_SENSITIVITY(checkbtn_crosspost
, colormenu_crosspost
);
2795 #undef PACK_PORT_SPINBTN
2797 /* special folder setting (maybe these options are redundant) */
2799 vbox3
= gtkut_get_options_frame(vbox1
, &folder_frame
, _("Folder"));
2801 table
= gtk_table_new (4, 3, FALSE
);
2802 gtk_widget_show (table
);
2803 gtk_container_add (GTK_CONTAINER (vbox3
), table
);
2804 gtk_table_set_row_spacings (GTK_TABLE (table
), VSPACING_NARROW_2
);
2805 gtk_table_set_col_spacings (GTK_TABLE (table
), 4);
2807 #define SET_CHECK_BTN_AND_ENTRY(label, checkbtn, entry, n) \
2809 GtkWidget *button; \
2811 checkbtn = gtk_check_button_new_with_label (label); \
2812 gtk_widget_show (checkbtn); \
2813 gtk_table_attach (GTK_TABLE (table), checkbtn, \
2814 0, 1, n, n + 1, GTK_FILL, 0, 0, 0); \
2816 entry = gtk_entry_new (); \
2817 gtk_widget_show (entry); \
2818 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, n, n + 1, \
2819 GTK_EXPAND | GTK_SHRINK | GTK_FILL, \
2820 GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); \
2822 button = gtkut_get_browse_file_btn(_("Browse")); \
2823 gtk_widget_show (button); \
2824 gtk_table_attach (GTK_TABLE (table), button, \
2825 2, 3, n, n + 1, GTK_FILL, 0, 0, 0); \
2827 (G_OBJECT (button), "clicked", \
2828 G_CALLBACK (prefs_account_select_folder_cb), \
2831 SET_TOGGLE_SENSITIVITY (checkbtn, entry); \
2832 SET_TOGGLE_SENSITIVITY (checkbtn, button); \
2835 SET_CHECK_BTN_AND_ENTRY(_("Put sent messages in"),
2836 sent_folder_checkbtn
, sent_folder_entry
, 0);
2837 SET_CHECK_BTN_AND_ENTRY(_("Put queued messages in"),
2838 queue_folder_checkbtn
, queue_folder_entry
, 1);
2839 SET_CHECK_BTN_AND_ENTRY(_("Put draft messages in"),
2840 draft_folder_checkbtn
, draft_folder_entry
, 2);
2841 SET_CHECK_BTN_AND_ENTRY(_("Put deleted messages in"),
2842 trash_folder_checkbtn
, trash_folder_entry
, 3);
2844 page
->smtpport_checkbtn
= checkbtn_smtpport
;
2845 page
->smtpport_spinbtn
= spinbtn_smtpport
;
2846 page
->popport_hbox
= hbox_popport
;
2847 page
->popport_checkbtn
= checkbtn_popport
;
2848 page
->popport_spinbtn
= spinbtn_popport
;
2849 page
->imapport_hbox
= hbox_imapport
;
2850 page
->imapport_checkbtn
= checkbtn_imapport
;
2851 page
->imapport_spinbtn
= spinbtn_imapport
;
2852 page
->nntpport_hbox
= hbox_nntpport
;
2853 page
->nntpport_checkbtn
= checkbtn_nntpport
;
2854 page
->nntpport_spinbtn
= spinbtn_nntpport
;
2855 page
->domain_checkbtn
= checkbtn_domain
;
2856 page
->domain_entry
= entry_domain
;
2857 #if !GTK_CHECK_VERSION(3, 0, 0)
2858 page
->crosspost_checkbtn
= checkbtn_crosspost
;
2859 page
->crosspost_colormenu
= colormenu_crosspost
;
2863 page
->tunnelcmd_checkbtn
= checkbtn_tunnelcmd
;
2864 page
->tunnelcmd_entry
= entry_tunnelcmd
;
2866 page
->sent_folder_checkbtn
= sent_folder_checkbtn
;
2867 page
->sent_folder_entry
= sent_folder_entry
;
2868 page
->queue_folder_checkbtn
= queue_folder_checkbtn
;
2869 page
->queue_folder_entry
= queue_folder_entry
;
2870 page
->draft_folder_checkbtn
= draft_folder_checkbtn
;
2871 page
->draft_folder_entry
= draft_folder_entry
;
2872 page
->trash_folder_checkbtn
= trash_folder_checkbtn
;
2873 page
->trash_folder_entry
= trash_folder_entry
;
2875 tmp_ac_prefs
= *ac_prefs
;
2878 prefs_set_dialog_to_default(advanced_param
);
2880 prefs_set_dialog(advanced_param
);
2884 page
->page
.widget
= vbox1
;
2886 g_object_unref(G_OBJECT(size_group
));
2889 static gint
prefs_basic_apply(void)
2891 RecvProtocol protocol
;
2892 gchar
*old_id
= NULL
;
2893 gchar
*new_id
= NULL
;
2894 struct BasicProtocol
*protocol_optmenu
= (struct BasicProtocol
*) basic_page
.protocol_optmenu
;
2895 GtkWidget
*optmenu
= protocol_optmenu
->combobox
;
2897 protocol
= combobox_get_active_data(GTK_COMBO_BOX(optmenu
));
2899 if (*gtk_entry_get_text(GTK_ENTRY(basic_page
.acname_entry
)) == '\0') {
2900 alertpanel_error(_("Account name is not entered."));
2903 if (*gtk_entry_get_text(GTK_ENTRY(basic_page
.addr_entry
)) == '\0') {
2904 alertpanel_error(_("Mail address is not entered."));
2907 if (((protocol
== A_POP3
) ||
2908 (protocol
== A_LOCAL
&& !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(basic_page
.mailcmd_checkbtn
))) ||
2909 (protocol
== A_NONE
)) &&
2910 *gtk_entry_get_text(GTK_ENTRY(basic_page
.smtpserv_entry
)) == '\0') {
2911 alertpanel_error(_("SMTP server is not entered."));
2914 if ((protocol
== A_POP3
|| protocol
== A_IMAP4
) &&
2915 *gtk_entry_get_text(GTK_ENTRY(basic_page
.uid_entry
)) == '\0') {
2916 alertpanel_error(_("User ID is not entered."));
2919 if (protocol
== A_POP3
&&
2920 *gtk_entry_get_text(GTK_ENTRY(basic_page
.recvserv_entry
)) == '\0') {
2921 alertpanel_error(_("POP server is not entered."));
2924 if (protocol
== A_POP3
|| protocol
== A_LOCAL
) {
2925 GtkWidget
*inbox_entry
= (protocol
== A_POP3
? receive_page
.inbox_entry
: receive_page
.local_inbox_entry
);
2926 const gchar
*mailbox
= gtk_entry_get_text(GTK_ENTRY(inbox_entry
));
2927 FolderItem
*inbox
= folder_find_item_from_identifier(mailbox
);
2930 setup_write_mailbox_path(mainwindow_get_mainwindow(), "Mail");
2931 id
= folder_item_get_identifier(folder_get_default_inbox_for_class(F_MH
));
2932 gtk_entry_set_text(GTK_ENTRY(receive_page
.inbox_entry
),
2934 gtk_entry_set_text(GTK_ENTRY(receive_page
.local_inbox_entry
),
2937 mailbox
= gtk_entry_get_text(GTK_ENTRY(inbox_entry
));
2938 inbox
= folder_find_item_from_identifier(mailbox
);
2940 if (inbox
== NULL
) {
2941 alertpanel_error(_("The default Inbox folder doesn't exist."));
2945 if (protocol
== A_IMAP4
&&
2946 *gtk_entry_get_text(GTK_ENTRY(basic_page
.recvserv_entry
)) == '\0') {
2947 alertpanel_error(_("IMAP server is not entered."));
2950 if (protocol
== A_NNTP
&&
2951 *gtk_entry_get_text(GTK_ENTRY(basic_page
.nntpserv_entry
)) == '\0') {
2952 alertpanel_error(_("NNTP server is not entered."));
2956 if (protocol
== A_LOCAL
&&
2957 *gtk_entry_get_text(GTK_ENTRY(basic_page
.localmbox_entry
)) == '\0') {
2958 alertpanel_error(_("local mailbox filename is not entered."));
2962 if (protocol
== A_LOCAL
&&
2963 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(basic_page
.mailcmd_checkbtn
)) && *gtk_entry_get_text(GTK_ENTRY(basic_page
.mailcmd_entry
)) == '\0') {
2964 alertpanel_error(_("mail command is not entered."));
2968 if (protocol
== A_IMAP4
|| protocol
== A_NNTP
)
2969 old_id
= g_strdup_printf("#%s/%s",
2970 protocol
== A_IMAP4
? "imap":"news",
2971 tmp_ac_prefs
.account_name
? tmp_ac_prefs
.account_name
: "(null)");
2973 prefs_set_data_from_dialog(basic_param
);
2975 /* Passwords are stored outside of PrefParams. */
2976 passwd_store_set_account(tmp_ac_prefs
.account_id
,
2978 gtk_entry_get_text(GTK_ENTRY(basic_page
.pass_entry
)),
2981 if (protocol
== A_IMAP4
|| protocol
== A_NNTP
) {
2982 new_id
= g_strdup_printf("#%s/%s",
2983 protocol
== A_IMAP4
? "imap":"news",
2984 tmp_ac_prefs
.account_name
);
2985 if (old_id
!= NULL
&& new_id
!= NULL
)
2986 prefs_filtering_rename_path(old_id
, new_id
);
2994 static gint
prefs_receive_apply(void)
2996 prefs_set_data_from_dialog(receive_param
);
3000 static gint
prefs_send_apply(void)
3002 prefs_set_data_from_dialog(send_param
);
3004 /* Passwords are stored outside of PrefParams. */
3005 passwd_store_set_account(tmp_ac_prefs
.account_id
,
3007 gtk_entry_get_text(GTK_ENTRY(send_page
.smtp_pass_entry
)),
3013 static gint
prefs_compose_apply(void)
3015 prefs_set_data_from_dialog(compose_param
);
3019 static gint
prefs_templates_apply(void)
3021 prefs_set_data_from_dialog(templates_param
);
3025 static gint
prefs_privacy_apply(void)
3027 prefs_set_data_from_dialog(privacy_param
);
3032 static gint
prefs_ssl_apply(void)
3034 prefs_set_data_from_dialog(ssl_param
);
3036 /* Passwords are stored outside of PrefParams. */
3037 passwd_store_set_account(tmp_ac_prefs
.account_id
,
3038 PWS_ACCOUNT_RECV_CERT
,
3039 gtk_entry_get_text(GTK_ENTRY(ssl_page
.entry_in_cert_pass
)),
3041 passwd_store_set_account(tmp_ac_prefs
.account_id
,
3042 PWS_ACCOUNT_SEND_CERT
,
3043 gtk_entry_get_text(GTK_ENTRY(ssl_page
.entry_out_cert_pass
)),
3050 static gint
prefs_advanced_apply(void)
3052 prefs_set_data_from_dialog(advanced_param
);
3056 static void basic_destroy_widget_func(PrefsPage
*_page
)
3058 /* BasicPage *page = (BasicPage *) _page; */
3061 static void receive_destroy_widget_func(PrefsPage
*_page
)
3063 /* ReceivePage *page = (ReceivePage *) _page; */
3066 static void send_destroy_widget_func(PrefsPage
*_page
)
3068 /* SendPage *page = (SendPage *) _page; */
3071 static void compose_destroy_widget_func(PrefsPage
*_page
)
3073 /* ComposePage *page = (ComposePage *) _page; */
3076 static void templates_destroy_widget_func(PrefsPage
*_page
)
3078 /* TemplatesPage *page = (TemplatesPage *) _page; */
3081 static void privacy_destroy_widget_func(PrefsPage
*_page
)
3083 /* PrivacyPage *page = (PrivacyPage *) _page; */
3087 static void ssl_destroy_widget_func(PrefsPage
*_page
)
3089 /* SSLPage *page = (SSLPage *) _page; */
3093 static void advanced_destroy_widget_func(PrefsPage
*_page
)
3095 /* AdvancedPage *page = (AdvancedPage *) _page; */
3098 static gboolean
basic_can_close_func(PrefsPage
*_page
)
3100 BasicPage
*page
= (BasicPage
*) _page
;
3102 if (!page
->page
.page_open
)
3105 return prefs_basic_apply() >= 0;
3108 static gboolean
receive_can_close_func(PrefsPage
*_page
)
3110 ReceivePage
*page
= (ReceivePage
*) _page
;
3112 if (!page
->page
.page_open
)
3115 return prefs_receive_apply() >= 0;
3118 static gboolean
send_can_close_func(PrefsPage
*_page
)
3120 SendPage
*page
= (SendPage
*) _page
;
3122 if (!page
->page
.page_open
)
3125 return prefs_send_apply() >= 0;
3128 static gboolean
compose_can_close_func(PrefsPage
*_page
)
3130 ComposePage
*page
= (ComposePage
*) _page
;
3132 if (!page
->page
.page_open
)
3135 return prefs_compose_apply() >= 0;
3138 static gboolean
templates_can_close_func(PrefsPage
*_page
)
3140 TemplatesPage
*page
= (TemplatesPage
*) _page
;
3142 if (!page
->page
.page_open
)
3145 return prefs_templates_apply() >= 0;
3148 static gboolean
privacy_can_close_func(PrefsPage
*_page
)
3150 PrivacyPage
*page
= (PrivacyPage
*) _page
;
3152 if (!page
->page
.page_open
)
3155 return prefs_privacy_apply() >= 0;
3159 static gboolean
ssl_can_close_func(PrefsPage
*_page
)
3161 SSLPage
*page
= (SSLPage
*) _page
;
3163 if (!page
->page
.page_open
)
3166 return prefs_ssl_apply() >= 0;
3170 static gboolean
advanced_can_close_func(PrefsPage
*_page
)
3172 AdvancedPage
*page
= (AdvancedPage
*) _page
;
3174 if (!page
->page
.page_open
)
3177 return prefs_advanced_apply() >= 0;
3180 static void basic_save_func(PrefsPage
*_page
)
3182 BasicPage
*page
= (BasicPage
*) _page
;
3184 if (!page
->page
.page_open
)
3187 if (prefs_basic_apply() >= 0)
3191 static void receive_save_func(PrefsPage
*_page
)
3193 ReceivePage
*page
= (ReceivePage
*) _page
;
3195 if (!page
->page
.page_open
)
3198 if (prefs_receive_apply() >= 0)
3202 static void send_save_func(PrefsPage
*_page
)
3204 SendPage
*page
= (SendPage
*) _page
;
3206 if (!page
->page
.page_open
)
3209 if (prefs_send_apply() >= 0)
3213 static void compose_save_func(PrefsPage
*_page
)
3215 ComposePage
*page
= (ComposePage
*) _page
;
3217 if (!page
->page
.page_open
)
3220 if (prefs_compose_apply() >= 0)
3224 static void templates_save_func(PrefsPage
*_page
)
3226 TemplatesPage
*page
= (TemplatesPage
*) _page
;
3228 if (!page
->page
.page_open
)
3231 quotefmt_check_new_msg_formats(tmp_ac_prefs
.compose_with_format
,
3233 tmp_ac_prefs
.compose_subject_format
,
3234 tmp_ac_prefs
.compose_body_format
);
3235 quotefmt_check_reply_formats(tmp_ac_prefs
.reply_with_format
,
3237 tmp_ac_prefs
.reply_quotemark
,
3238 tmp_ac_prefs
.reply_body_format
);
3239 quotefmt_check_forward_formats(tmp_ac_prefs
.forward_with_format
,
3241 tmp_ac_prefs
.forward_quotemark
,
3242 tmp_ac_prefs
.forward_body_format
);
3243 if (prefs_templates_apply() >= 0)
3247 static void privacy_save_func(PrefsPage
*_page
)
3249 PrivacyPage
*page
= (PrivacyPage
*) _page
;
3251 if (!page
->page
.page_open
)
3254 if (prefs_privacy_apply() >= 0)
3259 static void ssl_save_func(PrefsPage
*_page
)
3261 SSLPage
*page
= (SSLPage
*) _page
;
3263 if (!page
->page
.page_open
)
3266 if (prefs_ssl_apply() >= 0)
3271 static void advanced_save_func(PrefsPage
*_page
)
3273 AdvancedPage
*page
= (AdvancedPage
*) _page
;
3275 if (!page
->page
.page_open
)
3278 if (prefs_advanced_apply() >= 0)
3282 static void register_basic_page(void)
3284 static gchar
*path
[3];
3286 path
[0] = _("Account");
3287 path
[1] = _("Basic");
3290 basic_page
.page
.path
= path
;
3291 basic_page
.page
.weight
= 1000.0;
3292 basic_page
.page
.create_widget
= basic_create_widget_func
;
3293 basic_page
.page
.destroy_widget
= basic_destroy_widget_func
;
3294 basic_page
.page
.save_page
= basic_save_func
;
3295 basic_page
.page
.can_close
= basic_can_close_func
;
3297 prefs_account_register_page((PrefsPage
*) &basic_page
);
3300 static void register_receive_page(void)
3302 static gchar
*path
[3];
3304 path
[0] = _("Account");
3305 path
[1] = _("Receive");
3308 receive_page
.page
.path
= path
;
3309 receive_page
.page
.weight
= 1000.0;
3310 receive_page
.page
.create_widget
= receive_create_widget_func
;
3311 receive_page
.page
.destroy_widget
= receive_destroy_widget_func
;
3312 receive_page
.page
.save_page
= receive_save_func
;
3313 receive_page
.page
.can_close
= receive_can_close_func
;
3315 prefs_account_register_page((PrefsPage
*) &receive_page
);
3318 static void register_send_page(void)
3320 static gchar
*path
[3];
3322 path
[0] = _("Account");
3323 path
[1] = _("Send");
3326 send_page
.page
.path
= path
;
3327 send_page
.page
.weight
= 1000.0;
3328 send_page
.page
.create_widget
= send_create_widget_func
;
3329 send_page
.page
.destroy_widget
= send_destroy_widget_func
;
3330 send_page
.page
.save_page
= send_save_func
;
3331 send_page
.page
.can_close
= send_can_close_func
;
3333 prefs_account_register_page((PrefsPage
*) &send_page
);
3336 static void register_compose_page(void)
3338 static gchar
*path
[3];
3340 path
[0] = _("Account");
3341 path
[1] = _("Compose");
3344 compose_page
.page
.path
= path
;
3345 compose_page
.page
.weight
= 1000.0;
3346 compose_page
.page
.create_widget
= compose_create_widget_func
;
3347 compose_page
.page
.destroy_widget
= compose_destroy_widget_func
;
3348 compose_page
.page
.save_page
= compose_save_func
;
3349 compose_page
.page
.can_close
= compose_can_close_func
;
3351 prefs_account_register_page((PrefsPage
*) &compose_page
);
3354 static void register_templates_page(void)
3356 static gchar
*path
[3];
3358 path
[0] = _("Account");
3359 path
[1] = _("Templates");
3362 templates_page
.page
.path
= path
;
3363 templates_page
.page
.weight
= 1000.0;
3364 templates_page
.page
.create_widget
= templates_create_widget_func
;
3365 templates_page
.page
.destroy_widget
= templates_destroy_widget_func
;
3366 templates_page
.page
.save_page
= templates_save_func
;
3367 templates_page
.page
.can_close
= templates_can_close_func
;
3369 prefs_account_register_page((PrefsPage
*) &templates_page
);
3372 static void register_privacy_page(void)
3374 static gchar
*path
[3];
3376 path
[0] = _("Account");
3377 path
[1] = _("Privacy");
3380 privacy_page
.page
.path
= path
;
3381 privacy_page
.page
.weight
= 1000.0;
3382 privacy_page
.page
.create_widget
= privacy_create_widget_func
;
3383 privacy_page
.page
.destroy_widget
= privacy_destroy_widget_func
;
3384 privacy_page
.page
.save_page
= privacy_save_func
;
3385 privacy_page
.page
.can_close
= privacy_can_close_func
;
3387 prefs_account_register_page((PrefsPage
*) &privacy_page
);
3391 static void register_ssl_page(void)
3393 static gchar
*path
[3];
3395 path
[0] = _("Account");
3396 path
[1] = _("SSL/TLS");
3399 ssl_page
.page
.path
= path
;
3400 ssl_page
.page
.weight
= 1000.0;
3401 ssl_page
.page
.create_widget
= ssl_create_widget_func
;
3402 ssl_page
.page
.destroy_widget
= ssl_destroy_widget_func
;
3403 ssl_page
.page
.save_page
= ssl_save_func
;
3404 ssl_page
.page
.can_close
= ssl_can_close_func
;
3406 prefs_account_register_page((PrefsPage
*) &ssl_page
);
3409 static gboolean
sslcert_get_client_cert_hook(gpointer source
, gpointer data
)
3411 SSLClientCertHookData
*hookdata
= (SSLClientCertHookData
*)source
;
3412 PrefsAccount
*account
= (PrefsAccount
*)hookdata
->account
;
3415 hookdata
->cert_path
= NULL
;
3416 hookdata
->password
= NULL
;
3418 if (!g_list_find(account_get_list(), account
)) {
3419 g_warning("can't find account");
3423 if (hookdata
->is_smtp
) {
3424 if (account
->out_ssl_client_cert_file
&& *account
->out_ssl_client_cert_file
)
3425 hookdata
->cert_path
= account
->out_ssl_client_cert_file
;
3426 pwd_id
= PWS_ACCOUNT_SEND_CERT
;
3428 if (account
->in_ssl_client_cert_file
&& *account
->in_ssl_client_cert_file
)
3429 hookdata
->cert_path
= account
->in_ssl_client_cert_file
;
3430 pwd_id
= PWS_ACCOUNT_RECV_CERT
;
3433 hookdata
->password
= passwd_store_get_account(account
->account_id
, pwd_id
);
3437 struct GetPassData
{
3444 static gboolean
do_get_pass(gpointer data
)
3446 struct GetPassData
*pass_data
= (struct GetPassData
*)data
;
3447 g_mutex_lock(pass_data
->mutex
);
3448 *(pass_data
->pass
) = input_dialog_query_password("the PKCS12 client certificate", NULL
);
3449 g_cond_signal(pass_data
->cond
);
3450 g_mutex_unlock(pass_data
->mutex
);
3453 static gboolean
sslcert_get_password(gpointer source
, gpointer data
)
3455 struct GetPassData pass_data
;
3456 /* do complicated stuff to be able to call GTK from the mainloop */
3457 #if !GLIB_CHECK_VERSION(2,32,0)
3458 pass_data
.cond
= g_cond_new();
3460 pass_data
.cond
= g_new0(GCond
, 1);
3461 g_cond_init(pass_data
.cond
);
3463 pass_data
.mutex
= cm_mutex_new();
3464 pass_data
.pass
= (gchar
**)source
;
3466 g_mutex_lock(pass_data
.mutex
);
3468 g_idle_add(do_get_pass
, &pass_data
);
3470 g_cond_wait(pass_data
.cond
, pass_data
.mutex
);
3471 #if !GLIB_CHECK_VERSION(2,32,0)
3472 g_cond_free(pass_data
.cond
);
3474 g_cond_clear(pass_data
.cond
);
3475 g_free(pass_data
.cond
);
3477 g_mutex_unlock(pass_data
.mutex
);
3478 cm_mutex_free(pass_data
.mutex
);
3484 static void register_advanced_page(void)
3486 static gchar
*path
[3];
3488 path
[0] = _("Account");
3489 path
[1] = _("Advanced");
3492 advanced_page
.page
.path
= path
;
3493 advanced_page
.page
.weight
= 1000.0;
3494 advanced_page
.page
.create_widget
= advanced_create_widget_func
;
3495 advanced_page
.page
.destroy_widget
= advanced_destroy_widget_func
;
3496 advanced_page
.page
.save_page
= advanced_save_func
;
3497 advanced_page
.page
.can_close
= advanced_can_close_func
;
3499 prefs_account_register_page((PrefsPage
*) &advanced_page
);
3502 void prefs_account_init()
3504 register_basic_page();
3505 register_receive_page();
3506 register_send_page();
3507 register_compose_page();
3508 register_templates_page();
3509 register_privacy_page();
3511 register_ssl_page();
3512 hooks_register_hook(SSLCERT_GET_CLIENT_CERT_HOOKLIST
, sslcert_get_client_cert_hook
, NULL
);
3513 hooks_register_hook(SSL_CERT_GET_PASSWORD
, sslcert_get_password
, NULL
);
3515 register_advanced_page();
3518 PrefsAccount
*prefs_account_new(void)
3520 PrefsAccount
*ac_prefs
;
3522 ac_prefs
= g_new0(PrefsAccount
, 1);
3523 memset(&tmp_ac_prefs
, 0, sizeof(PrefsAccount
));
3524 prefs_set_default(basic_param
);
3525 prefs_set_default(receive_param
);
3526 prefs_set_default(send_param
);
3527 prefs_set_default(compose_param
);
3528 prefs_set_default(templates_param
);
3529 prefs_set_default(privacy_param
);
3530 prefs_set_default(ssl_param
);
3531 prefs_set_default(advanced_param
);
3532 *ac_prefs
= tmp_ac_prefs
;
3533 ac_prefs
->account_id
= prefs_account_get_new_id();
3535 ac_prefs
->privacy_prefs
= g_hash_table_new(g_str_hash
, g_str_equal
);
3540 void prefs_account_read_config(PrefsAccount
*ac_prefs
, const gchar
*label
)
3542 const gchar
*p
= label
;
3545 gchar
**strv
, **cur
;
3548 cm_return_if_fail(ac_prefs
!= NULL
);
3549 cm_return_if_fail(label
!= NULL
);
3551 memset(&tmp_ac_prefs
, 0, sizeof(PrefsAccount
));
3552 tmp_ac_prefs
.privacy_prefs
= ac_prefs
->privacy_prefs
;
3554 rcpath
= g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S
, ACCOUNT_RC
, NULL
);
3555 prefs_read_config(basic_param
, label
, rcpath
, NULL
);
3556 prefs_read_config(receive_param
, label
, rcpath
, NULL
);
3557 prefs_read_config(send_param
, label
, rcpath
, NULL
);
3558 prefs_read_config(compose_param
, label
, rcpath
, NULL
);
3559 prefs_read_config(templates_param
, label
, rcpath
, NULL
);
3560 prefs_read_config(privacy_param
, label
, rcpath
, NULL
);
3561 prefs_read_config(ssl_param
, label
, rcpath
, NULL
);
3562 prefs_read_config(advanced_param
, label
, rcpath
, NULL
);
3565 *ac_prefs
= tmp_ac_prefs
;
3566 while (*p
&& !g_ascii_isdigit(*p
)) p
++;
3568 if (id
< 0) g_warning("wrong account id: %d", id
);
3569 ac_prefs
->account_id
= id
;
3571 if (privacy_prefs
!= NULL
) {
3572 strv
= g_strsplit(privacy_prefs
, ",", 0);
3573 for (cur
= strv
; *cur
!= NULL
; cur
++) {
3574 gchar
*encvalue
, *tmp
;
3576 encvalue
= strchr(*cur
, '=');
3577 if (encvalue
== NULL
)
3582 tmp
= g_base64_decode_zero(encvalue
, &len
);
3584 g_hash_table_insert(ac_prefs
->privacy_prefs
, g_strdup(*cur
), tmp
);
3589 g_free(privacy_prefs
);
3590 privacy_prefs
= NULL
;
3593 gboolean passwords_migrated
= FALSE
;
3595 if (ac_prefs
->passwd
!= NULL
&& strlen(ac_prefs
->passwd
) > 1) {
3596 passwd_store_set_account(ac_prefs
->account_id
,
3597 PWS_ACCOUNT_RECV
, ac_prefs
->passwd
, TRUE
);
3598 passwords_migrated
= TRUE
;
3600 if (ac_prefs
->smtp_passwd
!= NULL
&& strlen(ac_prefs
->smtp_passwd
) > 1) {
3601 passwd_store_set_account(ac_prefs
->account_id
,
3602 PWS_ACCOUNT_SEND
, ac_prefs
->smtp_passwd
, TRUE
);
3603 passwords_migrated
= TRUE
;
3605 if (ac_prefs
->in_ssl_client_cert_pass
!= NULL
3606 && strlen(ac_prefs
->in_ssl_client_cert_pass
) > 1) {
3607 passwd_store_set_account(ac_prefs
->account_id
,
3608 PWS_ACCOUNT_RECV_CERT
, ac_prefs
->in_ssl_client_cert_pass
, TRUE
);
3609 passwords_migrated
= TRUE
;
3611 if (ac_prefs
->out_ssl_client_cert_pass
!= NULL
3612 && strlen(ac_prefs
->out_ssl_client_cert_pass
) > 1) {
3613 passwd_store_set_account(ac_prefs
->account_id
,
3614 PWS_ACCOUNT_SEND_CERT
, ac_prefs
->out_ssl_client_cert_pass
, TRUE
);
3615 passwords_migrated
= TRUE
;
3618 /* Write out password store to file immediately after their move
3619 * from accountrc there. */
3620 if (passwords_migrated
)
3621 passwd_store_write_config();
3623 ac_prefs
->receive_in_progress
= FALSE
;
3625 prefs_custom_header_read_config(ac_prefs
);
3628 static void create_privacy_prefs(gpointer key
, gpointer _value
, gpointer user_data
)
3630 GString
*str
= (GString
*) user_data
;
3632 gchar
*value
= (gchar
*) _value
;
3635 g_string_append_c(str
, ',');
3637 encvalue
= g_base64_encode(value
, strlen(value
));
3638 g_string_append_printf(str
, "%s=%s", (gchar
*) key
, encvalue
);
3642 #define WRITE_PARAM(PARAM_TABLE) \
3643 if (prefs_write_param(PARAM_TABLE, pfile->fp) < 0) { \
3644 g_warning("failed to write configuration to file"); \
3645 prefs_file_close_revert(pfile); \
3646 g_free(privacy_prefs); \
3647 privacy_prefs = NULL; \
3651 void prefs_account_write_config_all(GList
*account_list
)
3657 rcpath
= g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S
, ACCOUNT_RC
, NULL
);
3658 if ((pfile
= prefs_write_open(rcpath
)) == NULL
) {
3664 for (cur
= account_list
; cur
!= NULL
; cur
= cur
->next
) {
3667 tmp_ac_prefs
= *(PrefsAccount
*)cur
->data
;
3668 if (fprintf(pfile
->fp
, "[Account: %d]\n",
3669 tmp_ac_prefs
.account_id
) <= 0)
3672 str
= g_string_sized_new(32);
3673 g_hash_table_foreach(tmp_ac_prefs
.privacy_prefs
, create_privacy_prefs
, str
);
3674 privacy_prefs
= str
->str
;
3675 g_string_free(str
, FALSE
);
3677 WRITE_PARAM(basic_param
)
3678 WRITE_PARAM(receive_param
)
3679 WRITE_PARAM(send_param
)
3680 WRITE_PARAM(compose_param
)
3681 WRITE_PARAM(templates_param
)
3682 WRITE_PARAM(privacy_param
)
3683 WRITE_PARAM(ssl_param
)
3684 WRITE_PARAM(advanced_param
)
3686 g_free(privacy_prefs
);
3687 privacy_prefs
= NULL
;
3690 if (fputc('\n', pfile
->fp
) == EOF
) {
3691 FILE_OP_ERROR(rcpath
, "fputc");
3692 prefs_file_close_revert(pfile
);
3698 if (prefs_file_close(pfile
) < 0)
3699 g_warning("failed to write configuration to file");
3701 passwd_store_write_config();
3705 static gboolean
free_privacy_prefs(gpointer key
, gpointer value
, gpointer user_data
)
3713 void prefs_account_free(PrefsAccount
*ac_prefs
)
3715 if (!ac_prefs
) return;
3717 g_hash_table_foreach_remove(ac_prefs
->privacy_prefs
, free_privacy_prefs
, NULL
);
3719 tmp_ac_prefs
= *ac_prefs
;
3720 prefs_free(basic_param
);
3721 prefs_free(receive_param
);
3722 prefs_free(send_param
);
3723 prefs_free(compose_param
);
3724 prefs_free(templates_param
);
3725 prefs_free(privacy_param
);
3726 prefs_free(ssl_param
);
3727 prefs_free(advanced_param
);
3730 const gchar
*prefs_account_get_privacy_prefs(PrefsAccount
*account
, gchar
*id
)
3732 return g_hash_table_lookup(account
->privacy_prefs
, id
);
3735 void prefs_account_set_privacy_prefs(PrefsAccount
*account
, gchar
*id
, gchar
*new_value
)
3737 gchar
*orig_key
= NULL
, *value
;
3739 if (g_hash_table_lookup_extended(account
->privacy_prefs
, id
, (gpointer
*)(gchar
*) &orig_key
, (gpointer
*)(gchar
*) &value
)) {
3740 g_hash_table_remove(account
->privacy_prefs
, id
);
3746 if (new_value
!= NULL
)
3747 g_hash_table_insert(account
->privacy_prefs
, g_strdup(id
), g_strdup(new_value
));
3750 static gint
prefs_account_get_new_id(void)
3754 static gint last_id
= 0;
3756 for (ac_list
= account_get_list(); ac_list
!= NULL
;
3757 ac_list
= ac_list
->next
) {
3758 ac
= (PrefsAccount
*)ac_list
->data
;
3759 if (last_id
< ac
->account_id
)
3760 last_id
= ac
->account_id
;
3766 static void destroy_dialog(gpointer data
)
3768 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
3770 gboolean update_fld_list
= FALSE
;
3771 if (ac_prefs
->protocol
== A_IMAP4
&& !new_account
) {
3772 if ((&tmp_ac_prefs
)->imap_subsonly
!= ac_prefs
->imap_subsonly
) {
3773 update_fld_list
= TRUE
;
3776 *ac_prefs
= tmp_ac_prefs
;
3777 if (update_fld_list
)
3778 folderview_rescan_tree(ac_prefs
->folder
, FALSE
);
3779 } else /* the customhdr_list may have changed, update it anyway */
3780 ac_prefs
->customhdr_list
= (&tmp_ac_prefs
)->customhdr_list
;
3786 PrefsAccount
*prefs_account_open(PrefsAccount
*ac_prefs
, gboolean
*dirty
)
3790 if (prefs_rc_is_readonly(ACCOUNT_RC
))
3793 debug_print("Opening account preferences window...\n");
3800 ac_prefs
= prefs_account_new();
3803 new_account
= FALSE
;
3806 title
= g_strdup (_("Preferences for new account"));
3808 title
= g_strdup_printf (_("%s - Account preferences"),
3809 ac_prefs
->account_name
);
3811 prefswindow_open_full(title
, prefs_pages
, ac_prefs
, destroy_dialog
,
3812 &prefs_common
.editaccountwin_width
, &prefs_common
.editaccountwin_height
,
3813 TRUE
, NULL
, NULL
, NULL
);
3819 if (!cancelled
&& dirty
!= NULL
)
3821 if (cancelled
&& new_account
)
3824 if (ac_prefs
->recv_server
)
3825 g_strstrip(ac_prefs
->recv_server
);
3826 if (ac_prefs
->smtp_server
)
3827 g_strstrip(ac_prefs
->smtp_server
);
3828 if (ac_prefs
->nntp_server
)
3829 g_strstrip(ac_prefs
->nntp_server
);
3835 #if !GTK_CHECK_VERSION(3, 0, 0)
3836 static void crosspost_color_toggled(void)
3840 is_active
= gtk_toggle_button_get_active
3841 (GTK_TOGGLE_BUTTON(advanced_page
.crosspost_checkbtn
));
3842 gtk_widget_set_sensitive(advanced_page
.crosspost_colormenu
, is_active
);
3845 static void prefs_account_crosspost_set_data_from_colormenu(PrefParam
*pparam
)
3848 GtkWidget
*menuitem
;
3850 menu
= gtk_cmoption_menu_get_menu(GTK_CMOPTION_MENU(advanced_page
.crosspost_colormenu
));
3851 menuitem
= gtk_menu_get_active(GTK_MENU(menu
));
3852 *((gint
*)pparam
->data
) = GPOINTER_TO_INT
3853 (g_object_get_data(G_OBJECT(menuitem
), "color"));
3856 static void prefs_account_crosspost_set_colormenu(PrefParam
*pparam
)
3858 gint colorlabel
= *((gint
*)pparam
->data
);
3859 GtkCMOptionMenu
*colormenu
= GTK_CMOPTION_MENU(*pparam
->widget
);
3861 GtkWidget
*menuitem
;
3863 gtk_cmoption_menu_set_history(colormenu
, colorlabel
+ 1);
3864 menu
= gtk_cmoption_menu_get_menu(colormenu
);
3865 menuitem
= gtk_menu_get_active(GTK_MENU(menu
));
3866 gtk_menu_item_activate(GTK_MENU_ITEM(menuitem
));
3870 static void pop_bfr_smtp_tm_set_sens(GtkWidget
*widget
, gpointer data
)
3872 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_tm_spinbtn
,
3873 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(send_page
.pop_bfr_smtp_checkbtn
)));
3874 gtk_widget_set_sensitive(send_page
.pop_auth_timeout_lbl
,
3875 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(send_page
.pop_bfr_smtp_checkbtn
)));
3876 gtk_widget_set_sensitive(send_page
.pop_auth_minutes_lbl
,
3877 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(send_page
.pop_bfr_smtp_checkbtn
)));
3880 static void prefs_account_select_folder_cb(GtkWidget
*widget
, gpointer data
)
3885 item
= foldersel_folder_sel(NULL
, FOLDER_SEL_COPY
, NULL
, FALSE
);
3886 if (item
&& item
->path
) {
3887 id
= folder_item_get_identifier(item
);
3889 gtk_entry_set_text(GTK_ENTRY(data
), id
);
3895 #if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
3896 static void auto_configure_cb (GtkWidget
*widget
, gpointer data
)
3898 gchar
*address
= NULL
;
3899 AutoConfigureData
*recv_data
;
3900 AutoConfigureData
*send_data
;
3901 static GCancellable
*recv_cancel
= NULL
;
3902 static GCancellable
*send_cancel
= NULL
;
3903 RecvProtocol protocol
;
3904 struct BasicProtocol
*protocol_optmenu
= (struct BasicProtocol
*) basic_page
.protocol_optmenu
;
3905 GtkWidget
*optmenu
= protocol_optmenu
->combobox
;
3908 recv_cancel
= g_cancellable_new();
3909 send_cancel
= g_cancellable_new();
3912 if (widget
== basic_page
.auto_configure_cancel_btn
) {
3913 g_cancellable_cancel(recv_cancel
);
3914 g_cancellable_cancel(send_cancel
);
3915 g_object_unref(recv_cancel
);
3916 g_object_unref(send_cancel
);
3922 protocol
= combobox_get_active_data(GTK_COMBO_BOX(optmenu
));
3924 address
= gtk_editable_get_chars(GTK_EDITABLE(basic_page
.addr_entry
), 0, -1);
3926 if (strchr(address
, '@') == NULL
) {
3928 gtk_label_set_text(GTK_LABEL(basic_page
.auto_configure_lbl
),
3929 _("Failed (wrong address)"));
3933 if (protocol
== A_POP3
|| protocol
== A_IMAP4
) {
3934 recv_data
= g_new0(AutoConfigureData
, 1);
3935 recv_data
->configure_button
= GTK_BUTTON(basic_page
.auto_configure_btn
);
3936 recv_data
->cancel_button
= GTK_BUTTON(basic_page
.auto_configure_cancel_btn
);
3937 recv_data
->info_label
= GTK_LABEL(basic_page
.auto_configure_lbl
);
3938 recv_data
->cancel
= recv_cancel
;
3941 recv_data
->ssl_service
= "pop3s";
3942 recv_data
->tls_service
= "pop3";
3943 recv_data
->address
= g_strdup(address
);
3944 recv_data
->hostname_entry
= GTK_ENTRY(basic_page
.recvserv_entry
);
3945 recv_data
->set_port
= GTK_TOGGLE_BUTTON(advanced_page
.popport_checkbtn
);
3946 recv_data
->port
= GTK_SPIN_BUTTON(advanced_page
.popport_spinbtn
);
3947 recv_data
->tls_checkbtn
= GTK_TOGGLE_BUTTON(ssl_page
.pop_starttls_radiobtn
);
3948 recv_data
->ssl_checkbtn
= GTK_TOGGLE_BUTTON(ssl_page
.pop_ssltunnel_radiobtn
);
3949 recv_data
->default_port
= 110;
3950 recv_data
->default_ssl_port
= 995;
3951 recv_data
->uid_entry
= GTK_ENTRY(basic_page
.uid_entry
);
3954 recv_data
->ssl_service
= "imaps";
3955 recv_data
->tls_service
= "imap";
3956 recv_data
->address
= g_strdup(address
);
3957 recv_data
->hostname_entry
= GTK_ENTRY(basic_page
.recvserv_entry
);
3958 recv_data
->set_port
= GTK_TOGGLE_BUTTON(advanced_page
.imapport_checkbtn
);
3959 recv_data
->port
= GTK_SPIN_BUTTON(advanced_page
.imapport_spinbtn
);
3960 recv_data
->tls_checkbtn
= GTK_TOGGLE_BUTTON(ssl_page
.imap_starttls_radiobtn
);
3961 recv_data
->ssl_checkbtn
= GTK_TOGGLE_BUTTON(ssl_page
.imap_ssltunnel_radiobtn
);
3962 recv_data
->default_port
= 143;
3963 recv_data
->default_ssl_port
= 993;
3964 recv_data
->uid_entry
= GTK_ENTRY(basic_page
.uid_entry
);
3967 cm_return_if_fail(FALSE
);
3969 auto_configure_service(recv_data
);
3972 send_data
= g_new0(AutoConfigureData
, 1);
3973 send_data
->configure_button
= GTK_BUTTON(basic_page
.auto_configure_btn
);
3974 send_data
->cancel_button
= GTK_BUTTON(basic_page
.auto_configure_cancel_btn
);
3975 send_data
->info_label
= GTK_LABEL(basic_page
.auto_configure_lbl
);
3976 send_data
->cancel
= send_cancel
;
3978 send_data
->ssl_service
= NULL
;
3979 send_data
->tls_service
= "submission";
3980 send_data
->address
= g_strdup(address
);
3981 send_data
->hostname_entry
= GTK_ENTRY(basic_page
.smtpserv_entry
);
3982 send_data
->set_port
= GTK_TOGGLE_BUTTON(advanced_page
.smtpport_checkbtn
);
3983 send_data
->port
= GTK_SPIN_BUTTON(advanced_page
.smtpport_spinbtn
);
3984 send_data
->tls_checkbtn
= GTK_TOGGLE_BUTTON(ssl_page
.smtp_starttls_radiobtn
);
3985 send_data
->ssl_checkbtn
= NULL
;
3986 send_data
->default_port
= 25;
3987 send_data
->default_ssl_port
= -1;
3988 send_data
->uid_entry
= NULL
;
3989 send_data
->auth_checkbtn
= GTK_TOGGLE_BUTTON(send_page
.smtp_auth_checkbtn
);
3991 auto_configure_service(send_data
);
3997 static void prefs_account_sigfile_radiobtn_cb(GtkWidget
*widget
, gpointer data
)
3999 gtk_widget_set_sensitive(GTK_WIDGET(signature_browse_button
), TRUE
);
4000 gtk_widget_set_sensitive(GTK_WIDGET(signature_edit_button
), TRUE
);
4003 static void prefs_account_sigcmd_radiobtn_cb(GtkWidget
*widget
, gpointer data
)
4005 gtk_widget_set_sensitive(GTK_WIDGET(signature_browse_button
), FALSE
);
4006 gtk_widget_set_sensitive(GTK_WIDGET(signature_edit_button
), FALSE
);
4009 static void prefs_account_signature_browse_cb(GtkWidget
*widget
, gpointer data
)
4012 gchar
*utf8_filename
;
4014 filename
= filesel_select_file_open(_("Select signature file"), NULL
);
4015 if (!filename
) return;
4017 utf8_filename
= g_filename_to_utf8(filename
, -1, NULL
, NULL
, NULL
);
4018 if (!utf8_filename
) {
4019 g_warning("prefs_account_signature_browse_cb(): failed to convert character set.");
4020 utf8_filename
= g_strdup(filename
);
4022 gtk_entry_set_text(GTK_ENTRY(entry_sigpath
), utf8_filename
);
4023 g_free(utf8_filename
);
4027 static void prefs_account_in_cert_browse_cb(GtkWidget
*widget
, gpointer data
)
4030 gchar
*utf8_filename
;
4032 filename
= filesel_select_file_open(_("Select certificate file"), NULL
);
4033 if (!filename
) return;
4035 utf8_filename
= g_filename_to_utf8(filename
, -1, NULL
, NULL
, NULL
);
4036 if (!utf8_filename
) {
4037 g_warning("prefs_account_cert_browse_cb(): failed to convert character set.");
4038 utf8_filename
= g_strdup(filename
);
4040 gtk_entry_set_text(GTK_ENTRY(entry_in_cert_file
), utf8_filename
);
4041 g_free(utf8_filename
);
4044 static void prefs_account_out_cert_browse_cb(GtkWidget
*widget
, gpointer data
)
4047 gchar
*utf8_filename
;
4049 filename
= filesel_select_file_open(_("Select certificate file"), NULL
);
4050 if (!filename
) return;
4052 utf8_filename
= g_filename_to_utf8(filename
, -1, NULL
, NULL
, NULL
);
4053 if (!utf8_filename
) {
4054 g_warning("prefs_account_cert_browse_cb(): failed to convert character set.");
4055 utf8_filename
= g_strdup(filename
);
4057 gtk_entry_set_text(GTK_ENTRY(entry_out_cert_file
), utf8_filename
);
4058 g_free(utf8_filename
);
4062 static void prefs_account_signature_edit_cb(GtkWidget
*widget
, gpointer data
)
4064 const gchar
*sigpath
= gtk_entry_get_text(GTK_ENTRY(data
));
4065 if (!is_file_exist(sigpath
))
4066 str_write_to_file(sigpath
, "");
4067 open_txt_editor(sigpath
, prefs_common_get_ext_editor_cmd());
4070 static void prefs_account_edit_custom_header(void)
4072 prefs_custom_header_open(&tmp_ac_prefs
);
4075 static void prefs_account_enum_set_data_from_radiobtn(PrefParam
*pparam
)
4077 GtkRadioButton
*radiobtn
;
4080 radiobtn
= GTK_RADIO_BUTTON (*pparam
->widget
);
4081 group
= gtk_radio_button_get_group (radiobtn
);
4082 while (group
!= NULL
) {
4083 GtkToggleButton
*btn
= GTK_TOGGLE_BUTTON (group
->data
);
4084 if (gtk_toggle_button_get_active (btn
)) {
4085 *((gint
*)pparam
->data
) = GPOINTER_TO_INT
4086 (g_object_get_data (G_OBJECT (btn
), MENU_VAL_ID
));
4089 group
= group
->next
;
4093 static void prefs_account_enum_set_radiobtn(PrefParam
*pparam
)
4095 GtkRadioButton
*radiobtn
;
4099 data
= GINT_TO_POINTER (*((gint
*)pparam
->data
));
4100 radiobtn
= GTK_RADIO_BUTTON (*pparam
->widget
);
4101 group
= gtk_radio_button_get_group (radiobtn
);
4102 while (group
!= NULL
) {
4103 GtkToggleButton
*btn
= GTK_TOGGLE_BUTTON (group
->data
);
4104 gpointer data1
= g_object_get_data (G_OBJECT (btn
), MENU_VAL_ID
);
4105 if (data1
== data
) {
4106 gtk_toggle_button_set_active (btn
, TRUE
);
4109 group
= group
->next
;
4113 static void prefs_account_protocol_set_data_from_optmenu(PrefParam
*pparam
)
4115 struct BasicProtocol
*protocol_optmenu
=
4116 (struct BasicProtocol
*)*pparam
->widget
;
4117 GtkWidget
*optmenu
= protocol_optmenu
->combobox
;
4119 *((RecvProtocol
*)pparam
->data
) =
4120 combobox_get_active_data(GTK_COMBO_BOX(optmenu
));
4123 static void prefs_account_protocol_set_optmenu(PrefParam
*pparam
)
4125 RecvProtocol protocol
;
4126 struct BasicProtocol
*protocol_optmenu
=
4127 (struct BasicProtocol
*)*pparam
->widget
;
4128 GtkWidget
*optmenu
= protocol_optmenu
->combobox
;
4129 GtkWidget
*optlabel
= protocol_optmenu
->label
;
4130 GtkWidget
*descrlabel
= protocol_optmenu
->descrlabel
;
4131 gchar
*label
= NULL
;
4133 protocol
= *((RecvProtocol
*)pparam
->data
);
4135 /* Set combobox to correct value even if it will be hidden, so
4136 * we won't break existing accounts when saving. */
4137 combobox_select_by_data(GTK_COMBO_BOX(optmenu
), protocol
);
4139 /* Set up widgets accordingly */
4141 gtk_label_set_text(GTK_LABEL(descrlabel
), _("Protocol"));
4142 gtk_widget_hide(optlabel
);
4143 gtk_widget_show(optmenu
);
4145 gtk_label_set_text(GTK_LABEL(descrlabel
), _("Protocol:"));
4146 label
= g_markup_printf_escaped("<b>%s</b>", protocol_names
[protocol
]);
4147 gtk_label_set_markup(GTK_LABEL(optlabel
), label
);
4149 gtk_widget_hide(optmenu
);
4150 gtk_widget_show(optlabel
);
4151 #ifndef HAVE_LIBETPAN
4152 if (protocol
== A_IMAP4
|| protocol
== A_NNTP
) {
4153 gtk_widget_show(protocol_optmenu
->no_imap_warn_icon
);
4154 gtk_widget_show(protocol_optmenu
->no_imap_warn_label
);
4156 gtk_widget_hide(protocol_optmenu
->no_imap_warn_icon
);
4157 gtk_widget_hide(protocol_optmenu
->no_imap_warn_label
);
4160 if (protocol
== A_IMAP4
) {
4162 gtk_toggle_button_set_active(
4163 GTK_TOGGLE_BUTTON(send_page
.msgid_checkbtn
),
4165 gtk_widget_hide(send_page
.msgid_checkbtn
);
4167 gtk_widget_show(send_page
.msgid_checkbtn
);
4169 gtk_widget_show(send_page
.xmailer_checkbtn
);
4173 static void prefs_account_imap_auth_type_set_data_from_optmenu(PrefParam
*pparam
)
4175 *((RecvProtocol
*)pparam
->data
) =
4176 combobox_get_active_data(GTK_COMBO_BOX(*pparam
->widget
));
4179 static void prefs_account_imap_auth_type_set_optmenu(PrefParam
*pparam
)
4181 IMAPAuthType type
= *((IMAPAuthType
*)pparam
->data
);
4182 GtkComboBox
*optmenu
= GTK_COMBO_BOX(*pparam
->widget
);
4184 combobox_select_by_data(optmenu
, type
);
4187 static void prefs_account_smtp_auth_type_set_data_from_optmenu(PrefParam
*pparam
)
4189 *((RecvProtocol
*)pparam
->data
) =
4190 combobox_get_active_data(GTK_COMBO_BOX(*pparam
->widget
));
4193 static void prefs_account_smtp_auth_type_set_optmenu(PrefParam
*pparam
)
4195 SMTPAuthType type
= *((SMTPAuthType
*)pparam
->data
);
4196 GtkComboBox
*optmenu
= GTK_COMBO_BOX(*pparam
->widget
);
4198 combobox_select_by_data(optmenu
, type
);
4201 static void prefs_account_set_string_from_combobox(PrefParam
*pparam
)
4203 GtkWidget
*combobox
;
4208 cm_return_if_fail(*pparam
->widget
!= NULL
);
4210 combobox
= *pparam
->widget
;
4211 cm_return_if_fail(gtk_combo_box_get_active_iter(
4212 GTK_COMBO_BOX(combobox
), &iter
));
4214 str
= (gchar
**)pparam
->data
;
4216 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combobox
)));
4217 gtk_tree_model_get(GTK_TREE_MODEL(menu
), &iter
,
4218 COMBOBOX_PRIVACY_PLUGIN_ID
, &(*str
),
4222 /* Context struct and internal function called by gtk_tree_model_foreach().
4223 * This is used in prefs_account_set_privacy_combobox_from_string() to find
4224 * correct combobox entry to activate when account preferences are displayed
4225 * and their values are set according to preferences. */
4226 typedef struct _privacy_system_set_ctx
{
4227 GtkWidget
*combobox
;
4230 } PrivacySystemSetCtx
;
4232 static gboolean
_privacy_system_set_func(GtkTreeModel
*model
, GtkTreePath
*path
,
4233 GtkTreeIter
*iter
, PrivacySystemSetCtx
*ctx
)
4235 GtkWidget
*combobox
= ctx
->combobox
;
4236 gchar
*prefsid
= ctx
->prefsid
;
4239 /* We're searching for correct privacy plugin ID. */
4240 gtk_tree_model_get(model
, iter
, COMBOBOX_PRIVACY_PLUGIN_ID
, &curid
, -1);
4241 if( strcmp(prefsid
, curid
) == 0 ) {
4242 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combobox
), iter
);
4252 static void prefs_account_set_privacy_combobox_from_string(PrefParam
*pparam
)
4254 GtkWidget
*optionmenu
;
4257 gboolean found
= FALSE
;
4259 PrivacySystemSetCtx
*ctx
= NULL
;
4261 cm_return_if_fail(*pparam
->widget
!= NULL
);
4263 prefsid
= *((gchar
**) pparam
->data
);
4264 if (prefsid
== NULL
)
4267 optionmenu
= *pparam
->widget
;
4268 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optionmenu
)));
4270 ctx
= g_new(PrivacySystemSetCtx
, sizeof(PrivacySystemSetCtx
));
4271 ctx
->combobox
= optionmenu
;
4272 ctx
->prefsid
= prefsid
;
4275 gtk_tree_model_foreach(GTK_TREE_MODEL(menu
),
4276 (GtkTreeModelForeachFunc
)_privacy_system_set_func
, ctx
);
4280 /* If chosen privacy system is not available, add a dummy entry with
4281 * "not loaded" note and make it active. */
4285 name
= g_strdup_printf(_("%s (plugin not loaded)"), prefsid
);
4286 gtk_list_store_append(menu
, &iter
);
4287 gtk_list_store_set(menu
, &iter
,
4288 COMBOBOX_TEXT
, name
,
4290 COMBOBOX_SENS
, TRUE
,
4291 COMBOBOX_PRIVACY_PLUGIN_ID
, prefsid
,
4295 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(optionmenu
), &iter
);
4299 static void prefs_account_protocol_changed(GtkComboBox
*combobox
, gpointer data
)
4301 RecvProtocol protocol
;
4302 struct BasicProtocol
*protocol_optmenu
= (struct BasicProtocol
*)basic_page
.protocol_optmenu
;
4304 protocol
= combobox_get_active_data(combobox
);
4306 gtk_widget_hide(protocol_optmenu
->no_imap_warn_icon
);
4307 gtk_widget_hide(protocol_optmenu
->no_imap_warn_label
);
4311 #ifndef HAVE_LIBETPAN
4312 gtk_widget_show(protocol_optmenu
->no_imap_warn_icon
);
4313 gtk_widget_show(protocol_optmenu
->no_imap_warn_label
);
4315 gtk_widget_hide(protocol_optmenu
->no_imap_warn_icon
);
4316 gtk_widget_hide(protocol_optmenu
->no_imap_warn_label
);
4318 gtk_widget_show(send_page
.msgid_checkbtn
);
4319 gtk_widget_show(send_page
.xmailer_checkbtn
);
4320 gtk_widget_show(basic_page
.nntpserv_label
);
4321 gtk_widget_show(basic_page
.nntpserv_entry
);
4322 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4323 0, VSPACING_NARROW
);
4325 gtk_widget_set_sensitive(basic_page
.nntpauth_checkbtn
, TRUE
);
4326 gtk_widget_show(basic_page
.nntpauth_checkbtn
);
4328 gtk_widget_set_sensitive(basic_page
.nntpauth_onconnect_checkbtn
, TRUE
);
4329 gtk_widget_show(basic_page
.nntpauth_onconnect_checkbtn
);
4331 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4332 1, VSPACING_NARROW
);
4333 gtk_widget_hide(basic_page
.recvserv_label
);
4334 gtk_widget_hide(basic_page
.recvserv_entry
);
4335 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4337 gtk_widget_show(basic_page
.smtpserv_label
);
4338 gtk_widget_show(basic_page
.smtpserv_entry
);
4339 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4340 4, VSPACING_NARROW
);
4341 gtk_widget_hide(basic_page
.localmbox_label
);
4342 gtk_widget_hide(basic_page
.localmbox_entry
);
4343 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4345 gtk_widget_hide(basic_page
.mailcmd_label
);
4346 gtk_widget_hide(basic_page
.mailcmd_entry
);
4347 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4349 gtk_widget_hide(basic_page
.mailcmd_checkbtn
);
4350 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4352 gtk_widget_show(basic_page
.uid_label
);
4353 gtk_widget_show(basic_page
.pass_label
);
4354 gtk_widget_show(basic_page
.uid_entry
);
4355 gtk_widget_show(basic_page
.pass_entry
);
4356 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4357 7, VSPACING_NARROW
);
4359 gtk_widget_set_sensitive(basic_page
.uid_label
, TRUE
);
4360 gtk_widget_set_sensitive(basic_page
.pass_label
, TRUE
);
4361 gtk_widget_set_sensitive(basic_page
.uid_entry
, TRUE
);
4362 gtk_widget_set_sensitive(basic_page
.pass_entry
, TRUE
);
4364 /* update userid/passwd sensitive state */
4366 prefs_account_nntpauth_toggled
4367 (GTK_TOGGLE_BUTTON(basic_page
.nntpauth_checkbtn
), NULL
);
4368 gtk_widget_hide(receive_page
.pop3_frame
);
4369 gtk_widget_hide(receive_page
.imap_frame
);
4370 gtk_widget_hide(receive_page
.local_frame
);
4371 gtk_widget_show(receive_page
.frame_maxarticle
);
4372 gtk_widget_set_sensitive(receive_page
.filter_on_recv_checkbtn
, TRUE
);
4373 prefs_account_filter_on_recv_toggled
4374 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
), NULL
);
4375 gtk_widget_set_sensitive(receive_page
.recvatgetall_checkbtn
, TRUE
);
4376 /* update pop_before_smtp sensitivity */
4377 gtk_toggle_button_set_active
4378 (GTK_TOGGLE_BUTTON(send_page
.pop_bfr_smtp_checkbtn
), FALSE
);
4379 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_checkbtn
, FALSE
);
4380 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_tm_spinbtn
, FALSE
);
4382 if (!tmp_ac_prefs
.account_name
) {
4383 gtk_toggle_button_set_active
4384 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
),
4386 gtk_toggle_button_set_active
4387 (GTK_TOGGLE_BUTTON(receive_page
.filterhook_on_recv_checkbtn
),
4389 gtk_toggle_button_set_active
4390 (GTK_TOGGLE_BUTTON(receive_page
.recvatgetall_checkbtn
),
4395 gtk_widget_hide(ssl_page
.pop_frame
);
4396 gtk_widget_hide(ssl_page
.imap_frame
);
4397 gtk_widget_show(ssl_page
.nntp_frame
);
4398 gtk_widget_show(ssl_page
.send_frame
);
4400 gtk_widget_hide(advanced_page
.popport_hbox
);
4401 gtk_widget_hide(advanced_page
.imapport_hbox
);
4402 gtk_widget_show(advanced_page
.nntpport_hbox
);
4403 #if !GTK_CHECK_VERSION(3, 0, 0)
4404 gtk_widget_show(advanced_page
.crosspost_checkbtn
);
4405 gtk_widget_show(advanced_page
.crosspost_colormenu
);
4408 gtk_widget_hide(advanced_page
.tunnelcmd_checkbtn
);
4409 gtk_widget_hide(advanced_page
.tunnelcmd_entry
);
4411 gtk_widget_hide(receive_page
.imapdir_label
);
4412 gtk_widget_hide(receive_page
.imapdir_entry
);
4413 gtk_widget_hide(receive_page
.subsonly_checkbtn
);
4414 gtk_widget_hide(receive_page
.low_bandwidth_checkbtn
);
4417 gtk_widget_show(send_page
.msgid_checkbtn
);
4418 gtk_widget_show(send_page
.xmailer_checkbtn
);
4419 gtk_widget_hide(protocol_optmenu
->no_imap_warn_icon
);
4420 gtk_widget_hide(protocol_optmenu
->no_imap_warn_label
);
4421 gtk_widget_hide(basic_page
.nntpserv_label
);
4422 gtk_widget_hide(basic_page
.nntpserv_entry
);
4423 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4425 gtk_widget_set_sensitive(basic_page
.nntpauth_checkbtn
, FALSE
);
4426 gtk_widget_hide(basic_page
.nntpauth_checkbtn
);
4428 gtk_widget_set_sensitive(basic_page
.nntpauth_onconnect_checkbtn
, FALSE
);
4429 gtk_widget_hide(basic_page
.nntpauth_onconnect_checkbtn
);
4430 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4432 gtk_widget_hide(basic_page
.recvserv_label
);
4433 gtk_widget_hide(basic_page
.recvserv_entry
);
4434 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4436 gtk_widget_show(basic_page
.smtpserv_label
);
4437 gtk_widget_show(basic_page
.smtpserv_entry
);
4438 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4439 4, VSPACING_NARROW
);
4440 gtk_widget_show(basic_page
.localmbox_label
);
4441 gtk_widget_show(basic_page
.localmbox_entry
);
4442 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4443 3, VSPACING_NARROW
);
4444 gtk_widget_show(basic_page
.mailcmd_label
);
4445 gtk_widget_show(basic_page
.mailcmd_entry
);
4446 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4447 6, VSPACING_NARROW
);
4448 gtk_widget_show(basic_page
.mailcmd_checkbtn
);
4449 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4450 5, VSPACING_NARROW
);
4451 gtk_widget_hide(basic_page
.uid_label
);
4452 gtk_widget_hide(basic_page
.pass_label
);
4453 gtk_widget_hide(basic_page
.uid_entry
);
4454 gtk_widget_hide(basic_page
.pass_entry
);
4455 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4458 gtk_widget_set_sensitive(basic_page
.uid_label
, TRUE
);
4459 gtk_widget_set_sensitive(basic_page
.pass_label
, TRUE
);
4460 gtk_widget_set_sensitive(basic_page
.uid_entry
, TRUE
);
4461 gtk_widget_set_sensitive(basic_page
.pass_entry
, TRUE
);
4462 gtk_widget_hide(receive_page
.pop3_frame
);
4463 gtk_widget_hide(receive_page
.imap_frame
);
4464 gtk_widget_show(receive_page
.local_frame
);
4465 gtk_widget_hide(receive_page
.frame_maxarticle
);
4466 gtk_widget_set_sensitive(receive_page
.filter_on_recv_checkbtn
, TRUE
);
4467 prefs_account_filter_on_recv_toggled
4468 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
), NULL
);
4469 gtk_widget_set_sensitive(receive_page
.recvatgetall_checkbtn
, TRUE
);
4470 prefs_account_mailcmd_toggled
4471 (GTK_TOGGLE_BUTTON(basic_page
.mailcmd_checkbtn
), NULL
);
4473 /* update pop_before_smtp sensitivity */
4474 gtk_toggle_button_set_active
4475 (GTK_TOGGLE_BUTTON(send_page
.pop_bfr_smtp_checkbtn
), FALSE
);
4476 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_checkbtn
, FALSE
);
4477 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_tm_spinbtn
, FALSE
);
4479 if (!tmp_ac_prefs
.account_name
) {
4480 gtk_toggle_button_set_active
4481 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
),
4483 gtk_toggle_button_set_active
4484 (GTK_TOGGLE_BUTTON(receive_page
.filterhook_on_recv_checkbtn
),
4486 gtk_toggle_button_set_active
4487 (GTK_TOGGLE_BUTTON(receive_page
.recvatgetall_checkbtn
),
4492 gtk_widget_hide(ssl_page
.pop_frame
);
4493 gtk_widget_hide(ssl_page
.imap_frame
);
4494 gtk_widget_hide(ssl_page
.nntp_frame
);
4495 gtk_widget_show(ssl_page
.send_frame
);
4497 gtk_widget_hide(advanced_page
.popport_hbox
);
4498 gtk_widget_hide(advanced_page
.imapport_hbox
);
4499 gtk_widget_hide(advanced_page
.nntpport_hbox
);
4500 #if !GTK_CHECK_VERSION(3, 0, 0)
4501 gtk_widget_hide(advanced_page
.crosspost_checkbtn
);
4502 gtk_widget_hide(advanced_page
.crosspost_colormenu
);
4505 gtk_widget_hide(advanced_page
.tunnelcmd_checkbtn
);
4506 gtk_widget_hide(advanced_page
.tunnelcmd_entry
);
4508 gtk_widget_hide(receive_page
.imapdir_label
);
4509 gtk_widget_hide(receive_page
.imapdir_entry
);
4510 gtk_widget_hide(receive_page
.subsonly_checkbtn
);
4511 gtk_widget_hide(receive_page
.low_bandwidth_checkbtn
);
4514 #ifndef HAVE_LIBETPAN
4515 gtk_widget_show(protocol_optmenu
->no_imap_warn_icon
);
4516 gtk_widget_show(protocol_optmenu
->no_imap_warn_label
);
4519 gtk_toggle_button_set_active(
4520 GTK_TOGGLE_BUTTON(send_page
.msgid_checkbtn
),
4522 gtk_widget_hide(send_page
.msgid_checkbtn
);
4523 gtk_widget_show(send_page
.xmailer_checkbtn
);
4524 gtk_widget_hide(basic_page
.nntpserv_label
);
4525 gtk_widget_hide(basic_page
.nntpserv_entry
);
4526 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4528 gtk_widget_set_sensitive(basic_page
.nntpauth_checkbtn
, FALSE
);
4529 gtk_widget_hide(basic_page
.nntpauth_checkbtn
);
4531 gtk_widget_set_sensitive(basic_page
.nntpauth_onconnect_checkbtn
, FALSE
);
4532 gtk_widget_hide(basic_page
.nntpauth_onconnect_checkbtn
);
4534 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4536 gtk_widget_set_sensitive(basic_page
.recvserv_label
, TRUE
);
4537 gtk_widget_set_sensitive(basic_page
.recvserv_entry
, TRUE
);
4538 gtk_widget_show(basic_page
.recvserv_label
);
4539 gtk_widget_show(basic_page
.recvserv_entry
);
4540 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4541 2, VSPACING_NARROW
);
4542 gtk_widget_show(basic_page
.smtpserv_label
);
4543 gtk_widget_show(basic_page
.smtpserv_entry
);
4544 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4545 4, VSPACING_NARROW
);
4546 gtk_widget_hide(basic_page
.localmbox_label
);
4547 gtk_widget_hide(basic_page
.localmbox_entry
);
4548 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4550 gtk_widget_hide(basic_page
.mailcmd_label
);
4551 gtk_widget_hide(basic_page
.mailcmd_entry
);
4552 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4554 gtk_widget_hide(basic_page
.mailcmd_checkbtn
);
4555 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4557 gtk_widget_show(basic_page
.uid_label
);
4558 gtk_widget_show(basic_page
.pass_label
);
4559 gtk_widget_show(basic_page
.uid_entry
);
4560 gtk_widget_show(basic_page
.pass_entry
);
4561 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4562 7, VSPACING_NARROW
);
4564 gtk_widget_set_sensitive(basic_page
.uid_label
, TRUE
);
4565 gtk_widget_set_sensitive(basic_page
.pass_label
, TRUE
);
4566 gtk_widget_set_sensitive(basic_page
.uid_entry
, TRUE
);
4567 gtk_widget_set_sensitive(basic_page
.pass_entry
, TRUE
);
4568 gtk_widget_hide(receive_page
.pop3_frame
);
4569 gtk_widget_show(receive_page
.imap_frame
);
4570 gtk_widget_hide(receive_page
.local_frame
);
4571 gtk_widget_hide(receive_page
.frame_maxarticle
);
4572 gtk_widget_set_sensitive(receive_page
.filter_on_recv_checkbtn
, TRUE
);
4573 prefs_account_filter_on_recv_toggled
4574 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
), NULL
);
4575 gtk_widget_set_sensitive(receive_page
.recvatgetall_checkbtn
, TRUE
);
4576 gtk_widget_set_sensitive(basic_page
.smtpserv_entry
, TRUE
);
4577 gtk_widget_set_sensitive(basic_page
.smtpserv_label
, TRUE
);
4579 /* update pop_before_smtp sensitivity */
4580 gtk_toggle_button_set_active
4581 (GTK_TOGGLE_BUTTON(send_page
.pop_bfr_smtp_checkbtn
), FALSE
);
4582 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_checkbtn
, FALSE
);
4583 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_tm_spinbtn
, FALSE
);
4585 if (!tmp_ac_prefs
.account_name
) {
4586 gtk_toggle_button_set_active
4587 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
),
4589 gtk_toggle_button_set_active
4590 (GTK_TOGGLE_BUTTON(receive_page
.filterhook_on_recv_checkbtn
),
4592 gtk_toggle_button_set_active
4593 (GTK_TOGGLE_BUTTON(receive_page
.recvatgetall_checkbtn
),
4598 gtk_widget_hide(ssl_page
.pop_frame
);
4599 gtk_widget_show(ssl_page
.imap_frame
);
4600 gtk_widget_hide(ssl_page
.nntp_frame
);
4601 gtk_widget_show(ssl_page
.send_frame
);
4603 gtk_widget_hide(advanced_page
.popport_hbox
);
4604 gtk_widget_show(advanced_page
.imapport_hbox
);
4605 gtk_widget_hide(advanced_page
.nntpport_hbox
);
4606 #if !GTK_CHECK_VERSION(3, 0, 0)
4607 gtk_widget_hide(advanced_page
.crosspost_checkbtn
);
4608 gtk_widget_hide(advanced_page
.crosspost_colormenu
);
4611 gtk_widget_show(advanced_page
.tunnelcmd_checkbtn
);
4612 gtk_widget_show(advanced_page
.tunnelcmd_entry
);
4614 gtk_widget_show(receive_page
.imapdir_label
);
4615 gtk_widget_show(receive_page
.imapdir_entry
);
4616 gtk_widget_show(receive_page
.subsonly_checkbtn
);
4617 gtk_widget_show(receive_page
.low_bandwidth_checkbtn
);
4620 gtk_widget_show(send_page
.msgid_checkbtn
);
4621 gtk_widget_show(send_page
.xmailer_checkbtn
);
4622 gtk_widget_hide(protocol_optmenu
->no_imap_warn_icon
);
4623 gtk_widget_hide(protocol_optmenu
->no_imap_warn_label
);
4624 gtk_widget_hide(basic_page
.nntpserv_label
);
4625 gtk_widget_hide(basic_page
.nntpserv_entry
);
4626 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4628 gtk_widget_set_sensitive(basic_page
.nntpauth_checkbtn
, FALSE
);
4629 gtk_widget_hide(basic_page
.nntpauth_checkbtn
);
4631 gtk_widget_set_sensitive(basic_page
.nntpauth_onconnect_checkbtn
, FALSE
);
4632 gtk_widget_hide(basic_page
.nntpauth_onconnect_checkbtn
);
4634 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4636 gtk_widget_set_sensitive(basic_page
.recvserv_label
, FALSE
);
4637 gtk_widget_set_sensitive(basic_page
.recvserv_entry
, FALSE
);
4638 gtk_widget_hide(basic_page
.recvserv_label
);
4639 gtk_widget_hide(basic_page
.recvserv_entry
);
4640 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4641 2, VSPACING_NARROW
);
4642 gtk_widget_show(basic_page
.smtpserv_label
);
4643 gtk_widget_show(basic_page
.smtpserv_entry
);
4644 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4645 4, VSPACING_NARROW
);
4646 gtk_widget_hide(basic_page
.localmbox_label
);
4647 gtk_widget_hide(basic_page
.localmbox_entry
);
4648 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4650 gtk_widget_hide(basic_page
.mailcmd_label
);
4651 gtk_widget_hide(basic_page
.mailcmd_entry
);
4652 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4654 gtk_widget_hide(basic_page
.mailcmd_checkbtn
);
4655 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4657 gtk_widget_hide(basic_page
.uid_label
);
4658 gtk_widget_hide(basic_page
.pass_label
);
4659 gtk_widget_hide(basic_page
.uid_entry
);
4660 gtk_widget_hide(basic_page
.pass_entry
);
4661 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4662 7, VSPACING_NARROW
);
4664 gtk_widget_set_sensitive(basic_page
.uid_label
, FALSE
);
4665 gtk_widget_set_sensitive(basic_page
.pass_label
, FALSE
);
4666 gtk_widget_set_sensitive(basic_page
.uid_entry
, FALSE
);
4667 gtk_widget_set_sensitive(basic_page
.pass_entry
, FALSE
);
4668 gtk_widget_set_sensitive(receive_page
.pop3_frame
, FALSE
);
4669 gtk_widget_hide(receive_page
.pop3_frame
);
4670 gtk_widget_hide(receive_page
.imap_frame
);
4671 gtk_widget_hide(receive_page
.local_frame
);
4672 gtk_widget_hide(receive_page
.frame_maxarticle
);
4673 gtk_widget_set_sensitive(receive_page
.filter_on_recv_checkbtn
, FALSE
);
4674 prefs_account_filter_on_recv_toggled
4675 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
), NULL
);
4676 gtk_widget_set_sensitive(receive_page
.recvatgetall_checkbtn
, FALSE
);
4678 gtk_widget_set_sensitive(basic_page
.smtpserv_entry
, TRUE
);
4679 gtk_widget_set_sensitive(basic_page
.smtpserv_label
, TRUE
);
4681 /* update pop_before_smtp sensitivity */
4682 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_checkbtn
, FALSE
);
4683 pop_bfr_smtp_tm_set_sens(NULL
, NULL
);
4685 gtk_toggle_button_set_active
4686 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
), FALSE
);
4687 gtk_toggle_button_set_active
4688 (GTK_TOGGLE_BUTTON(receive_page
.filterhook_on_recv_checkbtn
), FALSE
);
4689 gtk_toggle_button_set_active
4690 (GTK_TOGGLE_BUTTON(receive_page
.recvatgetall_checkbtn
), FALSE
);
4693 gtk_widget_hide(ssl_page
.pop_frame
);
4694 gtk_widget_hide(ssl_page
.imap_frame
);
4695 gtk_widget_hide(ssl_page
.nntp_frame
);
4696 gtk_widget_show(ssl_page
.send_frame
);
4698 gtk_widget_hide(advanced_page
.popport_hbox
);
4699 gtk_widget_hide(advanced_page
.imapport_hbox
);
4700 gtk_widget_hide(advanced_page
.nntpport_hbox
);
4701 #if !GTK_CHECK_VERSION(3, 0, 0)
4702 gtk_widget_hide(advanced_page
.crosspost_checkbtn
);
4703 gtk_widget_hide(advanced_page
.crosspost_colormenu
);
4706 gtk_widget_hide(advanced_page
.tunnelcmd_checkbtn
);
4707 gtk_widget_hide(advanced_page
.tunnelcmd_entry
);
4709 gtk_widget_hide(receive_page
.imapdir_label
);
4710 gtk_widget_hide(receive_page
.imapdir_entry
);
4711 gtk_widget_hide(receive_page
.subsonly_checkbtn
);
4712 gtk_widget_hide(receive_page
.low_bandwidth_checkbtn
);
4715 /* continue to default: */
4717 gtk_widget_show(send_page
.msgid_checkbtn
);
4718 gtk_widget_show(send_page
.xmailer_checkbtn
);
4719 gtk_widget_hide(protocol_optmenu
->no_imap_warn_icon
);
4720 gtk_widget_hide(protocol_optmenu
->no_imap_warn_label
);
4721 gtk_widget_hide(basic_page
.nntpserv_label
);
4722 gtk_widget_hide(basic_page
.nntpserv_entry
);
4723 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4725 gtk_widget_set_sensitive(basic_page
.nntpauth_checkbtn
, FALSE
);
4726 gtk_widget_hide(basic_page
.nntpauth_checkbtn
);
4728 gtk_widget_set_sensitive(basic_page
.nntpauth_onconnect_checkbtn
, FALSE
);
4729 gtk_widget_hide(basic_page
.nntpauth_onconnect_checkbtn
);
4731 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4733 gtk_widget_set_sensitive(basic_page
.recvserv_label
, TRUE
);
4734 gtk_widget_set_sensitive(basic_page
.recvserv_entry
, TRUE
);
4735 gtk_widget_show(basic_page
.recvserv_label
);
4736 gtk_widget_show(basic_page
.recvserv_entry
);
4737 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4738 2, VSPACING_NARROW
);
4739 gtk_widget_show(basic_page
.smtpserv_label
);
4740 gtk_widget_show(basic_page
.smtpserv_entry
);
4741 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4742 4, VSPACING_NARROW
);
4743 gtk_widget_hide(basic_page
.localmbox_label
);
4744 gtk_widget_hide(basic_page
.localmbox_entry
);
4745 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4747 gtk_widget_hide(basic_page
.mailcmd_label
);
4748 gtk_widget_hide(basic_page
.mailcmd_entry
);
4749 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4751 gtk_widget_hide(basic_page
.mailcmd_checkbtn
);
4752 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4754 gtk_widget_show(basic_page
.uid_label
);
4755 gtk_widget_show(basic_page
.pass_label
);
4756 gtk_widget_show(basic_page
.uid_entry
);
4757 gtk_widget_show(basic_page
.pass_entry
);
4758 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
4759 7, VSPACING_NARROW
);
4761 gtk_widget_set_sensitive(basic_page
.uid_label
, TRUE
);
4762 gtk_widget_set_sensitive(basic_page
.pass_label
, TRUE
);
4763 gtk_widget_set_sensitive(basic_page
.uid_entry
, TRUE
);
4764 gtk_widget_set_sensitive(basic_page
.pass_entry
, TRUE
);
4765 gtk_widget_set_sensitive(receive_page
.pop3_frame
, TRUE
);
4766 gtk_widget_show(receive_page
.pop3_frame
);
4767 gtk_widget_hide(receive_page
.imap_frame
);
4768 gtk_widget_hide(receive_page
.local_frame
);
4769 gtk_widget_hide(receive_page
.frame_maxarticle
);
4770 gtk_widget_set_sensitive(receive_page
.filter_on_recv_checkbtn
, TRUE
);
4771 prefs_account_filter_on_recv_toggled
4772 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
), NULL
);
4773 gtk_widget_set_sensitive(receive_page
.recvatgetall_checkbtn
, TRUE
);
4775 gtk_widget_set_sensitive(basic_page
.smtpserv_entry
, TRUE
);
4776 gtk_widget_set_sensitive(basic_page
.smtpserv_label
, TRUE
);
4778 /* update pop_before_smtp sensitivity */
4779 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_checkbtn
, TRUE
);
4780 pop_bfr_smtp_tm_set_sens(NULL
, NULL
);
4782 if (!tmp_ac_prefs
.account_name
) {
4783 gtk_toggle_button_set_active
4784 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
),
4786 gtk_toggle_button_set_active
4787 (GTK_TOGGLE_BUTTON(receive_page
.filterhook_on_recv_checkbtn
),
4789 gtk_toggle_button_set_active
4790 (GTK_TOGGLE_BUTTON(receive_page
.recvatgetall_checkbtn
),
4795 gtk_widget_show(ssl_page
.pop_frame
);
4796 gtk_widget_hide(ssl_page
.imap_frame
);
4797 gtk_widget_hide(ssl_page
.nntp_frame
);
4798 gtk_widget_show(ssl_page
.send_frame
);
4800 gtk_widget_show(advanced_page
.popport_hbox
);
4801 gtk_widget_hide(advanced_page
.imapport_hbox
);
4802 gtk_widget_hide(advanced_page
.nntpport_hbox
);
4803 #if !GTK_CHECK_VERSION(3, 0, 0)
4804 gtk_widget_hide(advanced_page
.crosspost_checkbtn
);
4805 gtk_widget_hide(advanced_page
.crosspost_colormenu
);
4808 gtk_widget_hide(advanced_page
.tunnelcmd_checkbtn
);
4809 gtk_widget_hide(advanced_page
.tunnelcmd_entry
);
4811 gtk_widget_hide(receive_page
.imapdir_label
);
4812 gtk_widget_hide(receive_page
.imapdir_entry
);
4813 gtk_widget_hide(receive_page
.subsonly_checkbtn
);
4814 gtk_widget_hide(receive_page
.low_bandwidth_checkbtn
);
4818 gtk_widget_queue_resize(basic_page
.serv_frame
);
4821 static void prefs_account_nntpauth_toggled(GtkToggleButton
*button
,
4826 if (!gtk_widget_get_sensitive (GTK_WIDGET (button
)))
4828 auth
= gtk_toggle_button_get_active (button
);
4829 gtk_widget_set_sensitive(basic_page
.uid_label
, auth
);
4830 gtk_widget_set_sensitive(basic_page
.pass_label
, auth
);
4831 gtk_widget_set_sensitive(basic_page
.uid_entry
, auth
);
4832 gtk_widget_set_sensitive(basic_page
.pass_entry
, auth
);
4833 gtk_widget_set_sensitive(basic_page
.nntpauth_onconnect_checkbtn
, auth
);
4836 static void prefs_account_mailcmd_toggled(GtkToggleButton
*button
,
4839 gboolean use_mailcmd
;
4841 use_mailcmd
= gtk_toggle_button_get_active (button
);
4843 gtk_widget_set_sensitive(basic_page
.mailcmd_entry
, use_mailcmd
);
4844 gtk_widget_set_sensitive(basic_page
.mailcmd_label
, use_mailcmd
);
4845 gtk_widget_set_sensitive(basic_page
.smtpserv_entry
, !use_mailcmd
);
4846 gtk_widget_set_sensitive(basic_page
.smtpserv_label
, !use_mailcmd
);
4847 gtk_widget_set_sensitive(basic_page
.uid_entry
, !use_mailcmd
);
4848 gtk_widget_set_sensitive(basic_page
.pass_entry
, !use_mailcmd
);
4851 static void prefs_account_filter_on_recv_toggled(GtkToggleButton
*button
,
4856 do_filter
= gtk_toggle_button_get_active (button
);
4857 gtk_widget_set_sensitive(receive_page
.filterhook_on_recv_checkbtn
, do_filter
);
4861 static void prefs_account_compose_default_dictionary_set_string_from_optmenu
4867 cm_return_if_fail(*pparam
->widget
!= NULL
);
4869 combo
= *pparam
->widget
;
4870 str
= (gchar
**) pparam
->data
;
4873 *str
= gtkaspell_get_dictionary_menu_active_item(GTK_COMBO_BOX(combo
));
4876 static void prefs_account_compose_default_dictionary_set_optmenu_from_string
4882 cm_return_if_fail(*pparam
->widget
!= NULL
);
4884 dictionary
= *((gchar
**) pparam
->data
);
4885 if (dictionary
!= NULL
) {
4886 if (strrchr(dictionary
, '/')) {
4887 dictionary
= g_strdup(strrchr(dictionary
, '/')+1);
4890 if (strchr(dictionary
, '-')) {
4891 *(strchr(dictionary
, '-')) = '\0';
4894 combo
= *pparam
->widget
;
4895 if (dictionary
&& *dictionary
)
4896 gtkaspell_set_dictionary_menu_active_item(GTK_COMBO_BOX(combo
),
4899 GtkTreeModel
*model
;
4901 if((model
= gtk_combo_box_get_model(GTK_COMBO_BOX(combo
))) == NULL
)
4903 if((gtk_tree_model_get_iter_first(model
, &iter
)) == FALSE
)
4905 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo
), &iter
);
4910 gchar
*prefs_account_generate_msgid(PrefsAccount
*account
)
4912 gchar
*addr
, *tmbuf
, *buf
= NULL
;
4914 gchar
*user_addr
= account
->msgid_with_addr
? g_strdup(account
->address
) : NULL
;
4916 if (account
->set_domain
&& account
->domain
) {
4917 buf
= g_strdup(account
->domain
);
4918 } else if (!strncmp(get_domain_name(), "localhost", strlen("localhost"))) {
4920 strchr(account
->address
, '@') ?
4921 strchr(account
->address
, '@')+1 :
4925 if (user_addr
!= NULL
) {
4926 addr
= g_strdup_printf(".%s", user_addr
);
4928 addr
= g_strdup_printf("@%s",
4929 buf
!= NULL
&& strlen(buf
) > 0 ?
4930 buf
: get_domain_name());
4935 if (user_addr
!= NULL
)
4938 /* Replace all @ but the last one in addr, with underscores.
4939 * RFC 2822 States that msg-id syntax only allows one @.
4941 while (strchr(addr
, '@') != NULL
&& strchr(addr
, '@') != strrchr(addr
, '@'))
4942 *(strchr(addr
, '@')) = '_';
4944 now
= g_date_time_new_now_local();
4945 tmbuf
= g_date_time_format(now
, "%Y%m%d%H%M%S");
4946 buf
= g_strdup_printf("%s.%08x%s",
4947 tmbuf
, (guint
)rand(), addr
);
4951 debug_print("Generated Message-ID string '%s'\n", buf
);
4955 void prefs_account_register_page(PrefsPage
*page
)
4957 prefs_pages
= g_slist_append(prefs_pages
, page
);
4961 void prefs_account_unregister_page(PrefsPage
*page
)
4963 prefs_pages
= g_slist_remove(prefs_pages
, page
);