2 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2021 the Claws Mail team and Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 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 #include "gtkcmoptionmenu.h"
39 #include "prefs_gtk.h"
40 #include "prefs_account.h"
41 #include "prefs_receive.h"
42 #include "prefs_common.h"
43 #include "prefs_customheader.h"
45 #include "mainwindow.h"
46 #include "manage_window.h"
48 #include "foldersel.h"
53 #include "alertpanel.h"
54 #include "colorlabel.h"
59 #include "remotefolder.h"
62 #include "quote_fmt.h"
65 #include "inputdialog.h"
66 #include "ssl_certificate.h"
67 #include "passwordstore.h"
68 #include "file-utils.h"
70 #include <gnutls/gnutls.h>
73 static gboolean cancelled
;
74 static gboolean new_account
;
76 static PrefsAccount tmp_ac_prefs
;
78 static GtkWidget
*sigfile_radiobtn
;
79 static GtkWidget
*sigcmd_radiobtn
;
80 static GtkWidget
*entry_sigpath
;
81 static GtkWidget
*signature_browse_button
;
82 static GtkWidget
*signature_edit_button
;
85 static GtkWidget
*entry_in_cert_file
;
86 static GtkWidget
*entry_out_cert_file
;
87 static GtkWidget
*in_ssl_cert_browse_button
;
88 static GtkWidget
*out_ssl_cert_browse_button
;
91 struct AutocheckWidgets
{
92 GtkWidget
*autochk_hour_spinbtn
;
93 GtkWidget
*autochk_min_spinbtn
;
94 GtkWidget
*autochk_sec_spinbtn
;
97 static GSList
*prefs_pages
= NULL
;
99 typedef struct BasicPage
105 GtkWidget
*acname_entry
;
106 GtkWidget
*default_checkbtn
;
108 GtkWidget
*name_entry
;
109 GtkWidget
*addr_entry
;
110 GtkWidget
*org_entry
;
112 GtkWidget
*serv_frame
;
113 GtkWidget
*serv_table
;
114 gpointer
*protocol_optmenu
;
115 GtkWidget
*recvserv_label
;
116 GtkWidget
*smtpserv_label
;
117 GtkWidget
*nntpserv_label
;
118 GtkWidget
*localmbox_label
;
119 GtkWidget
*mailcmd_label
;
120 GtkWidget
*recvserv_entry
;
121 GtkWidget
*smtpserv_entry
;
122 GtkWidget
*nntpserv_entry
;
123 GtkWidget
*nntpauth_checkbtn
;
124 GtkWidget
*nntpauth_onconnect_checkbtn
;
125 GtkWidget
*localmbox_entry
;
126 GtkWidget
*mailcmd_checkbtn
;
127 GtkWidget
*mailcmd_entry
;
128 GtkWidget
*uid_label
;
129 GtkWidget
*pass_label
;
130 GtkWidget
*uid_entry
;
131 GtkWidget
*pass_entry
;
132 GtkWidget
*showpwd_checkbtn
;
133 GtkWidget
*auto_configure_btn
;
134 GtkWidget
*auto_configure_cancel_btn
;
135 GtkWidget
*auto_configure_lbl
;
138 typedef struct ReceivePage
144 GtkWidget
*pop3_frame
;
145 GtkWidget
*pop_auth_checkbtn
;
146 GtkWidget
*pop_auth_type_optmenu
;
147 GtkWidget
*rmmail_checkbtn
;
148 GtkWidget
*leave_time_spinbtn
;
149 GtkWidget
*leave_hour_spinbtn
;
150 GtkWidget
*size_limit_checkbtn
;
151 GtkWidget
*size_limit_spinbtn
;
152 GtkWidget
*inbox_label
;
153 GtkWidget
*inbox_entry
;
154 GtkWidget
*inbox_btn
;
156 GtkWidget
*autochk_frame
;
158 GtkWidget
*local_frame
;
159 GtkWidget
*local_inbox_label
;
160 GtkWidget
*local_inbox_entry
;
161 GtkWidget
*local_inbox_btn
;
163 GtkWidget
*filter_on_recv_checkbtn
;
164 GtkWidget
*filterhook_on_recv_checkbtn
;
165 GtkWidget
*recvatgetall_checkbtn
;
167 GtkWidget
*imap_frame
;
168 GtkWidget
*imap_auth_type_optmenu
;
169 GtkWidget
*imapdir_label
;
170 GtkWidget
*imapdir_entry
;
171 GtkWidget
*subsonly_checkbtn
;
172 GtkWidget
*low_bandwidth_checkbtn
;
174 GtkWidget
*frame_maxarticle
;
175 GtkWidget
*maxarticle_label
;
176 GtkWidget
*maxarticle_spinbtn
;
177 GtkAdjustment
*maxarticle_spinbtn_adj
;
179 GtkWidget
*autochk_checkbtn
;
180 GtkWidget
*autochk_use_default_checkbtn
;
181 struct AutocheckWidgets
*autochk_widgets
;
184 typedef struct SendPage
190 GtkWidget
*msgid_checkbtn
;
191 GtkWidget
*xmailer_checkbtn
;
192 GtkWidget
*customhdr_checkbtn
;
193 GtkWidget
*msgid_with_addr_checkbtn
;
194 GtkWidget
*smtp_auth_checkbtn
;
195 GtkWidget
*smtp_auth_type_optmenu
;
196 GtkWidget
*smtp_uid_entry
;
197 GtkWidget
*smtp_pass_entry
;
198 GtkWidget
*pop_bfr_smtp_checkbtn
;
199 GtkWidget
*pop_bfr_smtp_tm_spinbtn
;
200 GtkWidget
*pop_auth_timeout_lbl
;
201 GtkWidget
*pop_auth_minutes_lbl
;
204 typedef struct Oauth2Page
209 GtkWidget
*oauth2_sensitive
;
211 GtkWidget
*oauth2_authorise_btn
;
212 GtkWidget
*oauth2_deauthorise_btn
;
213 GtkWidget
*oauth2_authcode_entry
;
214 GtkWidget
*oauth2_auth_optmenu
;
215 GtkWidget
*oauth2_link_button
;
216 GtkWidget
*oauth2_link_copy_button
;
217 gpointer
*protocol_optmenu
;
218 GtkWidget
*oauth2_client_id_entry
;
219 GtkWidget
*oauth2_client_secret_entry
;
227 } AuthCodeQueryButtonData
;
229 typedef struct ComposePage
235 GtkWidget
*sigfile_radiobtn
;
236 GtkWidget
*entry_sigpath
;
237 GtkWidget
*checkbtn_autosig
;
238 GtkWidget
*entry_sigsep
;
239 GtkWidget
*autocc_checkbtn
;
240 GtkWidget
*autocc_entry
;
241 GtkWidget
*autobcc_checkbtn
;
242 GtkWidget
*autobcc_entry
;
243 GtkWidget
*autoreplyto_checkbtn
;
244 GtkWidget
*autoreplyto_entry
;
246 GtkWidget
*checkbtn_enable_default_dictionary
;
247 GtkWidget
*combo_default_dictionary
;
248 GtkWidget
*checkbtn_enable_default_alt_dictionary
;
249 GtkWidget
*combo_default_alt_dictionary
;
253 typedef struct TemplatesPage
259 GtkWidget
*checkbtn_compose_with_format
;
260 GtkWidget
*compose_subject_format
;
261 GtkWidget
*compose_body_format
;
262 GtkWidget
*checkbtn_reply_with_format
;
263 GtkWidget
*reply_quotemark
;
264 GtkWidget
*reply_body_format
;
265 GtkWidget
*checkbtn_forward_with_format
;
266 GtkWidget
*forward_quotemark
;
267 GtkWidget
*forward_body_format
;
270 typedef struct PrivacyPage
276 GtkWidget
*default_privacy_system
;
277 GtkWidget
*default_encrypt_checkbtn
;
278 GtkWidget
*default_encrypt_reply_checkbtn
;
279 GtkWidget
*default_sign_checkbtn
;
280 GtkWidget
*default_sign_reply_checkbtn
;
281 GtkWidget
*save_clear_text_checkbtn
;
282 GtkWidget
*encrypt_to_self_checkbtn
;
285 typedef struct SSLPage
291 GtkWidget
*pop_frame
;
292 GtkWidget
*pop_nossl_radiobtn
;
293 GtkWidget
*pop_ssltunnel_radiobtn
;
294 GtkWidget
*pop_starttls_radiobtn
;
296 GtkWidget
*imap_frame
;
297 GtkWidget
*imap_nossl_radiobtn
;
298 GtkWidget
*imap_ssltunnel_radiobtn
;
299 GtkWidget
*imap_starttls_radiobtn
;
301 GtkWidget
*nntp_frame
;
302 GtkWidget
*nntp_nossl_radiobtn
;
303 GtkWidget
*nntp_ssltunnel_radiobtn
;
305 GtkWidget
*send_frame
;
306 GtkWidget
*smtp_nossl_radiobtn
;
307 GtkWidget
*smtp_ssltunnel_radiobtn
;
308 GtkWidget
*smtp_starttls_radiobtn
;
310 GtkWidget
*entry_in_cert_file
;
311 GtkWidget
*entry_in_cert_pass
;
312 GtkWidget
*entry_out_cert_file
;
313 GtkWidget
*entry_out_cert_pass
;
315 GtkWidget
*ssl_certs_auto_accept_checkbtn
;
316 GtkWidget
*use_nonblocking_ssl_checkbtn
;
319 typedef struct ProxyPage
325 GtkWidget
*proxy_checkbtn
;
326 GtkWidget
*default_proxy_checkbtn
;
327 GtkWidget
*socks4_radiobtn
;
328 GtkWidget
*socks5_radiobtn
;
329 GtkWidget
*proxy_host_entry
;
330 GtkWidget
*proxy_port_spinbtn
;
331 GtkWidget
*proxy_auth_checkbtn
;
332 GtkWidget
*proxy_name_entry
;
333 GtkWidget
*proxy_pass_entry
;
334 GtkWidget
*proxy_send_checkbtn
;
337 typedef struct AdvancedPage
343 GtkWidget
*smtpport_checkbtn
;
344 GtkWidget
*smtpport_spinbtn
;
345 GtkWidget
*popport_hbox
;
346 GtkWidget
*popport_checkbtn
;
347 GtkWidget
*popport_spinbtn
;
348 GtkWidget
*imapport_hbox
;
349 GtkWidget
*imapport_checkbtn
;
350 GtkWidget
*imapport_spinbtn
;
351 GtkWidget
*nntpport_hbox
;
352 GtkWidget
*nntpport_checkbtn
;
353 GtkWidget
*nntpport_spinbtn
;
354 GtkWidget
*domain_checkbtn
;
355 GtkWidget
*domain_entry
;
356 GtkWidget
*crosspost_checkbtn
;
357 GtkWidget
*crosspost_colormenu
;
360 GtkWidget
*tunnelcmd_checkbtn
;
361 GtkWidget
*tunnelcmd_entry
;
364 GtkWidget
*sent_folder_checkbtn
;
365 GtkWidget
*sent_folder_entry
;
366 GtkWidget
*queue_folder_checkbtn
;
367 GtkWidget
*queue_folder_entry
;
368 GtkWidget
*draft_folder_checkbtn
;
369 GtkWidget
*draft_folder_entry
;
370 GtkWidget
*trash_folder_checkbtn
;
371 GtkWidget
*trash_folder_entry
;
374 static BasicPage basic_page
;
375 static ReceivePage receive_page
;
376 static SendPage send_page
;
377 static Oauth2Page oauth2_page
;
378 static ComposePage compose_page
;
379 static TemplatesPage templates_page
;
380 static PrivacyPage privacy_page
;
382 static SSLPage ssl_page
;
384 static ProxyPage proxy_page
;
385 static AdvancedPage advanced_page
;
387 struct BasicProtocol
{
390 GtkWidget
*descrlabel
;
391 GtkWidget
*no_imap_warn_icon
;
392 GtkWidget
*no_imap_warn_label
;
395 static char *protocol_names
[] = {
399 N_("Local mbox file"),
400 N_("None (SMTP only)")
403 static void prefs_account_protocol_set_data_from_optmenu(PrefParam
*pparam
);
404 static void prefs_account_protocol_set_optmenu (PrefParam
*pparam
);
405 static void prefs_account_protocol_changed (GtkComboBox
*combobox
,
408 static void prefs_account_set_string_from_combobox (PrefParam
*pparam
);
409 static void prefs_account_set_privacy_combobox_from_string (PrefParam
*pparam
);
411 static void prefs_account_imap_auth_type_set_data_from_optmenu
413 static void prefs_account_imap_auth_type_set_optmenu (PrefParam
*pparam
);
414 static void prefs_account_smtp_auth_type_set_data_from_optmenu
416 static void prefs_account_smtp_auth_type_set_optmenu (PrefParam
*pparam
);
417 static void prefs_account_pop_auth_type_set_data_from_optmenu
419 static void prefs_account_pop_auth_type_set_optmenu (PrefParam
*pparam
);
421 static void prefs_account_oauth2_provider_set_data_from_optmenu
423 static void prefs_account_oauth2_provider_set_optmenu (PrefParam
*pparam
);
424 static void prefs_account_oauth2_copy_url (GtkButton
*button
,
426 static void prefs_account_oauth2_set_sensitivity(void);
427 static void prefs_account_oauth2_set_auth_sensitivity(void);
428 static void prefs_account_oauth2_obtain_tokens(GtkButton
*button
, gpointer data
);
429 static void prefs_account_set_autochk_interval_from_widgets(PrefParam
*pparam
);
430 static void prefs_account_set_autochk_interval_to_widgets(PrefParam
*pparam
);
432 static void prefs_account_enum_set_data_from_radiobtn (PrefParam
*pparam
);
433 static void prefs_account_enum_set_radiobtn (PrefParam
*pparam
);
435 static void crosspost_color_toggled(void);
436 static void prefs_account_crosspost_set_data_from_colormenu(PrefParam
*pparam
);
437 static void prefs_account_crosspost_set_colormenu(PrefParam
*pparam
);
439 static void prefs_account_nntpauth_toggled(GtkToggleButton
*button
,
441 static void prefs_account_mailcmd_toggled(GtkToggleButton
*button
,
443 static void prefs_account_showpwd_checkbtn_toggled(GtkToggleButton
*button
,
445 static void prefs_account_entry_changed_newline_check_cb(GtkWidget
*entry
,
447 static void prefs_account_filter_on_recv_toggled(GtkToggleButton
*button
,
451 static void prefs_account_compose_default_dictionary_set_string_from_optmenu
453 static void prefs_account_compose_default_dictionary_set_optmenu_from_string
457 static gchar
*privacy_prefs
;
459 static PrefParam basic_param
[] = {
460 {"account_name", NULL
, &tmp_ac_prefs
.account_name
, P_STRING
,
461 &basic_page
.acname_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
463 {"is_default", "FALSE", &tmp_ac_prefs
.is_default
, P_BOOL
,
464 &basic_page
.default_checkbtn
,
465 prefs_set_data_from_toggle
, prefs_set_toggle
},
467 {"name", NULL
, &tmp_ac_prefs
.name
, P_STRING
,
468 &basic_page
.name_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
470 {"address", NULL
, &tmp_ac_prefs
.address
, P_STRING
,
471 &basic_page
.addr_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
473 {"organization", NULL
, &tmp_ac_prefs
.organization
, P_STRING
,
474 &basic_page
.org_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
476 {"protocol", NULL
, &tmp_ac_prefs
.protocol
, P_ENUM
,
477 (GtkWidget
**)&basic_page
.protocol_optmenu
,
478 prefs_account_protocol_set_data_from_optmenu
,
479 prefs_account_protocol_set_optmenu
},
481 {"receive_server", NULL
, &tmp_ac_prefs
.recv_server
, P_STRING
,
482 &basic_page
.recvserv_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
484 {"smtp_server", NULL
, &tmp_ac_prefs
.smtp_server
, P_STRING
,
485 &basic_page
.smtpserv_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
487 {"nntp_server", NULL
, &tmp_ac_prefs
.nntp_server
, P_STRING
,
488 &basic_page
.nntpserv_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
490 {"local_mbox", "/var/mail", &tmp_ac_prefs
.local_mbox
, P_STRING
,
491 &basic_page
.localmbox_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
493 {"use_mail_command", "FALSE", &tmp_ac_prefs
.use_mail_command
, P_BOOL
,
494 &basic_page
.mailcmd_checkbtn
, prefs_set_data_from_toggle
, prefs_set_toggle
},
496 {"mail_command", DEFAULT_SENDMAIL_CMD
, &tmp_ac_prefs
.mail_command
, P_STRING
,
497 &basic_page
.mailcmd_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
499 {"use_nntp_auth", "FALSE", &tmp_ac_prefs
.use_nntp_auth
, P_BOOL
,
500 &basic_page
.nntpauth_checkbtn
,
501 prefs_set_data_from_toggle
, prefs_set_toggle
},
503 {"use_nntp_auth_onconnect", "FALSE", &tmp_ac_prefs
.use_nntp_auth_onconnect
, P_BOOL
,
504 &basic_page
.nntpauth_onconnect_checkbtn
,
505 prefs_set_data_from_toggle
, prefs_set_toggle
},
507 {"user_id", NULL
, &tmp_ac_prefs
.userid
, P_STRING
,
508 &basic_page
.uid_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
510 {"password", NULL
, &tmp_ac_prefs
.passwd
, P_PASSWORD
,
513 {"config_version", "-1", &tmp_ac_prefs
.config_version
, P_INT
,
516 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
519 static PrefParam receive_param
[] = {
520 {"use_apop_auth", "FALSE", &tmp_ac_prefs
.use_apop_auth
, P_BOOL
,
521 NULL
, NULL
}, /* deprecated */
523 {"use_pop_auth", "FALSE", &tmp_ac_prefs
.use_pop_auth
, P_BOOL
,
524 &receive_page
.pop_auth_checkbtn
,
525 prefs_set_data_from_toggle
, prefs_set_toggle
},
527 {"pop_auth_method", "0", &tmp_ac_prefs
.pop_auth_type
, P_ENUM
,
528 &receive_page
.pop_auth_type_optmenu
,
529 prefs_account_pop_auth_type_set_data_from_optmenu
,
530 prefs_account_pop_auth_type_set_optmenu
},
532 {"remove_mail", "TRUE", &tmp_ac_prefs
.rmmail
, P_BOOL
,
533 &receive_page
.rmmail_checkbtn
,
534 prefs_set_data_from_toggle
, prefs_set_toggle
},
537 {"message_leave_time", "7", &tmp_ac_prefs
.msg_leave_time
, P_INT
,
538 &receive_page
.leave_time_spinbtn
,
539 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
541 {"message_leave_time", "30", &tmp_ac_prefs
.msg_leave_time
, P_INT
,
542 &receive_page
.leave_time_spinbtn
,
543 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
545 {"message_leave_hour", "0", &tmp_ac_prefs
.msg_leave_hour
, P_INT
,
546 &receive_page
.leave_hour_spinbtn
,
547 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
549 {"enable_size_limit", "FALSE", &tmp_ac_prefs
.enable_size_limit
, P_BOOL
,
550 &receive_page
.size_limit_checkbtn
,
551 prefs_set_data_from_toggle
, prefs_set_toggle
},
552 {"size_limit", "1024", &tmp_ac_prefs
.size_limit
, P_INT
,
553 &receive_page
.size_limit_spinbtn
,
554 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
556 {"filter_on_receive", "TRUE", &tmp_ac_prefs
.filter_on_recv
, P_BOOL
,
557 &receive_page
.filter_on_recv_checkbtn
,
558 prefs_set_data_from_toggle
, prefs_set_toggle
},
560 {"filterhook_on_receive", "TRUE", &tmp_ac_prefs
.filterhook_on_recv
, P_BOOL
,
561 &receive_page
.filterhook_on_recv_checkbtn
,
562 prefs_set_data_from_toggle
, prefs_set_toggle
},
564 {"imap_auth_method", "0", &tmp_ac_prefs
.imap_auth_type
, P_ENUM
,
565 &receive_page
.imap_auth_type_optmenu
,
566 prefs_account_imap_auth_type_set_data_from_optmenu
,
567 prefs_account_imap_auth_type_set_optmenu
},
569 {"receive_at_get_all", "TRUE", &tmp_ac_prefs
.recv_at_getall
, P_BOOL
,
570 &receive_page
.recvatgetall_checkbtn
,
571 prefs_set_data_from_toggle
, prefs_set_toggle
},
573 {"max_news_articles", "300", &tmp_ac_prefs
.max_articles
, P_INT
,
574 &receive_page
.maxarticle_spinbtn
,
575 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
577 {"inbox", "#mh/Mailbox/inbox", &tmp_ac_prefs
.inbox
, P_STRING
,
578 &receive_page
.inbox_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
580 {"local_inbox", "#mh/Mailbox/inbox", &tmp_ac_prefs
.local_inbox
, P_STRING
,
581 &receive_page
.local_inbox_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
583 {"imap_directory", NULL
, &tmp_ac_prefs
.imap_dir
, P_STRING
,
584 &receive_page
.imapdir_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
586 {"imap_subsonly", "TRUE", &tmp_ac_prefs
.imap_subsonly
, P_BOOL
,
587 &receive_page
.subsonly_checkbtn
,
588 prefs_set_data_from_toggle
, prefs_set_toggle
},
590 {"low_bandwidth", "FALSE", &tmp_ac_prefs
.low_bandwidth
, P_BOOL
,
591 &receive_page
.low_bandwidth_checkbtn
,
592 prefs_set_data_from_toggle
, prefs_set_toggle
},
594 {"autochk_use_default", "TRUE", &tmp_ac_prefs
.autochk_use_default
, P_BOOL
,
595 &receive_page
.autochk_use_default_checkbtn
,
596 prefs_set_data_from_toggle
, prefs_set_toggle
},
598 {"autochk_use_custom", "FALSE", &tmp_ac_prefs
.autochk_use_custom
, P_BOOL
,
599 &receive_page
.autochk_checkbtn
,
600 prefs_set_data_from_toggle
, prefs_set_toggle
},
602 /* Here we lie a bit, passing a pointer to our custom struct,
603 * disguised as a GtkWidget pointer, to get around the
604 * inflexibility of PrefParam system. */
605 {"autochk_interval", "600", &tmp_ac_prefs
.autochk_itv
, P_INT
,
606 (GtkWidget
**)&receive_page
.autochk_widgets
,
607 prefs_account_set_autochk_interval_from_widgets
,
608 prefs_account_set_autochk_interval_to_widgets
},
610 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
613 static PrefParam send_param
[] = {
614 {"generate_msgid", "TRUE", &tmp_ac_prefs
.gen_msgid
, P_BOOL
,
615 &send_page
.msgid_checkbtn
,
616 prefs_set_data_from_toggle
, prefs_set_toggle
},
618 {"generate_xmailer", "TRUE", &tmp_ac_prefs
.gen_xmailer
, P_BOOL
,
619 &send_page
.xmailer_checkbtn
,
620 prefs_set_data_from_toggle
, prefs_set_toggle
},
622 {"add_custom_header", "FALSE", &tmp_ac_prefs
.add_customhdr
, P_BOOL
,
623 &send_page
.customhdr_checkbtn
,
624 prefs_set_data_from_toggle
, prefs_set_toggle
},
626 {"msgid_with_addr", "FALSE", &tmp_ac_prefs
.msgid_with_addr
, P_BOOL
,
627 &send_page
.msgid_with_addr_checkbtn
,
628 prefs_set_data_from_toggle
, prefs_set_toggle
},
630 {"use_smtp_auth", "FALSE", &tmp_ac_prefs
.use_smtp_auth
, P_BOOL
,
631 &send_page
.smtp_auth_checkbtn
,
632 prefs_set_data_from_toggle
, prefs_set_toggle
},
634 {"smtp_auth_method", "0", &tmp_ac_prefs
.smtp_auth_type
, P_ENUM
,
635 &send_page
.smtp_auth_type_optmenu
,
636 prefs_account_smtp_auth_type_set_data_from_optmenu
,
637 prefs_account_smtp_auth_type_set_optmenu
},
639 {"smtp_user_id", NULL
, &tmp_ac_prefs
.smtp_userid
, P_STRING
,
640 &send_page
.smtp_uid_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
641 {"smtp_password", NULL
, &tmp_ac_prefs
.smtp_passwd
, P_PASSWORD
,
644 {"pop_before_smtp", "FALSE", &tmp_ac_prefs
.pop_before_smtp
, P_BOOL
,
645 &send_page
.pop_bfr_smtp_checkbtn
,
646 prefs_set_data_from_toggle
, prefs_set_toggle
},
648 {"pop_before_smtp_timeout", "5", &tmp_ac_prefs
.pop_before_smtp_timeout
, P_INT
,
649 &send_page
.pop_bfr_smtp_tm_spinbtn
,
650 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
652 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
655 static PrefParam oauth2_param
[] = {
656 {"oauth2_auth_provider", "0", &tmp_ac_prefs
.oauth2_provider
, P_ENUM
,
657 &oauth2_page
.oauth2_auth_optmenu
,
658 prefs_account_oauth2_provider_set_data_from_optmenu
,
659 prefs_account_oauth2_provider_set_optmenu
},
661 {"oauth2_date", 0, &tmp_ac_prefs
.oauth2_date
, P_INT
,
664 {"oauth2_authcode", NULL
, &tmp_ac_prefs
.oauth2_authcode
, P_PASSWORD
,
667 {"oauth2_client_id", NULL
, &tmp_ac_prefs
.oauth2_client_id
, P_STRING
,
668 &oauth2_page
.oauth2_client_id_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
670 {"oauth2_client_secret", NULL
, &tmp_ac_prefs
.oauth2_client_secret
, P_STRING
,
671 &oauth2_page
.oauth2_client_secret_entry
, prefs_set_data_from_entry
, prefs_set_entry
},
673 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
676 static PrefParam compose_param
[] = {
677 {"signature_type", "0", &tmp_ac_prefs
.sig_type
, P_ENUM
,
678 &compose_page
.sigfile_radiobtn
,
679 prefs_account_enum_set_data_from_radiobtn
,
680 prefs_account_enum_set_radiobtn
},
681 {"signature_path", "~" G_DIR_SEPARATOR_S DEFAULT_SIGNATURE
,
682 &tmp_ac_prefs
.sig_path
, P_STRING
, &compose_page
.entry_sigpath
,
683 prefs_set_data_from_entry
, prefs_set_entry
},
685 {"auto_signature", "TRUE", &tmp_ac_prefs
.auto_sig
, P_BOOL
,
686 &compose_page
.checkbtn_autosig
,
687 prefs_set_data_from_toggle
, prefs_set_toggle
},
689 {"signature_separator", "-- ", &tmp_ac_prefs
.sig_sep
, P_STRING
,
690 &compose_page
.entry_sigsep
,
691 prefs_set_data_from_entry
, prefs_set_entry
},
693 {"set_autocc", "FALSE", &tmp_ac_prefs
.set_autocc
, P_BOOL
,
694 &compose_page
.autocc_checkbtn
,
695 prefs_set_data_from_toggle
, prefs_set_toggle
},
697 {"auto_cc", NULL
, &tmp_ac_prefs
.auto_cc
, P_STRING
,
698 &compose_page
.autocc_entry
,
699 prefs_set_data_from_entry
, prefs_set_entry
},
701 {"set_autobcc", "FALSE", &tmp_ac_prefs
.set_autobcc
, P_BOOL
,
702 &compose_page
.autobcc_checkbtn
,
703 prefs_set_data_from_toggle
, prefs_set_toggle
},
705 {"auto_bcc", NULL
, &tmp_ac_prefs
.auto_bcc
, P_STRING
,
706 &compose_page
.autobcc_entry
,
707 prefs_set_data_from_entry
, prefs_set_entry
},
709 {"set_autoreplyto", "FALSE", &tmp_ac_prefs
.set_autoreplyto
, P_BOOL
,
710 &compose_page
.autoreplyto_checkbtn
,
711 prefs_set_data_from_toggle
, prefs_set_toggle
},
713 {"auto_replyto", NULL
, &tmp_ac_prefs
.auto_replyto
, P_STRING
,
714 &compose_page
.autoreplyto_entry
,
715 prefs_set_data_from_entry
, prefs_set_entry
},
718 {"enable_default_dictionary", "", &tmp_ac_prefs
.enable_default_dictionary
, P_BOOL
,
719 &compose_page
.checkbtn_enable_default_dictionary
,
720 prefs_set_data_from_toggle
, prefs_set_toggle
},
722 {"default_dictionary", NULL
, &tmp_ac_prefs
.default_dictionary
, P_STRING
,
723 &compose_page
.combo_default_dictionary
,
724 prefs_account_compose_default_dictionary_set_string_from_optmenu
,
725 prefs_account_compose_default_dictionary_set_optmenu_from_string
},
727 {"enable_default_alt_dictionary", "", &tmp_ac_prefs
.enable_default_alt_dictionary
, P_BOOL
,
728 &compose_page
.checkbtn_enable_default_alt_dictionary
,
729 prefs_set_data_from_toggle
, prefs_set_toggle
},
731 {"default_alt_dictionary", NULL
, &tmp_ac_prefs
.default_alt_dictionary
, P_STRING
,
732 &compose_page
.combo_default_alt_dictionary
,
733 prefs_account_compose_default_dictionary_set_string_from_optmenu
,
734 prefs_account_compose_default_dictionary_set_optmenu_from_string
},
736 {"enable_default_dictionary", "", &tmp_ac_prefs
.enable_default_dictionary
, P_BOOL
,
739 {"default_dictionary", NULL
, &tmp_ac_prefs
.default_dictionary
, P_STRING
,
742 {"enable_default_alt_dictionary", "", &tmp_ac_prefs
.enable_default_alt_dictionary
, P_BOOL
,
745 {"default_alt_dictionary", NULL
, &tmp_ac_prefs
.default_alt_dictionary
, P_STRING
,
749 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
752 static PrefParam templates_param
[] = {
753 {"compose_with_format", "FALSE", &tmp_ac_prefs
.compose_with_format
, P_BOOL
,
754 &templates_page
.checkbtn_compose_with_format
,
755 prefs_set_data_from_toggle
, prefs_set_toggle
},
757 {"compose_subject_format", NULL
, &tmp_ac_prefs
.compose_subject_format
, P_STRING
,
758 &templates_page
.compose_subject_format
,
759 prefs_set_escaped_data_from_entry
, prefs_set_entry_from_escaped
},
761 {"compose_body_format", NULL
, &tmp_ac_prefs
.compose_body_format
, P_STRING
,
762 &templates_page
.compose_body_format
,
763 prefs_set_escaped_data_from_text
, prefs_set_text_from_escaped
},
765 {"reply_with_format", "FALSE", &tmp_ac_prefs
.reply_with_format
, P_BOOL
,
766 &templates_page
.checkbtn_reply_with_format
,
767 prefs_set_data_from_toggle
, prefs_set_toggle
},
769 {"reply_quotemark", NULL
, &tmp_ac_prefs
.reply_quotemark
, P_STRING
,
770 &templates_page
.reply_quotemark
,
771 prefs_set_data_from_entry
, prefs_set_entry_from_escaped
},
773 {"reply_body_format", NULL
, &tmp_ac_prefs
.reply_body_format
, P_STRING
,
774 &templates_page
.reply_body_format
,
775 prefs_set_escaped_data_from_text
, prefs_set_text_from_escaped
},
777 {"forward_with_format", "FALSE", &tmp_ac_prefs
.forward_with_format
, P_BOOL
,
778 &templates_page
.checkbtn_forward_with_format
,
779 prefs_set_data_from_toggle
, prefs_set_toggle
},
781 {"forward_quotemark", NULL
, &tmp_ac_prefs
.forward_quotemark
, P_STRING
,
782 &templates_page
.forward_quotemark
,
783 prefs_set_data_from_entry
, prefs_set_entry_from_escaped
},
785 {"forward_body_format", NULL
, &tmp_ac_prefs
.forward_body_format
, P_STRING
,
786 &templates_page
.forward_body_format
,
787 prefs_set_escaped_data_from_text
, prefs_set_text_from_escaped
},
789 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
792 static PrefParam privacy_param
[] = {
793 {"default_privacy_system", "", &tmp_ac_prefs
.default_privacy_system
, P_STRING
,
794 &privacy_page
.default_privacy_system
,
795 prefs_account_set_string_from_combobox
,
796 prefs_account_set_privacy_combobox_from_string
},
798 {"default_encrypt", "FALSE", &tmp_ac_prefs
.default_encrypt
, P_BOOL
,
799 &privacy_page
.default_encrypt_checkbtn
,
800 prefs_set_data_from_toggle
, prefs_set_toggle
},
802 {"default_encrypt_reply", "TRUE", &tmp_ac_prefs
.default_encrypt_reply
, P_BOOL
,
803 &privacy_page
.default_encrypt_reply_checkbtn
,
804 prefs_set_data_from_toggle
, prefs_set_toggle
},
806 {"default_sign", "FALSE", &tmp_ac_prefs
.default_sign
, P_BOOL
,
807 &privacy_page
.default_sign_checkbtn
,
808 prefs_set_data_from_toggle
, prefs_set_toggle
},
810 {"default_sign_reply", "TRUE", &tmp_ac_prefs
.default_sign_reply
, P_BOOL
,
811 &privacy_page
.default_sign_reply_checkbtn
,
812 prefs_set_data_from_toggle
, prefs_set_toggle
},
814 /* Bug 2367: disturbing for Win32 users with no keypair */
815 {"default_sign_reply", "FALSE", &tmp_ac_prefs
.default_sign_reply
, P_BOOL
,
816 &privacy_page
.default_sign_reply_checkbtn
,
817 prefs_set_data_from_toggle
, prefs_set_toggle
},
819 {"save_clear_text", "FALSE", &tmp_ac_prefs
.save_encrypted_as_clear_text
, P_BOOL
,
820 &privacy_page
.save_clear_text_checkbtn
,
821 prefs_set_data_from_toggle
, prefs_set_toggle
},
823 {"encrypt_to_self", "FALSE", &tmp_ac_prefs
.encrypt_to_self
, P_BOOL
,
824 &privacy_page
.encrypt_to_self_checkbtn
,
825 prefs_set_data_from_toggle
, prefs_set_toggle
},
827 {"privacy_prefs", "", &privacy_prefs
, P_STRING
,
830 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
833 static PrefParam ssl_param
[] = {
835 {"ssl_pop", "0", &tmp_ac_prefs
.ssl_pop
, P_ENUM
,
836 &ssl_page
.pop_nossl_radiobtn
,
837 prefs_account_enum_set_data_from_radiobtn
,
838 prefs_account_enum_set_radiobtn
},
840 {"ssl_imap", "0", &tmp_ac_prefs
.ssl_imap
, P_ENUM
,
841 &ssl_page
.imap_nossl_radiobtn
,
842 prefs_account_enum_set_data_from_radiobtn
,
843 prefs_account_enum_set_radiobtn
},
845 {"ssl_nntp", "0", &tmp_ac_prefs
.ssl_nntp
, P_ENUM
,
846 &ssl_page
.nntp_nossl_radiobtn
,
847 prefs_account_enum_set_data_from_radiobtn
,
848 prefs_account_enum_set_radiobtn
},
850 {"ssl_smtp", "0", &tmp_ac_prefs
.ssl_smtp
, P_ENUM
,
851 &ssl_page
.smtp_nossl_radiobtn
,
852 prefs_account_enum_set_data_from_radiobtn
,
853 prefs_account_enum_set_radiobtn
},
855 {"ssl_certs_auto_accept", "0", &tmp_ac_prefs
.ssl_certs_auto_accept
, P_BOOL
,
856 &ssl_page
.ssl_certs_auto_accept_checkbtn
,
857 prefs_set_data_from_toggle
, prefs_set_toggle
},
859 {"use_nonblocking_ssl", "1", &tmp_ac_prefs
.use_nonblocking_ssl
, P_BOOL
,
860 &ssl_page
.use_nonblocking_ssl_checkbtn
,
861 prefs_set_data_from_toggle
, prefs_set_toggle
},
863 {"use_tls_sni", "1", &tmp_ac_prefs
.use_tls_sni
, P_BOOL
,
866 {"in_ssl_client_cert_file", "", &tmp_ac_prefs
.in_ssl_client_cert_file
, P_STRING
,
867 &ssl_page
.entry_in_cert_file
, prefs_set_data_from_entry
, prefs_set_entry
},
869 {"in_ssl_client_cert_pass", "", &tmp_ac_prefs
.in_ssl_client_cert_pass
, P_PASSWORD
,
872 {"out_ssl_client_cert_file", "", &tmp_ac_prefs
.out_ssl_client_cert_file
, P_STRING
,
873 &ssl_page
.entry_out_cert_file
, prefs_set_data_from_entry
, prefs_set_entry
},
875 {"out_ssl_client_cert_pass", "", &tmp_ac_prefs
.out_ssl_client_cert_pass
, P_PASSWORD
,
878 {"ssl_pop", "0", &tmp_ac_prefs
.ssl_pop
, P_ENUM
,
881 {"ssl_imap", "0", &tmp_ac_prefs
.ssl_imap
, P_ENUM
,
884 {"ssl_nntp", "0", &tmp_ac_prefs
.ssl_nntp
, P_ENUM
,
887 {"ssl_smtp", "0", &tmp_ac_prefs
.ssl_smtp
, P_ENUM
,
890 {"in_ssl_client_cert_file", "", &tmp_ac_prefs
.in_ssl_client_cert_file
, P_STRING
,
893 {"in_ssl_client_cert_pass", "", &tmp_ac_prefs
.in_ssl_client_cert_pass
, P_PASSWORD
,
896 {"out_ssl_client_cert_file", "", &tmp_ac_prefs
.out_ssl_client_cert_file
, P_STRING
,
899 {"out_ssl_client_cert_pass", "", &tmp_ac_prefs
.out_ssl_client_cert_pass
, P_PASSWORD
,
902 {"ssl_certs_auto_accept", "0", &tmp_ac_prefs
.ssl_certs_auto_accept
, P_BOOL
,
905 {"use_nonblocking_ssl", "1", &tmp_ac_prefs
.use_nonblocking_ssl
, P_BOOL
,
907 #endif /* USE_GNUTLS */
909 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
912 static PrefParam proxy_param
[] = {
914 {"use_proxy", "FALSE", &tmp_ac_prefs
.use_proxy
, P_BOOL
,
915 &proxy_page
.proxy_checkbtn
,
916 prefs_set_data_from_toggle
, prefs_set_toggle
},
918 {"use_default_proxy", "TRUE", &tmp_ac_prefs
.use_default_proxy
, P_BOOL
,
919 &proxy_page
.default_proxy_checkbtn
,
920 prefs_set_data_from_toggle
, prefs_set_toggle
},
922 {"use_proxy_for_send", "TRUE", &tmp_ac_prefs
.use_proxy_for_send
, P_BOOL
,
923 &proxy_page
.proxy_send_checkbtn
,
924 prefs_set_data_from_toggle
, prefs_set_toggle
},
926 {"proxy_type", "1", &tmp_ac_prefs
.proxy_info
.proxy_type
, P_ENUM
,
927 &proxy_page
.socks4_radiobtn
,
928 prefs_account_enum_set_data_from_radiobtn
,
929 prefs_account_enum_set_radiobtn
},
931 {"proxy_host", "localhost", &tmp_ac_prefs
.proxy_info
.proxy_host
, P_STRING
,
932 &proxy_page
.proxy_host_entry
,
933 prefs_set_data_from_entry
, prefs_set_entry
},
935 {"proxy_port", "1080", &tmp_ac_prefs
.proxy_info
.proxy_port
, P_USHORT
,
936 &proxy_page
.proxy_port_spinbtn
,
937 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
939 {"use_proxy_auth", "FALSE", &tmp_ac_prefs
.proxy_info
.use_proxy_auth
, P_BOOL
,
940 &proxy_page
.proxy_auth_checkbtn
,
941 prefs_set_data_from_toggle
, prefs_set_toggle
},
943 {"proxy_name", "", &tmp_ac_prefs
.proxy_info
.proxy_name
, P_STRING
,
944 &proxy_page
.proxy_name_entry
,
945 prefs_set_data_from_entry
, prefs_set_entry
},
947 {"proxy_pass", NULL
, &tmp_ac_prefs
.proxy_info
.proxy_pass
, P_PASSWORD
,
951 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
954 static PrefParam advanced_param
[] = {
955 {"set_smtpport", "FALSE", &tmp_ac_prefs
.set_smtpport
, P_BOOL
,
956 &advanced_page
.smtpport_checkbtn
,
957 prefs_set_data_from_toggle
, prefs_set_toggle
},
959 {"smtp_port", "25", &tmp_ac_prefs
.smtpport
, P_USHORT
,
960 &advanced_page
.smtpport_spinbtn
,
961 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
963 {"set_popport", "FALSE", &tmp_ac_prefs
.set_popport
, P_BOOL
,
964 &advanced_page
.popport_checkbtn
,
965 prefs_set_data_from_toggle
, prefs_set_toggle
},
967 {"pop_port", "110", &tmp_ac_prefs
.popport
, P_USHORT
,
968 &advanced_page
.popport_spinbtn
,
969 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
971 {"set_imapport", "FALSE", &tmp_ac_prefs
.set_imapport
, P_BOOL
,
972 &advanced_page
.imapport_checkbtn
,
973 prefs_set_data_from_toggle
, prefs_set_toggle
},
975 {"imap_port", "143", &tmp_ac_prefs
.imapport
, P_USHORT
,
976 &advanced_page
.imapport_spinbtn
,
977 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
979 {"set_nntpport", "FALSE", &tmp_ac_prefs
.set_nntpport
, P_BOOL
,
980 &advanced_page
.nntpport_checkbtn
,
981 prefs_set_data_from_toggle
, prefs_set_toggle
},
983 {"nntp_port", "119", &tmp_ac_prefs
.nntpport
, P_USHORT
,
984 &advanced_page
.nntpport_spinbtn
,
985 prefs_set_data_from_spinbtn
, prefs_set_spinbtn
},
987 {"set_domain", "FALSE", &tmp_ac_prefs
.set_domain
, P_BOOL
,
988 &advanced_page
.domain_checkbtn
,
989 prefs_set_data_from_toggle
, prefs_set_toggle
},
991 {"domain", NULL
, &tmp_ac_prefs
.domain
, P_STRING
,
992 &advanced_page
.domain_entry
,
993 prefs_set_data_from_entry
, prefs_set_entry
},
996 {"gnutls_set_priority", "FALSE", &tmp_ac_prefs
.set_gnutls_priority
, P_BOOL
,
999 {"gnutls_priority", NULL
, &tmp_ac_prefs
.gnutls_priority
, P_STRING
,
1004 {"set_tunnelcmd", "FALSE", &tmp_ac_prefs
.set_tunnelcmd
, P_BOOL
,
1005 &advanced_page
.tunnelcmd_checkbtn
,
1006 prefs_set_data_from_toggle
, prefs_set_toggle
},
1008 {"tunnelcmd", NULL
, &tmp_ac_prefs
.tunnelcmd
, P_STRING
,
1009 &advanced_page
.tunnelcmd_entry
,
1010 prefs_set_data_from_entry
, prefs_set_entry
},
1012 {"mark_crosspost_read", "FALSE", &tmp_ac_prefs
.mark_crosspost_read
, P_BOOL
,
1013 &advanced_page
.crosspost_checkbtn
,
1014 prefs_set_data_from_toggle
, prefs_set_toggle
},
1016 {"crosspost_color", NULL
, &tmp_ac_prefs
.crosspost_col
, P_ENUM
,
1017 &advanced_page
.crosspost_colormenu
,
1018 prefs_account_crosspost_set_data_from_colormenu
,
1019 prefs_account_crosspost_set_colormenu
},
1021 {"set_sent_folder", "FALSE", &tmp_ac_prefs
.set_sent_folder
, P_BOOL
,
1022 &advanced_page
.sent_folder_checkbtn
,
1023 prefs_set_data_from_toggle
, prefs_set_toggle
},
1024 {"sent_folder", NULL
, &tmp_ac_prefs
.sent_folder
, P_STRING
,
1025 &advanced_page
.sent_folder_entry
,
1026 prefs_set_data_from_entry
, prefs_set_entry
},
1028 {"set_queue_folder", "FALSE", &tmp_ac_prefs
.set_queue_folder
, P_BOOL
,
1029 &advanced_page
.queue_folder_checkbtn
,
1030 prefs_set_data_from_toggle
, prefs_set_toggle
},
1031 {"queue_folder", NULL
, &tmp_ac_prefs
.queue_folder
, P_STRING
,
1032 &advanced_page
.queue_folder_entry
,
1033 prefs_set_data_from_entry
, prefs_set_entry
},
1035 {"set_draft_folder", "FALSE", &tmp_ac_prefs
.set_draft_folder
, P_BOOL
,
1036 &advanced_page
.draft_folder_checkbtn
,
1037 prefs_set_data_from_toggle
, prefs_set_toggle
},
1038 {"draft_folder", NULL
, &tmp_ac_prefs
.draft_folder
, P_STRING
,
1039 &advanced_page
.draft_folder_entry
,
1040 prefs_set_data_from_entry
, prefs_set_entry
},
1042 {"set_trash_folder", "FALSE", &tmp_ac_prefs
.set_trash_folder
, P_BOOL
,
1043 &advanced_page
.trash_folder_checkbtn
,
1044 prefs_set_data_from_toggle
, prefs_set_toggle
},
1045 {"trash_folder", NULL
, &tmp_ac_prefs
.trash_folder
, P_STRING
,
1046 &advanced_page
.trash_folder_entry
,
1047 prefs_set_data_from_entry
, prefs_set_entry
},
1050 {NULL
, NULL
, NULL
, P_OTHER
, NULL
, NULL
, NULL
}
1053 static gint
prefs_account_get_new_id (void);
1055 static void prefs_account_select_folder_cb (GtkWidget
*widget
,
1058 static void prefs_account_sigfile_radiobtn_cb (GtkWidget
*widget
,
1061 static void prefs_account_sigcmd_radiobtn_cb (GtkWidget
*widget
,
1064 static void prefs_account_signature_browse_cb (GtkWidget
*widget
,
1067 static void prefs_account_in_cert_browse_cb (GtkWidget
*widget
,
1070 static void prefs_account_out_cert_browse_cb (GtkWidget
*widget
,
1073 static void prefs_account_signature_edit_cb (GtkWidget
*widget
,
1076 static void pop_bfr_smtp_tm_set_sens (GtkWidget
*widget
,
1079 #if (defined USE_GNUTLS)
1080 static void auto_configure_cb (GtkWidget
*widget
,
1084 static void prefs_account_edit_custom_header (void);
1086 static void prefs_account_receive_itv_spinbutton_value_changed_cb(GtkWidget
*w
,
1089 #define COMBOBOX_PRIVACY_PLUGIN_ID 3
1091 /* Enable/disable necessary preference widgets based on current privacy
1093 static void privacy_system_activated(GtkWidget
*combobox
)
1095 gtk_widget_set_sensitive (privacy_page
.save_clear_text_checkbtn
,
1096 !gtk_toggle_button_get_active(
1097 GTK_TOGGLE_BUTTON(privacy_page
.encrypt_to_self_checkbtn
)));
1100 /* Populate the privacy system choice combobox with valid choices */
1101 static void update_privacy_system_menu() {
1104 GSList
*system_ids
, *cur
;
1106 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
1107 GTK_COMBO_BOX(privacy_page
.default_privacy_system
)));
1109 /* First add "None", as that one is always available. :) */
1110 gtk_list_store_append(menu
, &iter
);
1111 gtk_list_store_set(menu
, &iter
,
1112 COMBOBOX_TEXT
, _("None"),
1114 COMBOBOX_SENS
, TRUE
,
1115 COMBOBOX_PRIVACY_PLUGIN_ID
, "",
1118 /* Now go through list of available privacy systems and add an entry
1120 system_ids
= privacy_get_system_ids();
1121 for (cur
= system_ids
; cur
!= NULL
; cur
= g_slist_next(cur
)) {
1122 gchar
*id
= (gchar
*) cur
->data
;
1125 name
= privacy_system_get_name(id
);
1126 gtk_list_store_append(menu
, &iter
);
1127 gtk_list_store_set(menu
, &iter
,
1128 COMBOBOX_TEXT
, name
,
1130 COMBOBOX_SENS
, TRUE
,
1131 COMBOBOX_PRIVACY_PLUGIN_ID
, id
,
1135 g_slist_free(system_ids
);
1139 #define TABLE_YPAD 2
1141 static void basic_create_widget_func(PrefsPage
* _page
,
1145 BasicPage
*page
= (BasicPage
*) _page
;
1146 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
1151 GtkWidget
*acname_entry
;
1152 GtkWidget
*default_checkbtn
;
1155 GtkWidget
*name_entry
;
1156 GtkWidget
*addr_entry
;
1157 GtkWidget
*org_entry
;
1159 GtkWidget
*serv_frame
;
1161 GtkWidget
*optmenubox
;
1163 GtkWidget
*optlabel
;
1164 GtkWidget
*no_imap_warn_icon
;
1165 GtkWidget
*no_imap_warn_label
;
1166 GtkWidget
*serv_table
;
1167 GtkWidget
*recvserv_label
;
1168 GtkWidget
*smtpserv_label
;
1169 GtkWidget
*nntpserv_label
;
1170 GtkWidget
*localmbox_label
;
1171 GtkWidget
*mailcmd_label
;
1172 GtkWidget
*recvserv_entry
;
1173 GtkWidget
*smtpserv_entry
;
1174 GtkWidget
*nntpserv_entry
;
1175 GtkWidget
*nntpauth_checkbtn
;
1176 GtkWidget
*nntpauth_onconnect_checkbtn
;
1177 GtkWidget
*localmbox_entry
;
1178 GtkWidget
*mailcmd_checkbtn
;
1179 GtkWidget
*mailcmd_entry
;
1180 GtkWidget
*uid_label
;
1181 GtkWidget
*pass_label
;
1182 GtkWidget
*uid_entry
;
1183 GtkWidget
*pass_entry
;
1184 GtkWidget
*auto_configure_btn
;
1185 GtkWidget
*auto_configure_cancel_btn
;
1186 GtkWidget
*auto_configure_lbl
;
1187 GtkWidget
*showpwd_checkbtn
;
1192 struct BasicProtocol
*protocol_optmenu
;
1195 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
1196 gtk_widget_show (vbox1
);
1197 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
1199 hbox
= gtk_hbox_new (FALSE
, 8);
1200 gtk_widget_show (hbox
);
1201 gtk_box_pack_start (GTK_BOX (vbox1
), hbox
, FALSE
, FALSE
, 0);
1203 label
= gtk_label_new (_("Name of account"));
1204 gtk_widget_show (label
);
1205 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
1207 acname_entry
= gtk_entry_new ();
1208 gtk_widget_show (acname_entry
);
1209 gtk_widget_set_size_request (acname_entry
, DEFAULT_ENTRY_WIDTH
, -1);
1210 gtk_box_pack_start (GTK_BOX (hbox
), acname_entry
, TRUE
, TRUE
, 0);
1212 default_checkbtn
= gtk_check_button_new_with_label (_("Set as default"));
1213 gtk_widget_show (default_checkbtn
);
1214 #ifndef GENERIC_UMPC
1215 gtk_box_pack_end (GTK_BOX (hbox
), default_checkbtn
, TRUE
, FALSE
, 0);
1217 gtk_box_pack_start (GTK_BOX (vbox1
), default_checkbtn
, FALSE
, FALSE
, 0);
1220 PACK_FRAME (vbox1
, frame1
, _("Personal information"));
1222 table1
= gtk_table_new (3, 2, FALSE
);
1223 gtk_widget_show (table1
);
1224 gtk_container_add (GTK_CONTAINER (frame1
), table1
);
1225 gtk_container_set_border_width (GTK_CONTAINER (table1
), 8);
1226 gtk_table_set_row_spacings (GTK_TABLE (table1
), VSPACING_NARROW
);
1227 gtk_table_set_col_spacings (GTK_TABLE (table1
), 8);
1229 label
= gtk_label_new (_("Full name"));
1230 gtk_widget_show (label
);
1231 gtk_table_attach (GTK_TABLE (table1
), label
, 0, 1, 0, 1,
1233 gtk_misc_set_alignment (GTK_MISC (label
), 1, 0.5);
1235 label
= gtk_label_new (_("Mail address"));
1236 gtk_widget_show (label
);
1237 gtk_table_attach (GTK_TABLE (table1
), label
, 0, 1, 1, 2,
1239 gtk_misc_set_alignment (GTK_MISC (label
), 1, 0.5);
1241 label
= gtk_label_new (_("Organization"));
1242 gtk_widget_show (label
);
1243 gtk_table_attach (GTK_TABLE (table1
), label
, 0, 1, 2, 3,
1245 gtk_misc_set_alignment (GTK_MISC (label
), 1, 0.5);
1247 name_entry
= gtk_entry_new ();
1248 gtk_widget_show (name_entry
);
1249 gtk_table_attach (GTK_TABLE (table1
), name_entry
, 1, 2, 0, 1,
1250 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1251 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1253 addr_entry
= gtk_entry_new ();
1254 gtk_widget_show (addr_entry
);
1255 gtk_table_attach (GTK_TABLE (table1
), addr_entry
, 1, 2, 1, 2,
1256 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1257 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1259 org_entry
= gtk_entry_new ();
1260 gtk_widget_show (org_entry
);
1261 gtk_table_attach (GTK_TABLE (table1
), org_entry
, 1, 2, 2, 3,
1262 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1263 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1265 vbox2
= gtkut_get_options_frame(vbox1
, &serv_frame
, _("Server information"));
1267 hbox
= gtk_hbox_new (FALSE
, 8);
1268 gtk_widget_show (hbox
);
1269 gtk_box_pack_start (GTK_BOX (vbox2
), hbox
, FALSE
, FALSE
, 0);
1271 label
= gtk_label_new (_("Protocol"));
1272 gtk_widget_show (label
);
1273 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
1275 /* Create GtkHBox for protocol combobox and label */
1276 optmenubox
= gtk_hbox_new(FALSE
, 20);
1277 gtk_widget_show(optmenubox
);
1278 gtk_box_pack_start (GTK_BOX (hbox
), optmenubox
, FALSE
, FALSE
, 0);
1280 /* Create and populate the combobox */
1281 optmenu
= gtkut_sc_combobox_create(NULL
, FALSE
);
1282 gtk_box_pack_start(GTK_BOX (optmenubox
), optmenu
, FALSE
, FALSE
, 0);
1284 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu
)));
1285 for( i
= 0; i
< NUM_RECV_PROTOCOLS
; i
++ )
1286 if( protocol_names
[i
] != NULL
)
1287 COMBOBOX_ADD (menu
, _(protocol_names
[i
]), i
);
1289 g_signal_connect(G_OBJECT(optmenu
), "changed",
1290 G_CALLBACK(prefs_account_protocol_changed
), NULL
);
1292 /* Create protocol label, empty for now */
1293 optlabel
= gtk_label_new("");
1294 gtk_label_set_use_markup(GTK_LABEL(optlabel
), TRUE
);
1295 gtk_label_set_justify(GTK_LABEL(optlabel
), GTK_JUSTIFY_CENTER
);
1296 gtk_box_pack_start(GTK_BOX (optmenubox
), optlabel
, FALSE
, FALSE
, 0);
1298 auto_configure_btn
= gtk_button_new_with_label(_("Auto-configure"));
1299 gtk_box_pack_start(GTK_BOX (optmenubox
), auto_configure_btn
, FALSE
, FALSE
, 0);
1300 auto_configure_cancel_btn
= gtk_button_new_with_label(_("Cancel"));
1301 gtk_box_pack_start(GTK_BOX (optmenubox
), auto_configure_cancel_btn
, FALSE
, FALSE
, 0);
1302 auto_configure_lbl
= gtk_label_new("");
1303 gtk_label_set_justify(GTK_LABEL(auto_configure_lbl
), GTK_JUSTIFY_LEFT
);
1304 gtk_box_pack_start(GTK_BOX (optmenubox
), auto_configure_lbl
, FALSE
, FALSE
, 0);
1305 #if (defined USE_GNUTLS)
1306 gtk_widget_show(auto_configure_btn
);
1307 gtk_widget_show(auto_configure_lbl
);
1308 g_signal_connect (G_OBJECT (auto_configure_btn
), "clicked",
1309 G_CALLBACK (auto_configure_cb
), NULL
);
1310 g_signal_connect (G_OBJECT (auto_configure_cancel_btn
), "clicked",
1311 G_CALLBACK (auto_configure_cb
), NULL
);
1314 no_imap_warn_icon
= gtk_image_new_from_stock
1315 (GTK_STOCK_DIALOG_WARNING
, GTK_ICON_SIZE_SMALL_TOOLBAR
);
1316 buf
= g_strconcat("<span weight=\"bold\">",
1317 _("Warning: this version of Claws Mail\n"
1318 "has been built without IMAP and News support."), "</span>", NULL
);
1319 no_imap_warn_label
= gtk_label_new(buf
);
1321 gtk_label_set_use_markup(GTK_LABEL(no_imap_warn_label
), TRUE
);
1323 gtk_box_pack_start(GTK_BOX (optmenubox
), no_imap_warn_icon
, FALSE
, FALSE
, 0);
1324 gtk_box_pack_start(GTK_BOX (optmenubox
), no_imap_warn_label
, FALSE
, FALSE
, 0);
1325 /* Set up a struct to store pointers to necessary widgets */
1326 protocol_optmenu
= g_new(struct BasicProtocol
, 1);
1327 protocol_optmenu
->combobox
= optmenu
;
1328 protocol_optmenu
->label
= optlabel
;
1329 protocol_optmenu
->descrlabel
= label
;
1330 protocol_optmenu
->no_imap_warn_icon
= no_imap_warn_icon
;
1331 protocol_optmenu
->no_imap_warn_label
= no_imap_warn_label
;
1333 serv_table
= gtk_table_new (10, 4, FALSE
);
1334 gtk_widget_show (serv_table
);
1335 gtk_box_pack_start (GTK_BOX (vbox2
), serv_table
, FALSE
, FALSE
, 0);
1336 gtk_table_set_row_spacings (GTK_TABLE (serv_table
), VSPACING_NARROW
);
1337 gtk_table_set_row_spacing (GTK_TABLE (serv_table
), 3, 0);
1338 gtk_table_set_col_spacings (GTK_TABLE (serv_table
), 8);
1340 nntpserv_entry
= gtk_entry_new ();
1341 gtk_widget_show (nntpserv_entry
);
1342 gtk_table_attach (GTK_TABLE (serv_table
), nntpserv_entry
, 1, 4, 0, 1,
1343 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1344 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1345 /* gtk_table_set_row_spacing (GTK_TABLE (serv_table), 0, 0); */
1347 nntpauth_checkbtn
= gtk_check_button_new_with_label
1348 (_("This server requires authentication"));
1349 gtk_widget_show (nntpauth_checkbtn
);
1351 gtk_table_attach (GTK_TABLE (serv_table
), nntpauth_checkbtn
, 0, 2, 6, 7,
1354 nntpauth_onconnect_checkbtn
= gtk_check_button_new_with_label
1355 (_("Authenticate on connect"));
1356 gtk_widget_show (nntpauth_onconnect_checkbtn
);
1358 gtk_table_attach (GTK_TABLE (serv_table
), nntpauth_onconnect_checkbtn
, 2, 4, 6, 7,
1361 recvserv_entry
= gtk_entry_new ();
1362 gtk_widget_show (recvserv_entry
);
1363 gtk_table_attach (GTK_TABLE (serv_table
), recvserv_entry
, 1, 4, 2, 3,
1364 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1365 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1367 localmbox_entry
= gtk_entry_new ();
1368 gtk_widget_show (localmbox_entry
);
1369 gtk_table_attach (GTK_TABLE (serv_table
), localmbox_entry
, 1, 4, 3, 4,
1370 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1371 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1373 smtpserv_entry
= gtk_entry_new ();
1374 gtk_widget_show (smtpserv_entry
);
1375 gtk_table_attach (GTK_TABLE (serv_table
), smtpserv_entry
, 1, 4, 4, 5,
1376 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1377 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1379 mailcmd_entry
= gtk_entry_new ();
1380 gtk_widget_show (mailcmd_entry
);
1381 gtk_table_attach (GTK_TABLE (serv_table
), mailcmd_entry
, 1, 4, 6, 7,
1382 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1383 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1385 uid_entry
= gtk_entry_new ();
1386 gtk_widget_show (uid_entry
);
1387 gtk_widget_set_size_request (uid_entry
, DEFAULT_ENTRY_WIDTH
, -1);
1388 g_signal_connect(G_OBJECT(uid_entry
), "changed",
1389 G_CALLBACK(prefs_account_entry_changed_newline_check_cb
),
1390 GINT_TO_POINTER(ac_prefs
->protocol
));
1392 pass_entry
= gtk_entry_new ();
1393 gtk_widget_show (pass_entry
);
1394 gtk_widget_set_size_request (pass_entry
, DEFAULT_ENTRY_WIDTH
, -1);
1395 g_signal_connect(G_OBJECT(pass_entry
), "changed",
1396 G_CALLBACK(prefs_account_entry_changed_newline_check_cb
),
1397 GINT_TO_POINTER(ac_prefs
->protocol
));
1399 #ifndef GENERIC_UMPC
1400 gtk_table_attach (GTK_TABLE (serv_table
), uid_entry
, 1, 2, 7, 8,
1401 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1402 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1404 gtk_table_attach (GTK_TABLE (serv_table
), pass_entry
, 3, 4, 7, 8,
1405 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1406 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1408 gtk_table_attach (GTK_TABLE (serv_table
), uid_entry
, 1, 4, 7, 8,
1409 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1410 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1411 gtk_table_attach (GTK_TABLE (serv_table
), pass_entry
, 1, 4, 8, 9,
1412 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
1413 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
1415 gtk_entry_set_visibility (GTK_ENTRY (pass_entry
), FALSE
);
1417 nntpserv_label
= gtk_label_new (_("News server"));
1418 gtk_widget_show (nntpserv_label
);
1419 gtk_table_attach (GTK_TABLE (serv_table
), nntpserv_label
, 0, 1, 0, 1,
1421 gtk_misc_set_alignment (GTK_MISC (nntpserv_label
), 1, 0.5);
1423 recvserv_label
= gtk_label_new (_("Server for receiving"));
1424 gtk_widget_show (recvserv_label
);
1425 gtk_table_attach (GTK_TABLE (serv_table
), recvserv_label
, 0, 1, 2, 3,
1427 gtk_misc_set_alignment (GTK_MISC (recvserv_label
), 1, 0.5);
1429 localmbox_label
= gtk_label_new (_("Local mailbox"));
1430 gtk_widget_show (localmbox_label
);
1431 gtk_table_attach (GTK_TABLE (serv_table
), localmbox_label
, 0, 1, 3, 4,
1433 gtk_misc_set_alignment (GTK_MISC (localmbox_label
), 1, 0.5);
1434 /* gtk_table_set_row_spacing (GTK_TABLE (serv_table), 2, 0); */
1436 smtpserv_label
= gtk_label_new (_("SMTP server (send)"));
1437 gtk_widget_show (smtpserv_label
);
1438 gtk_table_attach (GTK_TABLE (serv_table
), smtpserv_label
, 0, 1, 4, 5,
1440 gtk_misc_set_alignment (GTK_MISC (smtpserv_label
), 1, 0.5);
1441 /* gtk_table_set_row_spacing (GTK_TABLE (serv_table), 2, 0); */
1443 mailcmd_checkbtn
= gtk_check_button_new_with_label
1444 (_("Use mail command rather than SMTP server"));
1445 gtk_widget_show (mailcmd_checkbtn
);
1446 gtk_table_attach (GTK_TABLE (serv_table
), mailcmd_checkbtn
, 0, 4, 5, 6,
1447 GTK_EXPAND
| GTK_FILL
,
1449 g_signal_connect(G_OBJECT(mailcmd_checkbtn
), "toggled",
1450 G_CALLBACK(prefs_account_mailcmd_toggled
),
1453 mailcmd_label
= gtk_label_new (_("command to send mails"));
1454 gtk_widget_show (mailcmd_label
);
1455 gtk_table_attach (GTK_TABLE (serv_table
), mailcmd_label
, 0, 1, 6, 7,
1457 gtk_misc_set_alignment (GTK_MISC (mailcmd_label
), 1, 0.5);
1458 /* gtk_table_set_row_spacing (GTK_TABLE (serv_table), 2, 0); */
1460 uid_label
= gtk_label_new (_("User ID"));
1461 gtk_widget_show (uid_label
);
1462 gtk_table_attach (GTK_TABLE (serv_table
), uid_label
, 0, 1, 7, 8,
1464 gtk_misc_set_alignment (GTK_MISC (uid_label
), 1, 0.5);
1466 pass_label
= gtk_label_new (_("Password"));
1467 gtk_widget_show (pass_label
);
1468 #ifndef GENERIC_UMPC
1469 gtk_table_attach (GTK_TABLE (serv_table
), pass_label
, 2, 3, 7, 8,
1472 gtk_misc_set_alignment (GTK_MISC (pass_label
), 1, 0.5);
1473 gtk_table_attach (GTK_TABLE (serv_table
), pass_label
, 0, 1, 8, 9,
1477 showpwd_checkbtn
= gtk_check_button_new_with_label (_("Show password"));
1478 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(showpwd_checkbtn
), FALSE
);
1479 gtk_widget_show(showpwd_checkbtn
);
1480 gtk_table_attach (GTK_TABLE (serv_table
), showpwd_checkbtn
, 3, 4, 9, 10,
1482 g_signal_connect(G_OBJECT(showpwd_checkbtn
), "toggled",
1483 G_CALLBACK(prefs_account_showpwd_checkbtn_toggled
), pass_entry
);
1485 SET_TOGGLE_SENSITIVITY (nntpauth_checkbtn
, uid_label
);
1486 SET_TOGGLE_SENSITIVITY (nntpauth_checkbtn
, pass_label
);
1487 SET_TOGGLE_SENSITIVITY (nntpauth_checkbtn
, uid_entry
);
1488 SET_TOGGLE_SENSITIVITY (nntpauth_checkbtn
, pass_entry
);
1489 SET_TOGGLE_SENSITIVITY (nntpauth_checkbtn
, showpwd_checkbtn
);
1490 SET_TOGGLE_SENSITIVITY (nntpauth_checkbtn
, nntpauth_onconnect_checkbtn
);
1492 page
->acname_entry
= acname_entry
;
1493 page
->default_checkbtn
= default_checkbtn
;
1495 page
->name_entry
= name_entry
;
1496 page
->addr_entry
= addr_entry
;
1497 page
->org_entry
= org_entry
;
1499 page
->serv_frame
= serv_frame
;
1500 page
->serv_table
= serv_table
;
1501 page
->protocol_optmenu
= (gpointer
)protocol_optmenu
;
1502 page
->recvserv_label
= recvserv_label
;
1503 page
->recvserv_entry
= recvserv_entry
;
1504 page
->smtpserv_label
= smtpserv_label
;
1505 page
->smtpserv_entry
= smtpserv_entry
;
1506 page
->nntpserv_label
= nntpserv_label
;
1507 page
->nntpserv_entry
= nntpserv_entry
;
1508 page
->nntpauth_checkbtn
= nntpauth_checkbtn
;
1509 page
->nntpauth_onconnect_checkbtn
= nntpauth_onconnect_checkbtn
;
1510 page
->localmbox_label
= localmbox_label
;
1511 page
->localmbox_entry
= localmbox_entry
;
1512 page
->mailcmd_checkbtn
= mailcmd_checkbtn
;
1513 page
->mailcmd_label
= mailcmd_label
;
1514 page
->mailcmd_entry
= mailcmd_entry
;
1515 page
->uid_label
= uid_label
;
1516 page
->pass_label
= pass_label
;
1517 page
->uid_entry
= uid_entry
;
1518 page
->pass_entry
= pass_entry
;
1519 page
->showpwd_checkbtn
= showpwd_checkbtn
;
1520 page
->auto_configure_btn
= auto_configure_btn
;
1521 page
->auto_configure_cancel_btn
= auto_configure_cancel_btn
;
1522 page
->auto_configure_lbl
= auto_configure_lbl
;
1525 prefs_set_dialog_to_default(basic_param
);
1526 buf
= g_strdup_printf(_("Account%d"), ac_prefs
->account_id
);
1527 gtk_entry_set_text(GTK_ENTRY(basic_page
.acname_entry
), buf
);
1530 prefs_set_dialog(basic_param
);
1532 /* Passwords are handled outside of PrefParams. */
1533 buf
= passwd_store_get_account(ac_prefs
->account_id
,
1535 gtk_entry_set_text(GTK_ENTRY(page
->pass_entry
), buf
!= NULL
? buf
: "");
1537 memset(buf
, 0, strlen(buf
));
1544 page
->page
.widget
= vbox1
;
1547 static void receive_create_widget_func(PrefsPage
* _page
,
1551 ReceivePage
*page
= (ReceivePage
*) _page
;
1552 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
1554 GtkWidget
*vbox1
, *vbox2
, *vbox3
, *vbox4
, *vbox5
;
1555 GtkWidget
*hbox1
, *hbox2
, *hbox3
;
1557 GtkWidget
*pop_auth_checkbtn
;
1558 GtkWidget
*rmmail_checkbtn
;
1559 GtkWidget
*hbox_spc
;
1560 GtkWidget
*leave_time_label
;
1561 GtkWidget
*leave_time_spinbtn
;
1562 GtkWidget
*leave_hour_label
;
1563 GtkWidget
*leave_hour_spinbtn
;
1564 GtkWidget
*size_limit_checkbtn
;
1565 GtkWidget
*size_limit_spinbtn
;
1567 GtkWidget
*filter_on_recv_checkbtn
;
1568 GtkWidget
*filterhook_on_recv_checkbtn
;
1569 GtkWidget
*inbox_label
;
1570 GtkWidget
*inbox_entry
;
1571 GtkWidget
*inbox_btn
;
1572 GtkWidget
*imap_frame
;
1573 GtkWidget
*imapdir_label
;
1574 GtkWidget
*imapdir_entry
;
1575 GtkWidget
*subsonly_checkbtn
;
1576 GtkWidget
*low_bandwidth_checkbtn
;
1577 GtkWidget
*local_frame
;
1578 GtkWidget
*local_vbox
;
1579 GtkWidget
*local_hbox
;
1580 GtkWidget
*local_inbox_label
;
1581 GtkWidget
*local_inbox_entry
;
1582 GtkWidget
*local_inbox_btn
;
1583 GtkWidget
*autochk_checkbtn
;
1584 GtkWidget
*autochk_hour_spinbtn
, *autochk_hour_label
;
1585 GtkWidget
*autochk_min_spinbtn
, *autochk_min_label
;
1586 GtkWidget
*autochk_sec_spinbtn
, *autochk_sec_label
;
1587 GtkWidget
*autochk_use_default_checkbtn
;
1589 struct AutocheckWidgets
*autochk_widgets
;
1591 GtkWidget
*optmenu
, *optmenu2
;
1592 GtkListStore
*menu
, *menu2
;
1594 GtkWidget
*recvatgetall_checkbtn
;
1596 GtkWidget
*frame
, *frame2
;
1597 GtkWidget
*maxarticle_label
;
1598 GtkWidget
*maxarticle_spinbtn
;
1599 GtkAdjustment
*maxarticle_spinbtn_adj
;
1601 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
1602 gtk_widget_show (vbox1
);
1603 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
1605 local_vbox
= gtkut_get_options_frame(vbox1
, &local_frame
, _("Local"));
1607 local_hbox
= gtk_hbox_new (FALSE
, 8);
1608 gtk_widget_show (local_hbox
);
1609 gtk_box_pack_start (GTK_BOX (local_vbox
), local_hbox
, FALSE
, FALSE
, 0);
1611 local_inbox_label
= gtk_label_new (_("Default Inbox"));
1612 gtk_widget_show (local_inbox_label
);
1613 gtk_box_pack_start (GTK_BOX (local_hbox
), local_inbox_label
, FALSE
, FALSE
, 0);
1615 local_inbox_entry
= gtk_entry_new ();
1616 gtk_widget_show (local_inbox_entry
);
1617 CLAWS_SET_TIP(local_inbox_entry
,
1618 _("Unfiltered messages will be stored in this folder"));
1619 gtk_widget_set_size_request (local_inbox_entry
, DEFAULT_ENTRY_WIDTH
, -1);
1620 gtk_box_pack_start (GTK_BOX (local_hbox
), local_inbox_entry
, TRUE
, TRUE
, 0);
1622 local_inbox_btn
= gtkut_get_browse_file_btn(_("Bro_wse"));
1623 gtk_widget_show (local_inbox_btn
);
1624 CLAWS_SET_TIP(local_inbox_btn
,
1625 _("Unfiltered messages will be stored in this folder"));
1626 gtk_box_pack_start (GTK_BOX (local_hbox
), local_inbox_btn
, FALSE
, FALSE
, 0);
1627 g_signal_connect (G_OBJECT (local_inbox_btn
), "clicked",
1628 G_CALLBACK (prefs_account_select_folder_cb
),
1631 vbox2
= gtkut_get_options_frame(vbox1
, &frame1
, _("POP"));
1633 PACK_CHECK_BUTTON (vbox2
, pop_auth_checkbtn
,
1634 _("Authenticate before POP connection"));
1636 vbox5
= gtk_vbox_new (FALSE
, 0);
1637 gtk_widget_show (vbox5
);
1638 gtk_box_pack_start (GTK_BOX (vbox2
), vbox5
, FALSE
, FALSE
, 0);
1640 hbox3
= gtk_hbox_new (FALSE
, 8);
1641 gtk_widget_show (hbox3
);
1642 gtk_box_pack_start (GTK_BOX (vbox5
), hbox3
, FALSE
, FALSE
, 0);
1644 hbox_spc
= gtk_hbox_new (FALSE
, 0);
1645 gtk_widget_show (hbox_spc
);
1646 gtk_box_pack_start (GTK_BOX (hbox3
), hbox_spc
, FALSE
, FALSE
, 0);
1647 gtk_widget_set_size_request (hbox_spc
, 12, -1);
1649 label
= gtk_label_new (_("Authentication method"));
1650 gtk_widget_show (label
);
1651 gtk_box_pack_start (GTK_BOX (hbox3
), label
, FALSE
, FALSE
, 0);
1653 optmenu2
= gtkut_sc_combobox_create(NULL
, FALSE
);
1654 menu2
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu2
)));
1655 gtk_widget_show (optmenu2
);
1656 gtk_box_pack_start (GTK_BOX (hbox3
), optmenu2
, FALSE
, FALSE
, 0);
1658 COMBOBOX_ADD (menu2
, _("Select"), 0);
1659 COMBOBOX_ADD (menu2
, NULL
, 0);
1660 COMBOBOX_ADD (menu2
, "APOP", POPAUTH_APOP
);
1661 COMBOBOX_ADD (menu2
, "OAuth2", POPAUTH_OAUTH2
);
1663 SET_TOGGLE_SENSITIVITY (pop_auth_checkbtn
, vbox5
);
1665 PACK_CHECK_BUTTON (vbox2
, rmmail_checkbtn
,
1666 _("Remove messages on server when received"));
1668 hbox1
= gtk_hbox_new (FALSE
, 8);
1669 gtk_widget_show (hbox1
);
1670 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 0);
1672 hbox_spc
= gtk_hbox_new (FALSE
, 0);
1673 gtk_widget_show (hbox_spc
);
1674 gtk_box_pack_start (GTK_BOX (hbox1
), hbox_spc
, FALSE
, FALSE
, 0);
1675 gtk_widget_set_size_request (hbox_spc
, 12, -1);
1677 leave_time_label
= gtk_label_new (_("Remove after"));
1678 gtk_widget_show (leave_time_label
);
1679 gtk_box_pack_start (GTK_BOX (hbox1
), leave_time_label
, FALSE
, FALSE
, 0);
1681 leave_time_spinbtn
= gtk_spin_button_new_with_range(0, 365, 1);
1682 gtk_widget_show (leave_time_spinbtn
);
1683 CLAWS_SET_TIP(leave_time_spinbtn
,
1684 _("0 days and 0 hours : remove immediately"));
1685 gtk_box_pack_start (GTK_BOX (hbox1
), leave_time_spinbtn
, FALSE
, FALSE
, 0);
1687 leave_time_label
= gtk_label_new (_("days"));
1688 gtk_widget_show (leave_time_label
);
1689 gtk_box_pack_start (GTK_BOX (hbox1
), leave_time_label
, FALSE
, FALSE
, 0);
1691 leave_hour_spinbtn
= gtk_spin_button_new_with_range(0, 23, 1);
1692 gtk_widget_show (leave_hour_spinbtn
);
1693 CLAWS_SET_TIP(leave_hour_spinbtn
,
1694 _("0 days and 0 hours : remove immediately"));
1695 gtk_box_pack_start (GTK_BOX (hbox1
), leave_hour_spinbtn
, FALSE
, FALSE
, 0);
1697 leave_hour_label
= gtk_label_new (_("hours"));
1698 gtk_widget_show (leave_hour_label
);
1699 gtk_box_pack_start (GTK_BOX (hbox1
), leave_hour_label
, FALSE
, FALSE
, 0);
1701 SET_TOGGLE_SENSITIVITY (rmmail_checkbtn
, hbox1
);
1703 hbox1
= gtk_hbox_new (FALSE
, 8);
1704 gtk_widget_show (hbox1
);
1705 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 0);
1707 PACK_CHECK_BUTTON (hbox1
, size_limit_checkbtn
, _("Receive size limit"));
1709 CLAWS_SET_TIP(size_limit_checkbtn
,
1710 _("Messages over this limit will be partially retrieved. "
1711 "When selecting them you will be able to download them fully "
1712 "or delete them."));
1714 size_limit_spinbtn
= gtk_spin_button_new_with_range(0, 100000, 1);
1715 gtk_widget_show (size_limit_spinbtn
);
1716 gtk_box_pack_start (GTK_BOX (hbox1
), size_limit_spinbtn
, FALSE
, FALSE
, 0);
1718 label
= gtk_label_new (_("KB"));
1719 gtk_widget_show (label
);
1720 gtk_box_pack_start (GTK_BOX (hbox1
), label
, FALSE
, FALSE
, 0);
1722 SET_TOGGLE_SENSITIVITY (size_limit_checkbtn
, size_limit_spinbtn
);
1724 PACK_SPACER(vbox2
, vbox3
, VSPACING_NARROW_2
);
1726 hbox1
= gtk_hbox_new (FALSE
, 8);
1727 gtk_widget_show (hbox1
);
1728 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 0);
1730 inbox_label
= gtk_label_new (_("Default Inbox"));
1731 gtk_widget_show (inbox_label
);
1732 gtk_box_pack_start (GTK_BOX (hbox1
), inbox_label
, FALSE
, FALSE
, 0);
1734 inbox_entry
= gtk_entry_new ();
1735 gtk_widget_show (inbox_entry
);
1736 CLAWS_SET_TIP(inbox_entry
,
1737 _("Unfiltered messages will be stored in this folder"));
1738 gtk_widget_set_size_request (inbox_entry
, DEFAULT_ENTRY_WIDTH
, -1);
1739 gtk_box_pack_start (GTK_BOX (hbox1
), inbox_entry
, TRUE
, TRUE
, 0);
1741 inbox_btn
= gtkut_get_browse_file_btn(_("Bro_wse"));
1742 gtk_widget_show (inbox_btn
);
1743 CLAWS_SET_TIP(inbox_btn
,
1744 _("Unfiltered messages will be stored in this folder"));
1745 gtk_box_pack_start (GTK_BOX (hbox1
), inbox_btn
, FALSE
, FALSE
, 0);
1746 g_signal_connect (G_OBJECT (inbox_btn
), "clicked",
1747 G_CALLBACK (prefs_account_select_folder_cb
),
1750 vbox2
= gtkut_get_options_frame(vbox1
, &frame2
, _("NNTP"));
1752 hbox2
= gtk_hbox_new (FALSE
, 8);
1753 gtk_widget_show (hbox2
);
1754 gtk_box_pack_start (GTK_BOX (vbox2
), hbox2
, FALSE
, FALSE
, 0);
1756 maxarticle_label
= gtk_label_new
1757 (_("Maximum number of articles to download"));
1758 gtk_widget_show (maxarticle_label
);
1759 gtk_box_pack_start (GTK_BOX (hbox2
), maxarticle_label
, FALSE
, FALSE
, 0);
1761 maxarticle_spinbtn_adj
=
1762 GTK_ADJUSTMENT(gtk_adjustment_new (300, 0, 10000, 10, 100, 0));
1763 maxarticle_spinbtn
= gtk_spin_button_new
1764 (GTK_ADJUSTMENT (maxarticle_spinbtn_adj
), 10, 0);
1765 gtk_widget_show (maxarticle_spinbtn
);
1766 CLAWS_SET_TIP(maxarticle_spinbtn
,
1767 _("unlimited if 0 is specified"));
1768 gtk_box_pack_start (GTK_BOX (hbox2
), maxarticle_spinbtn
,
1770 gtk_widget_set_size_request (maxarticle_spinbtn
, 64, -1);
1771 gtk_spin_button_set_numeric
1772 (GTK_SPIN_BUTTON (maxarticle_spinbtn
), TRUE
);
1774 vbox2
= gtkut_get_options_frame(vbox1
, &imap_frame
, _("IMAP"));
1776 hbox1
= gtk_hbox_new (FALSE
, 8);
1777 gtk_widget_show (hbox1
);
1778 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 0);
1780 label
= gtk_label_new (_("Authentication method"));
1781 gtk_widget_show (label
);
1782 gtk_box_pack_start (GTK_BOX (hbox1
), label
, FALSE
, FALSE
, 0);
1785 optmenu
= gtkut_sc_combobox_create(NULL
, FALSE
);
1786 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu
)));
1787 gtk_widget_show (optmenu
);
1788 gtk_box_pack_start (GTK_BOX (hbox1
), optmenu
, FALSE
, FALSE
, 0);
1790 COMBOBOX_ADD (menu
, _("Automatic"), 0);
1791 COMBOBOX_ADD (menu
, NULL
, 0);
1792 COMBOBOX_ADD (menu
, _("Plain text"), IMAP_AUTH_PLAINTEXT
);
1793 COMBOBOX_ADD (menu
, "CRAM-MD5", IMAP_AUTH_CRAM_MD5
);
1794 COMBOBOX_ADD (menu
, "ANONYMOUS", IMAP_AUTH_ANON
);
1795 COMBOBOX_ADD (menu
, "GSSAPI", IMAP_AUTH_GSSAPI
);
1796 COMBOBOX_ADD (menu
, "DIGEST-MD5", IMAP_AUTH_DIGEST_MD5
);
1797 COMBOBOX_ADD (menu
, "SCRAM-SHA-1", IMAP_AUTH_SCRAM_SHA1
);
1798 COMBOBOX_ADD (menu
, "PLAIN", IMAP_AUTH_PLAIN
);
1799 COMBOBOX_ADD (menu
, "LOGIN", IMAP_AUTH_LOGIN
);
1800 COMBOBOX_ADD (menu
, "OAUTH2", IMAP_AUTH_OAUTH2
);
1802 hbox1
= gtk_hbox_new (FALSE
, 8);
1803 gtk_widget_show (hbox1
);
1804 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 4);
1806 imapdir_label
= gtk_label_new (_("IMAP server directory"));
1807 gtk_widget_show (imapdir_label
);
1808 gtk_box_pack_start (GTK_BOX (hbox1
), imapdir_label
, FALSE
, FALSE
, 0);
1810 imapdir_label
= gtk_label_new(_("(usually empty)"));
1811 gtk_widget_show (imapdir_label
);
1812 gtkut_widget_set_small_font_size (imapdir_label
);
1813 gtk_box_pack_start (GTK_BOX (hbox1
), imapdir_label
, FALSE
, FALSE
, 0);
1815 imapdir_entry
= gtk_entry_new();
1816 gtk_widget_show (imapdir_entry
);
1817 gtk_box_pack_start (GTK_BOX (hbox1
), imapdir_entry
, FALSE
, FALSE
, 0);
1819 hbox1
= gtk_hbox_new (FALSE
, 8);
1820 gtk_widget_show (hbox1
);
1821 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 4);
1823 PACK_CHECK_BUTTON (hbox1
, subsonly_checkbtn
,
1824 _("Show subscribed folders only"));
1826 hbox1
= gtk_hbox_new (FALSE
, 8);
1827 gtk_widget_show (hbox1
);
1828 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 4);
1830 PACK_CHECK_BUTTON (hbox1
, low_bandwidth_checkbtn
,
1831 _("Bandwidth-efficient mode (prevents retrieving remote tags)"));
1832 CLAWS_SET_TIP(low_bandwidth_checkbtn
,
1833 _("This mode uses less bandwidth, but can be slower with some servers."));
1835 hbox1
= gtk_hbox_new (FALSE
, 8);
1836 gtk_widget_show (hbox1
);
1837 gtk_box_pack_start (GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 4);
1840 vbox4
= gtkut_get_options_frame(vbox1
, &frame
, _("Automatic checking"));
1842 PACK_CHECK_BUTTON(vbox4
, autochk_use_default_checkbtn
,
1843 _("Use global settings"));
1845 hbox2
= gtk_hbox_new(FALSE
, 8);
1846 gtk_box_pack_start(GTK_BOX(vbox4
), hbox2
, FALSE
, FALSE
, 0);
1848 PACK_CHECK_BUTTON(hbox2
, autochk_checkbtn
,
1849 _("Check for new mail every"));
1851 adj
= gtk_adjustment_new(5, 0, 99, 1, 10, 0);
1852 autochk_hour_spinbtn
= gtk_spin_button_new(GTK_ADJUSTMENT(adj
), 1, 0);
1853 gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(autochk_hour_spinbtn
), TRUE
);
1854 gtk_box_pack_start(GTK_BOX(hbox2
), autochk_hour_spinbtn
, FALSE
, FALSE
, 0);
1855 autochk_hour_label
= gtk_label_new(_("hours"));
1856 gtk_box_pack_start(GTK_BOX(hbox2
), autochk_hour_label
, FALSE
, FALSE
, 0);
1858 adj
= gtk_adjustment_new(5, 0, 99, 1, 10, 0);
1859 autochk_min_spinbtn
= gtk_spin_button_new(GTK_ADJUSTMENT(adj
), 1, 0);
1860 gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(autochk_min_spinbtn
), TRUE
);
1861 gtk_box_pack_start(GTK_BOX(hbox2
), autochk_min_spinbtn
, FALSE
, FALSE
, 0);
1862 autochk_min_label
= gtk_label_new(_("minutes"));
1863 gtk_box_pack_start(GTK_BOX(hbox2
), autochk_min_label
, FALSE
, FALSE
, 0);
1865 adj
= gtk_adjustment_new(5, 0, 99, 1, 10, 0);
1866 autochk_sec_spinbtn
= gtk_spin_button_new(GTK_ADJUSTMENT(adj
), 1, 0);
1867 gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(autochk_sec_spinbtn
), TRUE
);
1868 gtk_box_pack_start(GTK_BOX(hbox2
), autochk_sec_spinbtn
, FALSE
, FALSE
, 0);
1869 autochk_sec_label
= gtk_label_new(_("seconds"));
1870 gtk_box_pack_start(GTK_BOX(hbox2
), autochk_sec_label
, FALSE
, FALSE
, 0);
1872 autochk_widgets
= g_new0(struct AutocheckWidgets
, 1);
1873 autochk_widgets
->autochk_hour_spinbtn
= autochk_hour_spinbtn
;
1874 autochk_widgets
->autochk_min_spinbtn
= autochk_min_spinbtn
;
1875 autochk_widgets
->autochk_sec_spinbtn
= autochk_sec_spinbtn
;
1877 gtk_widget_show_all(vbox4
);
1879 SET_TOGGLE_SENSITIVITY_REVERSE(autochk_use_default_checkbtn
, hbox2
);
1880 SET_TOGGLE_SENSITIVITY(autochk_checkbtn
, autochk_hour_spinbtn
);
1881 SET_TOGGLE_SENSITIVITY(autochk_checkbtn
, autochk_min_spinbtn
);
1882 SET_TOGGLE_SENSITIVITY(autochk_checkbtn
, autochk_sec_spinbtn
);
1883 SET_TOGGLE_SENSITIVITY(autochk_checkbtn
, autochk_hour_label
);
1884 SET_TOGGLE_SENSITIVITY(autochk_checkbtn
, autochk_min_label
);
1885 SET_TOGGLE_SENSITIVITY(autochk_checkbtn
, autochk_sec_label
);
1887 PACK_CHECK_BUTTON (vbox1
, filter_on_recv_checkbtn
,
1888 _("Filter messages on receiving"));
1890 g_signal_connect(G_OBJECT(filter_on_recv_checkbtn
), "toggled",
1891 G_CALLBACK(prefs_account_filter_on_recv_toggled
),
1893 g_signal_connect(G_OBJECT(autochk_hour_spinbtn
), "value-changed",
1894 G_CALLBACK(prefs_account_receive_itv_spinbutton_value_changed_cb
),
1896 g_signal_connect(G_OBJECT(autochk_min_spinbtn
), "value-changed",
1897 G_CALLBACK(prefs_account_receive_itv_spinbutton_value_changed_cb
),
1899 g_signal_connect(G_OBJECT(autochk_sec_spinbtn
), "value-changed",
1900 G_CALLBACK(prefs_account_receive_itv_spinbutton_value_changed_cb
),
1903 PACK_CHECK_BUTTON (vbox1
, filterhook_on_recv_checkbtn
,
1904 _("Allow filtering using plugins on receiving"));
1907 (vbox1
, recvatgetall_checkbtn
,
1908 _("'Get Mail' checks for new messages on this account"));
1910 page
->pop3_frame
= frame1
;
1911 page
->pop_auth_checkbtn
= pop_auth_checkbtn
;
1912 page
->pop_auth_type_optmenu
= optmenu2
;
1913 page
->rmmail_checkbtn
= rmmail_checkbtn
;
1914 page
->leave_time_spinbtn
= leave_time_spinbtn
;
1915 page
->leave_hour_spinbtn
= leave_hour_spinbtn
;
1916 page
->size_limit_checkbtn
= size_limit_checkbtn
;
1917 page
->size_limit_spinbtn
= size_limit_spinbtn
;
1918 page
->filter_on_recv_checkbtn
= filter_on_recv_checkbtn
;
1919 page
->filterhook_on_recv_checkbtn
= filterhook_on_recv_checkbtn
;
1920 page
->inbox_label
= inbox_label
;
1921 page
->inbox_entry
= inbox_entry
;
1922 page
->inbox_btn
= inbox_btn
;
1924 page
->autochk_frame
= frame
;
1926 page
->imap_frame
= imap_frame
;
1927 page
->imap_auth_type_optmenu
= optmenu
;
1929 page
->imapdir_label
= imapdir_label
;
1930 page
->imapdir_entry
= imapdir_entry
;
1931 page
->subsonly_checkbtn
= subsonly_checkbtn
;
1932 page
->low_bandwidth_checkbtn
= low_bandwidth_checkbtn
;
1933 page
->local_frame
= local_frame
;
1934 page
->local_inbox_label
= local_inbox_label
;
1935 page
->local_inbox_entry
= local_inbox_entry
;
1936 page
->local_inbox_btn
= local_inbox_btn
;
1938 page
->recvatgetall_checkbtn
= recvatgetall_checkbtn
;
1940 page
->frame_maxarticle
= frame2
;
1941 page
->maxarticle_spinbtn
= maxarticle_spinbtn
;
1942 page
->maxarticle_spinbtn_adj
= maxarticle_spinbtn_adj
;
1944 page
->autochk_checkbtn
= autochk_checkbtn
;
1945 page
->autochk_widgets
= autochk_widgets
;
1946 page
->autochk_use_default_checkbtn
= autochk_use_default_checkbtn
;
1948 tmp_ac_prefs
= *ac_prefs
;
1951 prefs_set_dialog_to_default(receive_param
);
1953 prefs_set_dialog(receive_param
);
1957 page
->page
.widget
= vbox1
;
1960 static void send_create_widget_func(PrefsPage
* _page
,
1964 SendPage
*page
= (SendPage
*) _page
;
1965 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
1970 GtkWidget
*msgid_checkbtn
;
1971 GtkWidget
*xmailer_checkbtn
;
1973 GtkWidget
*customhdr_checkbtn
;
1974 GtkWidget
*customhdr_edit_btn
;
1975 GtkWidget
*checkbtn_msgid_with_addr
;
1977 GtkWidget
*smtp_auth_checkbtn
;
1978 GtkWidget
*showpwd_checkbtn
;
1983 GtkWidget
*hbox_spc
;
1985 GtkWidget
*smtp_uid_entry
;
1986 GtkWidget
*smtp_pass_entry
;
1987 GtkWidget
*vbox_spc
;
1988 GtkWidget
*pop_bfr_smtp_checkbtn
;
1989 GtkWidget
*pop_bfr_smtp_tm_spinbtn
;
1990 GtkWidget
*pop_auth_timeout_lbl
;
1991 GtkWidget
*pop_auth_minutes_lbl
;
1994 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
1995 gtk_widget_show (vbox1
);
1996 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
1998 vbox2
= gtkut_get_options_frame(vbox1
, &frame
, _("Header"));
2000 PACK_CHECK_BUTTON (vbox2
, msgid_checkbtn
, _("Generate Message-ID"));
2002 PACK_CHECK_BUTTON (vbox2
, checkbtn_msgid_with_addr
,
2003 _("Send account mail address in Message-ID"));
2005 PACK_CHECK_BUTTON (vbox2
, xmailer_checkbtn
,
2006 _("Add user agent header"));
2008 hbox
= gtk_hbox_new (FALSE
, 12);
2009 gtk_widget_show (hbox
);
2010 gtk_box_pack_start (GTK_BOX (vbox2
), hbox
, FALSE
, FALSE
, 0);
2012 PACK_CHECK_BUTTON (hbox
, customhdr_checkbtn
,
2013 _("Add user-defined header"));
2015 customhdr_edit_btn
= gtk_button_new_from_stock (GTK_STOCK_EDIT
);
2016 gtk_widget_show (customhdr_edit_btn
);
2017 gtk_box_pack_start (GTK_BOX (hbox
), customhdr_edit_btn
,
2019 g_signal_connect (G_OBJECT (customhdr_edit_btn
), "clicked",
2020 G_CALLBACK (prefs_account_edit_custom_header
),
2023 SET_TOGGLE_SENSITIVITY (customhdr_checkbtn
, customhdr_edit_btn
);
2025 vbox3
= gtkut_get_options_frame(vbox1
, &frame
, _("Authentication"));
2027 PACK_CHECK_BUTTON (vbox3
, smtp_auth_checkbtn
,
2028 _("SMTP Authentication (SMTP AUTH)"));
2030 vbox4
= gtk_vbox_new (FALSE
, 0);
2031 gtk_widget_show (vbox4
);
2032 gtk_box_pack_start (GTK_BOX (vbox3
), vbox4
, FALSE
, FALSE
, 0);
2034 hbox
= gtk_hbox_new (FALSE
, 8);
2035 gtk_widget_show (hbox
);
2036 gtk_box_pack_start (GTK_BOX (vbox4
), hbox
, FALSE
, FALSE
, 0);
2038 hbox_spc
= gtk_hbox_new (FALSE
, 0);
2039 gtk_widget_show (hbox_spc
);
2040 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
2041 gtk_widget_set_size_request (hbox_spc
, 12, -1);
2043 label
= gtk_label_new (_("Authentication method"));
2044 gtk_widget_show (label
);
2045 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
2047 optmenu
= gtkut_sc_combobox_create(NULL
, FALSE
);
2048 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu
)));
2049 gtk_widget_show (optmenu
);
2050 gtk_box_pack_start (GTK_BOX (hbox
), optmenu
, FALSE
, FALSE
, 0);
2052 COMBOBOX_ADD (menu
, _("Automatic"), 0);
2053 COMBOBOX_ADD (menu
, NULL
, 0);
2054 COMBOBOX_ADD (menu
, "PLAIN", SMTPAUTH_PLAIN
);
2055 COMBOBOX_ADD (menu
, "LOGIN", SMTPAUTH_LOGIN
);
2056 COMBOBOX_ADD (menu
, "CRAM-MD5", SMTPAUTH_CRAM_MD5
);
2057 COMBOBOX_ADD (menu
, "OAUTH2", SMTPAUTH_OAUTH2
);
2058 COMBOBOX_ADD (menu
, "DIGEST-MD5", SMTPAUTH_DIGEST_MD5
);
2059 gtk_list_store_set(menu
, &iter
, COMBOBOX_SENS
, FALSE
, -1);
2061 PACK_SPACER(vbox4
, vbox_spc
, VSPACING_NARROW_2
);
2063 hbox
= gtk_hbox_new (FALSE
, 8);
2064 gtk_widget_show (hbox
);
2065 gtk_box_pack_start (GTK_BOX (vbox4
), hbox
, FALSE
, FALSE
, 0);
2067 hbox_spc
= gtk_hbox_new (FALSE
, 0);
2068 gtk_widget_show (hbox_spc
);
2069 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
2070 gtk_widget_set_size_request (hbox_spc
, 12, -1);
2072 label
= gtk_label_new (_("User ID"));
2073 gtk_widget_show (label
);
2074 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
2076 smtp_uid_entry
= gtk_entry_new ();
2077 gtk_widget_show (smtp_uid_entry
);
2078 gtk_widget_set_size_request (smtp_uid_entry
, DEFAULT_ENTRY_WIDTH
, -1);
2079 gtk_box_pack_start (GTK_BOX (hbox
), smtp_uid_entry
, TRUE
, TRUE
, 0);
2080 g_signal_connect(G_OBJECT(smtp_uid_entry
), "changed",
2081 G_CALLBACK(prefs_account_entry_changed_newline_check_cb
),
2082 GINT_TO_POINTER(ac_prefs
->protocol
));
2085 PACK_SPACER(vbox4
, vbox_spc
, VSPACING_NARROW_2
);
2086 hbox
= gtk_hbox_new (FALSE
, 8);
2087 gtk_widget_show (hbox
);
2088 gtk_box_pack_start (GTK_BOX (vbox4
), hbox
, FALSE
, FALSE
, 0);
2090 hbox_spc
= gtk_hbox_new (FALSE
, 0);
2091 gtk_widget_show (hbox_spc
);
2092 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
2093 gtk_widget_set_size_request (hbox_spc
, 12, -1);
2095 label
= gtk_label_new (_("Password"));
2096 gtk_widget_show (label
);
2097 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
2099 smtp_pass_entry
= gtk_entry_new ();
2100 gtk_widget_show (smtp_pass_entry
);
2101 gtk_widget_set_size_request (smtp_pass_entry
, DEFAULT_ENTRY_WIDTH
, -1);
2102 gtk_box_pack_start (GTK_BOX (hbox
), smtp_pass_entry
, TRUE
, TRUE
, 0);
2103 gtk_entry_set_visibility (GTK_ENTRY (smtp_pass_entry
), FALSE
);
2104 g_signal_connect(G_OBJECT(smtp_pass_entry
), "changed",
2105 G_CALLBACK(prefs_account_entry_changed_newline_check_cb
),
2106 GINT_TO_POINTER(ac_prefs
->protocol
));
2108 showpwd_checkbtn
= gtk_check_button_new_with_label (_("Show password"));
2109 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(showpwd_checkbtn
), FALSE
);
2110 gtk_widget_show(showpwd_checkbtn
);
2111 gtk_box_pack_start(GTK_BOX (hbox
), showpwd_checkbtn
, FALSE
, FALSE
, 0);
2112 g_signal_connect(G_OBJECT(showpwd_checkbtn
), "toggled",
2113 G_CALLBACK(prefs_account_showpwd_checkbtn_toggled
), smtp_pass_entry
);
2115 PACK_SPACER(vbox4
, vbox_spc
, VSPACING_NARROW_2
);
2117 hbox
= gtk_hbox_new (FALSE
, 8);
2118 gtk_widget_show (hbox
);
2119 gtk_box_pack_start (GTK_BOX (vbox4
), hbox
, FALSE
, FALSE
, 0);
2121 hbox_spc
= gtk_hbox_new (FALSE
, 0);
2122 gtk_widget_show (hbox_spc
);
2123 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
2124 gtk_widget_set_size_request (hbox_spc
, 12, -1);
2126 label
= gtk_label_new
2127 (_("If you leave these entries empty, the same "
2128 "user ID and password as receiving will be used."));
2129 gtk_widget_show (label
);
2130 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
2131 gtk_label_set_justify (GTK_LABEL (label
), GTK_JUSTIFY_LEFT
);
2132 gtk_label_set_line_wrap (GTK_LABEL (label
), TRUE
);
2133 gtkut_widget_set_small_font_size (label
);
2135 SET_TOGGLE_SENSITIVITY (smtp_auth_checkbtn
, vbox4
);
2137 PACK_CHECK_BUTTON (vbox3
, pop_bfr_smtp_checkbtn
,
2138 _("Authenticate with POP before sending"));
2140 g_signal_connect (G_OBJECT (pop_bfr_smtp_checkbtn
), "clicked",
2141 G_CALLBACK (pop_bfr_smtp_tm_set_sens
),
2144 hbox
= gtk_hbox_new (FALSE
, 8);
2145 gtk_widget_show (hbox
);
2146 gtk_box_pack_start (GTK_BOX (vbox3
), hbox
, FALSE
, FALSE
, 0);
2148 hbox_spc
= gtk_hbox_new (FALSE
, 0);
2149 gtk_widget_show (hbox_spc
);
2150 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
2151 gtk_widget_set_size_request (hbox_spc
, 12, -1);
2153 pop_auth_timeout_lbl
= gtk_label_new(_("POP authentication timeout"));
2154 gtk_widget_show (pop_auth_timeout_lbl
);
2155 gtk_box_pack_start (GTK_BOX (hbox
), pop_auth_timeout_lbl
, FALSE
, FALSE
, 0);
2157 pop_bfr_smtp_tm_spinbtn
= gtk_spin_button_new_with_range(0, 1440, 1);
2158 gtk_widget_show (pop_bfr_smtp_tm_spinbtn
);
2159 gtk_box_pack_start (GTK_BOX (hbox
), pop_bfr_smtp_tm_spinbtn
, FALSE
, FALSE
, 0);
2161 pop_auth_minutes_lbl
= gtk_label_new(_("minutes"));
2162 gtk_widget_show (pop_auth_minutes_lbl
);
2163 gtk_box_pack_start (GTK_BOX (hbox
), pop_auth_minutes_lbl
, FALSE
, FALSE
, 0);
2165 page
->msgid_checkbtn
= msgid_checkbtn
;
2166 page
->xmailer_checkbtn
= xmailer_checkbtn
;
2167 page
->customhdr_checkbtn
= customhdr_checkbtn
;
2168 page
->msgid_with_addr_checkbtn
= checkbtn_msgid_with_addr
;
2170 page
->smtp_auth_checkbtn
= smtp_auth_checkbtn
;
2171 page
->smtp_auth_type_optmenu
= optmenu
;
2172 page
->smtp_uid_entry
= smtp_uid_entry
;
2173 page
->smtp_pass_entry
= smtp_pass_entry
;
2174 page
->pop_bfr_smtp_checkbtn
= pop_bfr_smtp_checkbtn
;
2175 page
->pop_bfr_smtp_tm_spinbtn
= pop_bfr_smtp_tm_spinbtn
;
2176 page
->pop_auth_timeout_lbl
= pop_auth_timeout_lbl
;
2177 page
->pop_auth_minutes_lbl
= pop_auth_minutes_lbl
;
2179 tmp_ac_prefs
= *ac_prefs
;
2182 prefs_set_dialog_to_default(send_param
);
2184 prefs_set_dialog(send_param
);
2186 /* Passwords are handled outside of PrefParams. */
2187 buf
= passwd_store_get_account(ac_prefs
->account_id
,
2189 gtk_entry_set_text(GTK_ENTRY(page
->smtp_pass_entry
), buf
!= NULL
? buf
: "");
2191 memset(buf
, 0, strlen(buf
));
2196 pop_bfr_smtp_tm_set_sens (NULL
, NULL
);
2200 page
->page
.widget
= vbox1
;
2203 static void oauth2_create_widget_func(PrefsPage
* _page
,
2207 Oauth2Page
*page
= (Oauth2Page
*) _page
;
2208 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
2210 GtkWidget
*vbox1
, *vbox2
, *vbox3
;
2212 GtkWidget
*hbox_spc
;
2213 GtkWidget
*oauth2_authorise_btn
;
2214 GtkWidget
*auth_vbox
, *auth_frame
;
2216 GtkWidget
*oauth2_authcode_entry
;
2217 GtkWidget
*oauth2_auth_optmenu
;
2218 GtkWidget
*oauth2_link_button
;
2219 GtkWidget
*oauth2_link_copy_button
;
2220 GtkWidget
*oauth2_client_id_entry
;
2221 GtkWidget
*oauth2_client_secret_entry
;
2226 struct BasicProtocol
*protocol_optmenu
;
2228 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
2229 gtk_widget_show (vbox1
);
2230 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
2232 auth_vbox
= gtkut_get_options_frame(vbox1
, &auth_frame
,
2233 _("Authorization"));
2235 hbox
= gtk_hbox_new (FALSE
, 0);
2236 gtk_widget_show (hbox
);
2237 gtk_box_pack_start (GTK_BOX (auth_vbox
), hbox
, FALSE
, FALSE
, 0);
2239 hbox_spc
= gtk_hbox_new (FALSE
, 0);
2240 gtk_widget_show (hbox_spc
);
2241 gtk_widget_set_size_request (hbox_spc
, 12, -1);
2242 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
2244 /* Email service provider */
2246 hbox
= gtk_hbox_new (FALSE
, 8);
2247 gtk_widget_show (hbox
);
2248 gtk_box_pack_start (GTK_BOX (auth_vbox
), hbox
, FALSE
, FALSE
, 0);
2250 label
= gtk_label_new (_("Select OAuth2 Email Service Provider"));
2251 gtk_widget_show (label
);
2252 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
2254 oauth2_auth_optmenu
= gtkut_sc_combobox_create(NULL
, FALSE
);
2255 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(oauth2_auth_optmenu
)));
2256 gtk_widget_show (oauth2_auth_optmenu
);
2257 gtk_box_pack_start (GTK_BOX (hbox
), oauth2_auth_optmenu
, FALSE
, FALSE
, 0);
2259 COMBOBOX_ADD (menu
, _("Select"), NULL
);
2260 COMBOBOX_ADD (menu
, NULL
, 0);
2261 COMBOBOX_ADD (menu
, "Google/Gmail", OAUTH2AUTH_GOOGLE
);
2262 COMBOBOX_ADD (menu
, "MS Outlook", OAUTH2AUTH_OUTLOOK
);
2263 COMBOBOX_ADD (menu
, "MS Exchange", OAUTH2AUTH_EXCHANGE
);
2264 COMBOBOX_ADD (menu
, "Yahoo", OAUTH2AUTH_YAHOO
);
2266 protocol_optmenu
= g_new(struct BasicProtocol
, 1);
2267 protocol_optmenu
->combobox
= oauth2_auth_optmenu
;
2268 protocol_optmenu
->label
= label
;
2269 protocol_optmenu
->descrlabel
= label
;
2271 hbox
= gtk_hbox_new (FALSE
, 8);
2272 gtk_widget_show (hbox
);
2273 gtk_box_pack_start (GTK_BOX (auth_vbox
), hbox
, FALSE
, FALSE
, 0);
2275 vbox3
= gtk_vbox_new (FALSE
, 0);
2276 gtk_widget_show (vbox3
);
2277 gtk_box_pack_start (GTK_BOX (auth_vbox
), vbox3
, FALSE
, FALSE
, 0);
2279 vbox2
= gtk_vbox_new (FALSE
, 0);
2280 gtk_widget_show (vbox2
);
2281 gtk_box_pack_start (GTK_BOX (vbox3
), vbox2
, FALSE
, FALSE
, 0);
2283 table1
= gtk_table_new (3, 2, FALSE
);
2284 gtk_widget_show (table1
);
2285 gtk_container_add (GTK_CONTAINER (vbox2
), table1
);
2286 gtk_container_set_border_width (GTK_CONTAINER (table1
), 8);
2287 gtk_table_set_row_spacings (GTK_TABLE (table1
), VSPACING_NARROW
);
2288 gtk_table_set_col_spacings (GTK_TABLE (table1
), 8);
2290 label
= gtk_label_new (_("Client ID"));
2291 gtk_widget_show (label
);
2292 gtk_table_attach (GTK_TABLE (table1
), label
, 0, 1, 0, 1,
2294 gtk_misc_set_alignment (GTK_MISC (label
), 1, 0.5);
2296 label
= gtk_label_new (_("Client secret"));
2297 gtk_widget_show (label
);
2298 gtk_table_attach (GTK_TABLE (table1
), label
, 0, 1, 1, 2,
2300 gtk_misc_set_alignment (GTK_MISC (label
), 1, 0.5);
2302 oauth2_client_id_entry
= gtk_entry_new ();
2303 gtk_widget_show (oauth2_client_id_entry
);
2304 gtk_table_attach (GTK_TABLE (table1
), oauth2_client_id_entry
, 1, 2, 0, 1,
2305 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
2306 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
2308 oauth2_client_secret_entry
= gtk_entry_new ();
2309 gtk_widget_show (oauth2_client_secret_entry
);
2310 gtk_table_attach (GTK_TABLE (table1
), oauth2_client_secret_entry
, 1, 2, 1, 2,
2311 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
2312 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
2314 hbox_spc
= gtk_hbox_new (FALSE
, 0);
2315 gtk_widget_show (hbox_spc
);
2316 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
2317 gtk_widget_set_size_request (hbox_spc
, 12, -1);
2319 hbox_spc
= gtk_hbox_new (FALSE
, 0);
2320 gtk_widget_show (hbox_spc
);
2321 gtk_box_pack_start (GTK_BOX (vbox2
), hbox_spc
, FALSE
, FALSE
, 0);
2322 gtk_widget_set_size_request (hbox_spc
, 12, 10);
2324 hbox
= gtk_hbox_new (FALSE
, 8);
2325 gtk_widget_show (hbox
);
2326 gtk_box_pack_start (GTK_BOX (vbox3
), hbox
, FALSE
, FALSE
, 0);
2328 label
= gtk_label_new (_("Obtain authorization code"));
2329 gtk_widget_show (label
);
2330 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
2332 oauth2_link_button
= gtk_button_new_with_label(_("Open default browser with request"));
2333 g_signal_connect(G_OBJECT(oauth2_link_button
), "clicked", G_CALLBACK(prefs_account_oauth2_copy_url
), NULL
);
2334 gtk_widget_set_sensitive(oauth2_link_button
, TRUE
);
2335 gtk_widget_show (oauth2_link_button
);
2336 gtk_box_pack_start (GTK_BOX (hbox
), oauth2_link_button
, FALSE
, FALSE
, 0);
2338 oauth2_link_copy_button
= gtk_button_new_with_label(_("Copy link"));
2339 g_signal_connect(G_OBJECT(oauth2_link_copy_button
), "clicked", G_CALLBACK(prefs_account_oauth2_copy_url
), NULL
);
2340 gtk_widget_set_sensitive(oauth2_link_copy_button
, TRUE
);
2341 gtk_widget_show (oauth2_link_copy_button
);
2342 gtk_box_pack_start (GTK_BOX (hbox
), oauth2_link_copy_button
, FALSE
, FALSE
, 0);
2344 /* Authorisation code */
2345 hbox
= gtk_hbox_new (FALSE
, 8);
2346 gtk_widget_show (hbox
);
2347 gtk_box_pack_start (GTK_BOX (vbox3
), hbox
, FALSE
, FALSE
, 0);
2348 gtk_widget_set_size_request (hbox
, -1, 50);
2350 label
= gtk_label_new (_("Authorization code"));
2351 gtk_widget_show (label
);
2352 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
2354 oauth2_authcode_entry
= gtk_entry_new ();
2355 gtk_widget_show (oauth2_authcode_entry
);
2356 gtk_widget_set_size_request (oauth2_authcode_entry
, DEFAULT_ENTRY_WIDTH
, -1);
2357 gtk_widget_set_tooltip_text(oauth2_authcode_entry
,
2358 _("Paste complete URL from browser or the provided authorization token"));
2359 gtk_box_pack_start (GTK_BOX (hbox
), oauth2_authcode_entry
, TRUE
, TRUE
, 0);
2361 hbox
= gtk_hbox_new (FALSE
, 8);
2362 gtk_widget_show (hbox
);
2363 gtk_box_pack_start (GTK_BOX (vbox3
), hbox
, FALSE
, FALSE
, 0);
2365 label
= gtk_label_new (_("Complete authorization"));
2366 gtk_widget_show (label
);
2367 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
2369 oauth2_authorise_btn
= gtk_button_new_with_label(_("Authorize"));
2370 gtk_box_pack_start(GTK_BOX(hbox
), oauth2_authorise_btn
, FALSE
, FALSE
, 0);
2371 g_signal_connect(G_OBJECT(oauth2_authorise_btn
), "clicked",
2372 G_CALLBACK(prefs_account_oauth2_obtain_tokens
), NULL
);
2373 gtk_widget_show(oauth2_authorise_btn
);
2375 /* Add items to page struct */
2377 page
->oauth2_link_button
= oauth2_link_button
;
2378 page
->oauth2_link_copy_button
= oauth2_link_copy_button
;
2379 page
->oauth2_authcode_entry
= oauth2_authcode_entry
;
2380 page
->oauth2_auth_optmenu
= oauth2_auth_optmenu
;
2381 page
->protocol_optmenu
= (gpointer
)protocol_optmenu
;
2382 page
->oauth2_authorise_btn
= oauth2_authorise_btn
;
2383 page
->oauth2_client_id_entry
= oauth2_client_id_entry
;
2384 page
->oauth2_client_secret_entry
= oauth2_client_secret_entry
;
2386 page
->page
.widget
= vbox1
;
2387 page
->oauth2_sensitive
= vbox3
;
2389 tmp_ac_prefs
= *ac_prefs
;
2391 g_signal_connect(G_OBJECT(oauth2_auth_optmenu
), "changed",
2392 G_CALLBACK(prefs_account_oauth2_set_sensitivity
), NULL
);
2393 g_signal_connect(G_OBJECT(oauth2_authcode_entry
), "changed",
2394 G_CALLBACK(prefs_account_oauth2_set_auth_sensitivity
), NULL
);
2395 prefs_account_oauth2_set_auth_sensitivity();
2398 prefs_set_dialog_to_default(oauth2_param
);
2400 prefs_set_dialog(oauth2_param
);
2402 /* Passwords are handled outside of PrefParams. */
2403 buf
= passwd_store_get_account(ac_prefs
->account_id
,
2404 PWS_ACCOUNT_OAUTH2_AUTH
);
2405 gtk_entry_set_text(GTK_ENTRY(page
->oauth2_authcode_entry
), buf
!= NULL
? buf
: "");
2407 memset(buf
, 0, strlen(buf
));
2413 /* oauth2_encode(OAUTH2info[0][OA2_CLIENT_ID]); */
2418 static void compose_create_widget_func(PrefsPage
* _page
,
2422 ComposePage
*page
= (ComposePage
*) _page
;
2423 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
2426 GtkWidget
*sig_hbox
;
2429 GtkWidget
*frame_sig
;
2430 GtkWidget
*vbox_sig
;
2431 GtkWidget
*label_sigpath
;
2432 GtkWidget
*checkbtn_autosig
;
2433 GtkWidget
*label_sigsep
;
2434 GtkWidget
*entry_sigsep
;
2437 GtkWidget
*autocc_checkbtn
;
2438 GtkWidget
*autocc_entry
;
2439 GtkWidget
*autobcc_checkbtn
;
2440 GtkWidget
*autobcc_entry
;
2441 GtkWidget
*autoreplyto_checkbtn
;
2442 GtkWidget
*autoreplyto_entry
;
2444 GtkWidget
*frame_dict
;
2445 GtkWidget
*table_dict
;
2446 GtkWidget
*checkbtn_enable_default_dictionary
= NULL
;
2447 GtkWidget
*combo_default_dictionary
= NULL
;
2448 GtkWidget
*checkbtn_enable_default_alt_dictionary
= NULL
;
2449 GtkWidget
*combo_default_alt_dictionary
= NULL
;
2452 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
2453 gtk_widget_show (vbox1
);
2454 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
2456 vbox_sig
= gtkut_get_options_frame(vbox1
, &frame_sig
, _("Signature"));
2458 PACK_CHECK_BUTTON (vbox_sig
, checkbtn_autosig
,
2459 _("Automatically insert signature"));
2461 hbox1
= gtk_hbox_new (FALSE
, 8);
2462 gtk_widget_show (hbox1
);
2463 gtk_box_pack_start (GTK_BOX (vbox_sig
), hbox1
, TRUE
, TRUE
, 0);
2464 label_sigsep
= gtk_label_new (_("Signature separator"));
2465 gtk_widget_show (label_sigsep
);
2466 gtk_box_pack_start (GTK_BOX (hbox1
), label_sigsep
, FALSE
, FALSE
, 0);
2468 entry_sigsep
= gtk_entry_new ();
2469 gtk_widget_show (entry_sigsep
);
2470 gtk_box_pack_start (GTK_BOX (hbox1
), entry_sigsep
, FALSE
, FALSE
, 0);
2472 gtk_widget_set_size_request (entry_sigsep
, 64, -1);
2474 sig_hbox
= gtk_hbox_new (FALSE
, 8);
2475 gtk_widget_show (sig_hbox
);
2476 gtk_box_pack_start (GTK_BOX (vbox_sig
), sig_hbox
, FALSE
, FALSE
, 0);
2478 sigfile_radiobtn
= gtk_radio_button_new_with_label (NULL
, _("File"));
2479 gtk_widget_show (sigfile_radiobtn
);
2480 gtk_box_pack_start (GTK_BOX (sig_hbox
), sigfile_radiobtn
,
2482 g_object_set_data (G_OBJECT (sigfile_radiobtn
),
2484 GINT_TO_POINTER (SIG_FILE
));
2485 g_signal_connect(G_OBJECT(sigfile_radiobtn
), "clicked",
2486 G_CALLBACK(prefs_account_sigfile_radiobtn_cb
), NULL
);
2488 sigcmd_radiobtn
= gtk_radio_button_new_with_label_from_widget
2489 (GTK_RADIO_BUTTON(sigfile_radiobtn
), _("Command output"));
2490 gtk_widget_show (sigcmd_radiobtn
);
2491 gtk_box_pack_start (GTK_BOX (sig_hbox
), sigcmd_radiobtn
,
2493 g_object_set_data (G_OBJECT (sigcmd_radiobtn
),
2495 GINT_TO_POINTER (SIG_COMMAND
));
2496 g_signal_connect(G_OBJECT(sigcmd_radiobtn
), "clicked",
2497 G_CALLBACK(prefs_account_sigcmd_radiobtn_cb
), NULL
);
2499 hbox2
= gtk_hbox_new (FALSE
, 8);
2500 gtk_widget_show (hbox2
);
2501 gtk_box_pack_start (GTK_BOX (vbox_sig
), hbox2
, TRUE
, TRUE
, 0);
2502 label_sigpath
= gtk_label_new (_("Signature"));
2503 gtk_widget_show (label_sigpath
);
2504 gtk_box_pack_start (GTK_BOX (hbox2
), label_sigpath
, FALSE
, FALSE
, 0);
2506 entry_sigpath
= gtk_entry_new ();
2507 gtk_widget_show (entry_sigpath
);
2508 gtk_box_pack_start (GTK_BOX (hbox2
), entry_sigpath
, TRUE
, TRUE
, 0);
2510 signature_browse_button
= gtkut_get_browse_file_btn(_("Bro_wse"));
2511 gtk_widget_show (signature_browse_button
);
2512 gtk_box_pack_start (GTK_BOX (hbox2
), signature_browse_button
, FALSE
, FALSE
, 0);
2513 g_signal_connect(G_OBJECT(signature_browse_button
), "clicked",
2514 G_CALLBACK(prefs_account_signature_browse_cb
), NULL
);
2516 signature_edit_button
= gtk_button_new_from_stock (GTK_STOCK_EDIT
);
2517 gtk_widget_show (signature_edit_button
);
2518 gtk_box_pack_start (GTK_BOX (hbox2
), signature_edit_button
, FALSE
, FALSE
, 0);
2519 g_signal_connect(G_OBJECT(signature_edit_button
), "clicked",
2520 G_CALLBACK(prefs_account_signature_edit_cb
), entry_sigpath
);
2522 PACK_FRAME (vbox1
, frame
, _("Automatically set the following addresses"));
2524 table
= gtk_table_new (3, 2, FALSE
);
2525 gtk_widget_show (table
);
2526 gtk_container_add (GTK_CONTAINER (frame
), table
);
2527 gtk_container_set_border_width (GTK_CONTAINER (table
), 8);
2528 gtk_table_set_row_spacings (GTK_TABLE (table
), VSPACING_NARROW_2
);
2529 gtk_table_set_col_spacings (GTK_TABLE (table
), 8);
2531 autocc_checkbtn
= gtk_check_button_new_with_label (
2532 prefs_common_translated_header_name("Cc:"));
2533 gtk_widget_show (autocc_checkbtn
);
2534 gtk_table_attach (GTK_TABLE (table
), autocc_checkbtn
, 0, 1, 0, 1,
2537 autocc_entry
= gtk_entry_new ();
2538 gtk_widget_show (autocc_entry
);
2539 gtk_table_attach (GTK_TABLE (table
), autocc_entry
, 1, 2, 0, 1,
2540 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
2541 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
2543 SET_TOGGLE_SENSITIVITY (autocc_checkbtn
, autocc_entry
);
2545 autobcc_checkbtn
= gtk_check_button_new_with_label (
2546 prefs_common_translated_header_name("Bcc:"));
2547 gtk_widget_show (autobcc_checkbtn
);
2548 gtk_table_attach (GTK_TABLE (table
), autobcc_checkbtn
, 0, 1, 1, 2,
2551 autobcc_entry
= gtk_entry_new ();
2552 gtk_widget_show (autobcc_entry
);
2553 gtk_table_attach (GTK_TABLE (table
), autobcc_entry
, 1, 2, 1, 2,
2554 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
2555 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
2557 SET_TOGGLE_SENSITIVITY (autobcc_checkbtn
, autobcc_entry
);
2559 autoreplyto_checkbtn
= gtk_check_button_new_with_label (
2560 prefs_common_translated_header_name("Reply-To:"));
2561 gtk_widget_show (autoreplyto_checkbtn
);
2562 gtk_table_attach (GTK_TABLE (table
), autoreplyto_checkbtn
, 0, 1, 2, 3,
2565 autoreplyto_entry
= gtk_entry_new ();
2566 gtk_widget_show (autoreplyto_entry
);
2567 gtk_table_attach (GTK_TABLE (table
), autoreplyto_entry
, 1, 2, 2, 3,
2568 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
2569 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
2571 SET_TOGGLE_SENSITIVITY (autoreplyto_checkbtn
, autoreplyto_entry
);
2574 PACK_FRAME (vbox1
, frame_dict
, _("Spell check dictionaries"));
2576 table_dict
= gtk_table_new (2, 2, FALSE
);
2577 gtk_widget_show (table_dict
);
2578 gtk_container_add (GTK_CONTAINER (frame_dict
), table_dict
);
2579 gtk_container_set_border_width (GTK_CONTAINER (table_dict
), 8);
2580 gtk_table_set_row_spacings (GTK_TABLE (table_dict
), VSPACING_NARROW_2
);
2581 gtk_table_set_col_spacings (GTK_TABLE (table_dict
), 8);
2583 /* Default dictionary */
2584 checkbtn_enable_default_dictionary
= gtk_check_button_new_with_label(_("Default dictionary"));
2585 gtk_table_attach(GTK_TABLE(table_dict
), checkbtn_enable_default_dictionary
, 0, 1,
2586 0, 1, GTK_SHRINK
| GTK_FILL
, GTK_SHRINK
, 0, 0);
2587 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_dictionary
),
2588 tmp_ac_prefs
.enable_default_dictionary
);
2590 combo_default_dictionary
= gtkaspell_dictionary_combo_new(TRUE
);
2591 gtk_table_attach(GTK_TABLE(table_dict
), combo_default_dictionary
, 1, 2,
2592 0, 1, GTK_EXPAND
| GTK_FILL
, GTK_SHRINK
, 0, 0);
2594 SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_dictionary
, combo_default_dictionary
);
2596 /* Default dictionary */
2597 checkbtn_enable_default_alt_dictionary
= gtk_check_button_new_with_label(_("Default alternate dictionary"));
2598 gtk_table_attach(GTK_TABLE(table_dict
), checkbtn_enable_default_alt_dictionary
, 0, 1,
2599 1, 2, GTK_SHRINK
| GTK_FILL
, GTK_SHRINK
, 0, 0);
2600 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_alt_dictionary
),
2601 tmp_ac_prefs
.enable_default_alt_dictionary
);
2603 combo_default_alt_dictionary
= gtkaspell_dictionary_combo_new(FALSE
);
2604 gtk_table_attach(GTK_TABLE(table_dict
), combo_default_alt_dictionary
, 1, 2,
2605 1, 2, GTK_EXPAND
| GTK_FILL
, GTK_SHRINK
, 0, 0);
2607 SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_alt_dictionary
, combo_default_alt_dictionary
);
2609 gtk_widget_show_all(table_dict
);
2612 page
->sigfile_radiobtn
= sigfile_radiobtn
;
2613 page
->entry_sigpath
= entry_sigpath
;
2614 page
->checkbtn_autosig
= checkbtn_autosig
;
2615 page
->entry_sigsep
= entry_sigsep
;
2617 page
->autocc_checkbtn
= autocc_checkbtn
;
2618 page
->autocc_entry
= autocc_entry
;
2619 page
->autobcc_checkbtn
= autobcc_checkbtn
;
2620 page
->autobcc_entry
= autobcc_entry
;
2621 page
->autoreplyto_checkbtn
= autoreplyto_checkbtn
;
2622 page
->autoreplyto_entry
= autoreplyto_entry
;
2624 page
->checkbtn_enable_default_dictionary
= checkbtn_enable_default_dictionary
;
2625 page
->combo_default_dictionary
= combo_default_dictionary
;
2626 page
->checkbtn_enable_default_alt_dictionary
= checkbtn_enable_default_alt_dictionary
;
2627 page
->combo_default_alt_dictionary
= combo_default_alt_dictionary
;
2631 /* reset gtkaspell menus */
2632 if (compose_page
.combo_default_dictionary
!= NULL
) {
2633 gtk_combo_box_set_model(GTK_COMBO_BOX(compose_page
.combo_default_dictionary
),
2634 gtkaspell_dictionary_store_new());
2635 gtk_combo_box_set_model(GTK_COMBO_BOX(compose_page
.combo_default_alt_dictionary
),
2636 gtkaspell_dictionary_store_new_with_refresh(
2641 tmp_ac_prefs
= *ac_prefs
;
2644 prefs_set_dialog_to_default(compose_param
);
2646 prefs_set_dialog(compose_param
);
2650 page
->page
.widget
= vbox1
;
2653 static void templates_create_widget_func(PrefsPage
* _page
,
2657 TemplatesPage
*page
= (TemplatesPage
*) _page
;
2658 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
2661 GtkWidget
*notebook
;
2663 vbox
= gtk_vbox_new(FALSE
, 0);
2664 gtk_widget_show(vbox
);
2666 notebook
= gtk_notebook_new();
2667 gtk_widget_show(notebook
);
2668 gtk_box_pack_start(GTK_BOX(vbox
), notebook
, TRUE
, TRUE
, 0);
2670 /* compose format */
2671 vbox2
= gtk_vbox_new (FALSE
, VSPACING
);
2672 gtk_widget_show (vbox2
);
2673 gtk_container_set_border_width (GTK_CONTAINER (vbox2
), VBOX_BORDER
);
2675 quotefmt_create_new_msg_fmt_widgets(
2678 &page
->checkbtn_compose_with_format
,
2680 &page
->compose_subject_format
,
2681 &page
->compose_body_format
,
2683 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox2
, gtk_label_new(_("Compose")));
2686 vbox2
= gtk_vbox_new (FALSE
, VSPACING
);
2687 gtk_widget_show (vbox2
);
2688 gtk_container_set_border_width (GTK_CONTAINER (vbox2
), VBOX_BORDER
);
2690 quotefmt_create_reply_fmt_widgets(
2693 &page
->checkbtn_reply_with_format
,
2695 &page
->reply_quotemark
,
2696 &page
->reply_body_format
,
2698 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox2
, gtk_label_new(_("Reply")));
2700 /* forward format */
2701 vbox2
= gtk_vbox_new (FALSE
, VSPACING
);
2702 gtk_widget_show (vbox2
);
2703 gtk_container_set_border_width (GTK_CONTAINER (vbox2
), VBOX_BORDER
);
2705 quotefmt_create_forward_fmt_widgets(
2708 &page
->checkbtn_forward_with_format
,
2710 &page
->forward_quotemark
,
2711 &page
->forward_body_format
,
2713 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox2
, gtk_label_new(_("Forward")));
2715 tmp_ac_prefs
= *ac_prefs
;
2718 prefs_set_dialog_to_default(templates_param
);
2720 prefs_set_dialog(templates_param
);
2724 page
->page
.widget
= vbox
;
2727 static void privacy_create_widget_func(PrefsPage
* _page
,
2731 PrivacyPage
*page
= (PrivacyPage
*) _page
;
2732 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
2738 GtkWidget
*default_privacy_system
;
2740 GtkCellRenderer
*rend
;
2741 GtkWidget
*default_encrypt_checkbtn
;
2742 GtkWidget
*default_encrypt_reply_checkbtn
;
2743 GtkWidget
*default_sign_checkbtn
;
2744 GtkWidget
*default_sign_reply_checkbtn
;
2745 GtkWidget
*save_clear_text_checkbtn
;
2746 GtkWidget
*encrypt_to_self_checkbtn
;
2748 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
2749 gtk_widget_show (vbox1
);
2750 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
2752 vbox2
= gtk_vbox_new (FALSE
, 0);
2753 gtk_widget_show (vbox2
);
2754 gtk_box_pack_start (GTK_BOX (vbox1
), vbox2
, FALSE
, FALSE
, 0);
2756 hbox1
= gtk_hbox_new(FALSE
, 8);
2757 gtk_widget_show (hbox1
);
2758 gtk_container_add (GTK_CONTAINER(vbox2
), hbox1
);
2760 label
= gtk_label_new(_("Default privacy system"));
2761 gtk_widget_show(label
);
2762 gtk_box_pack_start (GTK_BOX (hbox1
), label
, FALSE
, FALSE
, 0);
2764 /* Can't use gtkut_sc_combobox_create() here, because model for this
2765 * combobox needs an extra string column to store privacy plugin id. */
2766 menu
= gtk_list_store_new(4,
2770 G_TYPE_STRING
); /* This is where we store the privacy plugin id. */
2771 default_privacy_system
= gtk_combo_box_new_with_model(GTK_TREE_MODEL(menu
));
2773 rend
= gtk_cell_renderer_text_new();
2774 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(default_privacy_system
), rend
, TRUE
);
2775 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(default_privacy_system
), rend
,
2776 "text", COMBOBOX_TEXT
,
2777 "sensitive", COMBOBOX_SENS
,
2779 gtk_combo_box_set_focus_on_click(GTK_COMBO_BOX(default_privacy_system
), FALSE
);
2781 gtk_widget_show (default_privacy_system
);
2782 gtk_box_pack_start (GTK_BOX(hbox1
), default_privacy_system
, FALSE
, TRUE
, 0);
2784 g_signal_connect(G_OBJECT(default_privacy_system
), "changed",
2785 G_CALLBACK(privacy_system_activated
),
2788 PACK_CHECK_BUTTON (vbox2
, default_sign_checkbtn
,
2789 _("Always sign messages"));
2790 PACK_CHECK_BUTTON (vbox2
, default_encrypt_checkbtn
,
2791 _("Always encrypt messages"));
2792 PACK_CHECK_BUTTON (vbox2
, default_sign_reply_checkbtn
,
2793 _("Always sign messages when replying to a "
2795 PACK_CHECK_BUTTON (vbox2
, default_encrypt_reply_checkbtn
,
2796 _("Always encrypt messages when replying to an "
2797 "encrypted message"));
2798 PACK_CHECK_BUTTON (vbox2
, encrypt_to_self_checkbtn
,
2799 _("Encrypt sent messages with your own key in addition to recipient's"));
2800 PACK_CHECK_BUTTON (vbox2
, save_clear_text_checkbtn
,
2801 _("Save sent encrypted messages as clear text"));
2803 SET_TOGGLE_SENSITIVITY_REVERSE(encrypt_to_self_checkbtn
, save_clear_text_checkbtn
);
2804 SET_TOGGLE_SENSITIVITY_REVERSE(save_clear_text_checkbtn
, encrypt_to_self_checkbtn
);
2806 page
->default_privacy_system
= default_privacy_system
;
2807 page
->default_encrypt_checkbtn
= default_encrypt_checkbtn
;
2808 page
->default_encrypt_reply_checkbtn
= default_encrypt_reply_checkbtn
;
2809 page
->default_sign_reply_checkbtn
= default_sign_reply_checkbtn
;
2810 page
->default_sign_checkbtn
= default_sign_checkbtn
;
2811 page
->save_clear_text_checkbtn
= save_clear_text_checkbtn
;
2812 page
->encrypt_to_self_checkbtn
= encrypt_to_self_checkbtn
;
2814 update_privacy_system_menu();
2816 tmp_ac_prefs
= *ac_prefs
;
2819 prefs_set_dialog_to_default(privacy_param
);
2821 prefs_set_dialog(privacy_param
);
2825 page
->page
.widget
= vbox1
;
2828 #define CREATE_RADIO_BUTTON(box, btn, btn_p, label, data) \
2830 btn = gtk_radio_button_new_with_label_from_widget \
2831 (GTK_RADIO_BUTTON (btn_p), label); \
2832 gtk_widget_show (btn); \
2833 gtk_box_pack_start (GTK_BOX (box), btn, FALSE, FALSE, 0); \
2834 g_object_set_data (G_OBJECT (btn), \
2836 GINT_TO_POINTER (data)); \
2841 #define CREATE_RADIO_BUTTONS(box, \
2842 btn1, btn1_label, btn1_data, \
2843 btn2, btn2_label, btn2_data, \
2844 btn3, btn3_label, btn3_data) \
2846 btn1 = gtk_radio_button_new_with_label(NULL, btn1_label); \
2847 gtk_widget_show (btn1); \
2848 gtk_box_pack_start (GTK_BOX (box), btn1, FALSE, FALSE, 0); \
2849 g_object_set_data (G_OBJECT (btn1), \
2851 GINT_TO_POINTER (btn1_data)); \
2853 CREATE_RADIO_BUTTON(box, btn2, btn1, btn2_label, btn2_data); \
2854 CREATE_RADIO_BUTTON(box, btn3, btn1, btn3_label, btn3_data); \
2857 static void pop_ssltunnel_toggled(GtkToggleButton
*button
,
2860 gboolean active
= gtk_toggle_button_get_active(button
);
2862 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
2863 advanced_page
.popport_checkbtn
)) == TRUE
)
2865 gtk_spin_button_set_value(GTK_SPIN_BUTTON(advanced_page
.popport_spinbtn
),
2866 active
? 995 : 110);
2869 static void imap_ssltunnel_toggled(GtkToggleButton
*button
,
2872 gboolean active
= gtk_toggle_button_get_active(button
);
2874 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
2875 advanced_page
.imapport_checkbtn
)) == TRUE
)
2877 gtk_spin_button_set_value(GTK_SPIN_BUTTON(advanced_page
.imapport_spinbtn
),
2878 active
? 993 : 143);
2881 static void nntp_ssltunnel_toggled(GtkToggleButton
*button
,
2884 gboolean active
= gtk_toggle_button_get_active(button
);
2886 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
2887 advanced_page
.nntpport_checkbtn
)) == TRUE
)
2889 gtk_spin_button_set_value(GTK_SPIN_BUTTON(advanced_page
.nntpport_spinbtn
),
2890 active
? 563 : 119);
2893 static void smtp_ssltunnel_toggled(GtkToggleButton
*button
,
2896 gboolean active
= gtk_toggle_button_get_active(button
);
2898 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
2899 advanced_page
.smtpport_checkbtn
)) == TRUE
)
2901 gtk_spin_button_set_value(GTK_SPIN_BUTTON(advanced_page
.smtpport_spinbtn
),
2905 static void ssl_create_widget_func(PrefsPage
* _page
,
2909 SSLPage
*page
= (SSLPage
*) _page
;
2910 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
2914 GtkWidget
*pop_frame
;
2916 GtkWidget
*pop_nossl_radiobtn
;
2917 GtkWidget
*pop_ssltunnel_radiobtn
;
2918 GtkWidget
*pop_starttls_radiobtn
;
2920 GtkWidget
*imap_frame
;
2922 GtkWidget
*imap_nossl_radiobtn
;
2923 GtkWidget
*imap_ssltunnel_radiobtn
;
2924 GtkWidget
*imap_starttls_radiobtn
;
2926 GtkWidget
*nntp_frame
;
2928 GtkWidget
*nntp_nossl_radiobtn
;
2929 GtkWidget
*nntp_ssltunnel_radiobtn
;
2931 GtkWidget
*send_frame
;
2933 GtkWidget
*smtp_nossl_radiobtn
;
2934 GtkWidget
*smtp_ssltunnel_radiobtn
;
2935 GtkWidget
*smtp_starttls_radiobtn
;
2937 GtkWidget
*cert_frame
;
2938 GtkWidget
*cert_table
;
2939 GtkWidget
*entry_in_cert_pass
;
2940 GtkWidget
*entry_out_cert_pass
;
2941 GtkWidget
*showpwd_checkbtn
;
2944 GtkWidget
*ssl_certs_auto_accept_checkbtn
;
2945 GtkWidget
*use_nonblocking_ssl_checkbtn
;
2947 GtkWidget
*hbox_spc
;
2951 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
2952 gtk_widget_show (vbox1
);
2953 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
2955 vbox2
= gtkut_get_options_frame(vbox1
, &pop_frame
, _("POP"));
2957 CREATE_RADIO_BUTTONS(vbox2
,
2959 _("Don't use SSL/TLS"),
2961 pop_ssltunnel_radiobtn
,
2964 pop_starttls_radiobtn
,
2965 _("Use STARTTLS command to start encrypted session"),
2967 g_signal_connect(G_OBJECT(pop_ssltunnel_radiobtn
), "toggled",
2968 G_CALLBACK(pop_ssltunnel_toggled
), NULL
);
2970 vbox3
= gtkut_get_options_frame(vbox1
, &imap_frame
, _("IMAP"));
2972 CREATE_RADIO_BUTTONS(vbox3
,
2973 imap_nossl_radiobtn
,
2974 _("Don't use SSL/TLS"),
2976 imap_ssltunnel_radiobtn
,
2979 imap_starttls_radiobtn
,
2980 _("Use STARTTLS command to start encrypted session"),
2982 g_signal_connect(G_OBJECT(imap_ssltunnel_radiobtn
), "toggled",
2983 G_CALLBACK(imap_ssltunnel_toggled
), NULL
);
2985 vbox4
= gtkut_get_options_frame(vbox1
, &nntp_frame
, _("NNTP"));
2987 nntp_nossl_radiobtn
=
2988 gtk_radio_button_new_with_label (NULL
, _("Don't use SSL/TLS"));
2989 gtk_widget_show (nntp_nossl_radiobtn
);
2990 gtk_box_pack_start (GTK_BOX (vbox4
), nntp_nossl_radiobtn
,
2992 g_object_set_data (G_OBJECT (nntp_nossl_radiobtn
),
2994 GINT_TO_POINTER (SSL_NONE
));
2996 CREATE_RADIO_BUTTON(vbox4
, nntp_ssltunnel_radiobtn
, nntp_nossl_radiobtn
,
2997 _("Use SSL/TLS"), SSL_TUNNEL
);
2998 g_signal_connect(G_OBJECT(nntp_ssltunnel_radiobtn
), "toggled",
2999 G_CALLBACK(nntp_ssltunnel_toggled
), NULL
);
3001 vbox5
= gtkut_get_options_frame(vbox1
, &send_frame
, _("Send (SMTP)"));
3003 CREATE_RADIO_BUTTONS(vbox5
,
3004 smtp_nossl_radiobtn
,
3005 _("Don't use SSL/TLS (but, if necessary, use STARTTLS)"),
3007 smtp_ssltunnel_radiobtn
,
3010 smtp_starttls_radiobtn
,
3011 _("Use STARTTLS command to start encrypted session"),
3013 g_signal_connect(G_OBJECT(smtp_ssltunnel_radiobtn
), "toggled",
3014 G_CALLBACK(smtp_ssltunnel_toggled
), NULL
);
3016 PACK_FRAME(vbox1
, cert_frame
, _("Client certificates"));
3018 cert_table
= gtk_table_new(4,3, FALSE
);
3019 gtk_container_add(GTK_CONTAINER(cert_frame
), cert_table
);
3020 gtk_container_set_border_width(GTK_CONTAINER(cert_table
), 8);
3021 gtk_table_set_row_spacings(GTK_TABLE(cert_table
), VSPACING_NARROW_2
);
3022 gtk_table_set_col_spacings(GTK_TABLE(cert_table
), 8);
3024 label
= gtk_label_new(_("Certificate for receiving"));
3025 gtk_misc_set_alignment(GTK_MISC(label
), 1, 0.5);
3026 entry_in_cert_file
= gtk_entry_new();
3027 in_ssl_cert_browse_button
= gtkut_get_browse_file_btn(_("Browse"));
3028 CLAWS_SET_TIP(label
,
3029 _("Client certificate file as a PKCS12 or PEM file"));
3030 CLAWS_SET_TIP(entry_in_cert_file
,
3031 _("Client certificate file as a PKCS12 or PEM file"));
3032 gtk_table_attach(GTK_TABLE(cert_table
), label
, 0, 1, 0, 1, GTK_FILL
, 0, 0, 0);
3033 gtk_table_attach(GTK_TABLE(cert_table
), entry_in_cert_file
, 1, 2, 0, 1,
3034 GTK_EXPAND
|GTK_FILL
, 0, 0, 0);
3035 gtk_table_attach(GTK_TABLE(cert_table
), in_ssl_cert_browse_button
, 2, 3, 0, 1,
3038 label
= gtk_label_new(_("Password"));
3039 gtk_misc_set_alignment(GTK_MISC(label
), 1, 0.5);
3040 entry_in_cert_pass
= gtk_entry_new();
3041 gtk_entry_set_visibility(GTK_ENTRY(entry_in_cert_pass
), FALSE
);
3042 showpwd_checkbtn
= gtk_check_button_new_with_label (_("Show password"));
3043 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(showpwd_checkbtn
), FALSE
);
3044 g_signal_connect(G_OBJECT(showpwd_checkbtn
), "toggled",
3045 G_CALLBACK(prefs_account_showpwd_checkbtn_toggled
), entry_in_cert_pass
);
3046 gtk_table_attach(GTK_TABLE(cert_table
), label
, 0, 1, 1, 2, GTK_FILL
, 0, 0, 0);
3047 gtk_table_attach(GTK_TABLE(cert_table
), entry_in_cert_pass
, 1, 2, 1, 2,
3049 gtk_table_attach(GTK_TABLE(cert_table
), showpwd_checkbtn
, 2, 3, 1, 2,
3052 label
= gtk_label_new(_("Certificate for sending"));
3053 gtk_misc_set_alignment(GTK_MISC(label
), 1, 0.5);
3054 entry_out_cert_file
= gtk_entry_new();
3055 out_ssl_cert_browse_button
= gtkut_get_browse_file_btn(_("Browse"));
3056 CLAWS_SET_TIP(label
,
3057 _("Client certificate file as a PKCS12 or PEM file"));
3058 CLAWS_SET_TIP(entry_out_cert_file
,
3059 _("Client certificate file as a PKCS12 or PEM file"));
3060 gtk_table_attach(GTK_TABLE(cert_table
), label
, 0, 1, 2, 3, GTK_FILL
, 0, 0, 0);
3061 gtk_table_attach(GTK_TABLE(cert_table
), entry_out_cert_file
, 1, 2, 2, 3,
3062 GTK_EXPAND
|GTK_FILL
, 0, 0, 0);
3063 gtk_table_attach(GTK_TABLE(cert_table
), out_ssl_cert_browse_button
, 2, 3, 2, 3,
3066 label
= gtk_label_new(_("Password"));
3067 gtk_misc_set_alignment(GTK_MISC(label
), 1, 0.5);
3068 entry_out_cert_pass
= gtk_entry_new();
3069 gtk_entry_set_visibility(GTK_ENTRY(entry_out_cert_pass
), FALSE
);
3070 showpwd_checkbtn
= gtk_check_button_new_with_label (_("Show password"));
3071 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(showpwd_checkbtn
), FALSE
);
3072 g_signal_connect(G_OBJECT(showpwd_checkbtn
), "toggled",
3073 G_CALLBACK(prefs_account_showpwd_checkbtn_toggled
), entry_out_cert_pass
);
3074 gtk_table_attach(GTK_TABLE(cert_table
), label
, 0, 1, 3, 4, GTK_FILL
, 0, 0, 0);
3075 gtk_table_attach(GTK_TABLE(cert_table
), entry_out_cert_pass
, 1, 2, 3, 4,
3077 gtk_table_attach(GTK_TABLE(cert_table
), showpwd_checkbtn
, 2, 3, 3, 4,
3080 gtk_widget_show_all(cert_table
);
3082 g_signal_connect(G_OBJECT(in_ssl_cert_browse_button
), "clicked",
3083 G_CALLBACK(prefs_account_in_cert_browse_cb
), NULL
);
3084 g_signal_connect(G_OBJECT(out_ssl_cert_browse_button
), "clicked",
3085 G_CALLBACK(prefs_account_out_cert_browse_cb
), NULL
);
3087 vbox7
= gtk_vbox_new (FALSE
, 0);
3088 gtk_widget_show (vbox7
);
3089 gtk_box_pack_start (GTK_BOX (vbox1
), vbox7
, FALSE
, FALSE
, 0);
3091 PACK_CHECK_BUTTON(vbox7
, ssl_certs_auto_accept_checkbtn
,
3092 _("Automatically accept valid SSL/TLS certificates"));
3094 PACK_CHECK_BUTTON(vbox7
, use_nonblocking_ssl_checkbtn
,
3095 _("Use non-blocking SSL/TLS"));
3097 hbox
= gtk_hbox_new (FALSE
, 0);
3098 gtk_widget_show (hbox
);
3099 gtk_box_pack_start (GTK_BOX (vbox7
), hbox
, FALSE
, FALSE
, 0);
3101 hbox_spc
= gtk_hbox_new (FALSE
, 0);
3102 gtk_widget_show (hbox_spc
);
3103 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
3104 gtk_widget_set_size_request (hbox_spc
, 16, -1);
3106 label
= gtk_label_new
3107 (_("Turn this off if you have SSL/TLS connection problems"));
3108 gtk_widget_show (label
);
3109 gtk_box_pack_start (GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
3110 gtkut_widget_set_small_font_size (label
);
3112 page
->pop_frame
= pop_frame
;
3113 page
->pop_nossl_radiobtn
= pop_nossl_radiobtn
;
3114 page
->pop_ssltunnel_radiobtn
= pop_ssltunnel_radiobtn
;
3115 page
->pop_starttls_radiobtn
= pop_starttls_radiobtn
;
3117 page
->imap_frame
= imap_frame
;
3118 page
->imap_nossl_radiobtn
= imap_nossl_radiobtn
;
3119 page
->imap_ssltunnel_radiobtn
= imap_ssltunnel_radiobtn
;
3120 page
->imap_starttls_radiobtn
= imap_starttls_radiobtn
;
3122 page
->nntp_frame
= nntp_frame
;
3123 page
->nntp_nossl_radiobtn
= nntp_nossl_radiobtn
;
3124 page
->nntp_ssltunnel_radiobtn
= nntp_ssltunnel_radiobtn
;
3126 page
->send_frame
= send_frame
;
3127 page
->smtp_nossl_radiobtn
= smtp_nossl_radiobtn
;
3128 page
->smtp_ssltunnel_radiobtn
= smtp_ssltunnel_radiobtn
;
3129 page
->smtp_starttls_radiobtn
= smtp_starttls_radiobtn
;
3131 page
->entry_in_cert_file
= entry_in_cert_file
;
3132 page
->entry_in_cert_pass
= entry_in_cert_pass
;
3133 page
->entry_out_cert_file
= entry_out_cert_file
;
3134 page
->entry_out_cert_pass
= entry_out_cert_pass
;
3136 page
->ssl_certs_auto_accept_checkbtn
= ssl_certs_auto_accept_checkbtn
;
3137 page
->use_nonblocking_ssl_checkbtn
= use_nonblocking_ssl_checkbtn
;
3139 tmp_ac_prefs
= *ac_prefs
;
3142 prefs_set_dialog_to_default(ssl_param
);
3144 prefs_set_dialog(ssl_param
);
3146 /* Passwords are handled outside of PrefParams. */
3147 buf
= passwd_store_get_account(ac_prefs
->account_id
,
3148 PWS_ACCOUNT_RECV_CERT
);
3149 gtk_entry_set_text(GTK_ENTRY(page
->entry_in_cert_pass
), buf
!= NULL
? buf
: "");
3151 memset(buf
, 0, strlen(buf
));
3155 buf
= passwd_store_get_account(ac_prefs
->account_id
,
3156 PWS_ACCOUNT_SEND_CERT
);
3157 gtk_entry_set_text(GTK_ENTRY(page
->entry_out_cert_pass
), buf
!= NULL
? buf
: "");
3159 memset(buf
, 0, strlen(buf
));
3166 page
->page
.widget
= vbox1
;
3169 #undef CREATE_RADIO_BUTTONS
3170 #endif /* USE_GNUTLS */
3172 static void proxy_create_widget_func(PrefsPage
* _page
,
3176 ProxyPage
*page
= (ProxyPage
*) _page
;
3177 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
3178 GtkWidget
*vbox1
, *vbox2
, *vbox3
, *vbox4
;
3179 GtkWidget
*proxy_frame
;
3180 GtkWidget
*proxy_checkbtn
;
3181 GtkWidget
*default_proxy_checkbtn
;
3184 GtkWidget
*socks4_radiobtn
;
3185 GtkWidget
*socks5_radiobtn
;
3186 GtkWidget
*proxy_host_entry
;
3187 GtkWidget
*proxy_port_spinbtn
;
3188 GtkWidget
*proxy_auth_checkbtn
;
3189 GtkWidget
*proxy_name_entry
;
3190 GtkWidget
*proxy_pass_entry
;
3191 GtkWidget
*proxy_send_checkbtn
;
3196 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
3197 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
3199 proxy_checkbtn
= gtk_check_button_new_with_label (_("Use proxy server"));
3200 PACK_FRAME (vbox1
, proxy_frame
, NULL
);
3201 gtk_frame_set_label_widget (GTK_FRAME(proxy_frame
), proxy_checkbtn
);
3203 vbox2
= gtk_vbox_new (FALSE
, VSPACING_NARROW
);
3204 gtk_container_add (GTK_CONTAINER (proxy_frame
), vbox2
);
3205 gtk_container_set_border_width (GTK_CONTAINER (vbox2
), 8);
3207 default_proxy_checkbtn
=
3208 gtk_check_button_new_with_label (C_("In account preferences, referring to whether or not use proxy settings from common preferences", "Use default settings"));
3209 CLAWS_SET_TIP(default_proxy_checkbtn
,
3210 _("Use global proxy server settings"));
3211 gtk_box_pack_start (GTK_BOX (vbox2
), default_proxy_checkbtn
, FALSE
, FALSE
, 0);
3213 vbox3
= gtk_vbox_new (FALSE
, VSPACING_NARROW
);
3214 gtk_box_pack_start (GTK_BOX (vbox2
), vbox3
, FALSE
, FALSE
, 0);
3216 hbox
= gtk_hbox_new (FALSE
, 8);
3217 gtk_box_pack_start (GTK_BOX (vbox3
), hbox
, FALSE
, FALSE
, 0);
3219 socks4_radiobtn
= gtk_radio_button_new_with_label(NULL
, "SOCKS4");
3220 gtk_box_pack_start (GTK_BOX (hbox
), socks4_radiobtn
, FALSE
, FALSE
, 0);
3221 g_object_set_data(G_OBJECT(socks4_radiobtn
), MENU_VAL_ID
,
3222 GINT_TO_POINTER(PROXY_SOCKS4
));
3224 CREATE_RADIO_BUTTON(hbox
, socks5_radiobtn
, socks4_radiobtn
, "SOCKS5",
3227 hbox
= gtk_hbox_new (FALSE
, 8);
3228 gtk_box_pack_start (GTK_BOX (vbox3
), hbox
, FALSE
, FALSE
, 0);
3230 label
= gtk_label_new(_("Hostname"));
3231 gtk_box_pack_start(GTK_BOX(hbox
), label
, FALSE
, FALSE
, 0);
3233 proxy_host_entry
= gtk_entry_new();
3234 gtk_widget_set_size_request(proxy_host_entry
, DEFAULT_ENTRY_WIDTH
, -1);
3235 gtk_box_pack_start(GTK_BOX(hbox
), proxy_host_entry
, TRUE
, TRUE
, 0);
3237 label
= gtk_label_new(_("Port"));
3238 gtk_box_pack_start(GTK_BOX(hbox
), label
, FALSE
, FALSE
, 0);
3240 proxy_port_spinbtn
= gtk_spin_button_new_with_range(0, 65535, 1080);
3241 gtk_widget_set_size_request(proxy_port_spinbtn
, 64, -1);
3242 gtk_box_pack_start(GTK_BOX(hbox
), proxy_port_spinbtn
, FALSE
, FALSE
, 0);
3244 vbox4
= gtk_vbox_new (FALSE
, VSPACING_NARROW
);
3245 gtk_box_pack_start(GTK_BOX(vbox3
), vbox4
, FALSE
, FALSE
, 0);
3247 PACK_CHECK_BUTTON (vbox4
, proxy_auth_checkbtn
, _("Use authentication"));
3249 table
= gtk_table_new(2, 4, FALSE
);
3250 gtk_box_pack_start (GTK_BOX (vbox4
), table
, FALSE
, FALSE
, 0);
3252 label
= gtk_label_new(_("Username"));
3253 gtk_table_attach(GTK_TABLE(table
), label
, 0, 1, 0, 1,
3254 GTK_SHRINK
| GTK_FILL
,
3255 GTK_SHRINK
| GTK_FILL
, 0, 0);
3257 proxy_name_entry
= gtk_entry_new();
3258 gtk_widget_set_size_request(proxy_name_entry
, DEFAULT_ENTRY_WIDTH
, -1);
3259 gtk_table_attach(GTK_TABLE(table
), proxy_name_entry
, 1, 2, 0, 1,
3260 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
3261 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
3263 label
= gtk_label_new(_("Password"));
3264 gtk_table_attach(GTK_TABLE(table
), label
, 2, 3, 0, 1,
3265 GTK_SHRINK
| GTK_FILL
,
3266 GTK_SHRINK
| GTK_FILL
, 0, 0);
3268 proxy_pass_entry
= gtk_entry_new();
3269 gtk_widget_set_size_request(proxy_pass_entry
, DEFAULT_ENTRY_WIDTH
, -1);
3270 gtk_entry_set_visibility(GTK_ENTRY(proxy_pass_entry
), FALSE
);
3271 gtk_table_attach(GTK_TABLE(table
), proxy_pass_entry
, 3, 4, 0, 1,
3272 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
,
3273 GTK_EXPAND
| GTK_SHRINK
| GTK_FILL
, 0, 0);
3275 button
= gtk_check_button_new_with_label(_("Show password"));
3276 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button
), FALSE
);
3277 gtk_table_attach(GTK_TABLE(table
), button
, 3, 4, 1, 2,
3278 GTK_SHRINK
| GTK_FILL
,
3279 GTK_SHRINK
| GTK_FILL
, 0, 0);
3280 g_signal_connect(G_OBJECT(button
), "toggled",
3281 G_CALLBACK(prefs_account_showpwd_checkbtn_toggled
), proxy_pass_entry
);
3283 gtk_box_pack_start(GTK_BOX(vbox2
), gtk_hseparator_new(), FALSE
, FALSE
, 0);
3285 PACK_CHECK_BUTTON(vbox2
, proxy_send_checkbtn
,
3286 _("Use proxy server for sending"));
3287 CLAWS_SET_TIP(proxy_send_checkbtn
,
3288 _("If disabled, messages will be sent using direct connection to configured outgoing server, bypassing any configured proxy server."));
3290 SET_TOGGLE_SENSITIVITY(proxy_auth_checkbtn
, table
);
3291 SET_TOGGLE_SENSITIVITY(socks5_radiobtn
, vbox4
);
3292 SET_TOGGLE_SENSITIVITY(proxy_checkbtn
, vbox2
);
3293 SET_TOGGLE_SENSITIVITY_REVERSE(default_proxy_checkbtn
, vbox3
);
3295 gtk_widget_show_all(vbox1
);
3297 page
->proxy_checkbtn
= proxy_checkbtn
;
3298 page
->default_proxy_checkbtn
= default_proxy_checkbtn
;
3299 page
->socks4_radiobtn
= socks4_radiobtn
;
3300 page
->socks5_radiobtn
= socks5_radiobtn
;
3301 page
->proxy_host_entry
= proxy_host_entry
;
3302 page
->proxy_port_spinbtn
= proxy_port_spinbtn
;
3303 page
->proxy_auth_checkbtn
= proxy_auth_checkbtn
;
3304 page
->proxy_name_entry
= proxy_name_entry
;
3305 page
->proxy_pass_entry
= proxy_pass_entry
;
3306 page
->proxy_send_checkbtn
= proxy_send_checkbtn
;
3308 page
->page
.widget
= vbox1
;
3310 tmp_ac_prefs
= *ac_prefs
;
3313 prefs_set_dialog_to_default(proxy_param
);
3315 prefs_set_dialog(proxy_param
);
3317 /* Passwords are handled outside of PrefParams. */
3318 buf
= passwd_store_get_account(ac_prefs
->account_id
,
3319 PWS_ACCOUNT_PROXY_PASS
);
3320 gtk_entry_set_text(GTK_ENTRY(page
->proxy_pass_entry
),
3321 buf
!= NULL
? buf
: "");
3323 memset(buf
, 0, strlen(buf
));
3329 page
->page
.widget
= vbox1
;
3332 static void advanced_create_widget_func(PrefsPage
* _page
,
3336 AdvancedPage
*page
= (AdvancedPage
*) _page
;
3337 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
3342 GtkWidget
*checkbtn_smtpport
;
3343 GtkWidget
*spinbtn_smtpport
;
3344 GtkWidget
*hbox_popport
;
3345 GtkWidget
*checkbtn_popport
;
3346 GtkWidget
*spinbtn_popport
;
3347 GtkWidget
*hbox_imapport
;
3348 GtkWidget
*checkbtn_imapport
;
3349 GtkWidget
*spinbtn_imapport
;
3350 GtkWidget
*hbox_nntpport
;
3351 GtkWidget
*checkbtn_nntpport
;
3352 GtkWidget
*spinbtn_nntpport
;
3353 GtkWidget
*checkbtn_domain
;
3354 GtkWidget
*entry_domain
;
3356 GtkWidget
*checkbtn_crosspost
;
3357 GtkWidget
*colormenu_crosspost
;
3360 GtkWidget
*checkbtn_tunnelcmd
;
3361 GtkWidget
*entry_tunnelcmd
;
3363 GtkWidget
*folder_frame
;
3366 GtkWidget
*sent_folder_checkbtn
;
3367 GtkWidget
*sent_folder_entry
;
3368 GtkWidget
*queue_folder_checkbtn
;
3369 GtkWidget
*queue_folder_entry
;
3370 GtkWidget
*draft_folder_checkbtn
;
3371 GtkWidget
*draft_folder_entry
;
3372 GtkWidget
*trash_folder_checkbtn
;
3373 GtkWidget
*trash_folder_entry
;
3374 GtkSizeGroup
*size_group
= gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL
);
3376 #define PACK_HBOX(hbox) \
3378 hbox = gtk_hbox_new (FALSE, 8); \
3379 gtk_widget_show (hbox); \
3380 gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); \
3383 #define PACK_PORT_SPINBTN(box, spinbtn) \
3385 spinbtn = gtk_spin_button_new_with_range(0, 65535, 1); \
3386 gtk_widget_show (spinbtn); \
3387 gtk_box_pack_start (GTK_BOX (box), spinbtn, FALSE, FALSE, 0); \
3390 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
3391 gtk_widget_show (vbox1
);
3392 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
3394 vbox2
= gtk_vbox_new (FALSE
, VSPACING_NARROW_2
);
3395 gtk_widget_show (vbox2
);
3396 gtk_box_pack_start (GTK_BOX (vbox1
), vbox2
, FALSE
, FALSE
, 0);
3399 PACK_CHECK_BUTTON (hbox1
, checkbtn_smtpport
, _("SMTP port"));
3400 PACK_PORT_SPINBTN (hbox1
, spinbtn_smtpport
);
3401 SET_TOGGLE_SENSITIVITY (checkbtn_smtpport
, spinbtn_smtpport
);
3402 gtk_size_group_add_widget(size_group
, checkbtn_smtpport
);
3404 PACK_HBOX (hbox_popport
);
3405 PACK_CHECK_BUTTON (hbox_popport
, checkbtn_popport
,
3407 PACK_PORT_SPINBTN (hbox_popport
, spinbtn_popport
);
3408 SET_TOGGLE_SENSITIVITY (checkbtn_popport
, spinbtn_popport
);
3409 gtk_size_group_add_widget(size_group
, checkbtn_popport
);
3411 PACK_HBOX (hbox_imapport
);
3412 PACK_CHECK_BUTTON (hbox_imapport
, checkbtn_imapport
,
3414 PACK_PORT_SPINBTN (hbox_imapport
, spinbtn_imapport
);
3415 SET_TOGGLE_SENSITIVITY (checkbtn_imapport
, spinbtn_imapport
);
3416 gtk_size_group_add_widget(size_group
, checkbtn_imapport
);
3418 PACK_HBOX (hbox_nntpport
);
3419 PACK_CHECK_BUTTON (hbox_nntpport
, checkbtn_nntpport
,
3421 PACK_PORT_SPINBTN (hbox_nntpport
, spinbtn_nntpport
);
3422 SET_TOGGLE_SENSITIVITY (checkbtn_nntpport
, spinbtn_nntpport
);
3423 gtk_size_group_add_widget(size_group
, checkbtn_nntpport
);
3426 PACK_CHECK_BUTTON (hbox1
, checkbtn_domain
, _("Domain name"));
3427 gtk_size_group_add_widget(size_group
, checkbtn_domain
);
3429 tip_domain
= _("The domain name will be used in the generated "
3430 "Message-ID, and when connecting to SMTP servers.");
3432 CLAWS_SET_TIP(checkbtn_domain
, tip_domain
);
3434 entry_domain
= gtk_entry_new ();
3435 gtk_widget_show (entry_domain
);
3436 gtk_box_pack_start (GTK_BOX (hbox1
), entry_domain
, TRUE
, TRUE
, 0);
3437 SET_TOGGLE_SENSITIVITY (checkbtn_domain
, entry_domain
);
3438 CLAWS_SET_TIP(entry_domain
, tip_domain
);
3442 PACK_CHECK_BUTTON (hbox1
, checkbtn_tunnelcmd
,
3443 _("Use command to communicate with server"));
3444 entry_tunnelcmd
= gtk_entry_new ();
3445 gtk_widget_show (entry_tunnelcmd
);
3446 gtk_box_pack_start (GTK_BOX (hbox1
), entry_tunnelcmd
, TRUE
, TRUE
, 0);
3447 SET_TOGGLE_SENSITIVITY (checkbtn_tunnelcmd
, entry_tunnelcmd
);
3451 PACK_CHECK_BUTTON (hbox1
, checkbtn_crosspost
,
3452 _("Mark cross-posted messages as read and color:"));
3453 g_signal_connect (G_OBJECT (checkbtn_crosspost
), "toggled",
3454 G_CALLBACK (crosspost_color_toggled
),
3457 colormenu_crosspost
= gtk_cmoption_menu_new();
3458 gtk_widget_show (colormenu_crosspost
);
3459 gtk_box_pack_start (GTK_BOX (hbox1
), colormenu_crosspost
, FALSE
, FALSE
, 0);
3461 menu
= colorlabel_create_color_menu();
3462 gtk_cmoption_menu_set_menu (GTK_CMOPTION_MENU(colormenu_crosspost
), menu
);
3463 SET_TOGGLE_SENSITIVITY(checkbtn_crosspost
, colormenu_crosspost
);
3465 #undef PACK_PORT_SPINBTN
3467 /* special folder setting (maybe these options are redundant) */
3469 vbox3
= gtkut_get_options_frame(vbox1
, &folder_frame
, _("Folder"));
3471 table
= gtk_table_new (4, 3, FALSE
);
3472 gtk_widget_show (table
);
3473 gtk_container_add (GTK_CONTAINER (vbox3
), table
);
3474 gtk_table_set_row_spacings (GTK_TABLE (table
), VSPACING_NARROW_2
);
3475 gtk_table_set_col_spacings (GTK_TABLE (table
), 4);
3477 #define SET_CHECK_BTN_AND_ENTRY(label, checkbtn, entry, n) \
3479 GtkWidget *button; \
3481 checkbtn = gtk_check_button_new_with_label (label); \
3482 gtk_widget_show (checkbtn); \
3483 gtk_table_attach (GTK_TABLE (table), checkbtn, \
3484 0, 1, n, n + 1, GTK_FILL, 0, 0, 0); \
3486 entry = gtk_entry_new (); \
3487 gtk_widget_show (entry); \
3488 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, n, n + 1, \
3489 GTK_EXPAND | GTK_SHRINK | GTK_FILL, \
3490 GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); \
3492 button = gtkut_get_browse_file_btn(_("Browse")); \
3493 gtk_widget_show (button); \
3494 gtk_table_attach (GTK_TABLE (table), button, \
3495 2, 3, n, n + 1, GTK_FILL, 0, 0, 0); \
3497 (G_OBJECT (button), "clicked", \
3498 G_CALLBACK (prefs_account_select_folder_cb), \
3501 SET_TOGGLE_SENSITIVITY (checkbtn, entry); \
3502 SET_TOGGLE_SENSITIVITY (checkbtn, button); \
3505 SET_CHECK_BTN_AND_ENTRY(_("Put sent messages in"),
3506 sent_folder_checkbtn
, sent_folder_entry
, 0);
3507 SET_CHECK_BTN_AND_ENTRY(_("Put queued messages in"),
3508 queue_folder_checkbtn
, queue_folder_entry
, 1);
3509 SET_CHECK_BTN_AND_ENTRY(_("Put draft messages in"),
3510 draft_folder_checkbtn
, draft_folder_entry
, 2);
3511 SET_CHECK_BTN_AND_ENTRY(_("Put deleted messages in"),
3512 trash_folder_checkbtn
, trash_folder_entry
, 3);
3514 page
->smtpport_checkbtn
= checkbtn_smtpport
;
3515 page
->smtpport_spinbtn
= spinbtn_smtpport
;
3516 page
->popport_hbox
= hbox_popport
;
3517 page
->popport_checkbtn
= checkbtn_popport
;
3518 page
->popport_spinbtn
= spinbtn_popport
;
3519 page
->imapport_hbox
= hbox_imapport
;
3520 page
->imapport_checkbtn
= checkbtn_imapport
;
3521 page
->imapport_spinbtn
= spinbtn_imapport
;
3522 page
->nntpport_hbox
= hbox_nntpport
;
3523 page
->nntpport_checkbtn
= checkbtn_nntpport
;
3524 page
->nntpport_spinbtn
= spinbtn_nntpport
;
3525 page
->domain_checkbtn
= checkbtn_domain
;
3526 page
->domain_entry
= entry_domain
;
3527 page
->crosspost_checkbtn
= checkbtn_crosspost
;
3528 page
->crosspost_colormenu
= colormenu_crosspost
;
3531 page
->tunnelcmd_checkbtn
= checkbtn_tunnelcmd
;
3532 page
->tunnelcmd_entry
= entry_tunnelcmd
;
3534 page
->sent_folder_checkbtn
= sent_folder_checkbtn
;
3535 page
->sent_folder_entry
= sent_folder_entry
;
3536 page
->queue_folder_checkbtn
= queue_folder_checkbtn
;
3537 page
->queue_folder_entry
= queue_folder_entry
;
3538 page
->draft_folder_checkbtn
= draft_folder_checkbtn
;
3539 page
->draft_folder_entry
= draft_folder_entry
;
3540 page
->trash_folder_checkbtn
= trash_folder_checkbtn
;
3541 page
->trash_folder_entry
= trash_folder_entry
;
3543 tmp_ac_prefs
= *ac_prefs
;
3546 prefs_set_dialog_to_default(advanced_param
);
3548 prefs_set_dialog(advanced_param
);
3552 page
->page
.widget
= vbox1
;
3554 g_object_unref(G_OBJECT(size_group
));
3557 static gint
prefs_basic_apply(void)
3559 RecvProtocol protocol
;
3560 gchar
*old_id
= NULL
;
3561 gchar
*new_id
= NULL
;
3562 struct BasicProtocol
*protocol_optmenu
= (struct BasicProtocol
*) basic_page
.protocol_optmenu
;
3563 GtkWidget
*optmenu
= protocol_optmenu
->combobox
;
3565 protocol
= combobox_get_active_data(GTK_COMBO_BOX(optmenu
));
3567 if (*gtk_entry_get_text(GTK_ENTRY(basic_page
.acname_entry
)) == '\0') {
3568 alertpanel_error(_("Account name is not entered."));
3571 if (*gtk_entry_get_text(GTK_ENTRY(basic_page
.addr_entry
)) == '\0') {
3572 alertpanel_error(_("Mail address is not entered."));
3576 if (((protocol
== A_POP3
) ||
3577 (protocol
== A_LOCAL
&& !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(basic_page
.mailcmd_checkbtn
))) ||
3578 (protocol
== A_NONE
)) &&
3579 *gtk_entry_get_text(GTK_ENTRY(basic_page
.smtpserv_entry
)) == '\0') {
3580 alertpanel_error(_("SMTP server is not entered."));
3583 if ((protocol
== A_POP3
|| protocol
== A_IMAP4
) &&
3584 *gtk_entry_get_text(GTK_ENTRY(basic_page
.uid_entry
)) == '\0') {
3585 alertpanel_error(_("User ID is not entered."));
3588 if (protocol
== A_POP3
&&
3589 *gtk_entry_get_text(GTK_ENTRY(basic_page
.recvserv_entry
)) == '\0') {
3590 alertpanel_error(_("POP server is not entered."));
3593 if (protocol
== A_POP3
|| protocol
== A_LOCAL
) {
3594 GtkWidget
*inbox_entry
= (protocol
== A_POP3
? receive_page
.inbox_entry
: receive_page
.local_inbox_entry
);
3595 const gchar
*mailbox
= gtk_entry_get_text(GTK_ENTRY(inbox_entry
));
3596 FolderItem
*inbox
= folder_find_item_from_identifier(mailbox
);
3599 setup_write_mailbox_path(mainwindow_get_mainwindow(), "Mail");
3600 id
= folder_item_get_identifier(folder_get_default_inbox_for_class(F_MH
));
3601 gtk_entry_set_text(GTK_ENTRY(receive_page
.inbox_entry
),
3603 gtk_entry_set_text(GTK_ENTRY(receive_page
.local_inbox_entry
),
3606 mailbox
= gtk_entry_get_text(GTK_ENTRY(inbox_entry
));
3607 inbox
= folder_find_item_from_identifier(mailbox
);
3609 if (inbox
== NULL
) {
3610 alertpanel_error(_("The default Inbox folder doesn't exist."));
3614 if (protocol
== A_IMAP4
&&
3615 *gtk_entry_get_text(GTK_ENTRY(basic_page
.recvserv_entry
)) == '\0') {
3616 alertpanel_error(_("IMAP server is not entered."));
3619 if (protocol
== A_NNTP
&&
3620 *gtk_entry_get_text(GTK_ENTRY(basic_page
.nntpserv_entry
)) == '\0') {
3621 alertpanel_error(_("NNTP server is not entered."));
3625 if (protocol
== A_LOCAL
&&
3626 *gtk_entry_get_text(GTK_ENTRY(basic_page
.localmbox_entry
)) == '\0') {
3627 alertpanel_error(_("local mailbox filename is not entered."));
3631 if (protocol
== A_LOCAL
&&
3632 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(basic_page
.mailcmd_checkbtn
)) && *gtk_entry_get_text(GTK_ENTRY(basic_page
.mailcmd_entry
)) == '\0') {
3633 alertpanel_error(_("mail command is not entered."));
3637 if (protocol
== A_IMAP4
|| protocol
== A_NNTP
)
3638 old_id
= g_strdup_printf("#%s/%s",
3639 protocol
== A_IMAP4
? "imap":"news",
3640 tmp_ac_prefs
.account_name
? tmp_ac_prefs
.account_name
: "(null)");
3642 if (strchr(gtk_entry_get_text(GTK_ENTRY(basic_page
.uid_entry
)), '\n') != NULL
) {
3643 alertpanel_error(_("User ID cannot contain a newline character."));
3647 if (strchr(gtk_entry_get_text(GTK_ENTRY(basic_page
.pass_entry
)), '\n') != NULL
) {
3648 alertpanel_error(_("Password cannot contain a newline character."));
3652 prefs_set_data_from_dialog(basic_param
);
3654 /* Passwords are stored outside of PrefParams. */
3655 passwd_store_set_account(tmp_ac_prefs
.account_id
,
3657 gtk_entry_get_text(GTK_ENTRY(basic_page
.pass_entry
)),
3660 /* Manual password change - reset expiry on OAUTH2 tokens*/
3661 passwd_store_set_account(tmp_ac_prefs
.account_id
, PWS_ACCOUNT_OAUTH2_EXPIRY
, "0", FALSE
);
3663 if (protocol
== A_IMAP4
|| protocol
== A_NNTP
) {
3664 new_id
= g_strdup_printf("#%s/%s",
3665 protocol
== A_IMAP4
? "imap":"news",
3666 tmp_ac_prefs
.account_name
);
3667 if (old_id
!= NULL
&& new_id
!= NULL
)
3668 prefs_filtering_rename_path(old_id
, new_id
);
3676 static gint
prefs_receive_apply(void)
3678 if (strchr(gtk_entry_get_text(GTK_ENTRY(send_page
.smtp_uid_entry
)), '\n') != NULL
) {
3679 alertpanel_error(_("SMTP user ID cannot contain a newline character."));
3683 if (strchr(gtk_entry_get_text(GTK_ENTRY(send_page
.smtp_pass_entry
)), '\n') != NULL
) {
3684 alertpanel_error(_("SMTP password cannot contain a newline character."));
3688 prefs_set_data_from_dialog(receive_param
);
3693 static gint
prefs_send_apply(void)
3695 prefs_set_data_from_dialog(send_param
);
3697 /* Passwords are stored outside of PrefParams. */
3698 passwd_store_set_account(tmp_ac_prefs
.account_id
,
3700 gtk_entry_get_text(GTK_ENTRY(send_page
.smtp_pass_entry
)),
3703 /* Manual password change - reset expiry on OAUTH2 tokens*/
3704 passwd_store_set_account(tmp_ac_prefs
.account_id
, PWS_ACCOUNT_OAUTH2_EXPIRY
, "0", FALSE
);
3709 static gint
prefs_oauth2_apply(void)
3711 prefs_set_data_from_dialog(oauth2_param
);
3713 /* Passwords are stored outside of PrefParams. */
3714 passwd_store_set_account(tmp_ac_prefs
.account_id
,
3715 PWS_ACCOUNT_OAUTH2_AUTH
,
3716 gtk_entry_get_text(GTK_ENTRY(oauth2_page
.oauth2_authcode_entry
)),
3722 static gint
prefs_compose_apply(void)
3724 prefs_set_data_from_dialog(compose_param
);
3728 static gint
prefs_templates_apply(void)
3730 prefs_set_data_from_dialog(templates_param
);
3734 static gint
prefs_privacy_apply(void)
3736 prefs_set_data_from_dialog(privacy_param
);
3741 static gint
prefs_ssl_apply(void)
3743 prefs_set_data_from_dialog(ssl_param
);
3745 /* Passwords are stored outside of PrefParams. */
3746 passwd_store_set_account(tmp_ac_prefs
.account_id
,
3747 PWS_ACCOUNT_RECV_CERT
,
3748 gtk_entry_get_text(GTK_ENTRY(ssl_page
.entry_in_cert_pass
)),
3750 passwd_store_set_account(tmp_ac_prefs
.account_id
,
3751 PWS_ACCOUNT_SEND_CERT
,
3752 gtk_entry_get_text(GTK_ENTRY(ssl_page
.entry_out_cert_pass
)),
3759 static gint
prefs_proxy_apply(void)
3761 prefs_set_data_from_dialog(proxy_param
);
3763 /* Passwords are stored outside of PrefParams. */
3764 passwd_store_set_account(tmp_ac_prefs
.account_id
,
3765 PWS_ACCOUNT_PROXY_PASS
,
3766 gtk_entry_get_text(GTK_ENTRY(proxy_page
.proxy_pass_entry
)),
3772 static gint
prefs_advanced_apply(void)
3774 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(advanced_page
.domain_checkbtn
)) &&
3775 *gtk_entry_get_text(GTK_ENTRY(advanced_page
.domain_entry
)) == '\0') {
3776 alertpanel_error(_("domain is not specified."));
3779 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(advanced_page
.sent_folder_checkbtn
)) &&
3780 *gtk_entry_get_text(GTK_ENTRY(advanced_page
.sent_folder_entry
)) == '\0') {
3781 alertpanel_error(_("sent folder is not selected."));
3784 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(advanced_page
.queue_folder_checkbtn
)) &&
3785 *gtk_entry_get_text(GTK_ENTRY(advanced_page
.queue_folder_entry
)) == '\0') {
3786 alertpanel_error(_("queue folder is not selected."));
3789 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(advanced_page
.draft_folder_checkbtn
)) &&
3790 *gtk_entry_get_text(GTK_ENTRY(advanced_page
.draft_folder_entry
)) == '\0') {
3791 alertpanel_error(_("draft folder is not selected."));
3794 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(advanced_page
.trash_folder_checkbtn
)) &&
3795 *gtk_entry_get_text(GTK_ENTRY(advanced_page
.trash_folder_entry
)) == '\0') {
3796 alertpanel_error(_("trash folder is not selected."));
3800 prefs_set_data_from_dialog(advanced_param
);
3804 static void basic_destroy_widget_func(PrefsPage
*_page
)
3806 /* BasicPage *page = (BasicPage *) _page; */
3809 static void receive_destroy_widget_func(PrefsPage
*_page
)
3811 /* ReceivePage *page = (ReceivePage *) _page; */
3814 static void send_destroy_widget_func(PrefsPage
*_page
)
3816 /* SendPage *page = (SendPage *) _page; */
3819 static void oauth2_destroy_widget_func(PrefsPage
*_page
)
3821 /* Oauth2Page *page = (Oauth2Page *) _page; */
3824 static void compose_destroy_widget_func(PrefsPage
*_page
)
3826 /* ComposePage *page = (ComposePage *) _page; */
3829 static void templates_destroy_widget_func(PrefsPage
*_page
)
3831 /* TemplatesPage *page = (TemplatesPage *) _page; */
3834 static void privacy_destroy_widget_func(PrefsPage
*_page
)
3836 /* PrivacyPage *page = (PrivacyPage *) _page; */
3840 static void ssl_destroy_widget_func(PrefsPage
*_page
)
3842 /* SSLPage *page = (SSLPage *) _page; */
3846 static void proxy_destroy_widget_func(PrefsPage
*_page
)
3848 /* ProxyPage *page = (ProxyPage *) _page; */
3851 static void advanced_destroy_widget_func(PrefsPage
*_page
)
3853 /* AdvancedPage *page = (AdvancedPage *) _page; */
3856 static gboolean
basic_can_close_func(PrefsPage
*_page
)
3858 BasicPage
*page
= (BasicPage
*) _page
;
3860 if (!page
->page
.page_open
)
3863 return prefs_basic_apply() >= 0;
3866 static gboolean
receive_can_close_func(PrefsPage
*_page
)
3868 ReceivePage
*page
= (ReceivePage
*) _page
;
3870 if (!page
->page
.page_open
)
3873 return prefs_receive_apply() >= 0;
3876 static gboolean
send_can_close_func(PrefsPage
*_page
)
3878 SendPage
*page
= (SendPage
*) _page
;
3880 if (!page
->page
.page_open
)
3883 return prefs_send_apply() >= 0;
3886 static gboolean
oauth2_can_close_func(PrefsPage
*_page
)
3888 Oauth2Page
*page
= (Oauth2Page
*) _page
;
3890 if (!page
->page
.page_open
)
3893 return prefs_oauth2_apply() >= 0;
3896 static gboolean
compose_can_close_func(PrefsPage
*_page
)
3898 ComposePage
*page
= (ComposePage
*) _page
;
3900 if (!page
->page
.page_open
)
3903 return prefs_compose_apply() >= 0;
3906 static gboolean
templates_can_close_func(PrefsPage
*_page
)
3908 TemplatesPage
*page
= (TemplatesPage
*) _page
;
3910 if (!page
->page
.page_open
)
3913 return prefs_templates_apply() >= 0;
3916 static gboolean
privacy_can_close_func(PrefsPage
*_page
)
3918 PrivacyPage
*page
= (PrivacyPage
*) _page
;
3920 if (!page
->page
.page_open
)
3923 return prefs_privacy_apply() >= 0;
3927 static gboolean
ssl_can_close_func(PrefsPage
*_page
)
3929 SSLPage
*page
= (SSLPage
*) _page
;
3931 if (!page
->page
.page_open
)
3934 return prefs_ssl_apply() >= 0;
3938 static gboolean
proxy_can_close_func(PrefsPage
*_page
)
3940 ProxyPage
*page
= (ProxyPage
*) _page
;
3942 if (!page
->page
.page_open
)
3945 return prefs_proxy_apply() >= 0;
3948 static gboolean
advanced_can_close_func(PrefsPage
*_page
)
3950 AdvancedPage
*page
= (AdvancedPage
*) _page
;
3952 if (!page
->page
.page_open
)
3955 return prefs_advanced_apply() >= 0;
3958 static void basic_save_func(PrefsPage
*_page
)
3960 BasicPage
*page
= (BasicPage
*) _page
;
3962 if (!page
->page
.page_open
)
3965 if (prefs_basic_apply() >= 0)
3969 static void receive_save_func(PrefsPage
*_page
)
3971 ReceivePage
*page
= (ReceivePage
*) _page
;
3973 if (!page
->page
.page_open
)
3976 if (prefs_receive_apply() >= 0)
3980 static void send_save_func(PrefsPage
*_page
)
3982 SendPage
*page
= (SendPage
*) _page
;
3984 if (!page
->page
.page_open
)
3987 if (prefs_send_apply() >= 0)
3991 static void oauth2_save_func(PrefsPage
*_page
)
3993 Oauth2Page
*page
= (Oauth2Page
*) _page
;
3995 if (!page
->page
.page_open
)
3998 if (prefs_oauth2_apply() >= 0)
4002 static void compose_save_func(PrefsPage
*_page
)
4004 ComposePage
*page
= (ComposePage
*) _page
;
4006 if (!page
->page
.page_open
)
4009 if (prefs_compose_apply() >= 0)
4013 static void templates_save_func(PrefsPage
*_page
)
4015 TemplatesPage
*page
= (TemplatesPage
*) _page
;
4017 if (!page
->page
.page_open
)
4020 quotefmt_check_new_msg_formats(tmp_ac_prefs
.compose_with_format
,
4022 tmp_ac_prefs
.compose_subject_format
,
4023 tmp_ac_prefs
.compose_body_format
);
4024 quotefmt_check_reply_formats(tmp_ac_prefs
.reply_with_format
,
4026 tmp_ac_prefs
.reply_quotemark
,
4027 tmp_ac_prefs
.reply_body_format
);
4028 quotefmt_check_forward_formats(tmp_ac_prefs
.forward_with_format
,
4030 tmp_ac_prefs
.forward_quotemark
,
4031 tmp_ac_prefs
.forward_body_format
);
4032 if (prefs_templates_apply() >= 0)
4036 static void privacy_save_func(PrefsPage
*_page
)
4038 PrivacyPage
*page
= (PrivacyPage
*) _page
;
4040 if (!page
->page
.page_open
)
4043 if (prefs_privacy_apply() >= 0)
4048 static void ssl_save_func(PrefsPage
*_page
)
4050 SSLPage
*page
= (SSLPage
*) _page
;
4052 if (!page
->page
.page_open
)
4055 if (prefs_ssl_apply() >= 0)
4060 static void proxy_save_func(PrefsPage
*_page
)
4062 ProxyPage
*page
= (ProxyPage
*) _page
;
4064 if (!page
->page
.page_open
)
4067 if (prefs_proxy_apply() >= 0)
4071 static void advanced_save_func(PrefsPage
*_page
)
4073 AdvancedPage
*page
= (AdvancedPage
*) _page
;
4075 if (!page
->page
.page_open
)
4078 if (prefs_advanced_apply() >= 0)
4082 static void register_basic_page(void)
4084 static gchar
*path
[3];
4086 path
[0] = _("Account");
4087 path
[1] = _("Basic");
4090 basic_page
.page
.path
= path
;
4091 basic_page
.page
.weight
= 1000.0;
4092 basic_page
.page
.create_widget
= basic_create_widget_func
;
4093 basic_page
.page
.destroy_widget
= basic_destroy_widget_func
;
4094 basic_page
.page
.save_page
= basic_save_func
;
4095 basic_page
.page
.can_close
= basic_can_close_func
;
4097 prefs_account_register_page((PrefsPage
*) &basic_page
);
4100 static void register_receive_page(void)
4102 static gchar
*path
[3];
4104 path
[0] = _("Account");
4105 path
[1] = _("Receive");
4108 receive_page
.page
.path
= path
;
4109 receive_page
.page
.weight
= 1000.0;
4110 receive_page
.page
.create_widget
= receive_create_widget_func
;
4111 receive_page
.page
.destroy_widget
= receive_destroy_widget_func
;
4112 receive_page
.page
.save_page
= receive_save_func
;
4113 receive_page
.page
.can_close
= receive_can_close_func
;
4115 prefs_account_register_page((PrefsPage
*) &receive_page
);
4118 static void register_send_page(void)
4120 static gchar
*path
[3];
4122 path
[0] = _("Account");
4123 path
[1] = _("Send");
4126 send_page
.page
.path
= path
;
4127 send_page
.page
.weight
= 1000.0;
4128 send_page
.page
.create_widget
= send_create_widget_func
;
4129 send_page
.page
.destroy_widget
= send_destroy_widget_func
;
4130 send_page
.page
.save_page
= send_save_func
;
4131 send_page
.page
.can_close
= send_can_close_func
;
4133 prefs_account_register_page((PrefsPage
*) &send_page
);
4136 static void register_oauth2_page(void)
4138 static gchar
*path
[3];
4140 path
[0] = _("Account");
4141 path
[1] = _("OAuth2");
4144 oauth2_page
.page
.path
= path
;
4145 oauth2_page
.page
.weight
= 1000.0;
4146 oauth2_page
.page
.create_widget
= oauth2_create_widget_func
;
4147 oauth2_page
.page
.destroy_widget
= oauth2_destroy_widget_func
;
4148 oauth2_page
.page
.save_page
= oauth2_save_func
;
4149 oauth2_page
.page
.can_close
= oauth2_can_close_func
;
4151 prefs_account_register_page((PrefsPage
*) &oauth2_page
);
4154 static void register_compose_page(void)
4156 static gchar
*path
[3];
4158 path
[0] = _("Account");
4159 path
[1] = _("Compose");
4162 compose_page
.page
.path
= path
;
4163 compose_page
.page
.weight
= 1000.0;
4164 compose_page
.page
.create_widget
= compose_create_widget_func
;
4165 compose_page
.page
.destroy_widget
= compose_destroy_widget_func
;
4166 compose_page
.page
.save_page
= compose_save_func
;
4167 compose_page
.page
.can_close
= compose_can_close_func
;
4169 prefs_account_register_page((PrefsPage
*) &compose_page
);
4172 static void register_templates_page(void)
4174 static gchar
*path
[3];
4176 path
[0] = _("Account");
4177 path
[1] = _("Templates");
4180 templates_page
.page
.path
= path
;
4181 templates_page
.page
.weight
= 1000.0;
4182 templates_page
.page
.create_widget
= templates_create_widget_func
;
4183 templates_page
.page
.destroy_widget
= templates_destroy_widget_func
;
4184 templates_page
.page
.save_page
= templates_save_func
;
4185 templates_page
.page
.can_close
= templates_can_close_func
;
4187 prefs_account_register_page((PrefsPage
*) &templates_page
);
4190 static void register_privacy_page(void)
4192 static gchar
*path
[3];
4194 path
[0] = _("Account");
4195 path
[1] = _("Privacy");
4198 privacy_page
.page
.path
= path
;
4199 privacy_page
.page
.weight
= 1000.0;
4200 privacy_page
.page
.create_widget
= privacy_create_widget_func
;
4201 privacy_page
.page
.destroy_widget
= privacy_destroy_widget_func
;
4202 privacy_page
.page
.save_page
= privacy_save_func
;
4203 privacy_page
.page
.can_close
= privacy_can_close_func
;
4205 prefs_account_register_page((PrefsPage
*) &privacy_page
);
4209 static void register_ssl_page(void)
4211 static gchar
*path
[3];
4213 path
[0] = _("Account");
4214 path
[1] = _("SSL/TLS");
4217 ssl_page
.page
.path
= path
;
4218 ssl_page
.page
.weight
= 1000.0;
4219 ssl_page
.page
.create_widget
= ssl_create_widget_func
;
4220 ssl_page
.page
.destroy_widget
= ssl_destroy_widget_func
;
4221 ssl_page
.page
.save_page
= ssl_save_func
;
4222 ssl_page
.page
.can_close
= ssl_can_close_func
;
4224 prefs_account_register_page((PrefsPage
*) &ssl_page
);
4227 static gboolean
sslcert_get_client_cert_hook(gpointer source
, gpointer data
)
4229 SSLClientCertHookData
*hookdata
= (SSLClientCertHookData
*)source
;
4230 PrefsAccount
*account
= (PrefsAccount
*)hookdata
->account
;
4233 hookdata
->cert_path
= NULL
;
4234 hookdata
->password
= NULL
;
4236 if (!g_list_find(account_get_list(), account
)) {
4237 g_warning("can't find account");
4241 if (hookdata
->is_smtp
) {
4242 if (account
->out_ssl_client_cert_file
&& *account
->out_ssl_client_cert_file
)
4243 hookdata
->cert_path
= account
->out_ssl_client_cert_file
;
4244 pwd_id
= PWS_ACCOUNT_SEND_CERT
;
4246 if (account
->in_ssl_client_cert_file
&& *account
->in_ssl_client_cert_file
)
4247 hookdata
->cert_path
= account
->in_ssl_client_cert_file
;
4248 pwd_id
= PWS_ACCOUNT_RECV_CERT
;
4251 hookdata
->password
= passwd_store_get_account(account
->account_id
, pwd_id
);
4255 struct GetPassData
{
4262 static gboolean
do_get_pass(gpointer data
)
4264 struct GetPassData
*pass_data
= (struct GetPassData
*)data
;
4265 g_mutex_lock(pass_data
->mutex
);
4266 *(pass_data
->pass
) = input_dialog_query_password("the PKCS12 client certificate", NULL
);
4267 g_cond_signal(pass_data
->cond
);
4268 g_mutex_unlock(pass_data
->mutex
);
4271 static gboolean
sslcert_get_password(gpointer source
, gpointer data
)
4273 struct GetPassData pass_data
;
4274 /* do complicated stuff to be able to call GTK from the mainloop */
4275 #if !GLIB_CHECK_VERSION(2,32,0)
4276 pass_data
.cond
= g_cond_new();
4278 pass_data
.cond
= g_new0(GCond
, 1);
4279 g_cond_init(pass_data
.cond
);
4281 pass_data
.mutex
= cm_mutex_new();
4282 pass_data
.pass
= (gchar
**)source
;
4284 g_mutex_lock(pass_data
.mutex
);
4286 g_idle_add(do_get_pass
, &pass_data
);
4288 g_cond_wait(pass_data
.cond
, pass_data
.mutex
);
4289 #if !GLIB_CHECK_VERSION(2,32,0)
4290 g_cond_free(pass_data
.cond
);
4292 g_cond_clear(pass_data
.cond
);
4293 g_free(pass_data
.cond
);
4295 g_mutex_unlock(pass_data
.mutex
);
4296 cm_mutex_free(pass_data
.mutex
);
4302 static void register_proxy_page(void)
4304 static gchar
*path
[3];
4306 path
[0] = _("Account");
4307 path
[1] = _("Proxy");
4310 proxy_page
.page
.path
= path
;
4311 proxy_page
.page
.weight
= 1000.0;
4312 proxy_page
.page
.create_widget
= proxy_create_widget_func
;
4313 proxy_page
.page
.destroy_widget
= proxy_destroy_widget_func
;
4314 proxy_page
.page
.save_page
= proxy_save_func
;
4315 proxy_page
.page
.can_close
= proxy_can_close_func
;
4317 prefs_account_register_page((PrefsPage
*) &proxy_page
);
4320 static void register_advanced_page(void)
4322 static gchar
*path
[3];
4324 path
[0] = _("Account");
4325 path
[1] = _("Advanced");
4328 advanced_page
.page
.path
= path
;
4329 advanced_page
.page
.weight
= 1000.0;
4330 advanced_page
.page
.create_widget
= advanced_create_widget_func
;
4331 advanced_page
.page
.destroy_widget
= advanced_destroy_widget_func
;
4332 advanced_page
.page
.save_page
= advanced_save_func
;
4333 advanced_page
.page
.can_close
= advanced_can_close_func
;
4335 prefs_account_register_page((PrefsPage
*) &advanced_page
);
4338 void prefs_account_init()
4340 register_basic_page();
4341 register_receive_page();
4342 register_send_page();
4343 register_compose_page();
4344 register_templates_page();
4345 register_privacy_page();
4347 register_ssl_page();
4348 hooks_register_hook(SSLCERT_GET_CLIENT_CERT_HOOKLIST
, sslcert_get_client_cert_hook
, NULL
);
4349 hooks_register_hook(SSL_CERT_GET_PASSWORD
, sslcert_get_password
, NULL
);
4351 register_proxy_page();
4352 register_oauth2_page();
4353 register_advanced_page();
4356 PrefsAccount
*prefs_account_new(void)
4358 PrefsAccount
*ac_prefs
;
4360 ac_prefs
= g_new0(PrefsAccount
, 1);
4361 memset(&tmp_ac_prefs
, 0, sizeof(PrefsAccount
));
4362 prefs_set_default(basic_param
);
4363 prefs_set_default(receive_param
);
4364 prefs_set_default(send_param
);
4365 prefs_set_default(oauth2_param
);
4366 prefs_set_default(compose_param
);
4367 prefs_set_default(templates_param
);
4368 prefs_set_default(privacy_param
);
4369 prefs_set_default(ssl_param
);
4370 prefs_set_default(proxy_param
);
4371 prefs_set_default(advanced_param
);
4372 *ac_prefs
= tmp_ac_prefs
;
4373 ac_prefs
->account_id
= prefs_account_get_new_id();
4375 ac_prefs
->privacy_prefs
= g_hash_table_new(g_str_hash
, g_str_equal
);
4380 PrefsAccount
*prefs_account_new_from_config(const gchar
*label
)
4382 const gchar
*p
= label
;
4385 gchar
**strv
, **cur
;
4387 PrefsAccount
*ac_prefs
;
4389 cm_return_val_if_fail(label
!= NULL
, NULL
);
4391 ac_prefs
= g_new0(PrefsAccount
, 1);
4393 /* Load default values to tmp_ac_prefs first, ... */
4394 memset(&tmp_ac_prefs
, 0, sizeof(PrefsAccount
));
4395 prefs_set_default(basic_param
);
4396 prefs_set_default(receive_param
);
4397 prefs_set_default(send_param
);
4398 prefs_set_default(oauth2_param
);
4399 prefs_set_default(compose_param
);
4400 prefs_set_default(templates_param
);
4401 prefs_set_default(privacy_param
);
4402 prefs_set_default(ssl_param
);
4403 prefs_set_default(advanced_param
);
4405 /* ... overriding them with values from stored config file. */
4406 rcpath
= g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S
, ACCOUNT_RC
, NULL
);
4407 prefs_read_config(basic_param
, label
, rcpath
, NULL
);
4408 prefs_read_config(receive_param
, label
, rcpath
, NULL
);
4409 prefs_read_config(send_param
, label
, rcpath
, NULL
);
4410 prefs_read_config(oauth2_param
, label
, rcpath
, NULL
);
4411 prefs_read_config(compose_param
, label
, rcpath
, NULL
);
4412 prefs_read_config(templates_param
, label
, rcpath
, NULL
);
4413 prefs_read_config(privacy_param
, label
, rcpath
, NULL
);
4414 prefs_read_config(ssl_param
, label
, rcpath
, NULL
);
4415 prefs_read_config(proxy_param
, label
, rcpath
, NULL
);
4416 prefs_read_config(advanced_param
, label
, rcpath
, NULL
);
4419 *ac_prefs
= tmp_ac_prefs
;
4421 while (*p
&& !g_ascii_isdigit(*p
)) p
++;
4423 if (id
< 0) g_warning("wrong account id: %d", id
);
4424 ac_prefs
->account_id
= id
;
4426 /* Now parse privacy_prefs. */
4427 ac_prefs
->privacy_prefs
= g_hash_table_new(g_str_hash
, g_str_equal
);
4428 if (privacy_prefs
!= NULL
) {
4429 strv
= g_strsplit(privacy_prefs
, ",", 0);
4430 for (cur
= strv
; *cur
!= NULL
; cur
++) {
4431 gchar
*encvalue
, *tmp
;
4433 encvalue
= strchr(*cur
, '=');
4434 if (encvalue
== NULL
)
4439 tmp
= g_base64_decode_zero(encvalue
, &len
);
4441 g_hash_table_insert(ac_prefs
->privacy_prefs
, g_strdup(*cur
), tmp
);
4446 g_free(privacy_prefs
);
4447 privacy_prefs
= NULL
;
4450 /* For older configurations, move stored passwords into the
4451 * password store. */
4452 gboolean passwords_migrated
= FALSE
;
4454 if (ac_prefs
->passwd
!= NULL
&& strlen(ac_prefs
->passwd
) > 1) {
4455 passwd_store_set_account(ac_prefs
->account_id
,
4456 PWS_ACCOUNT_RECV
, ac_prefs
->passwd
, TRUE
);
4457 passwords_migrated
= TRUE
;
4459 if (ac_prefs
->smtp_passwd
!= NULL
&& strlen(ac_prefs
->smtp_passwd
) > 1) {
4460 passwd_store_set_account(ac_prefs
->account_id
,
4461 PWS_ACCOUNT_SEND
, ac_prefs
->smtp_passwd
, TRUE
);
4462 passwords_migrated
= TRUE
;
4464 if (ac_prefs
->in_ssl_client_cert_pass
!= NULL
4465 && strlen(ac_prefs
->in_ssl_client_cert_pass
) > 1) {
4466 passwd_store_set_account(ac_prefs
->account_id
,
4467 PWS_ACCOUNT_RECV_CERT
, ac_prefs
->in_ssl_client_cert_pass
, TRUE
);
4468 passwords_migrated
= TRUE
;
4470 if (ac_prefs
->out_ssl_client_cert_pass
!= NULL
4471 && strlen(ac_prefs
->out_ssl_client_cert_pass
) > 1) {
4472 passwd_store_set_account(ac_prefs
->account_id
,
4473 PWS_ACCOUNT_SEND_CERT
, ac_prefs
->out_ssl_client_cert_pass
, TRUE
);
4474 passwords_migrated
= TRUE
;
4477 /* Write out password store to file immediately, to prevent
4479 if (passwords_migrated
)
4480 passwd_store_write_config();
4482 ac_prefs
->receive_in_progress
= FALSE
;
4484 prefs_custom_header_read_config(ac_prefs
);
4486 /* Start the auto-check interval, if needed. */
4487 if (!ac_prefs
->autochk_use_default
&& ac_prefs
->autochk_use_custom
4488 && ac_prefs
->autochk_itv
> PREFS_RECV_AUTOCHECK_MIN_INTERVAL
) {
4489 inc_account_autocheck_timer_set_interval(ac_prefs
);
4495 static void create_privacy_prefs(gpointer key
, gpointer _value
, gpointer user_data
)
4497 GString
*str
= (GString
*) user_data
;
4499 gchar
*value
= (gchar
*) _value
;
4502 g_string_append_c(str
, ',');
4504 encvalue
= g_base64_encode(value
, strlen(value
));
4505 g_string_append_printf(str
, "%s=%s", (gchar
*) key
, encvalue
);
4509 #define WRITE_PARAM(PARAM_TABLE) \
4510 if (prefs_write_param(PARAM_TABLE, pfile->fp) < 0) { \
4511 g_warning("failed to write configuration to file"); \
4512 prefs_file_close_revert(pfile); \
4513 g_free(privacy_prefs); \
4514 privacy_prefs = NULL; \
4518 void prefs_account_write_config_all(GList
*account_list
)
4524 rcpath
= g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S
, ACCOUNT_RC
, NULL
);
4525 if ((pfile
= prefs_write_open(rcpath
)) == NULL
) {
4531 for (cur
= account_list
; cur
!= NULL
; cur
= cur
->next
) {
4534 tmp_ac_prefs
= *(PrefsAccount
*)cur
->data
;
4535 if (fprintf(pfile
->fp
, "[Account: %d]\n",
4536 tmp_ac_prefs
.account_id
) <= 0)
4539 str
= g_string_sized_new(32);
4540 g_hash_table_foreach(tmp_ac_prefs
.privacy_prefs
, create_privacy_prefs
, str
);
4541 privacy_prefs
= str
->str
;
4542 g_string_free(str
, FALSE
);
4544 WRITE_PARAM(basic_param
)
4545 WRITE_PARAM(receive_param
)
4546 WRITE_PARAM(send_param
)
4547 WRITE_PARAM(oauth2_param
)
4548 WRITE_PARAM(compose_param
)
4549 WRITE_PARAM(templates_param
)
4550 WRITE_PARAM(privacy_param
)
4551 WRITE_PARAM(ssl_param
)
4552 WRITE_PARAM(proxy_param
)
4553 WRITE_PARAM(advanced_param
)
4555 g_free(privacy_prefs
);
4556 privacy_prefs
= NULL
;
4559 if (claws_fputc('\n', pfile
->fp
) == EOF
) {
4560 FILE_OP_ERROR(rcpath
, "claws_fputc");
4561 prefs_file_close_revert(pfile
);
4567 if (prefs_file_close(pfile
) < 0)
4568 g_warning("failed to write configuration to file");
4570 passwd_store_write_config();
4574 static gboolean
free_privacy_prefs(gpointer key
, gpointer value
, gpointer user_data
)
4582 void prefs_account_free(PrefsAccount
*ac_prefs
)
4584 if (!ac_prefs
) return;
4586 g_hash_table_foreach_remove(ac_prefs
->privacy_prefs
, free_privacy_prefs
, NULL
);
4588 tmp_ac_prefs
= *ac_prefs
;
4589 prefs_free(basic_param
);
4590 prefs_free(receive_param
);
4591 prefs_free(send_param
);
4592 prefs_free(oauth2_param
);
4593 prefs_free(compose_param
);
4594 prefs_free(templates_param
);
4595 prefs_free(privacy_param
);
4596 prefs_free(ssl_param
);
4597 prefs_free(proxy_param
);
4598 prefs_free(advanced_param
);
4601 const gchar
*prefs_account_get_privacy_prefs(PrefsAccount
*account
, gchar
*id
)
4603 return g_hash_table_lookup(account
->privacy_prefs
, id
);
4606 void prefs_account_set_privacy_prefs(PrefsAccount
*account
, gchar
*id
, gchar
*new_value
)
4608 gchar
*orig_key
= NULL
, *value
;
4610 if (g_hash_table_lookup_extended(account
->privacy_prefs
, id
, (gpointer
*)(gchar
*) &orig_key
, (gpointer
*)(gchar
*) &value
)) {
4611 g_hash_table_remove(account
->privacy_prefs
, id
);
4617 if (new_value
!= NULL
)
4618 g_hash_table_insert(account
->privacy_prefs
, g_strdup(id
), g_strdup(new_value
));
4621 static gint
prefs_account_get_new_id(void)
4625 static gint last_id
= 0;
4627 for (ac_list
= account_get_list(); ac_list
!= NULL
;
4628 ac_list
= ac_list
->next
) {
4629 ac
= (PrefsAccount
*)ac_list
->data
;
4630 if (last_id
< ac
->account_id
)
4631 last_id
= ac
->account_id
;
4637 static void destroy_dialog(gpointer data
)
4639 PrefsAccount
*ac_prefs
= (PrefsAccount
*) data
;
4641 gboolean update_fld_list
= FALSE
;
4642 if (ac_prefs
->protocol
== A_IMAP4
&& !new_account
) {
4643 if ((&tmp_ac_prefs
)->imap_subsonly
!= ac_prefs
->imap_subsonly
) {
4644 update_fld_list
= TRUE
;
4647 *ac_prefs
= tmp_ac_prefs
;
4648 if (update_fld_list
)
4649 folderview_rescan_tree(ac_prefs
->folder
, FALSE
);
4651 inc_account_autocheck_timer_set_interval(ac_prefs
);
4653 } else /* the customhdr_list may have changed, update it anyway */
4654 ac_prefs
->customhdr_list
= (&tmp_ac_prefs
)->customhdr_list
;
4660 PrefsAccount
*prefs_account_open(PrefsAccount
*ac_prefs
, gboolean
*dirty
)
4664 if (prefs_rc_is_readonly(ACCOUNT_RC
))
4667 debug_print("Opening account preferences window...\n");
4674 ac_prefs
= prefs_account_new();
4677 new_account
= FALSE
;
4680 title
= g_strdup (_("Preferences for new account"));
4682 title
= g_strdup_printf (_("%s - Account preferences"),
4683 ac_prefs
->account_name
);
4685 prefswindow_open_full(title
, prefs_pages
, ac_prefs
, destroy_dialog
,
4686 &prefs_common
.editaccountwin_width
, &prefs_common
.editaccountwin_height
,
4687 TRUE
, NULL
, NULL
, NULL
);
4693 if (!cancelled
&& dirty
!= NULL
)
4695 if (cancelled
&& new_account
)
4698 if (ac_prefs
->recv_server
)
4699 g_strstrip(ac_prefs
->recv_server
);
4700 if (ac_prefs
->smtp_server
)
4701 g_strstrip(ac_prefs
->smtp_server
);
4702 if (ac_prefs
->nntp_server
)
4703 g_strstrip(ac_prefs
->nntp_server
);
4709 static void crosspost_color_toggled(void)
4713 is_active
= gtk_toggle_button_get_active
4714 (GTK_TOGGLE_BUTTON(advanced_page
.crosspost_checkbtn
));
4715 gtk_widget_set_sensitive(advanced_page
.crosspost_colormenu
, is_active
);
4718 static void prefs_account_crosspost_set_data_from_colormenu(PrefParam
*pparam
)
4721 GtkWidget
*menuitem
;
4723 menu
= gtk_cmoption_menu_get_menu(GTK_CMOPTION_MENU(advanced_page
.crosspost_colormenu
));
4724 menuitem
= gtk_menu_get_active(GTK_MENU(menu
));
4725 *((gint
*)pparam
->data
) = GPOINTER_TO_INT
4726 (g_object_get_data(G_OBJECT(menuitem
), "color"));
4729 static void prefs_account_crosspost_set_colormenu(PrefParam
*pparam
)
4731 gint colorlabel
= *((gint
*)pparam
->data
);
4732 GtkCMOptionMenu
*colormenu
= GTK_CMOPTION_MENU(*pparam
->widget
);
4734 GtkWidget
*menuitem
;
4736 gtk_cmoption_menu_set_history(colormenu
, colorlabel
+ 1);
4737 menu
= gtk_cmoption_menu_get_menu(colormenu
);
4738 menuitem
= gtk_menu_get_active(GTK_MENU(menu
));
4739 gtk_menu_item_activate(GTK_MENU_ITEM(menuitem
));
4742 static void pop_bfr_smtp_tm_set_sens(GtkWidget
*widget
, gpointer data
)
4744 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_tm_spinbtn
,
4745 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(send_page
.pop_bfr_smtp_checkbtn
)));
4746 gtk_widget_set_sensitive(send_page
.pop_auth_timeout_lbl
,
4747 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(send_page
.pop_bfr_smtp_checkbtn
)));
4748 gtk_widget_set_sensitive(send_page
.pop_auth_minutes_lbl
,
4749 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(send_page
.pop_bfr_smtp_checkbtn
)));
4752 static void prefs_account_select_folder_cb(GtkWidget
*widget
, gpointer data
)
4757 item
= foldersel_folder_sel(NULL
, FOLDER_SEL_COPY
, NULL
, FALSE
, NULL
);
4758 if (item
&& item
->path
) {
4759 id
= folder_item_get_identifier(item
);
4761 gtk_entry_set_text(GTK_ENTRY(data
), id
);
4767 #if (defined USE_GNUTLS)
4768 static void auto_configure_cb (GtkWidget
*widget
, gpointer data
)
4770 gchar
*address
= NULL
;
4771 AutoConfigureData
*recv_data
;
4772 AutoConfigureData
*send_data
;
4773 static GCancellable
*recv_cancel
= NULL
;
4774 static GCancellable
*send_cancel
= NULL
;
4775 RecvProtocol protocol
;
4776 struct BasicProtocol
*protocol_optmenu
= (struct BasicProtocol
*) basic_page
.protocol_optmenu
;
4777 GtkWidget
*optmenu
= protocol_optmenu
->combobox
;
4780 recv_cancel
= g_cancellable_new();
4781 send_cancel
= g_cancellable_new();
4784 if (widget
== basic_page
.auto_configure_cancel_btn
) {
4785 g_cancellable_cancel(recv_cancel
);
4786 g_cancellable_cancel(send_cancel
);
4787 g_object_unref(recv_cancel
);
4788 g_object_unref(send_cancel
);
4794 protocol
= combobox_get_active_data(GTK_COMBO_BOX(optmenu
));
4796 address
= gtk_editable_get_chars(GTK_EDITABLE(basic_page
.addr_entry
), 0, -1);
4798 if (strchr(address
, '@') == NULL
) {
4800 gtk_label_set_text(GTK_LABEL(basic_page
.auto_configure_lbl
),
4801 _("Failed (wrong address)"));
4805 if (protocol
== A_POP3
|| protocol
== A_IMAP4
) {
4806 recv_data
= g_new0(AutoConfigureData
, 1);
4807 recv_data
->configure_button
= GTK_BUTTON(basic_page
.auto_configure_btn
);
4808 recv_data
->cancel_button
= GTK_BUTTON(basic_page
.auto_configure_cancel_btn
);
4809 recv_data
->info_label
= GTK_LABEL(basic_page
.auto_configure_lbl
);
4810 recv_data
->cancel
= recv_cancel
;
4813 recv_data
->ssl_service
= "pop3s";
4814 recv_data
->tls_service
= "pop3";
4815 recv_data
->address
= g_strdup(address
);
4816 recv_data
->hostname_entry
= GTK_ENTRY(basic_page
.recvserv_entry
);
4817 recv_data
->set_port
= GTK_TOGGLE_BUTTON(advanced_page
.popport_checkbtn
);
4818 recv_data
->port
= GTK_SPIN_BUTTON(advanced_page
.popport_spinbtn
);
4819 recv_data
->tls_checkbtn
= GTK_TOGGLE_BUTTON(ssl_page
.pop_starttls_radiobtn
);
4820 recv_data
->ssl_checkbtn
= GTK_TOGGLE_BUTTON(ssl_page
.pop_ssltunnel_radiobtn
);
4821 recv_data
->default_port
= 110;
4822 recv_data
->default_ssl_port
= 995;
4823 recv_data
->uid_entry
= GTK_ENTRY(basic_page
.uid_entry
);
4826 recv_data
->ssl_service
= "imaps";
4827 recv_data
->tls_service
= "imap";
4828 recv_data
->address
= g_strdup(address
);
4829 recv_data
->hostname_entry
= GTK_ENTRY(basic_page
.recvserv_entry
);
4830 recv_data
->set_port
= GTK_TOGGLE_BUTTON(advanced_page
.imapport_checkbtn
);
4831 recv_data
->port
= GTK_SPIN_BUTTON(advanced_page
.imapport_spinbtn
);
4832 recv_data
->tls_checkbtn
= GTK_TOGGLE_BUTTON(ssl_page
.imap_starttls_radiobtn
);
4833 recv_data
->ssl_checkbtn
= GTK_TOGGLE_BUTTON(ssl_page
.imap_ssltunnel_radiobtn
);
4834 recv_data
->default_port
= 143;
4835 recv_data
->default_ssl_port
= 993;
4836 recv_data
->uid_entry
= GTK_ENTRY(basic_page
.uid_entry
);
4839 cm_return_if_fail(FALSE
);
4841 auto_configure_service(recv_data
);
4844 send_data
= g_new0(AutoConfigureData
, 1);
4845 send_data
->configure_button
= GTK_BUTTON(basic_page
.auto_configure_btn
);
4846 send_data
->cancel_button
= GTK_BUTTON(basic_page
.auto_configure_cancel_btn
);
4847 send_data
->info_label
= GTK_LABEL(basic_page
.auto_configure_lbl
);
4848 send_data
->cancel
= send_cancel
;
4850 send_data
->ssl_service
= NULL
;
4851 send_data
->tls_service
= "submission";
4852 send_data
->address
= g_strdup(address
);
4853 send_data
->hostname_entry
= GTK_ENTRY(basic_page
.smtpserv_entry
);
4854 send_data
->set_port
= GTK_TOGGLE_BUTTON(advanced_page
.smtpport_checkbtn
);
4855 send_data
->port
= GTK_SPIN_BUTTON(advanced_page
.smtpport_spinbtn
);
4856 send_data
->tls_checkbtn
= GTK_TOGGLE_BUTTON(ssl_page
.smtp_starttls_radiobtn
);
4857 send_data
->ssl_checkbtn
= GTK_TOGGLE_BUTTON(ssl_page
.smtp_ssltunnel_radiobtn
);
4858 send_data
->default_port
= 25;
4859 send_data
->default_ssl_port
= -1;
4860 send_data
->uid_entry
= NULL
;
4861 send_data
->auth_checkbtn
= GTK_TOGGLE_BUTTON(send_page
.smtp_auth_checkbtn
);
4863 auto_configure_service(send_data
);
4869 static void prefs_account_sigfile_radiobtn_cb(GtkWidget
*widget
, gpointer data
)
4871 gtk_widget_set_sensitive(GTK_WIDGET(signature_browse_button
), TRUE
);
4872 gtk_widget_set_sensitive(GTK_WIDGET(signature_edit_button
), TRUE
);
4875 static void prefs_account_sigcmd_radiobtn_cb(GtkWidget
*widget
, gpointer data
)
4877 gtk_widget_set_sensitive(GTK_WIDGET(signature_browse_button
), FALSE
);
4878 gtk_widget_set_sensitive(GTK_WIDGET(signature_edit_button
), FALSE
);
4881 static void prefs_account_signature_browse_cb(GtkWidget
*widget
, gpointer data
)
4884 gchar
*utf8_filename
;
4886 filename
= filesel_select_file_open(_("Select signature file"), NULL
);
4887 if (!filename
) return;
4889 utf8_filename
= g_filename_to_utf8(filename
, -1, NULL
, NULL
, NULL
);
4890 if (!utf8_filename
) {
4891 g_warning("prefs_account_signature_browse_cb(): failed to convert character set.");
4892 utf8_filename
= g_strdup(filename
);
4894 gtk_entry_set_text(GTK_ENTRY(entry_sigpath
), utf8_filename
);
4895 g_free(utf8_filename
);
4899 static void prefs_account_in_cert_browse_cb(GtkWidget
*widget
, gpointer data
)
4902 gchar
*utf8_filename
;
4904 filename
= filesel_select_file_open(_("Select certificate file"), NULL
);
4905 if (!filename
) return;
4907 utf8_filename
= g_filename_to_utf8(filename
, -1, NULL
, NULL
, NULL
);
4908 if (!utf8_filename
) {
4909 g_warning("prefs_account_cert_browse_cb(): failed to convert character set.");
4910 utf8_filename
= g_strdup(filename
);
4912 gtk_entry_set_text(GTK_ENTRY(entry_in_cert_file
), utf8_filename
);
4913 g_free(utf8_filename
);
4916 static void prefs_account_out_cert_browse_cb(GtkWidget
*widget
, gpointer data
)
4919 gchar
*utf8_filename
;
4921 filename
= filesel_select_file_open(_("Select certificate file"), NULL
);
4922 if (!filename
) return;
4924 utf8_filename
= g_filename_to_utf8(filename
, -1, NULL
, NULL
, NULL
);
4925 if (!utf8_filename
) {
4926 g_warning("prefs_account_cert_browse_cb(): failed to convert character set.");
4927 utf8_filename
= g_strdup(filename
);
4929 gtk_entry_set_text(GTK_ENTRY(entry_out_cert_file
), utf8_filename
);
4930 g_free(utf8_filename
);
4934 static void prefs_account_signature_edit_cb(GtkWidget
*widget
, gpointer data
)
4936 const gchar
*sigpath
= gtk_entry_get_text(GTK_ENTRY(data
));
4937 if (!is_file_exist(sigpath
))
4938 str_write_to_file(sigpath
, "", TRUE
);
4939 open_txt_editor(sigpath
, prefs_common_get_ext_editor_cmd());
4942 static void prefs_account_edit_custom_header(void)
4944 prefs_custom_header_open(&tmp_ac_prefs
);
4947 static void prefs_account_enum_set_data_from_radiobtn(PrefParam
*pparam
)
4949 GtkRadioButton
*radiobtn
;
4952 radiobtn
= GTK_RADIO_BUTTON (*pparam
->widget
);
4953 group
= gtk_radio_button_get_group (radiobtn
);
4954 while (group
!= NULL
) {
4955 GtkToggleButton
*btn
= GTK_TOGGLE_BUTTON (group
->data
);
4956 if (gtk_toggle_button_get_active (btn
)) {
4957 *((gint
*)pparam
->data
) = GPOINTER_TO_INT
4958 (g_object_get_data (G_OBJECT (btn
), MENU_VAL_ID
));
4961 group
= group
->next
;
4965 static void prefs_account_enum_set_radiobtn(PrefParam
*pparam
)
4967 GtkRadioButton
*radiobtn
;
4971 data
= GINT_TO_POINTER (*((gint
*)pparam
->data
));
4972 radiobtn
= GTK_RADIO_BUTTON (*pparam
->widget
);
4973 group
= gtk_radio_button_get_group (radiobtn
);
4974 while (group
!= NULL
) {
4975 GtkToggleButton
*btn
= GTK_TOGGLE_BUTTON (group
->data
);
4976 gpointer data1
= g_object_get_data (G_OBJECT (btn
), MENU_VAL_ID
);
4977 if (data1
== data
) {
4978 gtk_toggle_button_set_active (btn
, TRUE
);
4981 group
= group
->next
;
4985 static void prefs_account_protocol_set_data_from_optmenu(PrefParam
*pparam
)
4987 struct BasicProtocol
*protocol_optmenu
=
4988 (struct BasicProtocol
*)*pparam
->widget
;
4989 GtkWidget
*optmenu
= protocol_optmenu
->combobox
;
4991 *((RecvProtocol
*)pparam
->data
) =
4992 combobox_get_active_data(GTK_COMBO_BOX(optmenu
));
4995 static void prefs_account_protocol_set_optmenu(PrefParam
*pparam
)
4997 RecvProtocol protocol
;
4998 struct BasicProtocol
*protocol_optmenu
=
4999 (struct BasicProtocol
*)*pparam
->widget
;
5000 GtkWidget
*optmenu
= protocol_optmenu
->combobox
;
5001 GtkWidget
*optlabel
= protocol_optmenu
->label
;
5002 GtkWidget
*descrlabel
= protocol_optmenu
->descrlabel
;
5003 gchar
*label
= NULL
;
5005 protocol
= *((RecvProtocol
*)pparam
->data
);
5007 /* Set combobox to correct value even if it will be hidden, so
5008 * we won't break existing accounts when saving. */
5009 combobox_select_by_data(GTK_COMBO_BOX(optmenu
), protocol
);
5011 /* Set up widgets accordingly */
5013 gtk_label_set_text(GTK_LABEL(descrlabel
), _("Protocol"));
5014 gtk_widget_hide(optlabel
);
5015 gtk_widget_show(optmenu
);
5017 gtk_label_set_text(GTK_LABEL(descrlabel
), _("Protocol:"));
5018 label
= g_markup_printf_escaped("<b>%s</b>", protocol_names
[protocol
]);
5019 gtk_label_set_markup(GTK_LABEL(optlabel
), label
);
5021 gtk_widget_hide(optmenu
);
5022 gtk_widget_show(optlabel
);
5023 #ifndef HAVE_LIBETPAN
5024 if (protocol
== A_IMAP4
|| protocol
== A_NNTP
) {
5025 gtk_widget_show(protocol_optmenu
->no_imap_warn_icon
);
5026 gtk_widget_show(protocol_optmenu
->no_imap_warn_label
);
5028 gtk_widget_hide(protocol_optmenu
->no_imap_warn_icon
);
5029 gtk_widget_hide(protocol_optmenu
->no_imap_warn_label
);
5032 if (protocol
== A_IMAP4
) {
5034 gtk_toggle_button_set_active(
5035 GTK_TOGGLE_BUTTON(send_page
.msgid_checkbtn
),
5037 gtk_widget_hide(send_page
.msgid_checkbtn
);
5039 gtk_widget_show(send_page
.msgid_checkbtn
);
5041 gtk_widget_show(send_page
.xmailer_checkbtn
);
5045 static void prefs_account_imap_auth_type_set_data_from_optmenu(PrefParam
*pparam
)
5047 *((RecvProtocol
*)pparam
->data
) =
5048 combobox_get_active_data(GTK_COMBO_BOX(*pparam
->widget
));
5051 static void prefs_account_imap_auth_type_set_optmenu(PrefParam
*pparam
)
5053 IMAPAuthType type
= *((IMAPAuthType
*)pparam
->data
);
5054 GtkComboBox
*optmenu
= GTK_COMBO_BOX(*pparam
->widget
);
5056 combobox_select_by_data(optmenu
, type
);
5059 static void prefs_account_smtp_auth_type_set_data_from_optmenu(PrefParam
*pparam
)
5061 *((RecvProtocol
*)pparam
->data
) =
5062 combobox_get_active_data(GTK_COMBO_BOX(*pparam
->widget
));
5065 static void prefs_account_smtp_auth_type_set_optmenu(PrefParam
*pparam
)
5067 SMTPAuthType type
= *((SMTPAuthType
*)pparam
->data
);
5068 GtkComboBox
*optmenu
= GTK_COMBO_BOX(*pparam
->widget
);
5070 combobox_select_by_data(optmenu
, type
);
5073 static void prefs_account_pop_auth_type_set_data_from_optmenu(PrefParam
*pparam
)
5075 *((RecvProtocol
*)pparam
->data
) =
5076 combobox_get_active_data(GTK_COMBO_BOX(*pparam
->widget
));
5079 static void prefs_account_pop_auth_type_set_optmenu(PrefParam
*pparam
)
5081 POPAuthType type
= *((POPAuthType
*)pparam
->data
);
5082 GtkComboBox
*optmenu
= GTK_COMBO_BOX(*pparam
->widget
);
5084 combobox_select_by_data(optmenu
, type
);
5087 static void prefs_account_oauth2_provider_set_data_from_optmenu(PrefParam
*pparam
)
5089 *((Oauth2Service
*)pparam
->data
) =
5090 combobox_get_active_data(GTK_COMBO_BOX(*pparam
->widget
));
5093 static void prefs_account_oauth2_provider_set_optmenu(PrefParam
*pparam
)
5095 Oauth2Service type
= *((Oauth2Service
*)pparam
->data
);
5096 GtkComboBox
*optmenu
= GTK_COMBO_BOX(*pparam
->widget
);
5098 combobox_select_by_data(optmenu
, type
);
5101 static void prefs_account_oauth2_set_auth_sensitivity(void)
5103 const gchar
*authcode
= gtk_entry_get_text((GtkEntry
*)oauth2_page
.oauth2_authcode_entry
);
5104 gchar
*trim_text
= g_strdup(authcode
);
5105 g_strstrip(trim_text
);
5106 gtk_widget_set_sensitive(oauth2_page
.oauth2_authorise_btn
, (*trim_text
!= 0));
5110 static void prefs_account_oauth2_set_sensitivity(void)
5112 struct BasicProtocol
*protocol_optmenu
= (struct BasicProtocol
*)oauth2_page
.protocol_optmenu
;
5113 GtkWidget
*optmenu
= protocol_optmenu
->combobox
;
5114 Oauth2Service service
;
5116 service
= combobox_get_active_data(GTK_COMBO_BOX(optmenu
));
5118 if(service
== OAUTH2AUTH_NONE
)
5119 gtk_widget_set_sensitive(oauth2_page
.oauth2_sensitive
, FALSE
);
5121 gtk_widget_set_sensitive(oauth2_page
.oauth2_sensitive
, TRUE
);
5124 static void prefs_account_oauth2_copy_url(GtkButton
*button
, gpointer data
)
5126 struct BasicProtocol
*protocol_optmenu
= (struct BasicProtocol
*)oauth2_page
.protocol_optmenu
;
5128 GtkWidget
*optmenu
= protocol_optmenu
->combobox
;
5131 GtkClipboard
*clip
, *clip2
;
5134 url
= g_malloc(OAUTH2BUFSIZE
+1);
5135 Oauth2Service service
;
5136 const gchar
* custom_client_id
= NULL
;
5138 service
= combobox_get_active_data(GTK_COMBO_BOX(optmenu
));
5140 custom_client_id
= gtk_entry_get_text ((GtkEntry
*)oauth2_page
.oauth2_client_id_entry
);
5142 oauth2_authorisation_url(service
, &url
, custom_client_id
);
5144 win
= gtk_widget_get_toplevel (optmenu
);
5147 clip
= gtk_widget_get_clipboard (win
, GDK_SELECTION_PRIMARY
);
5148 clip2
= gtk_widget_get_clipboard (win
, GDK_SELECTION_CLIPBOARD
);
5149 gtk_clipboard_set_text (clip
, url
, len
);
5150 gtk_clipboard_set_text (clip2
, url
, len
);
5152 if (!strcmp(gtk_button_get_label(button
), "Copy link") == 0)
5153 open_uri(url
, prefs_common_get_uri_cmd());
5158 static void prefs_account_oauth2_obtain_tokens(GtkButton
*button
, gpointer data
)
5160 struct BasicProtocol
*protocol_optmenu
= (struct BasicProtocol
*)oauth2_page
.protocol_optmenu
;
5162 GtkWidget
*optmenu
= protocol_optmenu
->combobox
;
5163 Oauth2Service service
;
5164 OAUTH2Data
*OAUTH2Data
= g_malloc(sizeof(* OAUTH2Data
));
5165 const gchar
*authcode
= gtk_entry_get_text ((GtkEntry
*)oauth2_page
.oauth2_authcode_entry
);
5166 gchar
*trim_text
= g_strdup(authcode
);
5167 g_strstrip(trim_text
);
5170 oauth2_init (OAUTH2Data
);
5172 OAUTH2Data
->custom_client_secret
=
5173 g_strdup(gtk_entry_get_text((GtkEntry
*)oauth2_page
.oauth2_client_secret_entry
));
5174 OAUTH2Data
->custom_client_id
=
5175 g_strdup(gtk_entry_get_text((GtkEntry
*)oauth2_page
.oauth2_client_id_entry
));
5177 service
= combobox_get_active_data(GTK_COMBO_BOX(optmenu
));
5178 ret
= oauth2_obtain_tokens (service
, OAUTH2Data
, trim_text
);
5181 if(OAUTH2Data
->refresh_token
!= NULL
){
5182 passwd_store_set_account(tmp_ac_prefs
.account_id
,
5183 PWS_ACCOUNT_OAUTH2_REFRESH
,
5184 OAUTH2Data
->refresh_token
,
5186 log_message(LOG_PROTOCOL
, "OAuth2 refresh token stored\n");
5189 if(OAUTH2Data
->access_token
!= NULL
){
5190 passwd_store_set_account(tmp_ac_prefs
.account_id
,
5192 OAUTH2Data
->access_token
,
5195 passwd_store_set_account(tmp_ac_prefs
.account_id
,
5197 OAUTH2Data
->access_token
,
5199 log_message(LOG_PROTOCOL
, "OAuth2 access token stored\n");
5201 gtk_entry_set_text(GTK_ENTRY(basic_page
.pass_entry
), OAUTH2Data
->access_token
);
5202 gtk_entry_set_text(GTK_ENTRY(send_page
.smtp_pass_entry
), OAUTH2Data
->access_token
);
5205 if(OAUTH2Data
->expiry_str
!= NULL
){
5206 passwd_store_set_account(tmp_ac_prefs
.account_id
,
5207 PWS_ACCOUNT_OAUTH2_EXPIRY
,
5208 OAUTH2Data
->expiry_str
,
5210 log_message(LOG_PROTOCOL
, "OAuth2 access token expiry stored\n");
5213 tmp_ac_prefs
.oauth2_date
= g_get_real_time () / G_USEC_PER_SEC
;
5219 static void prefs_account_set_autochk_interval_from_widgets(PrefParam
*pparam
)
5221 struct AutocheckWidgets
*autochk_widgets
=
5222 (struct AutocheckWidgets
*)*pparam
->widget
;
5224 *(gint
*)pparam
->data
=
5225 (3600 * gtk_spin_button_get_value_as_int(
5226 GTK_SPIN_BUTTON(autochk_widgets
->autochk_hour_spinbtn
)))
5227 + (60 * gtk_spin_button_get_value_as_int(
5228 GTK_SPIN_BUTTON(autochk_widgets
->autochk_min_spinbtn
)))
5229 + gtk_spin_button_get_value_as_int(
5230 GTK_SPIN_BUTTON(autochk_widgets
->autochk_sec_spinbtn
));
5233 static void prefs_account_set_autochk_interval_to_widgets(PrefParam
*pparam
)
5235 gint val
= *((gint
*)pparam
->data
);
5236 struct AutocheckWidgets
*autochk_widgets
=
5237 (struct AutocheckWidgets
*)*pparam
->widget
;
5239 gtk_spin_button_set_value(
5240 GTK_SPIN_BUTTON(autochk_widgets
->autochk_hour_spinbtn
),
5242 gtk_spin_button_set_value(
5243 GTK_SPIN_BUTTON(autochk_widgets
->autochk_min_spinbtn
),
5245 gtk_spin_button_set_value(
5246 GTK_SPIN_BUTTON(autochk_widgets
->autochk_sec_spinbtn
),
5250 static void prefs_account_set_string_from_combobox(PrefParam
*pparam
)
5252 GtkWidget
*combobox
;
5257 cm_return_if_fail(*pparam
->widget
!= NULL
);
5259 combobox
= *pparam
->widget
;
5260 cm_return_if_fail(gtk_combo_box_get_active_iter(
5261 GTK_COMBO_BOX(combobox
), &iter
));
5263 str
= (gchar
**)pparam
->data
;
5265 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combobox
)));
5266 gtk_tree_model_get(GTK_TREE_MODEL(menu
), &iter
,
5267 COMBOBOX_PRIVACY_PLUGIN_ID
, &(*str
),
5271 /* Context struct and internal function called by gtk_tree_model_foreach().
5272 * This is used in prefs_account_set_privacy_combobox_from_string() to find
5273 * correct combobox entry to activate when account preferences are displayed
5274 * and their values are set according to preferences. */
5275 typedef struct _privacy_system_set_ctx
{
5276 GtkWidget
*combobox
;
5279 } PrivacySystemSetCtx
;
5281 static gboolean
_privacy_system_set_func(GtkTreeModel
*model
, GtkTreePath
*path
,
5282 GtkTreeIter
*iter
, PrivacySystemSetCtx
*ctx
)
5284 GtkWidget
*combobox
= ctx
->combobox
;
5285 gchar
*prefsid
= ctx
->prefsid
;
5288 /* We're searching for correct privacy plugin ID. */
5289 gtk_tree_model_get(model
, iter
, COMBOBOX_PRIVACY_PLUGIN_ID
, &curid
, -1);
5290 if( strcmp(prefsid
, curid
) == 0 ) {
5291 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combobox
), iter
);
5301 static void prefs_account_set_privacy_combobox_from_string(PrefParam
*pparam
)
5303 GtkWidget
*optionmenu
;
5306 gboolean found
= FALSE
;
5308 PrivacySystemSetCtx
*ctx
= NULL
;
5310 cm_return_if_fail(*pparam
->widget
!= NULL
);
5312 prefsid
= *((gchar
**) pparam
->data
);
5313 if (prefsid
== NULL
)
5316 optionmenu
= *pparam
->widget
;
5317 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optionmenu
)));
5319 ctx
= g_new(PrivacySystemSetCtx
, sizeof(PrivacySystemSetCtx
));
5320 ctx
->combobox
= optionmenu
;
5321 ctx
->prefsid
= prefsid
;
5324 gtk_tree_model_foreach(GTK_TREE_MODEL(menu
),
5325 (GtkTreeModelForeachFunc
)_privacy_system_set_func
, ctx
);
5329 /* If chosen privacy system is not available, add a dummy entry with
5330 * "not loaded" note and make it active. */
5334 name
= g_strdup_printf(_("%s (plugin not loaded)"), prefsid
);
5335 gtk_list_store_append(menu
, &iter
);
5336 gtk_list_store_set(menu
, &iter
,
5337 COMBOBOX_TEXT
, name
,
5339 COMBOBOX_SENS
, TRUE
,
5340 COMBOBOX_PRIVACY_PLUGIN_ID
, prefsid
,
5344 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(optionmenu
), &iter
);
5348 static void prefs_account_protocol_changed(GtkComboBox
*combobox
, gpointer data
)
5350 RecvProtocol protocol
;
5351 struct BasicProtocol
*protocol_optmenu
= (struct BasicProtocol
*)basic_page
.protocol_optmenu
;
5353 protocol
= combobox_get_active_data(combobox
);
5355 gtk_widget_hide(protocol_optmenu
->no_imap_warn_icon
);
5356 gtk_widget_hide(protocol_optmenu
->no_imap_warn_label
);
5360 #ifndef HAVE_LIBETPAN
5361 gtk_widget_show(protocol_optmenu
->no_imap_warn_icon
);
5362 gtk_widget_show(protocol_optmenu
->no_imap_warn_label
);
5364 gtk_widget_hide(protocol_optmenu
->no_imap_warn_icon
);
5365 gtk_widget_hide(protocol_optmenu
->no_imap_warn_label
);
5367 gtk_widget_show(send_page
.msgid_checkbtn
);
5368 gtk_widget_show(send_page
.xmailer_checkbtn
);
5369 gtk_widget_show(basic_page
.nntpserv_label
);
5370 gtk_widget_show(basic_page
.nntpserv_entry
);
5371 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5372 0, VSPACING_NARROW
);
5374 gtk_widget_set_sensitive(basic_page
.nntpauth_checkbtn
, TRUE
);
5375 gtk_widget_show(basic_page
.nntpauth_checkbtn
);
5377 gtk_widget_set_sensitive(basic_page
.nntpauth_onconnect_checkbtn
, TRUE
);
5378 gtk_widget_show(basic_page
.nntpauth_onconnect_checkbtn
);
5380 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5381 1, VSPACING_NARROW
);
5382 gtk_widget_hide(basic_page
.recvserv_label
);
5383 gtk_widget_hide(basic_page
.recvserv_entry
);
5384 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5386 gtk_widget_show(basic_page
.smtpserv_label
);
5387 gtk_widget_show(basic_page
.smtpserv_entry
);
5388 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5389 4, VSPACING_NARROW
);
5390 gtk_widget_hide(basic_page
.localmbox_label
);
5391 gtk_widget_hide(basic_page
.localmbox_entry
);
5392 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5394 gtk_widget_hide(basic_page
.mailcmd_label
);
5395 gtk_widget_hide(basic_page
.mailcmd_entry
);
5396 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5398 gtk_widget_hide(basic_page
.mailcmd_checkbtn
);
5399 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5401 gtk_widget_show(basic_page
.uid_label
);
5402 gtk_widget_show(basic_page
.pass_label
);
5403 gtk_widget_show(basic_page
.uid_entry
);
5404 gtk_widget_show(basic_page
.pass_entry
);
5405 gtk_widget_show(basic_page
.showpwd_checkbtn
);
5406 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5407 7, VSPACING_NARROW
);
5409 gtk_widget_set_sensitive(basic_page
.uid_label
, TRUE
);
5410 gtk_widget_set_sensitive(basic_page
.pass_label
, TRUE
);
5411 gtk_widget_set_sensitive(basic_page
.uid_entry
, TRUE
);
5412 gtk_widget_set_sensitive(basic_page
.pass_entry
, TRUE
);
5413 gtk_widget_set_sensitive(basic_page
.showpwd_checkbtn
, TRUE
);
5415 /* update userid/passwd sensitive state */
5417 prefs_account_nntpauth_toggled
5418 (GTK_TOGGLE_BUTTON(basic_page
.nntpauth_checkbtn
), NULL
);
5419 gtk_widget_hide(receive_page
.pop3_frame
);
5420 gtk_widget_hide(receive_page
.imap_frame
);
5421 gtk_widget_hide(receive_page
.local_frame
);
5422 gtk_widget_show(receive_page
.autochk_frame
);
5423 gtk_widget_show(receive_page
.frame_maxarticle
);
5424 gtk_widget_set_sensitive(receive_page
.filter_on_recv_checkbtn
, TRUE
);
5425 prefs_account_filter_on_recv_toggled
5426 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
), NULL
);
5427 gtk_widget_set_sensitive(receive_page
.recvatgetall_checkbtn
, TRUE
);
5428 /* update pop_before_smtp sensitivity */
5429 gtk_toggle_button_set_active
5430 (GTK_TOGGLE_BUTTON(send_page
.pop_bfr_smtp_checkbtn
), FALSE
);
5431 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_checkbtn
, FALSE
);
5432 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_tm_spinbtn
, FALSE
);
5434 if (!tmp_ac_prefs
.account_name
) {
5435 gtk_toggle_button_set_active
5436 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
),
5438 gtk_toggle_button_set_active
5439 (GTK_TOGGLE_BUTTON(receive_page
.filterhook_on_recv_checkbtn
),
5441 gtk_toggle_button_set_active
5442 (GTK_TOGGLE_BUTTON(receive_page
.recvatgetall_checkbtn
),
5447 gtk_widget_hide(ssl_page
.pop_frame
);
5448 gtk_widget_hide(ssl_page
.imap_frame
);
5449 gtk_widget_show(ssl_page
.nntp_frame
);
5450 gtk_widget_show(ssl_page
.send_frame
);
5452 gtk_widget_hide(advanced_page
.popport_hbox
);
5453 gtk_widget_hide(advanced_page
.imapport_hbox
);
5454 gtk_widget_show(advanced_page
.nntpport_hbox
);
5455 gtk_widget_show(advanced_page
.crosspost_checkbtn
);
5456 gtk_widget_show(advanced_page
.crosspost_colormenu
);
5458 gtk_widget_hide(advanced_page
.tunnelcmd_checkbtn
);
5459 gtk_widget_hide(advanced_page
.tunnelcmd_entry
);
5461 gtk_widget_hide(receive_page
.imapdir_label
);
5462 gtk_widget_hide(receive_page
.imapdir_entry
);
5463 gtk_widget_hide(receive_page
.subsonly_checkbtn
);
5464 gtk_widget_hide(receive_page
.low_bandwidth_checkbtn
);
5467 gtk_widget_show(send_page
.msgid_checkbtn
);
5468 gtk_widget_show(send_page
.xmailer_checkbtn
);
5469 gtk_widget_hide(protocol_optmenu
->no_imap_warn_icon
);
5470 gtk_widget_hide(protocol_optmenu
->no_imap_warn_label
);
5471 gtk_widget_hide(basic_page
.nntpserv_label
);
5472 gtk_widget_hide(basic_page
.nntpserv_entry
);
5473 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5475 gtk_widget_set_sensitive(basic_page
.nntpauth_checkbtn
, FALSE
);
5476 gtk_widget_hide(basic_page
.nntpauth_checkbtn
);
5478 gtk_widget_set_sensitive(basic_page
.nntpauth_onconnect_checkbtn
, FALSE
);
5479 gtk_widget_hide(basic_page
.nntpauth_onconnect_checkbtn
);
5480 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5482 gtk_widget_hide(basic_page
.recvserv_label
);
5483 gtk_widget_hide(basic_page
.recvserv_entry
);
5484 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5486 gtk_widget_show(basic_page
.smtpserv_label
);
5487 gtk_widget_show(basic_page
.smtpserv_entry
);
5488 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5489 4, VSPACING_NARROW
);
5490 gtk_widget_show(basic_page
.localmbox_label
);
5491 gtk_widget_show(basic_page
.localmbox_entry
);
5492 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5493 3, VSPACING_NARROW
);
5494 gtk_widget_show(basic_page
.mailcmd_label
);
5495 gtk_widget_show(basic_page
.mailcmd_entry
);
5496 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5497 6, VSPACING_NARROW
);
5498 gtk_widget_show(basic_page
.mailcmd_checkbtn
);
5499 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5500 5, VSPACING_NARROW
);
5501 gtk_widget_hide(basic_page
.uid_label
);
5502 gtk_widget_hide(basic_page
.pass_label
);
5503 gtk_widget_hide(basic_page
.uid_entry
);
5504 gtk_widget_hide(basic_page
.pass_entry
);
5505 gtk_widget_hide(basic_page
.showpwd_checkbtn
);
5506 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5509 gtk_widget_set_sensitive(basic_page
.uid_label
, TRUE
);
5510 gtk_widget_set_sensitive(basic_page
.pass_label
, TRUE
);
5511 gtk_widget_set_sensitive(basic_page
.uid_entry
, TRUE
);
5512 gtk_widget_set_sensitive(basic_page
.pass_entry
, TRUE
);
5513 gtk_widget_set_sensitive(basic_page
.showpwd_checkbtn
, TRUE
);
5514 gtk_widget_hide(receive_page
.pop3_frame
);
5515 gtk_widget_hide(receive_page
.imap_frame
);
5516 gtk_widget_show(receive_page
.local_frame
);
5517 gtk_widget_show(receive_page
.autochk_frame
);
5518 gtk_widget_hide(receive_page
.frame_maxarticle
);
5519 gtk_widget_set_sensitive(receive_page
.filter_on_recv_checkbtn
, TRUE
);
5520 prefs_account_filter_on_recv_toggled
5521 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
), NULL
);
5522 gtk_widget_set_sensitive(receive_page
.recvatgetall_checkbtn
, TRUE
);
5523 prefs_account_mailcmd_toggled
5524 (GTK_TOGGLE_BUTTON(basic_page
.mailcmd_checkbtn
), NULL
);
5526 /* update pop_before_smtp sensitivity */
5527 gtk_toggle_button_set_active
5528 (GTK_TOGGLE_BUTTON(send_page
.pop_bfr_smtp_checkbtn
), FALSE
);
5529 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_checkbtn
, FALSE
);
5530 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_tm_spinbtn
, FALSE
);
5532 if (!tmp_ac_prefs
.account_name
) {
5533 gtk_toggle_button_set_active
5534 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
),
5536 gtk_toggle_button_set_active
5537 (GTK_TOGGLE_BUTTON(receive_page
.filterhook_on_recv_checkbtn
),
5539 gtk_toggle_button_set_active
5540 (GTK_TOGGLE_BUTTON(receive_page
.recvatgetall_checkbtn
),
5545 gtk_widget_hide(ssl_page
.pop_frame
);
5546 gtk_widget_hide(ssl_page
.imap_frame
);
5547 gtk_widget_hide(ssl_page
.nntp_frame
);
5548 gtk_widget_show(ssl_page
.send_frame
);
5550 gtk_widget_hide(advanced_page
.popport_hbox
);
5551 gtk_widget_hide(advanced_page
.imapport_hbox
);
5552 gtk_widget_hide(advanced_page
.nntpport_hbox
);
5553 gtk_widget_hide(advanced_page
.crosspost_checkbtn
);
5554 gtk_widget_hide(advanced_page
.crosspost_colormenu
);
5556 gtk_widget_hide(advanced_page
.tunnelcmd_checkbtn
);
5557 gtk_widget_hide(advanced_page
.tunnelcmd_entry
);
5559 gtk_widget_hide(receive_page
.imapdir_label
);
5560 gtk_widget_hide(receive_page
.imapdir_entry
);
5561 gtk_widget_hide(receive_page
.subsonly_checkbtn
);
5562 gtk_widget_hide(receive_page
.low_bandwidth_checkbtn
);
5565 #ifndef HAVE_LIBETPAN
5566 gtk_widget_show(protocol_optmenu
->no_imap_warn_icon
);
5567 gtk_widget_show(protocol_optmenu
->no_imap_warn_label
);
5570 gtk_toggle_button_set_active(
5571 GTK_TOGGLE_BUTTON(send_page
.msgid_checkbtn
),
5573 gtk_widget_hide(send_page
.msgid_checkbtn
);
5574 gtk_widget_show(send_page
.xmailer_checkbtn
);
5575 gtk_widget_hide(basic_page
.nntpserv_label
);
5576 gtk_widget_hide(basic_page
.nntpserv_entry
);
5577 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5579 gtk_widget_set_sensitive(basic_page
.nntpauth_checkbtn
, FALSE
);
5580 gtk_widget_hide(basic_page
.nntpauth_checkbtn
);
5582 gtk_widget_set_sensitive(basic_page
.nntpauth_onconnect_checkbtn
, FALSE
);
5583 gtk_widget_hide(basic_page
.nntpauth_onconnect_checkbtn
);
5585 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5587 gtk_widget_set_sensitive(basic_page
.recvserv_label
, TRUE
);
5588 gtk_widget_set_sensitive(basic_page
.recvserv_entry
, TRUE
);
5589 gtk_widget_show(basic_page
.recvserv_label
);
5590 gtk_widget_show(basic_page
.recvserv_entry
);
5591 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5592 2, VSPACING_NARROW
);
5593 gtk_widget_show(basic_page
.smtpserv_label
);
5594 gtk_widget_show(basic_page
.smtpserv_entry
);
5595 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5596 4, VSPACING_NARROW
);
5597 gtk_widget_hide(basic_page
.localmbox_label
);
5598 gtk_widget_hide(basic_page
.localmbox_entry
);
5599 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5601 gtk_widget_hide(basic_page
.mailcmd_label
);
5602 gtk_widget_hide(basic_page
.mailcmd_entry
);
5603 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5605 gtk_widget_hide(basic_page
.mailcmd_checkbtn
);
5606 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5608 gtk_widget_show(basic_page
.uid_label
);
5609 gtk_widget_show(basic_page
.pass_label
);
5610 gtk_widget_show(basic_page
.uid_entry
);
5611 gtk_widget_show(basic_page
.pass_entry
);
5612 gtk_widget_show(basic_page
.showpwd_checkbtn
);
5613 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5614 7, VSPACING_NARROW
);
5616 gtk_widget_set_sensitive(basic_page
.uid_label
, TRUE
);
5617 gtk_widget_set_sensitive(basic_page
.pass_label
, TRUE
);
5618 gtk_widget_set_sensitive(basic_page
.uid_entry
, TRUE
);
5619 gtk_widget_set_sensitive(basic_page
.pass_entry
, TRUE
);
5620 gtk_widget_set_sensitive(basic_page
.showpwd_checkbtn
, TRUE
);
5621 gtk_widget_hide(receive_page
.pop3_frame
);
5622 gtk_widget_show(receive_page
.imap_frame
);
5623 gtk_widget_hide(receive_page
.local_frame
);
5624 gtk_widget_show(receive_page
.autochk_frame
);
5625 gtk_widget_hide(receive_page
.frame_maxarticle
);
5626 gtk_widget_set_sensitive(receive_page
.filter_on_recv_checkbtn
, TRUE
);
5627 prefs_account_filter_on_recv_toggled
5628 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
), NULL
);
5629 gtk_widget_set_sensitive(receive_page
.recvatgetall_checkbtn
, TRUE
);
5630 gtk_widget_set_sensitive(basic_page
.smtpserv_entry
, TRUE
);
5631 gtk_widget_set_sensitive(basic_page
.smtpserv_label
, TRUE
);
5633 /* update pop_before_smtp sensitivity */
5634 gtk_toggle_button_set_active
5635 (GTK_TOGGLE_BUTTON(send_page
.pop_bfr_smtp_checkbtn
), FALSE
);
5636 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_checkbtn
, FALSE
);
5637 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_tm_spinbtn
, FALSE
);
5639 if (!tmp_ac_prefs
.account_name
) {
5640 gtk_toggle_button_set_active
5641 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
),
5643 gtk_toggle_button_set_active
5644 (GTK_TOGGLE_BUTTON(receive_page
.filterhook_on_recv_checkbtn
),
5646 gtk_toggle_button_set_active
5647 (GTK_TOGGLE_BUTTON(receive_page
.recvatgetall_checkbtn
),
5652 gtk_widget_hide(ssl_page
.pop_frame
);
5653 gtk_widget_show(ssl_page
.imap_frame
);
5654 gtk_widget_hide(ssl_page
.nntp_frame
);
5655 gtk_widget_show(ssl_page
.send_frame
);
5657 gtk_widget_hide(advanced_page
.popport_hbox
);
5658 gtk_widget_show(advanced_page
.imapport_hbox
);
5659 gtk_widget_hide(advanced_page
.nntpport_hbox
);
5660 gtk_widget_hide(advanced_page
.crosspost_checkbtn
);
5661 gtk_widget_hide(advanced_page
.crosspost_colormenu
);
5663 gtk_widget_show(advanced_page
.tunnelcmd_checkbtn
);
5664 gtk_widget_show(advanced_page
.tunnelcmd_entry
);
5666 gtk_widget_show(receive_page
.imapdir_label
);
5667 gtk_widget_show(receive_page
.imapdir_entry
);
5668 gtk_widget_show(receive_page
.subsonly_checkbtn
);
5669 gtk_widget_show(receive_page
.low_bandwidth_checkbtn
);
5672 gtk_widget_show(send_page
.msgid_checkbtn
);
5673 gtk_widget_show(send_page
.xmailer_checkbtn
);
5674 gtk_widget_hide(protocol_optmenu
->no_imap_warn_icon
);
5675 gtk_widget_hide(protocol_optmenu
->no_imap_warn_label
);
5676 gtk_widget_hide(basic_page
.nntpserv_label
);
5677 gtk_widget_hide(basic_page
.nntpserv_entry
);
5678 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5680 gtk_widget_set_sensitive(basic_page
.nntpauth_checkbtn
, FALSE
);
5681 gtk_widget_hide(basic_page
.nntpauth_checkbtn
);
5683 gtk_widget_set_sensitive(basic_page
.nntpauth_onconnect_checkbtn
, FALSE
);
5684 gtk_widget_hide(basic_page
.nntpauth_onconnect_checkbtn
);
5686 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5688 gtk_widget_set_sensitive(basic_page
.recvserv_label
, FALSE
);
5689 gtk_widget_set_sensitive(basic_page
.recvserv_entry
, FALSE
);
5690 gtk_widget_hide(basic_page
.recvserv_label
);
5691 gtk_widget_hide(basic_page
.recvserv_entry
);
5692 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5693 2, VSPACING_NARROW
);
5694 gtk_widget_show(basic_page
.smtpserv_label
);
5695 gtk_widget_show(basic_page
.smtpserv_entry
);
5696 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5697 4, VSPACING_NARROW
);
5698 gtk_widget_hide(basic_page
.localmbox_label
);
5699 gtk_widget_hide(basic_page
.localmbox_entry
);
5700 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5702 gtk_widget_hide(basic_page
.mailcmd_label
);
5703 gtk_widget_hide(basic_page
.mailcmd_entry
);
5704 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5706 gtk_widget_hide(basic_page
.mailcmd_checkbtn
);
5707 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5709 gtk_widget_hide(basic_page
.uid_label
);
5710 gtk_widget_hide(basic_page
.pass_label
);
5711 gtk_widget_hide(basic_page
.uid_entry
);
5712 gtk_widget_hide(basic_page
.pass_entry
);
5713 gtk_widget_hide(basic_page
.showpwd_checkbtn
);
5714 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5715 7, VSPACING_NARROW
);
5717 gtk_widget_set_sensitive(basic_page
.uid_label
, FALSE
);
5718 gtk_widget_set_sensitive(basic_page
.pass_label
, FALSE
);
5719 gtk_widget_set_sensitive(basic_page
.uid_entry
, FALSE
);
5720 gtk_widget_set_sensitive(basic_page
.pass_entry
, FALSE
);
5721 gtk_widget_set_sensitive(basic_page
.showpwd_checkbtn
, FALSE
);
5722 gtk_widget_set_sensitive(receive_page
.pop3_frame
, FALSE
);
5723 gtk_widget_hide(receive_page
.pop3_frame
);
5724 gtk_widget_hide(receive_page
.imap_frame
);
5725 gtk_widget_hide(receive_page
.local_frame
);
5726 gtk_widget_hide(receive_page
.autochk_frame
);
5727 gtk_widget_hide(receive_page
.frame_maxarticle
);
5728 gtk_widget_set_sensitive(receive_page
.filter_on_recv_checkbtn
, FALSE
);
5729 prefs_account_filter_on_recv_toggled
5730 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
), NULL
);
5731 gtk_widget_set_sensitive(receive_page
.recvatgetall_checkbtn
, FALSE
);
5733 gtk_widget_set_sensitive(basic_page
.smtpserv_entry
, TRUE
);
5734 gtk_widget_set_sensitive(basic_page
.smtpserv_label
, TRUE
);
5736 /* update pop_before_smtp sensitivity */
5737 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_checkbtn
, FALSE
);
5738 pop_bfr_smtp_tm_set_sens(NULL
, NULL
);
5740 gtk_toggle_button_set_active
5741 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
), FALSE
);
5742 gtk_toggle_button_set_active
5743 (GTK_TOGGLE_BUTTON(receive_page
.filterhook_on_recv_checkbtn
), FALSE
);
5744 gtk_toggle_button_set_active
5745 (GTK_TOGGLE_BUTTON(receive_page
.recvatgetall_checkbtn
), FALSE
);
5748 gtk_widget_hide(ssl_page
.pop_frame
);
5749 gtk_widget_hide(ssl_page
.imap_frame
);
5750 gtk_widget_hide(ssl_page
.nntp_frame
);
5751 gtk_widget_show(ssl_page
.send_frame
);
5753 gtk_widget_hide(advanced_page
.popport_hbox
);
5754 gtk_widget_hide(advanced_page
.imapport_hbox
);
5755 gtk_widget_hide(advanced_page
.nntpport_hbox
);
5756 gtk_widget_hide(advanced_page
.crosspost_checkbtn
);
5757 gtk_widget_hide(advanced_page
.crosspost_colormenu
);
5759 gtk_widget_hide(advanced_page
.tunnelcmd_checkbtn
);
5760 gtk_widget_hide(advanced_page
.tunnelcmd_entry
);
5762 gtk_widget_hide(receive_page
.imapdir_label
);
5763 gtk_widget_hide(receive_page
.imapdir_entry
);
5764 gtk_widget_hide(receive_page
.subsonly_checkbtn
);
5765 gtk_widget_hide(receive_page
.low_bandwidth_checkbtn
);
5768 /* continue to default: */
5770 gtk_widget_show(send_page
.msgid_checkbtn
);
5771 gtk_widget_show(send_page
.xmailer_checkbtn
);
5772 gtk_widget_hide(protocol_optmenu
->no_imap_warn_icon
);
5773 gtk_widget_hide(protocol_optmenu
->no_imap_warn_label
);
5774 gtk_widget_hide(basic_page
.nntpserv_label
);
5775 gtk_widget_hide(basic_page
.nntpserv_entry
);
5776 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5778 gtk_widget_set_sensitive(basic_page
.nntpauth_checkbtn
, FALSE
);
5779 gtk_widget_hide(basic_page
.nntpauth_checkbtn
);
5781 gtk_widget_set_sensitive(basic_page
.nntpauth_onconnect_checkbtn
, FALSE
);
5782 gtk_widget_hide(basic_page
.nntpauth_onconnect_checkbtn
);
5784 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5786 gtk_widget_set_sensitive(basic_page
.recvserv_label
, TRUE
);
5787 gtk_widget_set_sensitive(basic_page
.recvserv_entry
, TRUE
);
5788 gtk_widget_show(basic_page
.recvserv_label
);
5789 gtk_widget_show(basic_page
.recvserv_entry
);
5790 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5791 2, VSPACING_NARROW
);
5792 gtk_widget_show(basic_page
.smtpserv_label
);
5793 gtk_widget_show(basic_page
.smtpserv_entry
);
5794 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5795 4, VSPACING_NARROW
);
5796 gtk_widget_hide(basic_page
.localmbox_label
);
5797 gtk_widget_hide(basic_page
.localmbox_entry
);
5798 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5800 gtk_widget_hide(basic_page
.mailcmd_label
);
5801 gtk_widget_hide(basic_page
.mailcmd_entry
);
5802 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5804 gtk_widget_hide(basic_page
.mailcmd_checkbtn
);
5805 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5807 gtk_widget_show(basic_page
.uid_label
);
5808 gtk_widget_show(basic_page
.pass_label
);
5809 gtk_widget_show(basic_page
.uid_entry
);
5810 gtk_widget_show(basic_page
.pass_entry
);
5811 gtk_widget_show(basic_page
.showpwd_checkbtn
);
5812 gtk_table_set_row_spacing (GTK_TABLE (basic_page
.serv_table
),
5813 7, VSPACING_NARROW
);
5815 gtk_widget_set_sensitive(basic_page
.uid_label
, TRUE
);
5816 gtk_widget_set_sensitive(basic_page
.pass_label
, TRUE
);
5817 gtk_widget_set_sensitive(basic_page
.uid_entry
, TRUE
);
5818 gtk_widget_set_sensitive(basic_page
.pass_entry
, TRUE
);
5819 gtk_widget_set_sensitive(basic_page
.showpwd_checkbtn
, TRUE
);
5820 gtk_widget_set_sensitive(receive_page
.pop3_frame
, TRUE
);
5821 gtk_widget_show(receive_page
.pop3_frame
);
5822 gtk_widget_hide(receive_page
.imap_frame
);
5823 gtk_widget_hide(receive_page
.local_frame
);
5824 gtk_widget_show(receive_page
.autochk_frame
);
5825 gtk_widget_hide(receive_page
.frame_maxarticle
);
5826 gtk_widget_set_sensitive(receive_page
.filter_on_recv_checkbtn
, TRUE
);
5827 prefs_account_filter_on_recv_toggled
5828 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
), NULL
);
5829 gtk_widget_set_sensitive(receive_page
.recvatgetall_checkbtn
, TRUE
);
5831 gtk_widget_set_sensitive(basic_page
.smtpserv_entry
, TRUE
);
5832 gtk_widget_set_sensitive(basic_page
.smtpserv_label
, TRUE
);
5834 /* update pop_before_smtp sensitivity */
5835 gtk_widget_set_sensitive(send_page
.pop_bfr_smtp_checkbtn
, TRUE
);
5836 pop_bfr_smtp_tm_set_sens(NULL
, NULL
);
5838 if (!tmp_ac_prefs
.account_name
) {
5839 gtk_toggle_button_set_active
5840 (GTK_TOGGLE_BUTTON(receive_page
.filter_on_recv_checkbtn
),
5842 gtk_toggle_button_set_active
5843 (GTK_TOGGLE_BUTTON(receive_page
.filterhook_on_recv_checkbtn
),
5845 gtk_toggle_button_set_active
5846 (GTK_TOGGLE_BUTTON(receive_page
.recvatgetall_checkbtn
),
5851 gtk_widget_show(ssl_page
.pop_frame
);
5852 gtk_widget_hide(ssl_page
.imap_frame
);
5853 gtk_widget_hide(ssl_page
.nntp_frame
);
5854 gtk_widget_show(ssl_page
.send_frame
);
5856 gtk_widget_show(advanced_page
.popport_hbox
);
5857 gtk_widget_hide(advanced_page
.imapport_hbox
);
5858 gtk_widget_hide(advanced_page
.nntpport_hbox
);
5859 gtk_widget_hide(advanced_page
.crosspost_checkbtn
);
5860 gtk_widget_hide(advanced_page
.crosspost_colormenu
);
5862 gtk_widget_hide(advanced_page
.tunnelcmd_checkbtn
);
5863 gtk_widget_hide(advanced_page
.tunnelcmd_entry
);
5865 gtk_widget_hide(receive_page
.imapdir_label
);
5866 gtk_widget_hide(receive_page
.imapdir_entry
);
5867 gtk_widget_hide(receive_page
.subsonly_checkbtn
);
5868 gtk_widget_hide(receive_page
.low_bandwidth_checkbtn
);
5872 gtk_widget_queue_resize(basic_page
.serv_frame
);
5875 static void prefs_account_nntpauth_toggled(GtkToggleButton
*button
,
5880 if (!gtk_widget_get_sensitive (GTK_WIDGET (button
)))
5882 auth
= gtk_toggle_button_get_active (button
);
5883 gtk_widget_set_sensitive(basic_page
.uid_label
, auth
);
5884 gtk_widget_set_sensitive(basic_page
.pass_label
, auth
);
5885 gtk_widget_set_sensitive(basic_page
.uid_entry
, auth
);
5886 gtk_widget_set_sensitive(basic_page
.pass_entry
, auth
);
5887 gtk_widget_set_sensitive(basic_page
.showpwd_checkbtn
, auth
);
5888 gtk_widget_set_sensitive(basic_page
.nntpauth_onconnect_checkbtn
, auth
);
5891 static void prefs_account_mailcmd_toggled(GtkToggleButton
*button
,
5894 gboolean use_mailcmd
;
5896 use_mailcmd
= gtk_toggle_button_get_active (button
);
5898 gtk_widget_set_sensitive(basic_page
.mailcmd_entry
, use_mailcmd
);
5899 gtk_widget_set_sensitive(basic_page
.mailcmd_label
, use_mailcmd
);
5900 gtk_widget_set_sensitive(basic_page
.smtpserv_entry
, !use_mailcmd
);
5901 gtk_widget_set_sensitive(basic_page
.smtpserv_label
, !use_mailcmd
);
5902 gtk_widget_set_sensitive(basic_page
.uid_entry
, !use_mailcmd
);
5903 gtk_widget_set_sensitive(basic_page
.pass_entry
, !use_mailcmd
);
5904 gtk_widget_set_sensitive(basic_page
.showpwd_checkbtn
, !use_mailcmd
);
5907 static void prefs_account_showpwd_checkbtn_toggled(GtkToggleButton
*button
,
5910 gboolean active
= gtk_toggle_button_get_active(button
);
5911 GtkWidget
*entry
= GTK_WIDGET(user_data
);
5913 gtk_entry_set_visibility(GTK_ENTRY(entry
), active
);
5916 static void prefs_account_entry_changed_newline_check_cb(GtkWidget
*entry
,
5919 static GdkColor red
;
5920 static gboolean colors_initialised
= FALSE
;
5922 if (strchr(gtk_entry_get_text(GTK_ENTRY(entry
)), '\n') != NULL
) {
5923 /* Entry contains a newline, light it up. */
5924 debug_print("found newline in string, painting entry red\n");
5925 if (!colors_initialised
) {
5926 if (!gdk_color_parse("#ff7070", &red
)) {
5927 g_warning("color parse failed: red");
5930 colors_initialised
= gdk_colormap_alloc_color(
5931 gdk_colormap_get_system(), &red
, FALSE
, TRUE
);
5934 if (colors_initialised
) {
5935 gtk_widget_modify_base(entry
, GTK_STATE_NORMAL
, &red
);
5938 gtk_widget_modify_base(entry
, GTK_STATE_NORMAL
, NULL
);
5942 static void prefs_account_filter_on_recv_toggled(GtkToggleButton
*button
,
5947 do_filter
= gtk_toggle_button_get_active (button
);
5948 gtk_widget_set_sensitive(receive_page
.filterhook_on_recv_checkbtn
, do_filter
);
5952 static void prefs_account_compose_default_dictionary_set_string_from_optmenu
5958 cm_return_if_fail(*pparam
->widget
!= NULL
);
5960 combo
= *pparam
->widget
;
5961 str
= (gchar
**) pparam
->data
;
5964 *str
= gtkaspell_get_dictionary_menu_active_item(GTK_COMBO_BOX(combo
));
5967 static void prefs_account_compose_default_dictionary_set_optmenu_from_string
5973 cm_return_if_fail(*pparam
->widget
!= NULL
);
5975 dictionary
= *((gchar
**) pparam
->data
);
5976 if (dictionary
!= NULL
) {
5977 if (strrchr(dictionary
, '/')) {
5978 dictionary
= g_strdup(strrchr(dictionary
, '/')+1);
5981 if (strchr(dictionary
, '-')) {
5982 *(strchr(dictionary
, '-')) = '\0';
5985 combo
= *pparam
->widget
;
5986 if (dictionary
&& *dictionary
)
5987 gtkaspell_set_dictionary_menu_active_item(GTK_COMBO_BOX(combo
),
5990 GtkTreeModel
*model
;
5992 if((model
= gtk_combo_box_get_model(GTK_COMBO_BOX(combo
))) == NULL
)
5994 if((gtk_tree_model_get_iter_first(model
, &iter
)) == FALSE
)
5996 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo
), &iter
);
6001 gchar
*prefs_account_generate_msgid(PrefsAccount
*account
)
6003 gchar
*addr
, *tmbuf
, *buf
= NULL
;
6005 gchar
*user_addr
= account
->msgid_with_addr
? g_strdup(account
->address
) : NULL
;
6007 if (account
->set_domain
&& account
->domain
) {
6008 buf
= g_strdup(account
->domain
);
6009 } else if (!strncmp(get_domain_name(), "localhost", strlen("localhost"))) {
6011 strchr(account
->address
, '@') ?
6012 strchr(account
->address
, '@')+1 :
6016 if (user_addr
!= NULL
) {
6017 addr
= g_strdup_printf(".%s", user_addr
);
6019 addr
= g_strdup_printf("@%s",
6020 buf
!= NULL
&& strlen(buf
) > 0 ?
6021 buf
: get_domain_name());
6026 if (user_addr
!= NULL
)
6029 /* Replace all @ but the last one in addr, with underscores.
6030 * RFC 2822 States that msg-id syntax only allows one @.
6032 while (strchr(addr
, '@') != NULL
&& strchr(addr
, '@') != strrchr(addr
, '@'))
6033 *(strchr(addr
, '@')) = '_';
6035 now
= g_date_time_new_now_local();
6036 tmbuf
= g_date_time_format(now
, "%Y%m%d%H%M%S");
6037 buf
= g_strdup_printf("%s.%08x%s",
6038 tmbuf
, (guint
)rand(), addr
);
6039 g_date_time_unref(now
);
6043 debug_print("Generated Message-ID string '%s'\n", buf
);
6047 void prefs_account_register_page(PrefsPage
*page
)
6049 prefs_pages
= g_slist_append(prefs_pages
, page
);
6053 void prefs_account_unregister_page(PrefsPage
*page
)
6055 prefs_pages
= g_slist_remove(prefs_pages
, page
);
6058 gchar
*prefs_account_cache_dir(PrefsAccount
*ac_prefs
, gboolean for_server
)
6062 gchar
*sanitized_server
;
6065 if (ac_prefs
->protocol
== A_IMAP4
) {
6067 sanitized_server
= g_strdup(ac_prefs
->recv_server
);
6068 g_strdelimit(sanitized_server
, ":", ',');
6071 dir
= g_strconcat(get_imap_cache_dir(),
6076 ac_prefs
->recv_server
,
6080 dir
= g_strconcat(get_imap_cache_dir(),
6085 ac_prefs
->recv_server
,
6092 g_free(sanitized_server
);
6099 static void prefs_account_receive_itv_spinbutton_value_changed_cb(GtkWidget
*w
, gpointer data
)
6101 ReceivePage
*page
= (ReceivePage
*)data
;
6102 gint seconds
= gtk_spin_button_get_value_as_int (
6103 GTK_SPIN_BUTTON (page
->autochk_widgets
->autochk_sec_spinbtn
));
6104 gint minutes
= gtk_spin_button_get_value_as_int (
6105 GTK_SPIN_BUTTON (page
->autochk_widgets
->autochk_min_spinbtn
));
6106 gint hours
= gtk_spin_button_get_value_as_int (
6107 GTK_SPIN_BUTTON(page
->autochk_widgets
->autochk_hour_spinbtn
));
6108 if (seconds
< PREFS_RECV_AUTOCHECK_MIN_INTERVAL
&& minutes
== 0 && hours
== 0) {
6109 gtk_spin_button_set_value (
6110 GTK_SPIN_BUTTON (page
->autochk_widgets
->autochk_sec_spinbtn
),
6111 PREFS_RECV_AUTOCHECK_MIN_INTERVAL
);