2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Claws Mail team
4 * This file (C) 2004 Colin Leroy
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 2 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, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 #include <glib/gi18n.h>
29 #include <gdk/gdkkeysyms.h>
30 #include <gtk/gtkwidget.h>
31 #include <gtk/gtkvbox.h>
32 #include <gtk/gtkbox.h>
33 #include <gtk/gtktable.h>
34 #include <gtk/gtkentry.h>
35 #include <gtk/gtklabel.h>
36 #include <gtk/gtknotebook.h>
37 #include <gtk/gtktogglebutton.h>
38 #include <gtk/gtkcheckbutton.h>
54 #include "prefs_account.h"
55 #include "mainwindow.h"
56 #include "stock_pixmap.h"
59 #include "alertpanel.h"
63 #include "prefs_common.h"
73 int WELCOME_PAGE = -1;
77 int MAILBOX_PAGE = -1;
91 GtkWidget *organization;
93 GtkWidget *mailbox_name;
95 GtkWidget *smtp_server;
97 GtkWidget *smtp_username;
98 GtkWidget *smtp_password;
99 GtkWidget *smtp_username_label;
100 GtkWidget *smtp_password_label;
102 GtkWidget *recv_type;
103 GtkWidget *recv_label;
104 GtkWidget *recv_server;
105 GtkWidget *recv_username;
106 GtkWidget *recv_password;
107 GtkWidget *recv_username_label;
108 GtkWidget *recv_password_label;
109 GtkWidget *recv_imap_label;
110 GtkWidget *recv_imap_subdir;
111 GtkWidget *no_imap_warning;
113 GtkWidget *smtp_use_ssl;
114 GtkWidget *recv_use_ssl;
117 gboolean create_mailbox;
123 typedef struct _AccountTemplate {
132 RecvProtocol recvtype;
143 static AccountTemplate tmpl;
145 static PrefParam template_params[] = {
146 {"name", "$USERNAME",
147 &tmpl.name, P_STRING, NULL, NULL, NULL},
148 {"domain", "$DEFAULTDOMAIN",
149 &tmpl.domain, P_STRING, NULL, NULL, NULL},
150 {"email", "$NAME_MAIL@$DOMAIN",
151 &tmpl.email, P_STRING, NULL, NULL, NULL},
153 &tmpl.organization, P_STRING, NULL, NULL, NULL},
154 {"smtpserver", "smtp.$DOMAIN",
155 &tmpl.smtpserver, P_STRING, NULL, NULL, NULL},
156 {"smtpauth", "FALSE",
157 &tmpl.smtpauth, P_BOOL, NULL, NULL, NULL},
159 &tmpl.smtpuser, P_STRING, NULL, NULL, NULL},
161 &tmpl.smtppass, P_STRING, NULL, NULL, NULL},
163 &tmpl.recvtype, P_INT, NULL, NULL, NULL},
164 {"recvserver", "pop.$DOMAIN",
165 &tmpl.recvserver, P_STRING, NULL, NULL, NULL},
166 {"recvuser", "$LOGIN",
167 &tmpl.recvuser, P_STRING, NULL, NULL, NULL},
169 &tmpl.recvpass, P_STRING, NULL, NULL, NULL},
171 &tmpl.imapdir, P_STRING, NULL, NULL, NULL},
172 {"mboxfile", "/var/mail/$LOGIN",
173 &tmpl.mboxfile, P_STRING, NULL, NULL, NULL},
175 &tmpl.mailbox, P_STRING, NULL, NULL, NULL},
177 &tmpl.smtpssl, P_BOOL, NULL, NULL, NULL},
179 &tmpl.recvssl, P_BOOL, NULL, NULL, NULL},
180 {NULL, NULL, NULL, P_INT, NULL, NULL, NULL}
184 static gchar *accountrc_tmpl =
185 "[AccountTemplate]\n"
186 "#you can use $DEFAULTDOMAIN here\n"
187 "#domain must be defined before the variables that use it\n"
188 "#by default, domain is extracted from the hostname\n"
191 "#you can use $USERNAME for name (this is the default)\n"
194 "#you can use $LOGIN, $NAME_MAIL and $DOMAIN here \n"
195 "#$NAME_MAIL is the name without uppercase and with dots instead\n"
197 "#the default is $NAME_MAIL@$DOMAIN\n"
200 "#you can use $DOMAIN here\n"
201 "#the default organization is empty\n"
204 "#you can use $DOMAIN here \n"
205 "#the default is stmp.$DOMAIN\n"
208 "#Whether to use smtp authentication\n"
209 "#the default is 0 (no)\n"
213 "#you can use $LOGIN, $NAME_MAIL, $DOMAIN or $EMAIL here\n"
214 "#the default is empty (same as reception username)\n"
218 "#the default is empty (same as reception password)\n"
221 "#recvtype can be:\n"
224 "#5 for a local mbox file\n"
227 "#you can use $DOMAIN here \n"
228 "#the default is {pop,imap}.$DOMAIN\n"
231 "#you can use $LOGIN, $NAME_MAIL, $DOMAIN or $EMAIL here\n"
232 "#default is $LOGIN\n"
235 "#default is empty\n"
238 "#imap dir if imap (relative to the home on the server\n"
239 "#default is empty\n"
242 "#mbox file if local\n"
243 "#you can use $LOGIN here\n"
244 "#default is /var/mail/$LOGIN\n"
247 "#mailbox name if pop3 or local\n"
248 "#relative path from the user's home\n"
249 "#default is \"Mail\"\n"
252 "#whether to use ssl on STMP connections\n"
256 "#whether to use ssl on pop or imap connections\n"
260 static gchar *wizard_get_default_domain_name(void)
262 static gchar *domain_name = NULL;
264 if (domain_name == NULL) {
265 domain_name = g_strdup(get_domain_name());
266 if (strchr(domain_name, '.') != strrchr(domain_name, '.')
267 && strlen(strchr(domain_name, '.')) > 6) {
268 gchar *tmp = g_strdup(strchr(domain_name, '.')+1);
276 static gchar *get_name_for_mail(void)
278 gchar *name = g_strdup(tmpl.name);
282 while(strstr(name, " "))
283 *strstr(name, " ")='.';
288 #define PARSE_DEFAULT(str) { \
289 gchar *tmp = NULL, *new = NULL; \
291 tmp = g_strdup(str); \
292 if (strstr(str, "$USERNAME")) { \
293 tmp = g_strdup(str); \
294 *strstr(tmp, "$USERNAME") = '\0'; \
295 new = g_strconcat(tmp, g_get_real_name(), \
296 strstr(str, "$USERNAME")+strlen("$USERNAME"), \
303 if (strstr(str, "$LOGIN")) { \
304 tmp = g_strdup(str); \
305 *strstr(tmp, "$LOGIN") = '\0'; \
306 new = g_strconcat(tmp, g_get_user_name(), \
307 strstr(str, "$LOGIN")+strlen("$LOGIN"), \
314 if (strstr(str, "$EMAIL")) { \
315 tmp = g_strdup(str); \
316 *strstr(tmp, "$EMAIL") = '\0'; \
317 new = g_strconcat(tmp, tmpl.email, \
318 strstr(str, "$EMAIL")+strlen("$EMAIL"), \
325 if (strstr(str, "$NAME_MAIL")) { \
326 tmp = g_strdup(str); \
327 *strstr(tmp, "$NAME_MAIL") = '\0'; \
328 new = g_strconcat(tmp, get_name_for_mail(), \
329 strstr(str, "$NAME_MAIL")+strlen("$NAME_MAIL"), \
336 if (strstr(str, "$DEFAULTDOMAIN")) { \
337 tmp = g_strdup(str); \
338 *strstr(tmp, "$DEFAULTDOMAIN") = '\0'; \
339 new = g_strconcat(tmp, wizard_get_default_domain_name(), \
340 strstr(str, "$DEFAULTDOMAIN")+strlen("$DEFAULTDOMAIN"), \
347 if (strstr(str, "$DOMAIN")) { \
348 tmp = g_strdup(str); \
349 *strstr(tmp, "$DOMAIN") = '\0'; \
350 new = g_strconcat(tmp, tmpl.domain, \
351 strstr(str, "$DOMAIN")+strlen("$DOMAIN"), \
360 static void wizard_read_defaults(void)
364 rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "accountrc.tmpl", NULL);
365 if (!is_file_exist(rcpath)) {
366 str_write_to_file(accountrc_tmpl, rcpath);
369 prefs_read_config(template_params, "AccountTemplate", rcpath, NULL);
371 PARSE_DEFAULT(tmpl.domain);
372 PARSE_DEFAULT(tmpl.name);
373 PARSE_DEFAULT(tmpl.email);
374 PARSE_DEFAULT(tmpl.organization);
375 PARSE_DEFAULT(tmpl.smtpserver);
376 PARSE_DEFAULT(tmpl.smtpuser);
377 PARSE_DEFAULT(tmpl.smtppass);
378 PARSE_DEFAULT(tmpl.recvserver);
379 PARSE_DEFAULT(tmpl.recvuser);
380 PARSE_DEFAULT(tmpl.recvpass);
381 PARSE_DEFAULT(tmpl.imapdir);
382 PARSE_DEFAULT(tmpl.mboxfile);
383 PARSE_DEFAULT(tmpl.mailbox);
386 "%s, %s, %s, %s, %s, %d, %s, %s, %s, %s, %s, %s, %d, %d\n",
387 tmpl.name,tmpl.domain,tmpl.email,tmpl.organization,tmpl.smtpserver,
388 tmpl.recvtype,tmpl.recvserver,tmpl.recvuser,tmpl.recvpass,
389 tmpl.imapdir,tmpl.mboxfile,tmpl.mailbox,tmpl.smtpssl,tmpl.recvssl);
394 static void initialize_fonts(WizardWindow *wizard)
396 GtkWidget *widget = wizard->email;
397 gint size = pango_font_description_get_size(
398 widget->style->font_desc)
402 tmp = g_strdup(prefs_common.textfont);
403 if (strrchr(tmp, ' ')) {
404 *(strrchr(tmp, ' ')) = '\0';
405 new = g_strdup_printf("%s %d", tmp, size);
406 g_free(prefs_common.textfont);
407 prefs_common.textfont = new;
411 tmp = g_strdup(prefs_common.smallfont);
412 if (strrchr(tmp, ' ')) {
413 *(strrchr(tmp, ' ')) = '\0';
414 new = g_strdup_printf("%s %d", tmp, size);
415 g_free(prefs_common.smallfont);
416 prefs_common.smallfont = new;
420 tmp = g_strdup(prefs_common.normalfont);
421 if (strrchr(tmp, ' ')) {
422 *(strrchr(tmp, ' ')) = '\0';
423 new = g_strdup_printf("%s %d", tmp, size);
424 g_free(prefs_common.normalfont);
425 prefs_common.normalfont = new;
430 #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"
431 #define FACE "iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEUTGBYnS3BCUE9KVC9acyRy\n\
432 kC6LjITZdGiumnF/p7yrq6jJzc/5+vf7GI+IAAACZ0lEQVQ4y5XUvW/UMBQA8LRl6VZ3QLqNNhVS\n\
433 YSnKFfExEg9lbJNK3QqVoiPHzgpFnAIs5Do9ORNDVOwuFVIgduZWOfuP4vlyybVVkeCdTpHe7z1/\n\
434 RHYc85dw/gEUxi2gS5ZlDKqbUDcpzarroMEOpDU2VtcAmFKlxn+t2VWQUNa1BmAlGrsCqWKMwetv\n\
435 MMbnFaixFn9rh47DFCuzDs6hxPyrxXuOA7WqWQcp2Fhx7gTOcga6bGHSS6FHCHFouLcMJptuaQbp\n\
436 +kff90P6Yn0TMpXN4DxNVz+FQZ8Gob8DGWSsBUIG23seDXwaBBnU0EJKVhNvqx/6aHTHrmMGhNw9\n\
437 XlqkgbdEX/gh1PUcVj84G4HnuHTXDQ+6Dk3IyqFL/UfEpXvj7RChaoEsUX9rYeGE7o83wp0WcCjS\n\
438 9/01AifhLrj0oINeuuJ53kIP+uF+7uL03eQpGWx5yzDu05fM3Z53AJDkvdODwvOfmbH3uOuwcLz+\n\
439 UBWLR8/N+MHnDsoeG4zecDl5Mhqa74NR90p+VEYmo+ioSEan8WnytANhDB8kX06TJFZJcowvfrZz\n\
440 XIMS2vxMIlHJfHMTRLOqC7TovlJFEVVGF7yafFVTkGgij+I851hZCHP5Tk8BWXObjuxhl2fm8pdu\n\
441 O0wluZDKHgJ91nVMKhuKN6cZQf9uQAs85lrjGDYmwmqzDynwClRKTCF/OwfDub0dQyzHxVUt6DzK\n\
442 eY5NseIxb8abwoVSMpZDhJyL9kJamGAxplC7izkHyaXM5/nZHFiNeRHfBFNwLjhOr+fAmw1G3OYl\n\
443 bwoijGGzD40pdeu3ROv/+Pr8AWPP4vVXbP0VAAAAAElFTkSuQmCC"
445 static void write_welcome_email(WizardWindow *wizard)
452 const gchar *mailbox = gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name));
453 Folder *folder = folder_find_from_path(mailbox);
454 FolderItem *inbox = folder ? folder->inbox:NULL;
455 gchar *file = get_tmp_file();
457 get_rfc822_date(buf_date, sizeof(buf_date));
459 subj = g_strdup_printf(_("Welcome to Claws Mail "));
461 head = g_strdup_printf(
468 "Content-Type: text/plain; charset=UTF-8\n",
469 _("Claws Mail Team"),
471 gtk_entry_get_text(GTK_ENTRY(wizard->full_name)),
472 gtk_entry_get_text(GTK_ENTRY(wizard->email)),
473 buf_date, subj, XFACE, FACE);
474 body = g_strdup_printf(
476 "Welcome to Claws Mail\n"
477 "-------------------------\n"
479 "Now that you have set up your account you can fetch your\n"
480 "mail by clicking the 'Get Mail' button at the left of the\n"
483 "Claws Mail has lots of extra features accessible via plugins,\n"
484 "like anti-spam filtering and learning (via the Bogofilter or\n"
485 "SpamAssassin plugins), privacy protection (via PGP/Mime), an RSS\n"
486 "aggregator, a calendar, and much more. You can load them from\n"
487 "the menu entry '/Configuration/Plugins'.\n"
489 "You can change your Account Preferences by using the menu\n"
490 "entry '/Configuration/Preferences for current account'\n"
491 "and change the general Preferences by using\n"
492 "'/Configuration/Preferences'.\n"
494 "You can find further information in the Claws Mail manual,\n"
495 "which can be accessed by using the menu entry '/Help/Manual'\n"
496 "or online at the URL given below.\n"
504 "Mailing Lists: <%s>\n"
508 "Claws Mail is free software, released under the terms\n"
509 "of the GNU General Public License, version 2 or later, as\n"
510 "published by the Free Software Foundation, 51 Franklin Street,\n"
511 "Fifth Floor, Boston, MA 02110-1301, USA. The license can be\n"
516 "If you wish to donate to the Claws Mail project you can do\n"
518 HOMEPAGE_URI, MANUAL_URI, FAQ_URI, THEMES_URI, MAILING_LIST_URI,
519 GPL_URI, DONATE_URI);
521 msg = g_strconcat(head, body, NULL);
523 if (inbox && inbox->total_msgs == 0
524 && str_write_to_file(msg, file) >= 0) {
525 MsgFlags flags = { MSG_UNREAD|MSG_NEW, 0};
526 folder_item_add_msg(inbox, file, &flags, FALSE);
536 static gboolean wizard_write_config(WizardWindow *wizard)
538 static gboolean mailbox_ok = FALSE;
539 PrefsAccount *prefs_account = prefs_account_new();
540 GList *account_list = NULL;
541 GtkWidget *menu, *menuitem;
543 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(wizard->recv_type));
544 menuitem = gtk_menu_get_active(GTK_MENU(menu));
545 prefs_account->protocol = GPOINTER_TO_INT
546 (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
549 if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4 &&
550 !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name)))) {
551 alertpanel_error(_("Please enter the mailbox name."));
552 g_free(prefs_account);
553 gtk_notebook_set_current_page (
554 GTK_NOTEBOOK(wizard->notebook),
560 if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4) {
561 mailbox_ok = setup_write_mailbox_path(wizard->mainwin,
563 GTK_ENTRY(wizard->mailbox_name)));
569 /* alertpanel done by setup_write_mailbox_path */
570 g_free(prefs_account);
571 gtk_notebook_set_current_page (
572 GTK_NOTEBOOK(wizard->notebook),
577 if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->full_name)))
578 || !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->email)))) {
579 alertpanel_error(_("Please enter your name and email address."));
580 g_free(prefs_account);
581 gtk_notebook_set_current_page (
582 GTK_NOTEBOOK(wizard->notebook),
587 if (prefs_account->protocol != A_LOCAL) {
588 if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->recv_username)))
589 || !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)))) {
590 alertpanel_error(_("Please enter your receiving server "
592 g_free(prefs_account);
593 gtk_notebook_set_current_page (
594 GTK_NOTEBOOK(wizard->notebook),
599 if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)))) {
600 alertpanel_error(_("Please enter your username."));
601 g_free(prefs_account);
602 gtk_notebook_set_current_page (
603 GTK_NOTEBOOK(wizard->notebook),
609 if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->smtp_server)))) {
610 alertpanel_error(_("Please enter your SMTP server."));
611 g_free(prefs_account);
612 gtk_notebook_set_current_page (
613 GTK_NOTEBOOK(wizard->notebook),
618 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->smtp_auth))) {
619 if (prefs_account->protocol == A_LOCAL
620 && !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->smtp_username)))) {
621 alertpanel_error(_("Please enter your SMTP username."));
622 g_free(prefs_account);
623 gtk_notebook_set_current_page (
624 GTK_NOTEBOOK(wizard->notebook),
627 } /* if it's not local we'll use the reception server */
630 if (prefs_account->protocol != A_LOCAL)
631 prefs_account->account_name = g_strdup_printf("%s@%s",
632 gtk_entry_get_text(GTK_ENTRY(wizard->recv_username)),
633 gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
635 prefs_account->account_name = g_strdup_printf("%s",
636 gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
638 prefs_account->name = g_strdup(
639 gtk_entry_get_text(GTK_ENTRY(wizard->full_name)));
640 prefs_account->address = g_strdup(
641 gtk_entry_get_text(GTK_ENTRY(wizard->email)));
642 prefs_account->organization = g_strdup(
643 gtk_entry_get_text(GTK_ENTRY(wizard->organization)));
644 prefs_account->smtp_server = g_strdup(
645 gtk_entry_get_text(GTK_ENTRY(wizard->smtp_server)));
647 if (prefs_account->protocol != A_LOCAL)
648 prefs_account->recv_server = g_strdup(
649 gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
651 prefs_account->local_mbox = g_strdup(
652 gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
654 prefs_account->userid = g_strdup(
655 gtk_entry_get_text(GTK_ENTRY(wizard->recv_username)));
656 prefs_account->passwd = g_strdup(
657 gtk_entry_get_text(GTK_ENTRY(wizard->recv_password)));
659 prefs_account->smtp_userid = g_strdup(
660 gtk_entry_get_text(GTK_ENTRY(wizard->smtp_username)));
661 prefs_account->smtp_passwd = g_strdup(
662 gtk_entry_get_text(GTK_ENTRY(wizard->smtp_password)));
663 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->smtp_auth))) {
664 prefs_account->use_smtp_auth = TRUE;
668 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->smtp_use_ssl)))
669 prefs_account->ssl_smtp = SSL_TUNNEL;
670 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->recv_use_ssl))) {
671 if (prefs_account->protocol == A_IMAP4)
672 prefs_account->ssl_imap = SSL_TUNNEL;
674 prefs_account->ssl_pop = SSL_TUNNEL;
677 if (prefs_account->protocol == A_IMAP4) {
678 gchar *directory = gtk_editable_get_chars(
679 GTK_EDITABLE(wizard->recv_imap_subdir), 0, -1);
680 if (directory && strlen(directory)) {
681 prefs_account->imap_dir = g_strdup(directory);
686 account_list = g_list_append(account_list, prefs_account);
687 prefs_account_write_config_all(account_list);
688 prefs_account_free(prefs_account);
689 account_read_config_all();
691 initialize_fonts(wizard);
692 if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4)
693 write_welcome_email(wizard);
696 plugin_load_standard_plugins();
701 static GtkWidget* create_page (WizardWindow *wizard, const char * title)
709 vbox = gtk_vbox_new (FALSE, 6);
710 gtk_container_set_border_width (GTK_CONTAINER(vbox), 10);
712 /* create the titlebar */
713 hbox = gtk_hbox_new (FALSE, 12);
714 image = stock_pixmap_widget(wizard->window,
715 STOCK_PIXMAP_CLAWS_MAIL_ICON);
716 gtk_box_pack_start (GTK_BOX(hbox), image, FALSE, FALSE, 0);
717 title_string = g_strconcat ("<span size=\"xx-large\" weight=\"ultrabold\">", title ? title : "", "</span>", NULL);
718 w = gtk_label_new (title_string);
719 gtk_label_set_use_markup (GTK_LABEL(w), TRUE);
720 g_free (title_string);
721 gtk_box_pack_start (GTK_BOX(hbox), w, FALSE, FALSE, 0);
723 /* pack the titlebar */
724 gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
726 /* pack the separator */
727 gtk_box_pack_start (GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
730 w = gtk_alignment_new (0, 0, 0, 0);
731 gtk_widget_set_size_request (w, 0, 6);
732 gtk_box_pack_start (GTK_BOX(vbox), w, FALSE, FALSE, 0);
737 #define GTK_TABLE_ADD_ROW_AT(table,text,entry,i) { \
738 GtkWidget *label = gtk_label_new(text); \
739 gtk_table_attach(GTK_TABLE(table), label, \
740 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0); \
741 gtk_label_set_use_markup(GTK_LABEL(label), TRUE); \
742 if (GTK_IS_MISC(label)) \
743 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); \
744 gtk_table_attach(GTK_TABLE(table), entry, \
745 1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0); \
748 static gchar *get_default_server(WizardWindow * wizard, const gchar *type)
750 if (!strcmp(type, "smtp")) {
751 if (!tmpl.smtpserver || !strlen(tmpl.smtpserver))
752 return g_strconcat(type, ".", tmpl.domain, NULL);
754 return g_strdup(tmpl.smtpserver);
756 if (!tmpl.recvserver || !strlen(tmpl.recvserver))
757 return g_strconcat(type, ".", tmpl.domain, NULL);
759 return g_strdup(tmpl.recvserver);
763 static gchar *get_default_account(WizardWindow * wizard)
765 gchar *result = NULL;
767 if (!tmpl.recvuser || !strlen(tmpl.recvuser)) {
768 result = gtk_editable_get_chars(
769 GTK_EDITABLE(wizard->email), 0, -1);
771 if (strstr(result, "@")) {
772 *(strstr(result,"@")) = '\0';
775 result = g_strdup(tmpl.recvuser);
780 static gchar *get_default_smtp_account(WizardWindow * wizard)
782 gchar *result = NULL;
784 if (!tmpl.smtpuser || !strlen(tmpl.smtpuser)) {
787 result = g_strdup(tmpl.smtpuser);
792 static void wizard_email_changed(GtkWidget *widget, gpointer data)
794 WizardWindow *wizard = (WizardWindow *)data;
795 RecvProtocol protocol;
797 protocol = GPOINTER_TO_INT
798 (g_object_get_data(G_OBJECT(wizard->recv_type), MENU_VAL_ID));
800 text = get_default_server(wizard, "smtp");
801 gtk_entry_set_text(GTK_ENTRY(wizard->smtp_server), text);
804 text = get_default_account(wizard);
805 gtk_entry_set_text(GTK_ENTRY(wizard->recv_username), text);
808 if (protocol == A_POP3) {
809 text = get_default_server(wizard, "pop");
810 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
812 } else if (protocol == A_IMAP4) {
813 text = get_default_server(wizard, "imap");
814 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
816 } else if (protocol == A_LOCAL) {
817 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), tmpl.mboxfile?tmpl.mboxfile:"");
822 static GtkWidget* user_page (WizardWindow * wizard)
824 GtkWidget *table = gtk_table_new(3,2, FALSE);
827 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
828 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
830 wizard->full_name = gtk_entry_new();
831 gtk_entry_set_text(GTK_ENTRY(wizard->full_name), tmpl.name?tmpl.name:"");
832 GTK_TABLE_ADD_ROW_AT(table, _("<span weight=\"bold\">Your name:</span>"),
833 wizard->full_name, i); i++;
835 wizard->email = gtk_entry_new();
836 gtk_entry_set_text(GTK_ENTRY(wizard->email), tmpl.email?tmpl.email:"");
837 GTK_TABLE_ADD_ROW_AT(table, _("<span weight=\"bold\">Your email address:</span>"),
838 wizard->email, i); i++;
840 wizard->organization = gtk_entry_new();
841 GTK_TABLE_ADD_ROW_AT(table, _("Your organization:"),
842 wizard->organization, i); i++;
843 gtk_entry_set_text(GTK_ENTRY(wizard->organization), tmpl.organization?tmpl.organization:"");
845 g_signal_connect(G_OBJECT(wizard->email), "changed",
846 G_CALLBACK(wizard_email_changed),
851 static GtkWidget* mailbox_page (WizardWindow * wizard)
853 GtkWidget *table = gtk_table_new(1,2, FALSE);
856 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
857 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
859 wizard->mailbox_name = gtk_entry_new();
860 gtk_entry_set_text(GTK_ENTRY(wizard->mailbox_name), tmpl.mailbox?tmpl.mailbox:"");
861 GTK_TABLE_ADD_ROW_AT(table, _("<span weight=\"bold\">Mailbox name:</span>"),
862 wizard->mailbox_name, i); i++;
867 static void smtp_auth_changed (GtkWidget *btn, gpointer data)
869 WizardWindow *wizard = (WizardWindow *)data;
870 gboolean do_auth = gtk_toggle_button_get_active(
871 GTK_TOGGLE_BUTTON(wizard->smtp_auth));
872 gtk_widget_set_sensitive(wizard->smtp_username, do_auth);
873 gtk_widget_set_sensitive(wizard->smtp_username_label, do_auth);
874 gtk_widget_set_sensitive(wizard->smtp_password, do_auth);
875 gtk_widget_set_sensitive(wizard->smtp_password_label, do_auth);
878 static GtkWidget* smtp_page (WizardWindow * wizard)
880 GtkWidget *table = gtk_table_new(1,4, FALSE);
884 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
885 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
887 wizard->smtp_server = gtk_entry_new();
888 text = get_default_server(wizard, "smtp");
889 gtk_entry_set_text(GTK_ENTRY(wizard->smtp_server), text);
891 GTK_TABLE_ADD_ROW_AT(table, _("<span weight=\"bold\">SMTP server address:</span>"),
892 wizard->smtp_server, i); i++;
893 wizard->smtp_auth = gtk_check_button_new_with_label(
894 _("Use authentication"));
895 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->smtp_auth),
897 g_signal_connect(G_OBJECT(wizard->smtp_auth), "toggled",
898 G_CALLBACK(smtp_auth_changed),
900 gtk_table_attach(GTK_TABLE(table), wizard->smtp_auth,
901 0,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0); i++;
903 text = get_default_smtp_account(wizard);
905 wizard->smtp_username = gtk_entry_new();
906 gtk_entry_set_text(GTK_ENTRY(wizard->smtp_username), text);
908 wizard->smtp_username_label = gtk_label_new(_("SMTP username:\n"
909 "<span size=\"small\">(empty to use the same as reception)</span>"));
910 gtk_label_set_use_markup(GTK_LABEL(wizard->smtp_username_label), TRUE);
911 gtk_table_attach(GTK_TABLE(table), wizard->smtp_username_label,
912 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
913 if (GTK_IS_MISC(wizard->smtp_username_label))
914 gtk_misc_set_alignment(GTK_MISC(wizard->smtp_username_label), 1, 0.5);
915 gtk_table_attach(GTK_TABLE(table), wizard->smtp_username,
916 1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
918 wizard->smtp_password = gtk_entry_new();
919 gtk_entry_set_text(GTK_ENTRY(wizard->smtp_password), tmpl.smtppass?tmpl.smtppass:"");
920 gtk_entry_set_visibility(GTK_ENTRY(wizard->smtp_password), FALSE);
921 wizard->smtp_password_label = gtk_label_new(_("SMTP password:\n"
922 "<span size=\"small\">(empty to use the same as reception)</span>"));
923 gtk_label_set_use_markup(GTK_LABEL(wizard->smtp_password_label), TRUE);
924 gtk_table_attach(GTK_TABLE(table), wizard->smtp_password_label,
925 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
926 if (GTK_IS_MISC(wizard->smtp_password_label))
927 gtk_misc_set_alignment(GTK_MISC(wizard->smtp_password_label), 1, 0.5);
928 gtk_table_attach(GTK_TABLE(table), wizard->smtp_password,
929 1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
931 smtp_auth_changed(NULL, wizard);
935 static void wizard_protocol_change(WizardWindow *wizard, RecvProtocol protocol)
939 if (protocol == A_POP3) {
940 text = get_default_server(wizard, "pop");
941 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
942 gtk_widget_hide(wizard->recv_imap_label);
943 gtk_widget_hide(wizard->recv_imap_subdir);
944 gtk_widget_show(wizard->recv_username);
945 gtk_widget_show(wizard->recv_password);
946 gtk_widget_show(wizard->recv_username_label);
947 gtk_widget_show(wizard->recv_password_label);
948 gtk_widget_hide(wizard->no_imap_warning);
949 gtk_label_set_text(GTK_LABEL(wizard->recv_label), _("<span weight=\"bold\">Server address:</span>"));
950 gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
951 gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, TRUE);
953 } else if (protocol == A_IMAP4) {
955 text = get_default_server(wizard, "imap");
956 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
957 gtk_widget_show(wizard->recv_imap_label);
958 gtk_widget_show(wizard->recv_imap_subdir);
959 gtk_widget_show(wizard->recv_username);
960 gtk_widget_show(wizard->recv_password);
961 gtk_widget_show(wizard->recv_username_label);
962 gtk_widget_show(wizard->recv_password_label);
963 gtk_widget_hide(wizard->no_imap_warning);
964 gtk_label_set_text(GTK_LABEL(wizard->recv_label), _("<span weight=\"bold\">Server address:</span>"));
965 gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
966 gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, TRUE);
969 gtk_widget_hide(wizard->recv_imap_label);
970 gtk_widget_hide(wizard->recv_imap_subdir);
971 gtk_widget_hide(wizard->recv_username);
972 gtk_widget_hide(wizard->recv_password);
973 gtk_widget_hide(wizard->recv_username_label);
974 gtk_widget_hide(wizard->recv_password_label);
975 gtk_widget_show(wizard->no_imap_warning);
976 gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, FALSE);
978 } else if (protocol == A_LOCAL) {
979 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), tmpl.mboxfile?tmpl.mboxfile:"");
980 gtk_label_set_text(GTK_LABEL(wizard->recv_label), _("<span weight=\"bold\">Local mailbox:</span>"));
981 gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
982 gtk_widget_hide(wizard->no_imap_warning);
983 gtk_widget_hide(wizard->recv_imap_label);
984 gtk_widget_hide(wizard->recv_imap_subdir);
985 gtk_widget_hide(wizard->recv_username);
986 gtk_widget_hide(wizard->recv_password);
987 gtk_widget_hide(wizard->recv_username_label);
988 gtk_widget_hide(wizard->recv_password_label);
989 gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, TRUE);
993 static void wizard_protocol_changed(GtkMenuItem *menuitem, gpointer data)
995 WizardWindow *wizard = (WizardWindow *)data;
996 RecvProtocol protocol;
997 protocol = GPOINTER_TO_INT
998 (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
1000 wizard_protocol_change(wizard, protocol);
1003 static GtkWidget* recv_page (WizardWindow * wizard)
1005 GtkWidget *table = gtk_table_new(5,2, FALSE);
1006 GtkWidget *menu = gtk_menu_new();
1007 GtkWidget *menuitem;
1012 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
1013 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
1015 wizard->recv_type = gtk_option_menu_new();
1017 MENUITEM_ADD (menu, menuitem, _("POP3"), A_POP3);
1018 g_signal_connect(G_OBJECT(menuitem), "activate",
1019 G_CALLBACK(wizard_protocol_changed),
1022 MENUITEM_ADD (menu, menuitem, _("IMAP"), A_IMAP4);
1023 g_signal_connect(G_OBJECT(menuitem), "activate",
1024 G_CALLBACK(wizard_protocol_changed),
1027 MENUITEM_ADD (menu, menuitem, _("Local mbox file"), A_LOCAL);
1028 g_signal_connect(G_OBJECT(menuitem), "activate",
1029 G_CALLBACK(wizard_protocol_changed),
1032 gtk_option_menu_set_menu (GTK_OPTION_MENU (wizard->recv_type), menu);
1033 switch(tmpl.recvtype) {
1046 gtk_option_menu_set_history(GTK_OPTION_MENU (wizard->recv_type), index);
1047 GTK_TABLE_ADD_ROW_AT(table, _("<span weight=\"bold\">Server type:</span>"),
1048 wizard->recv_type, i); i++;
1050 wizard->recv_server = gtk_entry_new();
1051 text = get_default_server(wizard, "pop");
1052 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
1055 wizard->recv_label = gtk_label_new(_("<span weight=\"bold\">Server address:</span>"));
1056 gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
1057 gtk_table_attach(GTK_TABLE(table), wizard->recv_label,
1058 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1059 if (GTK_IS_MISC(wizard->recv_label))
1060 gtk_misc_set_alignment(GTK_MISC(wizard->recv_label), 1, 0.5);
1061 gtk_table_attach(GTK_TABLE(table), wizard->recv_server,
1062 1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1065 wizard->recv_username = gtk_entry_new();
1066 wizard->recv_username_label = gtk_label_new(_("<span weight=\"bold\">Username:</span>"));
1067 gtk_label_set_use_markup(GTK_LABEL(wizard->recv_username_label), TRUE);
1068 gtk_table_attach(GTK_TABLE(table), wizard->recv_username_label,
1069 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1070 if (GTK_IS_MISC(wizard->recv_username_label))
1071 gtk_misc_set_alignment(GTK_MISC(wizard->recv_username_label), 1, 0.5);
1072 gtk_table_attach(GTK_TABLE(table), wizard->recv_username,
1073 1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1076 text = get_default_account(wizard);
1077 gtk_entry_set_text(GTK_ENTRY(wizard->recv_username), text);
1080 wizard->recv_password = gtk_entry_new();
1081 gtk_entry_set_text(GTK_ENTRY(wizard->recv_password), tmpl.recvpass?tmpl.recvpass:"");
1082 wizard->recv_password_label = gtk_label_new(_("Password:"));
1083 gtk_table_attach(GTK_TABLE(table), wizard->recv_password_label,
1084 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1085 if (GTK_IS_MISC(wizard->recv_password_label))
1086 gtk_misc_set_alignment(GTK_MISC(wizard->recv_password_label), 1, 0.5);
1087 gtk_table_attach(GTK_TABLE(table), wizard->recv_password,
1088 1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1089 gtk_entry_set_visibility(GTK_ENTRY(wizard->recv_password), FALSE);
1092 wizard->recv_imap_subdir = gtk_entry_new();
1093 gtk_entry_set_text(GTK_ENTRY(wizard->recv_imap_subdir), tmpl.imapdir?tmpl.imapdir:"");
1094 wizard->recv_imap_label = gtk_label_new(_("IMAP server directory:"));
1096 gtk_table_attach(GTK_TABLE(table), wizard->recv_imap_label,
1097 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1098 if (GTK_IS_MISC(wizard->recv_imap_label))
1099 gtk_misc_set_alignment(GTK_MISC(wizard->recv_imap_label), 1, 0.5);
1100 gtk_table_attach(GTK_TABLE(table), wizard->recv_imap_subdir,
1101 1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1105 wizard->no_imap_warning = gtk_label_new(_(
1106 "<span weight=\"bold\">Warning: this version of Claws Mail\n"
1107 "has been built without IMAP support.</span>"));
1108 gtk_label_set_use_markup(GTK_LABEL(wizard->no_imap_warning), TRUE);
1109 gtk_table_attach(GTK_TABLE(table), wizard->no_imap_warning,
1110 0,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1116 static GtkWidget* ssl_page (WizardWindow * wizard)
1118 GtkWidget *table = gtk_table_new(2,2, FALSE);
1121 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
1122 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
1124 wizard->smtp_use_ssl = gtk_check_button_new_with_label(
1125 _("Use SSL to connect to SMTP server"));
1126 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->smtp_use_ssl),
1128 gtk_table_attach(GTK_TABLE(table), wizard->smtp_use_ssl,
1129 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0); i++;
1131 wizard->recv_use_ssl = gtk_check_button_new_with_label(
1132 _("Use SSL to connect to receiving server"));
1133 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->recv_use_ssl),
1135 gtk_table_attach(GTK_TABLE(table), wizard->recv_use_ssl,
1136 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1143 wizard_response_cb (GtkDialog * dialog, int response, gpointer data)
1145 WizardWindow * wizard = (WizardWindow *)data;
1146 int current_page, num_pages;
1147 GtkWidget *menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(wizard->recv_type));
1148 GtkWidget *menuitem = gtk_menu_get_active(GTK_MENU(menu));
1149 gint protocol = GPOINTER_TO_INT
1150 (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
1151 gboolean skip_mailbox_page = FALSE;
1153 if (protocol == A_IMAP4) {
1154 skip_mailbox_page = TRUE;
1157 num_pages = g_slist_length(wizard->pages);
1159 current_page = gtk_notebook_get_current_page (
1160 GTK_NOTEBOOK(wizard->notebook));
1161 if (response == CANCEL)
1163 wizard->result = FALSE;
1164 wizard->finished = TRUE;
1165 gtk_widget_destroy (GTK_WIDGET(dialog));
1167 else if (response == FINISHED)
1169 if (!wizard_write_config(wizard)) {
1170 current_page = gtk_notebook_get_current_page (
1171 GTK_NOTEBOOK(wizard->notebook));
1174 wizard->result = TRUE;
1175 wizard->finished = TRUE;
1176 gtk_widget_destroy (GTK_WIDGET(dialog));
1180 if (response == GO_BACK)
1182 if (current_page > 0) {
1184 if (current_page == MAILBOX_PAGE && skip_mailbox_page) {
1188 gtk_notebook_set_current_page (
1189 GTK_NOTEBOOK(wizard->notebook),
1193 else if (response == GO_FORWARD)
1195 if (current_page < (num_pages-1)) {
1197 if (current_page == MAILBOX_PAGE && skip_mailbox_page) {
1201 gtk_notebook_set_current_page (
1202 GTK_NOTEBOOK(wizard->notebook),
1207 gtk_dialog_set_response_sensitive (dialog, GO_BACK,
1209 gtk_dialog_set_response_sensitive (dialog, GO_FORWARD,
1210 current_page < (num_pages - 1));
1211 gtk_dialog_set_response_sensitive (dialog, FINISHED,
1212 current_page == (num_pages - 1));
1216 static gint wizard_close_cb(GtkWidget *widget, GdkEventAny *event,
1219 WizardWindow *wizard = (WizardWindow *)data;
1220 wizard->result = FALSE;
1221 wizard->finished = TRUE;
1226 #define PACK_WARNING(text) { \
1227 label = gtk_label_new(text); \
1228 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); \
1229 gtk_box_pack_end(GTK_BOX(widget), label, FALSE, FALSE, 0); \
1232 gboolean run_wizard(MainWindow *mainwin, gboolean create_mailbox) {
1233 WizardWindow *wizard = g_new0(WizardWindow, 1);
1241 wizard->mainwin = mainwin;
1242 wizard->create_mailbox = create_mailbox;
1244 gtk_widget_hide(mainwin->window);
1246 wizard_read_defaults();
1248 wizard->window = gtk_dialog_new_with_buttons (_("Claws Mail Setup Wizard"),
1250 GTK_STOCK_GO_BACK, GO_BACK,
1251 GTK_STOCK_GO_FORWARD, GO_FORWARD,
1252 GTK_STOCK_SAVE, FINISHED,
1253 GTK_STOCK_CANCEL, CANCEL,
1256 g_signal_connect(wizard->window, "response",
1257 G_CALLBACK(wizard_response_cb), wizard);
1258 gtk_widget_realize(wizard->window);
1259 gtk_dialog_set_default_response(GTK_DIALOG(wizard->window),
1261 gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
1263 gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
1265 gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
1267 gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
1270 wizard->notebook = gtk_notebook_new();
1271 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(wizard->notebook), FALSE);
1272 gtk_notebook_set_show_border(GTK_NOTEBOOK(wizard->notebook), FALSE);
1273 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(wizard->window)->vbox),
1274 wizard->notebook, TRUE, TRUE, 0);
1276 wizard->pages = NULL;
1278 /*welcome page: 0 */
1280 page = create_page(wizard, _("Welcome to Claws Mail"));
1282 wizard->pages = g_slist_append(wizard->pages, page);
1283 widget = stock_pixmap_widget(wizard->window,
1284 STOCK_PIXMAP_CLAWS_MAIL_LOGO);
1286 gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
1288 text = g_strdup(_("Welcome to the Claws Mail setup wizard.\n\n"
1289 "We will begin by defining some basic "
1290 "information about you and your most common "
1291 "mail options so that you can start to use "
1292 "Claws Mail in less than five minutes."));
1293 widget = gtk_label_new(text);
1294 gtk_label_set_line_wrap(GTK_LABEL(widget), TRUE);
1295 gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
1301 widget = create_page (wizard, _("About You"));
1302 gtk_box_pack_start (GTK_BOX(widget), user_page(wizard), FALSE, FALSE, 0);
1303 PACK_WARNING(_("Bold fields must be completed"));
1305 wizard->pages = g_slist_append(wizard->pages, widget);
1307 /* recv+auth page: 2 */
1310 widget = create_page (wizard, _("Receiving mail"));
1311 gtk_box_pack_start (GTK_BOX(widget), recv_page(wizard), FALSE, FALSE, 0);
1312 PACK_WARNING(_("Bold fields must be completed"));
1314 wizard->pages = g_slist_append(wizard->pages, widget);
1319 widget = create_page (wizard, _("Sending mail"));
1320 gtk_box_pack_start (GTK_BOX(widget), smtp_page(wizard), FALSE, FALSE, 0);
1321 PACK_WARNING(_("Bold fields must be completed"));
1323 wizard->pages = g_slist_append(wizard->pages, widget);
1325 /* mailbox page: 4 */
1326 if (create_mailbox) {
1329 widget = create_page (wizard, _("Saving mail on disk"));
1330 gtk_box_pack_start (GTK_BOX(widget), mailbox_page(wizard), FALSE, FALSE, 0);
1331 PACK_WARNING(_("Bold fields must be completed"));
1333 wizard->pages = g_slist_append(wizard->pages, widget);
1339 widget = create_page (wizard, _("Security"));
1340 gtk_box_pack_start (GTK_BOX(widget), ssl_page(wizard), FALSE, FALSE, 0);
1341 PACK_WARNING(_("Bold fields must be completed"));
1343 wizard->pages = g_slist_append(wizard->pages, widget);
1349 page = create_page(wizard, _("Configuration finished"));
1351 wizard->pages = g_slist_append(wizard->pages, page);
1352 widget = stock_pixmap_widget(wizard->window,
1353 STOCK_PIXMAP_CLAWS_MAIL_LOGO);
1355 gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
1357 text = g_strdup(_("Claws Mail is now ready.\n\n"
1358 "Click Save to start."));
1359 widget = gtk_label_new(text);
1360 gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
1364 for (cur = wizard->pages; cur && cur->data; cur = cur->next) {
1365 gtk_notebook_append_page (GTK_NOTEBOOK(wizard->notebook),
1366 GTK_WIDGET(cur->data), NULL);
1369 g_signal_connect(G_OBJECT(wizard->window), "delete_event",
1370 G_CALLBACK(wizard_close_cb), wizard);
1371 gtk_widget_show_all (wizard->window);
1373 gtk_widget_hide(wizard->recv_imap_label);
1374 gtk_widget_hide(wizard->recv_imap_subdir);
1376 wizard_protocol_change(wizard, tmpl.recvtype);
1378 while (!wizard->finished)
1379 gtk_main_iteration();
1381 result = wizard->result;
1385 gtk_widget_show(mainwin->window);