2 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2013 Colin Leroy <colin@colino.net>
4 * and the Claws Mail team
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "claws-features.h"
29 #include <glib/gi18n.h>
30 #include <gdk/gdkkeysyms.h>
42 #include "prefs_account.h"
43 #include "mainwindow.h"
44 #include "stock_pixmap.h"
47 #include "alertpanel.h"
52 #include "prefs_common.h"
63 int WELCOME_PAGE = -1;
67 int MAILBOX_PAGE = -1;
80 GtkWidget *organization;
82 GtkWidget *mailbox_name;
83 GtkWidget *mailbox_label;
85 GtkWidget *smtp_server;
87 GtkWidget *smtp_username;
88 GtkWidget *smtp_password;
89 GtkWidget *smtp_username_label;
90 GtkWidget *smtp_password_label;
93 GtkWidget *recv_label;
94 GtkWidget *recv_server;
95 GtkWidget *recv_username;
96 GtkWidget *recv_password;
97 GtkWidget *recv_username_label;
98 GtkWidget *recv_password_label;
99 GtkWidget *recv_imap_label;
100 GtkWidget *recv_imap_subdir;
101 GtkWidget *subsonly_checkbtn;
102 GtkWidget *no_imap_warning;
104 GtkWidget *smtp_use_ssl;
105 GtkWidget *recv_use_ssl;
106 GtkWidget *smtp_use_tls;
107 GtkWidget *recv_use_tls;
108 GtkWidget *smtp_ssl_cert_file;
109 GtkWidget *recv_ssl_cert_file;
110 GtkWidget *smtp_ssl_cert_pass;
111 GtkWidget *recv_ssl_cert_pass;
112 GtkWidget *smtp_cert_table;
113 GtkWidget *recv_cert_table;
115 gboolean create_mailbox;
121 typedef struct _AccountTemplate {
130 RecvProtocol recvtype;
142 gchar *smtpssl_cert_pass;
143 gchar *recvssl_cert_pass;
146 static AccountTemplate tmpl;
148 static PrefParam template_params[] = {
149 {"name", "$USERNAME",
150 &tmpl.name, P_STRING, NULL, NULL, NULL},
151 {"domain", "$DEFAULTDOMAIN",
152 &tmpl.domain, P_STRING, NULL, NULL, NULL},
153 {"email", "$NAME_MAIL@$DOMAIN",
154 &tmpl.email, P_STRING, NULL, NULL, NULL},
156 &tmpl.organization, P_STRING, NULL, NULL, NULL},
157 {"smtpserver", "smtp.$DOMAIN",
158 &tmpl.smtpserver, P_STRING, NULL, NULL, NULL},
159 {"smtpauth", "FALSE",
160 &tmpl.smtpauth, P_BOOL, NULL, NULL, NULL},
162 &tmpl.smtpuser, P_STRING, NULL, NULL, NULL},
164 &tmpl.smtppass, P_STRING, NULL, NULL, NULL},
166 &tmpl.recvtype, P_INT, NULL, NULL, NULL},
167 {"recvserver", "pop.$DOMAIN",
168 &tmpl.recvserver, P_STRING, NULL, NULL, NULL},
169 {"recvuser", "$LOGIN",
170 &tmpl.recvuser, P_STRING, NULL, NULL, NULL},
172 &tmpl.recvpass, P_STRING, NULL, NULL, NULL},
174 &tmpl.imapdir, P_STRING, NULL, NULL, NULL},
176 &tmpl.subsonly, P_BOOL, NULL, NULL, NULL},
177 {"mboxfile", "/var/mail/$LOGIN",
178 &tmpl.mboxfile, P_STRING, NULL, NULL, NULL},
180 &tmpl.mailbox, P_STRING, NULL, NULL, NULL},
182 &tmpl.smtpssl, P_INT, NULL, NULL, NULL},
184 &tmpl.recvssl, P_INT, NULL, NULL, NULL},
186 &tmpl.smtpssl_cert, P_STRING, NULL, NULL, NULL},
188 &tmpl.recvssl_cert, P_STRING, NULL, NULL, NULL},
189 {"smtpssl_cert_pass", "",
190 &tmpl.smtpssl_cert, P_STRING, NULL, NULL, NULL},
191 {"recvssl_cert_pass", "",
192 &tmpl.recvssl_cert, P_STRING, NULL, NULL, NULL},
193 {NULL, NULL, NULL, P_INT, NULL, NULL, NULL}
197 static gchar *accountrc_tmpl =
198 "[AccountTemplate]\n"
199 "#you can use $DEFAULTDOMAIN here\n"
200 "#domain must be defined before the variables that use it\n"
201 "#by default, domain is extracted from the hostname\n"
204 "#you can use $USERNAME for name (this is the default)\n"
207 "#you can use $LOGIN, $NAME_MAIL and $DOMAIN here \n"
208 "#$NAME_MAIL is the name without uppercase and with dots instead\n"
210 "#the default is $NAME_MAIL@$DOMAIN\n"
213 "#you can use $DOMAIN here\n"
214 "#the default organization is empty\n"
217 "#you can use $DOMAIN here \n"
218 "#the default is smtp.$DOMAIN\n"
221 "#Whether to use smtp authentication\n"
222 "#the default is 0 (no)\n"
226 "#you can use $LOGIN, $NAME_MAIL, $DOMAIN or $EMAIL here\n"
227 "#the default is empty (same as reception username)\n"
231 "#the default is empty (same as reception password)\n"
234 "#recvtype can be:\n"
237 "#5 for a local mbox file\n"
240 "#you can use $DOMAIN here \n"
241 "#the default is {pop,imap}.$DOMAIN\n"
244 "#you can use $LOGIN, $NAME_MAIL, $DOMAIN or $EMAIL here\n"
245 "#default is $LOGIN\n"
248 "#default is empty\n"
251 "#imap dir if imap (relative to the home on the server)\n"
252 "#default is empty\n"
255 "#show subscribed folders only, if imap\n"
259 "#mbox file if local\n"
260 "#you can use $LOGIN here\n"
261 "#default is /var/mail/$LOGIN\n"
264 "#mailbox name if pop3 or local\n"
265 "#relative path from the user's home\n"
266 "#default is \"Mail\"\n"
269 "#whether to use ssl on smtp connections\n"
270 "#default is 0, 1 is ssl, 2 is starttls\n"
273 "#whether to use ssl on pop or imap connections\n"
274 "#default is 0, 1 is ssl, 2 is starttls\n"
277 "#SSL client certificate path for SMTP\n"
278 "#default is empty (no certificate)\n"
281 "#SSL client certificate path for POP/IMAP\n"
282 "#default is empty (no certificate)\n"
285 "#SSL client certificate password for SMTP\n"
286 "#default is empty (no password)\n"
287 "#smtpssl_cert_pass=\n"
289 "#SSL client certificate password for POP/IMAP\n"
290 "#default is empty (no password)\n"
291 "#recvssl_cert_pass=\n"
294 static gchar *wizard_get_default_domain_name(void)
296 static gchar *domain_name = NULL;
298 if (domain_name == NULL) {
299 domain_name = g_strdup(get_domain_name());
300 if (strchr(domain_name, '.') != NULL
301 && strchr(domain_name, '.') != strrchr(domain_name, '.')
302 && strlen(strchr(domain_name, '.')) > 6) {
303 gchar *tmp = g_strdup(strchr(domain_name, '.')+1);
311 static gchar *get_name_for_mail(void)
314 if (tmpl.name == NULL)
316 name = g_utf8_strdown(tmpl.name, -1);
317 while(strstr(name, " "))
318 *strstr(name, " ")='.';
323 #define PARSE_DEFAULT(str) { \
324 gchar *tmp = NULL, *new = NULL; \
326 tmp = g_strdup(str); \
327 if (strstr(str, "$USERNAME")) { \
328 tmp = g_strdup(str); \
329 *strstr(tmp, "$USERNAME") = '\0'; \
330 new = g_strconcat(tmp, g_get_real_name(), \
331 strstr(str, "$USERNAME")+strlen("$USERNAME"), \
338 if (strstr(str, "$LOGIN")) { \
339 tmp = g_strdup(str); \
340 *strstr(tmp, "$LOGIN") = '\0'; \
341 new = g_strconcat(tmp, g_get_user_name(), \
342 strstr(str, "$LOGIN")+strlen("$LOGIN"), \
349 if (strstr(str, "$EMAIL")) { \
350 tmp = g_strdup(str); \
351 *strstr(tmp, "$EMAIL") = '\0'; \
352 new = g_strconcat(tmp, tmpl.email, \
353 strstr(str, "$EMAIL")+strlen("$EMAIL"), \
360 if (strstr(str, "$NAME_MAIL")) { \
361 tmp = g_strdup(str); \
362 *strstr(tmp, "$NAME_MAIL") = '\0'; \
363 new = g_strconcat(tmp, get_name_for_mail(), \
364 strstr(str, "$NAME_MAIL")+strlen("$NAME_MAIL"), \
371 if (strstr(str, "$DEFAULTDOMAIN")) { \
372 tmp = g_strdup(str); \
373 *strstr(tmp, "$DEFAULTDOMAIN") = '\0'; \
374 new = g_strconcat(tmp, wizard_get_default_domain_name(), \
375 strstr(str, "$DEFAULTDOMAIN")+strlen("$DEFAULTDOMAIN"), \
382 if (strstr(str, "$DOMAIN")) { \
383 tmp = g_strdup(str); \
384 *strstr(tmp, "$DOMAIN") = '\0'; \
385 new = g_strconcat(tmp, tmpl.domain, \
386 strstr(str, "$DOMAIN")+strlen("$DOMAIN"), \
395 static void wizard_read_defaults(void)
399 rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "accountrc.tmpl", NULL);
400 if (!is_file_exist(rcpath)) {
401 str_write_to_file(accountrc_tmpl, rcpath);
404 prefs_read_config(template_params, "AccountTemplate", rcpath, NULL);
406 PARSE_DEFAULT(tmpl.domain);
407 PARSE_DEFAULT(tmpl.name);
408 PARSE_DEFAULT(tmpl.email);
409 PARSE_DEFAULT(tmpl.organization);
410 PARSE_DEFAULT(tmpl.smtpserver);
411 PARSE_DEFAULT(tmpl.smtpuser);
412 PARSE_DEFAULT(tmpl.smtppass);
413 PARSE_DEFAULT(tmpl.recvserver);
414 PARSE_DEFAULT(tmpl.recvuser);
415 PARSE_DEFAULT(tmpl.recvpass);
416 PARSE_DEFAULT(tmpl.imapdir);
417 PARSE_DEFAULT(tmpl.mboxfile);
418 PARSE_DEFAULT(tmpl.mailbox);
421 "%s, %s, %s, %s, %s, %d, %s, %s, %s, %s, %s, %s, %d, %d\n",
422 tmpl.name,tmpl.domain,tmpl.email,tmpl.organization,tmpl.smtpserver,
423 tmpl.recvtype,tmpl.recvserver,tmpl.recvuser,tmpl.recvpass,
424 tmpl.imapdir,tmpl.mboxfile,tmpl.mailbox,tmpl.smtpssl,tmpl.recvssl);
429 static void initialize_fonts(WizardWindow *wizard)
431 GtkWidget *widget = wizard->email;
432 gint size = pango_font_description_get_size(
433 gtk_widget_get_style(widget)->font_desc)
437 PangoFontDescription *bold_desc;
438 gchar *curfont = pango_font_description_to_string(widget->style->font_desc);
439 g_free(prefs_common.smallfont);
440 g_free(prefs_common.normalfont);
441 g_free(prefs_common.boldfont);
442 prefs_common.smallfont = g_strdup(curfont);
443 prefs_common.normalfont = g_strdup(curfont);
444 bold_desc = pango_font_description_from_string(curfont);
445 pango_font_description_set_weight(bold_desc, PANGO_WEIGHT_BOLD);
446 prefs_common.boldfont = pango_font_description_to_string(bold_desc);
447 pango_font_description_free(bold_desc);
450 tmp = g_strdup(prefs_common.textfont);
451 if (strrchr(tmp, ' ')) {
452 *(strrchr(tmp, ' ')) = '\0';
453 new = g_strdup_printf("%s %d", tmp, size);
454 g_free(prefs_common.textfont);
455 prefs_common.textfont = new;
459 tmp = g_strdup(prefs_common.smallfont);
460 if (strrchr(tmp, ' ')) {
461 *(strrchr(tmp, ' ')) = '\0';
462 new = g_strdup_printf("%s %d", tmp, size);
463 g_free(prefs_common.smallfont);
464 prefs_common.smallfont = new;
468 tmp = g_strdup(prefs_common.normalfont);
469 if (strrchr(tmp, ' ')) {
470 *(strrchr(tmp, ' ')) = '\0';
471 new = g_strdup_printf("%s %d", tmp, size);
472 g_free(prefs_common.normalfont);
473 prefs_common.normalfont = new;
477 tmp = g_strdup(prefs_common.boldfont);
478 if (strrchr(tmp, ' ')) {
479 *(strrchr(tmp, ' ')) = '\0';
480 new = g_strdup_printf("%s %d", tmp, size);
481 g_free(prefs_common.boldfont);
482 prefs_common.boldfont = new;
487 #define XFACE "+}Axz@~a,-Yx?0Ysa|q}CLRH=89Y]\"')DSX^<6p\"d)'81yx5%G#u^o*7JG&[aPU0h1Ux.vb2yIjH83{5`/bVo|~nn/i83vE^E)qk-4W)_E.4Y=D*qvf/,Ci_=P<iY<M6"
488 #define FACE "iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAM1BMVEUAAAAcJCI\n\
489 ONl1JUi0+Z4daY2NZciPabV9ykS5kj6Wsl2ybmZOBsMjZxK2wzN3Pzczs7OsCAGN0AAAAAXRSTlM\n\
490 AQObYZgAAAAFiS0dEAIgFHUgAAAIVSURBVEjH1ZbtlqMgDIaFECoGhPu/2s0b0Lais/NzN6d1OJ7\n\
491 3yReQzrL8B5Zy3rvl9At52Pf2tv1vSMjtYj8jaa8XUyI/yn3YD6sigj/2Tf5Bn069MIsTPHvx/t5\n\
492 /3rU/6JCIY3YwGe26r/cwUfE3cFe5T28L0K5rJAUHEeYAQxs8DHojjk3M9wECU4xxjXisI8RA0gy\n\
493 oczJZJOjxiTFZVTchAnIRJrgdmEGDyFfAI3UuG5FmYTkR9RDrIC4H0SqV4pzpEcUp0HNLjwBv+jA\n\
494 dikUE5g9iBvzmu3sH2oDk4lnHd829+2Q9gj6kDqDPg7hsGwBzH02fE3ZCt6ZHmlNKIMjMeRwra5I\n\
495 ecgNoBnLGPmzaHPJIwLY8Sq2M/tLUJfj0QcqmfVXAdLSStIYF8dzWjBBb2VgvDa4mO9oc651OiUo\n\
496 BEKbZokdPATF9E9oKAjQJcJOniaPXrVZRAnVWaqIyqRoNC8ZJvgCcW8XN39RqxVP1rS8Yd4WnCdN\n\
497 aRTo2jJRDbg3vtCpEUGffgDPhqKDaSuVqYtOplFIvIcx3HUI5/MuIWl6vKyBjNlqEru8hbFXqBPA\n\
498 5TpHGIUZOePeaIyzfQ/g9Xg0opU1AvdfXM9floYhv92pPAE96OZtkPV8eivgQi9RTfwPUU36I26n\n\
499 Hy+WuCJzAT7efMSeA1TNf2/VugDz+dN139xfA5ffxGZDD+MvcP/uvyB80wzZ76wbz8gAAAABJRU5\n\
502 static void write_welcome_email(WizardWindow *wizard)
508 const gchar *mailbox = gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name));
509 Folder *folder = folder_find_from_path(mailbox);
510 FolderItem *inbox = folder ? folder->inbox:NULL;
511 gchar *file = get_tmp_file();
512 gchar enc_from_name[BUFFSIZE], enc_to_name[BUFFSIZE], enc_subject[BUFFSIZE];
514 get_rfc822_date(buf_date, sizeof(buf_date));
516 conv_encode_header_full(enc_subject, sizeof(enc_subject),
517 C_("Welcome Mail Subject", "Welcome to Claws Mail"),
518 strlen("Subject: "), FALSE, CS_INTERNAL);
519 conv_encode_header_full(enc_to_name, sizeof(enc_to_name),
520 gtk_entry_get_text(GTK_ENTRY(wizard->full_name)),
521 strlen("To: "), TRUE, CS_INTERNAL);
522 conv_encode_header_full(enc_from_name, sizeof(enc_from_name),
523 _("The Claws Mail Team"),
524 strlen("From: "), TRUE, CS_INTERNAL);
526 head = g_strdup_printf(
533 "Content-Type: text/plain; charset=UTF-8\n",
537 gtk_entry_get_text(GTK_ENTRY(wizard->email)),
538 buf_date, enc_subject, XFACE, FACE);
539 body = g_strdup_printf(
541 "Welcome to Claws Mail\n"
542 "---------------------\n"
544 "Now that you have set up your account you can fetch your\n"
545 "mail by clicking the 'Get Mail' button at the left of the\n"
548 "Claws Mail has lots of extra features accessible via plugins,\n"
549 "like anti-spam filtering and learning (via the Bogofilter or\n"
550 "SpamAssassin plugins), privacy protection (via PGP/Mime), an RSS\n"
551 "aggregator, a calendar, and much more. You can load them from\n"
552 "the menu entry '/Configuration/Plugins'.\n"
554 "You can change your Account Preferences by using the menu\n"
555 "entry '/Configuration/Preferences for current account'\n"
556 "and change the general Preferences by using\n"
557 "'/Configuration/Preferences'.\n"
559 "You can find further information in the Claws Mail manual,\n"
560 "which can be accessed by using the menu entry '/Help/Manual'\n"
561 "or online at the URL given below.\n"
569 "Mailing Lists: <%s>\n"
573 "Claws Mail is free software, released under the terms\n"
574 "of the GNU General Public License, version 3 or later, as\n"
575 "published by the Free Software Foundation, 51 Franklin Street,\n"
576 "Fifth Floor, Boston, MA 02110-1301, USA. The license can be\n"
581 "If you wish to donate to the Claws Mail project you can do\n"
583 HOMEPAGE_URI, MANUAL_URI, FAQ_URI, THEMES_URI, MAILING_LIST_URI,
584 GPL_URI, DONATE_URI);
586 msg = g_strconcat(head, body, NULL);
588 if (inbox && inbox->total_msgs == 0
589 && str_write_to_file(msg, file) >= 0) {
590 MsgFlags flags = { MSG_UNREAD|MSG_NEW, 0};
591 folder_item_add_msg(inbox, file, &flags, FALSE);
600 static gboolean wizard_write_config(WizardWindow *wizard)
602 static gboolean mailbox_ok = FALSE;
603 PrefsAccount *prefs_account = prefs_account_new();
604 GList *account_list = NULL;
605 gchar *smtp_server, *recv_server;
606 gint smtp_port, recv_port;
608 SSLType smtp_ssl_type, recv_ssl_type;
611 prefs_account->protocol = combobox_get_active_data(
612 GTK_COMBO_BOX(wizard->recv_type));
614 if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4 &&
615 !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name)))) {
616 alertpanel_error(_("Please enter the mailbox name."));
617 g_free(prefs_account);
618 gtk_notebook_set_current_page (
619 GTK_NOTEBOOK(wizard->notebook),
625 if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4) {
626 mailbox_ok = setup_write_mailbox_path(wizard->mainwin,
628 GTK_ENTRY(wizard->mailbox_name)));
634 /* alertpanel done by setup_write_mailbox_path */
635 g_free(prefs_account);
636 gtk_notebook_set_current_page (
637 GTK_NOTEBOOK(wizard->notebook),
642 if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->full_name)))
643 || !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->email)))) {
644 alertpanel_error(_("Please enter your name and email address."));
645 g_free(prefs_account);
646 gtk_notebook_set_current_page (
647 GTK_NOTEBOOK(wizard->notebook),
652 if (prefs_account->protocol != A_LOCAL) {
653 if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->recv_username)))
654 || !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)))) {
655 alertpanel_error(_("Please enter your receiving server "
657 g_free(prefs_account);
658 gtk_notebook_set_current_page (
659 GTK_NOTEBOOK(wizard->notebook),
664 if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)))) {
665 alertpanel_error(_("Please enter your username."));
666 g_free(prefs_account);
667 gtk_notebook_set_current_page (
668 GTK_NOTEBOOK(wizard->notebook),
674 if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->smtp_server)))) {
675 alertpanel_error(_("Please enter your SMTP server."));
676 g_free(prefs_account);
677 gtk_notebook_set_current_page (
678 GTK_NOTEBOOK(wizard->notebook),
683 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->smtp_auth))) {
684 if (prefs_account->protocol == A_LOCAL
685 && !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->smtp_username)))) {
686 alertpanel_error(_("Please enter your SMTP username."));
687 g_free(prefs_account);
688 gtk_notebook_set_current_page (
689 GTK_NOTEBOOK(wizard->notebook),
692 } /* if it's not local we'll use the reception server */
695 if (prefs_account->protocol != A_LOCAL)
696 prefs_account->account_name = g_strdup_printf("%s@%s",
697 gtk_entry_get_text(GTK_ENTRY(wizard->recv_username)),
698 gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
700 prefs_account->account_name = g_strdup_printf("%s",
701 gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
703 recv_server = g_strdup(gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
704 smtp_server = g_strdup(gtk_entry_get_text(GTK_ENTRY(wizard->smtp_server)));
706 if (prefs_account->protocol != A_LOCAL && strstr(recv_server, ":")) {
707 recv_port = atoi(strstr(recv_server, ":")+1);
708 *(strstr(recv_server, ":")) = '\0';
709 if (prefs_account->protocol == A_IMAP4) {
710 prefs_account->set_imapport = TRUE;
711 prefs_account->imapport = recv_port;
712 } else if (prefs_account->protocol == A_POP3) {
713 prefs_account->set_popport = TRUE;
714 prefs_account->popport = recv_port;
717 if (strstr(smtp_server, ":")) {
718 smtp_port = atoi(strstr(smtp_server, ":")+1);
719 *(strstr(smtp_server, ":")) = '\0';
720 prefs_account->set_smtpport = TRUE;
721 prefs_account->smtpport = smtp_port;
724 prefs_account->name = g_strdup(
725 gtk_entry_get_text(GTK_ENTRY(wizard->full_name)));
726 prefs_account->address = g_strdup(
727 gtk_entry_get_text(GTK_ENTRY(wizard->email)));
728 prefs_account->organization = g_strdup(
729 gtk_entry_get_text(GTK_ENTRY(wizard->organization)));
730 prefs_account->smtp_server = g_strdup(smtp_server);
732 if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4) {
734 tmp = g_path_get_basename(gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name)));
735 prefs_account->inbox = g_strdup_printf("#mh/%s/inbox",
736 (!strcmp("Mail", gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name))))
739 prefs_account->local_inbox = g_strdup(prefs_account->inbox);
740 } else if (prefs_account->protocol != A_IMAP4) {
741 if (folder_get_default_inbox())
742 prefs_account->local_inbox =
743 folder_item_get_identifier(folder_get_default_inbox());
746 if (prefs_account->protocol != A_LOCAL)
747 prefs_account->recv_server = g_strdup(recv_server);
749 prefs_account->local_mbox = g_strdup(recv_server);
754 prefs_account->userid = g_strdup(
755 gtk_entry_get_text(GTK_ENTRY(wizard->recv_username)));
756 prefs_account->passwd = g_strdup(
757 gtk_entry_get_text(GTK_ENTRY(wizard->recv_password)));
759 prefs_account->smtp_userid = g_strdup(
760 gtk_entry_get_text(GTK_ENTRY(wizard->smtp_username)));
761 prefs_account->smtp_passwd = g_strdup(
762 gtk_entry_get_text(GTK_ENTRY(wizard->smtp_password)));
763 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->smtp_auth))) {
764 prefs_account->use_smtp_auth = TRUE;
768 smtp_ssl_type = SSL_NONE;
769 recv_ssl_type = SSL_NONE;
771 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->smtp_use_ssl))) {
772 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->smtp_use_tls)))
773 smtp_ssl_type = SSL_STARTTLS;
775 smtp_ssl_type = SSL_TUNNEL;
777 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->recv_use_ssl))) {
778 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->recv_use_tls)))
779 recv_ssl_type = SSL_STARTTLS;
781 recv_ssl_type = SSL_TUNNEL;
784 prefs_account->ssl_smtp = smtp_ssl_type;
786 if (prefs_account->protocol == A_IMAP4)
787 prefs_account->ssl_imap = recv_ssl_type;
789 prefs_account->ssl_pop = recv_ssl_type;
791 prefs_account->out_ssl_client_cert_file = g_strdup(
792 gtk_entry_get_text(GTK_ENTRY(wizard->smtp_ssl_cert_file)));
793 prefs_account->out_ssl_client_cert_pass = g_strdup(
794 gtk_entry_get_text(GTK_ENTRY(wizard->smtp_ssl_cert_pass)));
795 prefs_account->in_ssl_client_cert_file = g_strdup(
796 gtk_entry_get_text(GTK_ENTRY(wizard->recv_ssl_cert_file)));
797 prefs_account->in_ssl_client_cert_pass = g_strdup(
798 gtk_entry_get_text(GTK_ENTRY(wizard->recv_ssl_cert_pass)));
800 if (prefs_account->protocol == A_IMAP4) {
801 gchar *directory = gtk_editable_get_chars(
802 GTK_EDITABLE(wizard->recv_imap_subdir), 0, -1);
803 if (directory && strlen(directory)) {
804 prefs_account->imap_dir = g_strdup(directory);
806 prefs_account->imap_subsonly =
807 gtk_toggle_button_get_active(
808 GTK_TOGGLE_BUTTON(wizard->subsonly_checkbtn));
812 account_list = g_list_append(account_list, prefs_account);
813 prefs_account_write_config_all(account_list);
814 prefs_account_free(prefs_account);
815 account_read_config_all();
817 initialize_fonts(wizard);
818 if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4)
819 write_welcome_email(wizard);
822 plugin_load_standard_plugins();
827 static GtkWidget* create_page (WizardWindow *wizard, const char * title)
835 vbox = gtk_vbox_new (FALSE, 6);
836 gtk_container_set_border_width (GTK_CONTAINER(vbox), 10);
838 /* create the titlebar */
839 hbox = gtk_hbox_new (FALSE, 12);
840 image = stock_pixmap_widget(wizard->window,
841 STOCK_PIXMAP_CLAWS_MAIL_ICON);
842 gtk_box_pack_start (GTK_BOX(hbox), image, FALSE, FALSE, 0);
843 title_string = g_strconcat ("<span size=\"xx-large\" weight=\"ultrabold\">", title ? title : "", "</span>", NULL);
844 w = gtk_label_new (title_string);
845 gtk_label_set_use_markup (GTK_LABEL(w), TRUE);
846 g_free (title_string);
847 gtk_box_pack_start (GTK_BOX(hbox), w, FALSE, FALSE, 0);
849 /* pack the titlebar */
850 gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
852 /* pack the separator */
853 gtk_box_pack_start (GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
856 w = gtk_alignment_new (0, 0, 0, 0);
857 gtk_widget_set_size_request (w, 0, 6);
858 gtk_box_pack_start (GTK_BOX(vbox), w, FALSE, FALSE, 0);
863 #define PACK_BOX(hbox,text,entry) { \
864 GtkWidget *label = gtk_label_new(text); \
865 gtk_label_set_use_markup(GTK_LABEL(label), TRUE); \
866 if (GTK_IS_MISC(label)) \
867 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); \
868 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); \
869 gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0); \
872 static gchar *get_default_server(WizardWindow * wizard, const gchar *type)
874 if (!strcmp(type, "smtp")) {
875 if (!tmpl.smtpserver || !strlen(tmpl.smtpserver))
876 return g_strconcat(type, ".", tmpl.domain, NULL);
878 return g_strdup(tmpl.smtpserver);
880 if (!tmpl.recvserver || !strlen(tmpl.recvserver))
881 return g_strconcat(type, ".", tmpl.domain, NULL);
883 return g_strdup(tmpl.recvserver);
887 static gchar *get_default_account(WizardWindow * wizard)
889 gchar *result = NULL;
891 if (!tmpl.recvuser || !strlen(tmpl.recvuser)) {
892 result = gtk_editable_get_chars(
893 GTK_EDITABLE(wizard->email), 0, -1);
895 if (strstr(result, "@")) {
896 *(strstr(result,"@")) = '\0';
899 result = g_strdup(tmpl.recvuser);
904 static gchar *get_default_smtp_account(WizardWindow * wizard)
906 gchar *result = NULL;
908 if (!tmpl.smtpuser || !strlen(tmpl.smtpuser)) {
911 result = g_strdup(tmpl.smtpuser);
916 static void wizard_email_changed(GtkWidget *widget, gpointer data)
918 WizardWindow *wizard = (WizardWindow *)data;
919 RecvProtocol protocol;
921 protocol = combobox_get_active_data(GTK_COMBO_BOX(wizard->recv_type));
923 text = get_default_server(wizard, "smtp");
924 gtk_entry_set_text(GTK_ENTRY(wizard->smtp_server), text);
927 text = get_default_account(wizard);
928 gtk_entry_set_text(GTK_ENTRY(wizard->recv_username), text);
931 if (protocol == A_POP3) {
932 text = get_default_server(wizard, "pop");
933 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
935 } else if (protocol == A_IMAP4) {
936 text = get_default_server(wizard, "imap");
937 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
939 } else if (protocol == A_LOCAL) {
940 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), tmpl.mboxfile?tmpl.mboxfile:"");
945 static GtkWidget* user_page (WizardWindow * wizard)
947 GtkWidget *table = gtk_table_new(1,1, FALSE);
950 GtkWidget *user_table;
952 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
953 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
955 vbox = gtk_vbox_new(FALSE, VSPACING_NARROW);
956 gtk_container_set_border_width(GTK_CONTAINER(vbox), VSPACING_NARROW_2);
958 gtk_table_attach(GTK_TABLE(table), vbox, 0,1,1,2,
959 GTK_EXPAND|GTK_FILL, 0, 0, 0);
961 user_table = gtk_table_new(3, 2, FALSE);
962 gtk_table_set_row_spacings(GTK_TABLE(user_table), VSPACING_NARROW);
963 gtk_box_pack_start(GTK_BOX(vbox), user_table, FALSE, FALSE, 0);
965 label = gtk_label_new(_("<span weight=\"bold\">Your name:</span>"));
966 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
967 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
968 gtk_table_attach(GTK_TABLE(user_table), label, 0,1,0,1,
969 GTK_FILL, 0, VSPACING_NARROW, 0);
970 wizard->full_name = gtk_entry_new();
971 gtk_entry_set_text(GTK_ENTRY(wizard->full_name), tmpl.name?tmpl.name:"");
972 gtk_table_attach(GTK_TABLE(user_table), wizard->full_name, 1,2,0,1,
973 GTK_EXPAND|GTK_FILL, 0, 0, 0);
975 label = gtk_label_new(_("<span weight=\"bold\">Your email address:</span>"));
976 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
977 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
978 gtk_table_attach(GTK_TABLE(user_table), label, 0,1,1,2,
979 GTK_FILL, 0, VSPACING_NARROW, 0);
980 wizard->email = gtk_entry_new();
981 gtk_entry_set_text(GTK_ENTRY(wizard->email), tmpl.email?tmpl.email:"");
982 gtk_table_attach(GTK_TABLE(user_table), wizard->email, 1,2,1,2,
983 GTK_EXPAND|GTK_FILL, 0, 0, 0);
985 label = gtk_label_new(_("Your organization:"));
986 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
987 gtk_table_attach(GTK_TABLE(user_table), label, 0,1,2,3,
988 GTK_FILL, 0, VSPACING_NARROW, 0);
989 wizard->organization = gtk_entry_new();
990 gtk_entry_set_text(GTK_ENTRY(wizard->organization), tmpl.organization?tmpl.organization:"");
991 gtk_table_attach(GTK_TABLE(user_table), wizard->organization, 1,2,2,3,
992 GTK_EXPAND|GTK_FILL, 0, 0, 0);
994 g_signal_connect(G_OBJECT(wizard->email), "changed",
995 G_CALLBACK(wizard_email_changed),
1000 static GtkWidget* mailbox_page (WizardWindow * wizard)
1002 GtkWidget *table = gtk_table_new(1,1, FALSE);
1006 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
1007 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
1009 vbox = gtk_vbox_new(FALSE, VSPACING_NARROW);
1010 gtk_container_set_border_width(GTK_CONTAINER(vbox), VSPACING_NARROW_2);
1012 gtk_table_attach(GTK_TABLE(table), vbox, 0,1,1,2,
1013 GTK_EXPAND|GTK_FILL, 0, 0, 0);
1015 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1016 gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1018 wizard->mailbox_label = gtk_label_new(_("<span weight=\"bold\">Mailbox name:</span>"));
1019 gtk_label_set_use_markup(GTK_LABEL(wizard->mailbox_label), TRUE);
1020 if (GTK_IS_MISC(wizard->mailbox_label))
1021 gtk_misc_set_alignment(GTK_MISC(wizard->mailbox_label), 1, 0.5);
1022 wizard->mailbox_name = gtk_entry_new();
1024 gtk_entry_set_text(GTK_ENTRY(wizard->mailbox_name), tmpl.mailbox?tmpl.mailbox:"");
1026 CLAWS_SET_TIP(wizard->mailbox_name, _("You can also specify an absolute path, for example: "
1027 "\"/home/john/Documents/Mail\""));
1029 gtk_box_pack_start(GTK_BOX(hbox), wizard->mailbox_label, FALSE, FALSE, 0);
1030 gtk_box_pack_start(GTK_BOX(hbox), wizard->mailbox_name, TRUE, TRUE, 0);
1035 static void smtp_auth_changed (GtkWidget *btn, gpointer data)
1037 WizardWindow *wizard = (WizardWindow *)data;
1038 gboolean do_auth = gtk_toggle_button_get_active(
1039 GTK_TOGGLE_BUTTON(wizard->smtp_auth));
1040 gtk_widget_set_sensitive(wizard->smtp_username, do_auth);
1041 gtk_widget_set_sensitive(wizard->smtp_username_label, do_auth);
1042 gtk_widget_set_sensitive(wizard->smtp_password, do_auth);
1043 gtk_widget_set_sensitive(wizard->smtp_password_label, do_auth);
1047 static void cert_browse_cb(GtkWidget *widget, gpointer data)
1049 GtkEntry *dest = GTK_ENTRY(data);
1051 gchar *utf8_filename;
1053 filename = filesel_select_file_open(_("Select certificate file"), NULL);
1054 if (!filename) return;
1056 utf8_filename = g_filename_to_utf8(filename, -1, NULL, NULL, NULL);
1057 if (!utf8_filename) {
1058 g_warning("cert_browse_cb(): failed to convert character set.");
1059 utf8_filename = g_strdup(filename);
1061 gtk_entry_set_text(dest, utf8_filename);
1062 g_free(utf8_filename);
1066 static GtkWidget* smtp_page (WizardWindow * wizard)
1068 GtkWidget *table = gtk_table_new(1, 1, FALSE);
1071 GtkWidget *hbox_spc;
1072 GtkWidget *smtp_auth_table;
1076 GtkWidget *smtp_cert_table;
1080 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
1081 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
1083 vbox = gtk_vbox_new(FALSE, VSPACING_NARROW);
1084 gtk_container_set_border_width(GTK_CONTAINER(vbox), VSPACING_NARROW_2);
1086 gtk_table_attach(GTK_TABLE(table), vbox, 0,1,1,2,
1087 GTK_EXPAND|GTK_FILL, 0, 0, 0);
1089 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1090 gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1091 wizard->smtp_server = gtk_entry_new();
1092 text = get_default_server(wizard, "smtp");
1093 gtk_entry_set_text(GTK_ENTRY(wizard->smtp_server), text);
1096 CLAWS_SET_TIP(wizard->smtp_server,
1097 _("You can specify the port number by appending it at the end: "
1098 "\"mail.example.com:25\""));
1100 PACK_BOX(hbox, _("<span weight=\"bold\">SMTP server address:</span>"),
1101 wizard->smtp_server);
1103 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1104 gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1105 wizard->smtp_auth = gtk_check_button_new_with_label(
1106 _("Use authentication"));
1107 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->smtp_auth),
1109 g_signal_connect(G_OBJECT(wizard->smtp_auth), "toggled",
1110 G_CALLBACK(smtp_auth_changed),
1112 gtk_box_pack_start(GTK_BOX(hbox), wizard->smtp_auth, FALSE, FALSE, 0);
1114 label = gtk_label_new(_("<span size=\"small\">(empty to use the same as receive)</span>"));
1115 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
1116 SET_TOGGLE_SENSITIVITY (wizard->smtp_auth, label);
1117 gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1119 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1120 gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1121 hbox_spc = gtk_hbox_new (FALSE, 0);
1122 gtk_widget_set_size_request (hbox_spc, 12, -1);
1123 gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
1124 smtp_auth_table = gtk_table_new(2, 2, FALSE);
1125 SET_TOGGLE_SENSITIVITY (wizard->smtp_auth, smtp_auth_table);
1126 gtk_box_pack_start(GTK_BOX(hbox), smtp_auth_table, TRUE, TRUE, 0);
1128 wizard->smtp_username_label = gtk_label_new(_("SMTP username:"));
1129 gtk_misc_set_alignment(GTK_MISC(wizard->smtp_username_label), 1, 0.5);
1130 gtk_table_attach(GTK_TABLE(smtp_auth_table), wizard->smtp_username_label, 0,1,0,1,
1131 GTK_FILL, 0, VSPACING_NARROW, 0);
1132 text = get_default_smtp_account(wizard);
1133 wizard->smtp_username = gtk_entry_new();
1134 gtk_entry_set_text(GTK_ENTRY(wizard->smtp_username), text);
1136 gtk_table_attach(GTK_TABLE(smtp_auth_table), wizard->smtp_username, 1,2,0,1,
1137 GTK_EXPAND|GTK_FILL, 0, 0, 0);
1139 wizard->smtp_password_label = gtk_label_new(_("SMTP password:"));
1140 gtk_misc_set_alignment(GTK_MISC(wizard->smtp_password_label), 1, 0.5);
1141 gtk_table_attach(GTK_TABLE(smtp_auth_table), wizard->smtp_password_label, 0,1,1,2,
1142 GTK_FILL, 0, VSPACING_NARROW, 0);
1143 wizard->smtp_password = gtk_entry_new();
1144 gtk_entry_set_text(GTK_ENTRY(wizard->smtp_password), tmpl.smtppass?tmpl.smtppass:"");
1145 gtk_entry_set_visibility(GTK_ENTRY(wizard->smtp_password), FALSE);
1146 gtk_table_attach(GTK_TABLE(smtp_auth_table), wizard->smtp_password, 1,2,1,2,
1147 GTK_EXPAND|GTK_FILL, 0, 0, 0);
1149 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1150 gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1151 wizard->smtp_use_ssl = gtk_check_button_new_with_label(
1152 _("Use SSL to connect to SMTP server"));
1153 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->smtp_use_ssl),
1155 gtk_box_pack_start(GTK_BOX(hbox), wizard->smtp_use_ssl, FALSE, FALSE, 0);
1157 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1158 gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1159 hbox_spc = gtk_hbox_new (FALSE, 0);
1160 gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
1161 gtk_widget_set_size_request (hbox_spc, 12, -1);
1162 wizard->smtp_use_tls = gtk_check_button_new_with_label(
1163 _("Use SSL via STARTTLS"));
1164 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->smtp_use_tls),
1166 gtk_box_pack_start(GTK_BOX(hbox), wizard->smtp_use_tls, FALSE, FALSE, 0);
1167 SET_TOGGLE_SENSITIVITY (wizard->smtp_use_ssl, wizard->smtp_use_tls);
1169 smtp_cert_table = gtk_table_new(3,3, FALSE);
1170 gtk_box_pack_start (GTK_BOX(vbox), smtp_cert_table, FALSE, FALSE, 4);
1171 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1172 hbox_spc = gtk_hbox_new (FALSE, 0);
1173 gtk_widget_set_size_request (hbox_spc, 12, -1);
1174 gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
1175 label = gtk_label_new(_("Client SSL certificate (optional)"));
1176 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1177 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
1178 gtk_table_attach(GTK_TABLE(smtp_cert_table), hbox, 0, 3, 0, 1, GTK_FILL, 0, 0, 0);
1179 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1180 hbox_spc = gtk_hbox_new (FALSE, 0);
1181 gtk_widget_set_size_request (hbox_spc, 12, -1);
1182 gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
1183 label = gtk_label_new(_("File"));
1184 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
1185 gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
1186 gtk_table_attach(GTK_TABLE(smtp_cert_table), hbox, 0, 1, 1, 2,
1187 GTK_FILL, 0, VSPACING_NARROW, 0);
1188 wizard->smtp_ssl_cert_file = gtk_entry_new();
1189 gtk_entry_set_text(GTK_ENTRY(wizard->smtp_ssl_cert_file), tmpl.smtpssl_cert?tmpl.smtpssl_cert:"");
1190 gtk_table_attach(GTK_TABLE(smtp_cert_table), wizard->smtp_ssl_cert_file, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
1191 button = gtkut_get_browse_file_btn(_("Browse"));
1192 gtk_table_attach(GTK_TABLE(smtp_cert_table), button, 2, 3, 1, 2,
1193 GTK_FILL, 0, VSPACING_NARROW, 0);
1194 g_signal_connect(G_OBJECT(button), "clicked",
1195 G_CALLBACK(cert_browse_cb), wizard->smtp_ssl_cert_file);
1197 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1198 hbox_spc = gtk_hbox_new (FALSE, 0);
1199 gtk_widget_set_size_request (hbox_spc, 12, -1);
1200 gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
1201 label = gtk_label_new(_("Password"));
1202 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
1203 gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
1204 gtk_table_attach(GTK_TABLE(smtp_cert_table), hbox, 0, 1, 2, 3,
1205 GTK_FILL, 0, VSPACING_NARROW, 0);
1206 wizard->smtp_ssl_cert_pass = gtk_entry_new();
1207 gtk_entry_set_visibility(GTK_ENTRY(wizard->smtp_ssl_cert_pass), FALSE);
1208 gtk_entry_set_text(GTK_ENTRY(wizard->smtp_ssl_cert_pass), tmpl.smtpssl_cert_pass?tmpl.smtpssl_cert_pass:"");
1209 gtk_table_attach(GTK_TABLE(smtp_cert_table), wizard->smtp_ssl_cert_pass, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
1210 SET_TOGGLE_SENSITIVITY (wizard->smtp_use_ssl, smtp_cert_table);
1211 wizard->smtp_cert_table = smtp_cert_table;
1213 smtp_auth_changed(NULL, wizard);
1217 static void wizard_protocol_change(WizardWindow *wizard, RecvProtocol protocol)
1221 if (protocol == A_POP3) {
1222 text = get_default_server(wizard, "pop");
1223 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
1224 gtk_widget_hide(wizard->recv_imap_label);
1225 gtk_widget_hide(wizard->recv_imap_subdir);
1226 gtk_widget_hide(wizard->subsonly_checkbtn);
1227 gtk_widget_show(wizard->recv_username);
1228 gtk_widget_show(wizard->recv_password);
1229 gtk_widget_show(wizard->recv_username_label);
1230 gtk_widget_show(wizard->recv_password_label);
1231 gtk_widget_hide(wizard->no_imap_warning);
1233 gtk_widget_show(wizard->recv_use_ssl);
1234 gtk_widget_show(wizard->recv_use_tls);
1235 gtk_widget_show(wizard->recv_cert_table);
1237 gtk_label_set_text(GTK_LABEL(wizard->recv_label), _("<span weight=\"bold\">Server address:</span>"));
1238 gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
1239 gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, TRUE);
1241 if (wizard->create_mailbox) {
1242 gtk_widget_show(wizard->mailbox_label);
1243 gtk_widget_show(wizard->mailbox_name);
1245 } else if (protocol == A_IMAP4) {
1246 #ifdef HAVE_LIBETPAN
1247 text = get_default_server(wizard, "imap");
1248 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
1249 gtk_widget_show(wizard->recv_imap_label);
1250 gtk_widget_show(wizard->recv_imap_subdir);
1251 gtk_widget_show(wizard->subsonly_checkbtn);
1252 gtk_widget_show(wizard->recv_username);
1253 gtk_widget_show(wizard->recv_password);
1254 gtk_widget_show(wizard->recv_username_label);
1255 gtk_widget_show(wizard->recv_password_label);
1256 gtk_widget_hide(wizard->no_imap_warning);
1258 gtk_widget_show(wizard->recv_use_ssl);
1259 gtk_widget_show(wizard->recv_use_tls);
1260 gtk_widget_show(wizard->recv_cert_table);
1262 gtk_label_set_text(GTK_LABEL(wizard->recv_label), _("<span weight=\"bold\">Server address:</span>"));
1263 gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
1264 gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, TRUE);
1266 if (wizard->create_mailbox) {
1267 gtk_widget_hide(wizard->mailbox_label);
1268 gtk_widget_hide(wizard->mailbox_name);
1271 gtk_widget_hide(wizard->recv_imap_label);
1272 gtk_widget_hide(wizard->recv_imap_subdir);
1273 gtk_widget_hide(wizard->subsonly_checkbtn);
1274 gtk_widget_hide(wizard->recv_username);
1275 gtk_widget_hide(wizard->recv_password);
1276 gtk_widget_hide(wizard->recv_username_label);
1277 gtk_widget_hide(wizard->recv_password_label);
1278 gtk_widget_show(wizard->no_imap_warning);
1279 if (wizard->create_mailbox) {
1280 gtk_widget_hide(wizard->mailbox_label);
1281 gtk_widget_hide(wizard->mailbox_name);
1284 gtk_widget_hide(wizard->recv_use_ssl);
1285 gtk_widget_hide(wizard->recv_use_tls);
1286 gtk_widget_hide(wizard->recv_cert_table);
1288 gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, FALSE);
1290 } else if (protocol == A_LOCAL) {
1291 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), tmpl.mboxfile?tmpl.mboxfile:"");
1292 gtk_label_set_text(GTK_LABEL(wizard->recv_label), _("<span weight=\"bold\">Local mailbox:</span>"));
1293 gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
1294 gtk_widget_hide(wizard->no_imap_warning);
1295 gtk_widget_hide(wizard->recv_imap_label);
1296 gtk_widget_hide(wizard->recv_imap_subdir);
1297 gtk_widget_hide(wizard->subsonly_checkbtn);
1298 gtk_widget_hide(wizard->recv_username);
1299 gtk_widget_hide(wizard->recv_password);
1300 gtk_widget_hide(wizard->recv_username_label);
1301 gtk_widget_hide(wizard->recv_password_label);
1303 gtk_widget_hide(wizard->recv_use_ssl);
1304 gtk_widget_hide(wizard->recv_use_tls);
1305 gtk_widget_hide(wizard->recv_cert_table);
1307 if (wizard->create_mailbox) {
1308 gtk_widget_show(wizard->mailbox_label);
1309 gtk_widget_show(wizard->mailbox_name);
1311 gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, TRUE);
1315 static void wizard_protocol_changed(GtkComboBox *combo, gpointer data)
1317 WizardWindow *wizard = (WizardWindow *)data;
1318 RecvProtocol protocol = combobox_get_active_data(combo);
1320 wizard_protocol_change(wizard, protocol);
1323 static GtkWidget* recv_page (WizardWindow * wizard)
1325 GtkWidget *table = gtk_table_new(1,1, FALSE);
1328 GtkWidget *hbox_spc;
1329 GtkWidget *recv_table;
1333 GtkWidget *recv_cert_table;
1335 GtkListStore *store;
1340 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
1341 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
1343 vbox = gtk_vbox_new(FALSE, VSPACING_NARROW);
1344 gtk_container_set_border_width(GTK_CONTAINER(vbox), VSPACING_NARROW_2);
1346 gtk_table_attach(GTK_TABLE(table), vbox, 0,1,1,2,
1347 GTK_EXPAND|GTK_FILL, 0, 0, 0);
1349 recv_table = gtk_table_new(4, 2, FALSE);
1350 gtk_box_pack_start(GTK_BOX(vbox), recv_table, FALSE, FALSE, 0);
1352 label = gtk_label_new(_("<span weight=\"bold\">Server type:</span>"));
1353 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
1354 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
1355 gtk_table_attach(GTK_TABLE(recv_table), label, 0,1,0,1,
1356 GTK_FILL, 0, VSPACING_NARROW, 0);
1357 wizard->recv_type = gtkut_sc_combobox_create(NULL, FALSE);
1358 store = GTK_LIST_STORE(gtk_combo_box_get_model(
1359 GTK_COMBO_BOX(wizard->recv_type)));
1361 COMBOBOX_ADD(store, _("POP3"), A_POP3);
1362 COMBOBOX_ADD(store, _("IMAP"), A_IMAP4);
1363 COMBOBOX_ADD(store, _("Local mbox file"), A_LOCAL);
1365 switch(tmpl.recvtype) {
1378 gtk_combo_box_set_active(GTK_COMBO_BOX (wizard->recv_type), index);
1379 g_signal_connect(G_OBJECT(wizard->recv_type), "changed",
1380 G_CALLBACK(wizard_protocol_changed),
1382 gtk_table_attach(GTK_TABLE(recv_table), wizard->recv_type, 1,2,0,1,
1383 GTK_EXPAND|GTK_FILL, 0, 0, 0);
1385 wizard->recv_label = gtk_label_new(_("<span weight=\"bold\">Server address:</span>"));
1386 gtk_misc_set_alignment(GTK_MISC(wizard->recv_label), 1, 0.5);
1387 gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
1388 gtk_table_attach(GTK_TABLE(recv_table), wizard->recv_label, 0,1,1,2,
1389 GTK_FILL, 0, VSPACING_NARROW, 0);
1390 wizard->recv_server = gtk_entry_new();
1391 text = get_default_server(wizard, "pop");
1392 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
1395 CLAWS_SET_TIP(wizard->recv_server,
1396 _("You can specify the port number by appending it at the end: "
1397 "\"mail.example.com:110\""));
1398 gtk_table_attach(GTK_TABLE(recv_table), wizard->recv_server, 1,2,1,2,
1399 GTK_EXPAND|GTK_FILL, 0, 0, 0);
1401 wizard->recv_username_label = gtk_label_new(_("<span weight=\"bold\">Username:</span>"));
1402 gtk_misc_set_alignment(GTK_MISC(wizard->recv_username_label), 1, 0.5);
1403 gtk_label_set_use_markup(GTK_LABEL(wizard->recv_username_label), TRUE);
1404 gtk_table_attach(GTK_TABLE(recv_table), wizard->recv_username_label, 0,1,2,3,
1405 GTK_FILL, 0, VSPACING_NARROW, 0);
1406 wizard->recv_username = gtk_entry_new();
1407 text = get_default_account(wizard);
1408 gtk_entry_set_text(GTK_ENTRY(wizard->recv_username), text);
1410 gtk_table_attach(GTK_TABLE(recv_table), wizard->recv_username, 1,2,2,3,
1411 GTK_EXPAND|GTK_FILL, 0, 0, 0);
1413 wizard->recv_password_label = gtk_label_new(_("Password:"));
1414 gtk_misc_set_alignment(GTK_MISC(wizard->recv_password_label), 1, 0.5);
1415 gtk_table_attach(GTK_TABLE(recv_table), wizard->recv_password_label, 0,1,3,4,
1416 GTK_FILL, 0, VSPACING_NARROW, 0);
1417 wizard->recv_password = gtk_entry_new();
1418 gtk_entry_set_text(GTK_ENTRY(wizard->recv_password), tmpl.recvpass?tmpl.recvpass:"");
1419 gtk_entry_set_visibility(GTK_ENTRY(wizard->recv_password), FALSE);
1420 gtk_table_attach(GTK_TABLE(recv_table), wizard->recv_password, 1,2,3,4,
1421 GTK_EXPAND|GTK_FILL, 0, 0, 0);
1423 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1424 gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1425 wizard->recv_use_ssl = gtk_check_button_new_with_label(
1426 _("Use SSL to connect to receiving server"));
1427 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->recv_use_ssl),
1429 gtk_box_pack_start(GTK_BOX(hbox), wizard->recv_use_ssl, FALSE, FALSE, 0);
1431 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1432 gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1433 hbox_spc = gtk_hbox_new (FALSE, 0);
1434 gtk_widget_set_size_request (hbox_spc, 12, -1);
1435 gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
1436 wizard->recv_use_tls = gtk_check_button_new_with_label(
1437 _("Use SSL via STARTTLS"));
1438 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->recv_use_tls),
1440 gtk_box_pack_start(GTK_BOX(hbox), wizard->recv_use_tls, FALSE, FALSE, 0);
1441 SET_TOGGLE_SENSITIVITY (wizard->recv_use_ssl, wizard->recv_use_tls);
1443 recv_cert_table = gtk_table_new(3,3, FALSE);
1444 gtk_box_pack_start (GTK_BOX(vbox), recv_cert_table, FALSE, FALSE, 4);
1445 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1446 hbox_spc = gtk_hbox_new (FALSE, 0);
1447 gtk_widget_set_size_request (hbox_spc, 12, -1);
1448 gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
1449 label = gtk_label_new(_("Client SSL certificate (optional)"));
1450 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1451 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
1452 gtk_table_attach(GTK_TABLE(recv_cert_table), hbox, 0, 3, 0, 1, GTK_FILL, 0, 0, 0);
1453 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1454 hbox_spc = gtk_hbox_new (FALSE, 0);
1455 gtk_widget_set_size_request (hbox_spc, 12, -1);
1456 gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
1457 label = gtk_label_new(_("File"));
1458 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
1459 gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
1460 gtk_table_attach(GTK_TABLE(recv_cert_table), hbox, 0, 1, 1, 2,
1461 GTK_FILL, 0, VSPACING_NARROW, 0);
1462 wizard->recv_ssl_cert_file = gtk_entry_new();
1463 gtk_entry_set_text(GTK_ENTRY(wizard->recv_ssl_cert_file), tmpl.recvssl_cert?tmpl.recvssl_cert:"");
1464 gtk_table_attach(GTK_TABLE(recv_cert_table), wizard->recv_ssl_cert_file, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
1465 button = gtkut_get_browse_file_btn(_("Browse"));
1466 gtk_table_attach(GTK_TABLE(recv_cert_table), button, 2, 3, 1, 2,
1467 GTK_FILL, 0, VSPACING_NARROW, 0);
1468 g_signal_connect(G_OBJECT(button), "clicked",
1469 G_CALLBACK(cert_browse_cb), wizard->recv_ssl_cert_file);
1471 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1472 hbox_spc = gtk_hbox_new (FALSE, 0);
1473 gtk_widget_set_size_request (hbox_spc, 12, -1);
1474 gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
1475 label = gtk_label_new(_("Password"));
1476 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
1477 gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
1478 gtk_table_attach(GTK_TABLE(recv_cert_table), hbox, 0, 1, 2, 3,
1479 GTK_FILL, 0, VSPACING_NARROW, 0);
1480 wizard->recv_ssl_cert_pass = gtk_entry_new();
1481 gtk_entry_set_visibility(GTK_ENTRY(wizard->recv_ssl_cert_pass), FALSE);
1482 gtk_entry_set_text(GTK_ENTRY(wizard->recv_ssl_cert_pass), tmpl.recvssl_cert_pass?tmpl.recvssl_cert_pass:"");
1483 gtk_table_attach(GTK_TABLE(recv_cert_table), wizard->recv_ssl_cert_pass, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
1484 SET_TOGGLE_SENSITIVITY (wizard->recv_use_ssl, recv_cert_table);
1485 wizard->recv_cert_table = recv_cert_table;
1487 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1488 gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1489 wizard->recv_imap_subdir = gtk_entry_new();
1490 gtk_entry_set_text(GTK_ENTRY(wizard->recv_imap_subdir), tmpl.imapdir?tmpl.imapdir:"");
1491 wizard->recv_imap_label = gtk_label_new(_("IMAP server directory:"));
1492 gtk_misc_set_alignment(GTK_MISC(wizard->recv_imap_label), 1, 0.5);
1493 gtk_box_pack_start(GTK_BOX(hbox), wizard->recv_imap_label, FALSE, FALSE, 0);
1494 gtk_box_pack_start(GTK_BOX(hbox), wizard->recv_imap_subdir, TRUE, TRUE, 0);
1496 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1497 gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1498 hbox_spc = gtk_hbox_new (FALSE, 0);
1499 gtk_widget_set_size_request (hbox_spc, 12, -1);
1500 gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
1501 wizard->subsonly_checkbtn = gtk_check_button_new_with_label(
1502 _("Show only subscribed folders"));
1503 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->subsonly_checkbtn),
1505 gtk_box_pack_start(GTK_BOX(hbox), wizard->subsonly_checkbtn, FALSE, FALSE, 0);
1507 hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
1508 gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1509 wizard->no_imap_warning = gtk_label_new(_(
1510 "<span weight=\"bold\">Warning: this version of Claws Mail\n"
1511 "has been built without IMAP support.</span>"));
1512 gtk_label_set_use_markup(GTK_LABEL(wizard->no_imap_warning), TRUE);
1513 gtk_box_pack_start(GTK_BOX(hbox), wizard->no_imap_warning, FALSE, FALSE, 0);
1519 wizard_response_cb (GtkDialog * dialog, int response, gpointer data)
1521 WizardWindow * wizard = (WizardWindow *)data;
1522 int current_page, num_pages;
1523 gboolean skip_mailbox_page = FALSE;
1524 gint protocol = combobox_get_active_data(GTK_COMBO_BOX(wizard->recv_type));
1526 if (protocol == A_IMAP4) {
1527 skip_mailbox_page = TRUE;
1530 num_pages = g_slist_length(wizard->pages);
1532 current_page = gtk_notebook_get_current_page (
1533 GTK_NOTEBOOK(wizard->notebook));
1534 if (response == CANCEL)
1536 wizard->result = FALSE;
1537 wizard->finished = TRUE;
1538 gtk_widget_destroy (GTK_WIDGET(dialog));
1540 else if (response == FINISHED)
1542 if (!wizard_write_config(wizard)) {
1543 current_page = gtk_notebook_get_current_page (
1544 GTK_NOTEBOOK(wizard->notebook));
1547 wizard->result = TRUE;
1548 wizard->finished = TRUE;
1549 gtk_widget_destroy (GTK_WIDGET(dialog));
1553 if (response == GO_BACK)
1555 if (current_page > 0) {
1557 if (current_page == MAILBOX_PAGE && skip_mailbox_page) {
1561 gtk_notebook_set_current_page (
1562 GTK_NOTEBOOK(wizard->notebook),
1566 else if (response == GO_FORWARD)
1568 if (current_page < (num_pages-1)) {
1570 if (current_page == MAILBOX_PAGE && skip_mailbox_page) {
1574 gtk_notebook_set_current_page (
1575 GTK_NOTEBOOK(wizard->notebook),
1580 gtk_dialog_set_response_sensitive (dialog, GO_BACK,
1582 gtk_dialog_set_response_sensitive (dialog, GO_FORWARD,
1583 current_page < (num_pages - 1));
1584 if (current_page == (num_pages -1)) {
1585 gtk_dialog_set_response_sensitive (dialog, FINISHED, TRUE);
1586 gtk_dialog_set_default_response(GTK_DIALOG(wizard->window), FINISHED);
1588 gtk_dialog_set_response_sensitive (dialog, FINISHED, FALSE);
1589 gtk_dialog_set_default_response(GTK_DIALOG(wizard->window), GO_FORWARD);
1595 static gint wizard_close_cb(GtkWidget *widget, GdkEventAny *event,
1598 WizardWindow *wizard = (WizardWindow *)data;
1599 wizard->result = FALSE;
1600 wizard->finished = TRUE;
1605 #define PACK_WARNING(text) { \
1606 label = gtk_label_new(text); \
1607 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); \
1608 gtk_box_pack_end(GTK_BOX(widget), label, FALSE, FALSE, 0); \
1611 gboolean run_wizard(MainWindow *mainwin, gboolean create_mailbox) {
1612 WizardWindow *wizard = g_new0(WizardWindow, 1);
1616 GtkWidget *scrolled_window;
1621 wizard->mainwin = mainwin;
1622 wizard->create_mailbox = create_mailbox;
1624 gtk_widget_hide(mainwin->window);
1626 wizard_read_defaults();
1628 wizard->window = gtk_dialog_new_with_buttons (_("Claws Mail Setup Wizard"),
1630 GTK_STOCK_GO_BACK, GO_BACK,
1631 GTK_STOCK_GO_FORWARD, GO_FORWARD,
1632 GTK_STOCK_SAVE, FINISHED,
1633 GTK_STOCK_CANCEL, CANCEL,
1635 gtk_widget_set_size_request(wizard->window, -1, 480);
1636 gtk_window_set_position(GTK_WINDOW(wizard->window), GTK_WIN_POS_CENTER);
1638 g_signal_connect(wizard->window, "response",
1639 G_CALLBACK(wizard_response_cb), wizard);
1640 gtk_widget_realize(wizard->window);
1641 gtk_dialog_set_default_response(GTK_DIALOG(wizard->window),
1643 gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
1645 gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
1647 gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
1649 gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
1652 wizard->notebook = gtk_notebook_new();
1653 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(wizard->notebook), FALSE);
1654 gtk_notebook_set_show_border(GTK_NOTEBOOK(wizard->notebook), FALSE);
1655 gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(wizard->window))),
1656 wizard->notebook, TRUE, TRUE, 0);
1658 wizard->pages = NULL;
1660 /*welcome page: 0 */
1662 page = create_page(wizard, _("Welcome to Claws Mail"));
1664 wizard->pages = g_slist_append(wizard->pages, page);
1665 widget = stock_pixmap_widget(wizard->window,
1666 STOCK_PIXMAP_CLAWS_MAIL_LOGO);
1668 gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
1670 text = g_strdup(_("Welcome to the Claws Mail setup wizard.\n\n"
1671 "We will begin by defining some basic "
1672 "information about you and your most common "
1673 "mail options so that you can start to use "
1674 "Claws Mail in less than five minutes."));
1675 widget = gtk_label_new(text);
1676 gtk_label_set_line_wrap(GTK_LABEL(widget), TRUE);
1677 gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
1683 widget = create_page (wizard, _("About You"));
1684 scrolled_window = gtk_scrolled_window_new (NULL, NULL);
1685 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
1686 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
1687 gtk_box_pack_start(GTK_BOX(widget), scrolled_window, TRUE, TRUE, 0);
1689 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window),
1691 PACK_WARNING(_("Bold fields must be completed"));
1693 wizard->pages = g_slist_append(wizard->pages, widget);
1695 /* recv+auth page: 2 */
1698 widget = create_page (wizard, _("Receiving mail"));
1699 scrolled_window = gtk_scrolled_window_new (NULL, NULL);
1700 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
1701 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
1702 gtk_box_pack_start(GTK_BOX(widget), scrolled_window, TRUE, TRUE, 0);
1704 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window),
1706 PACK_WARNING(_("Bold fields must be completed"));
1708 wizard->pages = g_slist_append(wizard->pages, widget);
1713 widget = create_page (wizard, _("Sending mail"));
1714 scrolled_window = gtk_scrolled_window_new (NULL, NULL);
1715 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
1716 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
1717 gtk_box_pack_start(GTK_BOX(widget), scrolled_window, TRUE, TRUE, 0);
1719 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window),
1721 PACK_WARNING(_("Bold fields must be completed"));
1723 wizard->pages = g_slist_append(wizard->pages, widget);
1725 /* mailbox page: 4 */
1726 if (create_mailbox) {
1729 widget = create_page (wizard, _("Saving mail on disk"));
1730 scrolled_window = gtk_scrolled_window_new (NULL, NULL);
1731 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
1732 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
1733 gtk_box_pack_start(GTK_BOX(widget), scrolled_window, TRUE, TRUE, 0);
1735 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window),
1736 mailbox_page(wizard));
1737 PACK_WARNING(_("Bold fields must be completed"));
1739 wizard->pages = g_slist_append(wizard->pages, widget);
1745 page = create_page(wizard, _("Configuration finished"));
1747 wizard->pages = g_slist_append(wizard->pages, page);
1748 widget = stock_pixmap_widget(wizard->window,
1749 STOCK_PIXMAP_CLAWS_MAIL_LOGO);
1751 gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
1753 text = g_strdup(_("Claws Mail is now ready.\n"
1754 "Click Save to start."));
1755 widget = gtk_label_new(text);
1756 gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
1760 for (cur = wizard->pages; cur && cur->data; cur = cur->next) {
1761 gtk_notebook_append_page (GTK_NOTEBOOK(wizard->notebook),
1762 GTK_WIDGET(cur->data), NULL);
1765 g_signal_connect(G_OBJECT(wizard->window), "delete_event",
1766 G_CALLBACK(wizard_close_cb), wizard);
1767 gtk_widget_show_all (wizard->window);
1769 gtk_widget_hide(wizard->recv_imap_label);
1770 gtk_widget_hide(wizard->recv_imap_subdir);
1771 gtk_widget_hide(wizard->subsonly_checkbtn);
1773 wizard_protocol_change(wizard, tmpl.recvtype);
1775 while (!wizard->finished)
1776 gtk_main_iteration();
1778 result = wizard->result;
1782 gtk_widget_show(mainwin->window);