2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws 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>
53 #include "prefs_account.h"
54 #include "mainwindow.h"
55 #include "stock_pixmap.h"
58 #include "alertpanel.h"
62 #include "prefs_common.h"
72 int WELCOME_PAGE = -1;
76 int MAILBOX_PAGE = -1;
90 GtkWidget *organization;
92 GtkWidget *mailbox_name;
94 GtkWidget *smtp_server;
96 GtkWidget *smtp_username;
97 GtkWidget *smtp_password;
98 GtkWidget *smtp_username_label;
99 GtkWidget *smtp_password_label;
101 GtkWidget *recv_type;
102 GtkWidget *recv_label;
103 GtkWidget *recv_server;
104 GtkWidget *recv_username;
105 GtkWidget *recv_password;
106 GtkWidget *recv_username_label;
107 GtkWidget *recv_password_label;
108 GtkWidget *recv_imap_label;
109 GtkWidget *recv_imap_subdir;
112 GtkWidget *smtp_use_ssl;
113 GtkWidget *recv_use_ssl;
116 gboolean create_mailbox;
122 typedef struct _AccountTemplate {
131 RecvProtocol recvtype;
142 static AccountTemplate tmpl;
144 static PrefParam template_params[] = {
145 {"name", "$USERNAME",
146 &tmpl.name, P_STRING, NULL, NULL, NULL},
147 {"domain", "$DEFAULTDOMAIN",
148 &tmpl.domain, P_STRING, NULL, NULL, NULL},
149 {"email", "$NAME_MAIL@$DOMAIN",
150 &tmpl.email, P_STRING, NULL, NULL, NULL},
152 &tmpl.organization, P_STRING, NULL, NULL, NULL},
153 {"smtpserver", "smtp.$DOMAIN",
154 &tmpl.smtpserver, P_STRING, NULL, NULL, NULL},
155 {"smtpauth", "FALSE",
156 &tmpl.smtpauth, P_BOOL, NULL, NULL, NULL},
158 &tmpl.smtpuser, P_STRING, NULL, NULL, NULL},
160 &tmpl.smtppass, P_STRING, NULL, NULL, NULL},
162 &tmpl.recvtype, P_INT, NULL, NULL, NULL},
163 {"recvserver", "pop.$DOMAIN",
164 &tmpl.recvserver, P_STRING, NULL, NULL, NULL},
165 {"recvuser", "$LOGIN",
166 &tmpl.recvuser, P_STRING, NULL, NULL, NULL},
168 &tmpl.recvpass, P_STRING, NULL, NULL, NULL},
170 &tmpl.imapdir, P_STRING, NULL, NULL, NULL},
171 {"mboxfile", "/var/mail/$LOGIN",
172 &tmpl.mboxfile, P_STRING, NULL, NULL, NULL},
174 &tmpl.mailbox, P_STRING, NULL, NULL, NULL},
176 &tmpl.smtpssl, P_BOOL, NULL, NULL, NULL},
178 &tmpl.recvssl, P_BOOL, NULL, NULL, NULL},
179 {NULL, NULL, NULL, P_INT, NULL, NULL, NULL}
183 static gchar *accountrc_tmpl =
184 "[AccountTemplate]\n"
185 "#you can use $DEFAULTDOMAIN here\n"
186 "#domain must be defined before the variables that use it\n"
187 "#by default, domain is extracted from the hostname\n"
190 "#you can use $USERNAME for name (this is the default)\n"
193 "#you can use $LOGIN, $NAME_MAIL and $DOMAIN here \n"
194 "#$NAME_MAIL is the name without uppercase and with dots instead\n"
196 "#the default is $NAME_MAIL@$DOMAIN\n"
199 "#you can use $DOMAIN here\n"
200 "#the default organization is empty\n"
203 "#you can use $DOMAIN here \n"
204 "#the default is stmp.$DOMAIN\n"
207 "#Whether to use smtp authentication\n"
208 "#the default is 0 (no)\n"
212 "#you can use $LOGIN, $NAME_MAIL, $DOMAIN or $EMAIL here\n"
213 "#the default is empty (same as reception username)\n"
217 "#the default is empty (same as reception password)\n"
220 "#recvtype can be:\n"
223 "#5 for a local mbox file\n"
226 "#you can use $DOMAIN here \n"
227 "#the default is {pop,imap}.$DOMAIN\n"
230 "#you can use $LOGIN, $NAME_MAIL, $DOMAIN or $EMAIL here\n"
231 "#default is $LOGIN\n"
234 "#default is empty\n"
237 "#imap dir if imap (relative to the home on the server\n"
238 "#default is empty\n"
241 "#mbox file if local\n"
242 "#you can use $LOGIN here\n"
243 "#default is /var/mail/$LOGIN\n"
246 "#mailbox name if pop3 or local\n"
247 "#relative path from the user's home\n"
248 "#default is \"Mail\"\n"
251 "#whether to use ssl on STMP connections\n"
255 "#whether to use ssl on pop or imap connections\n"
259 static gchar *wizard_get_default_domain_name(void)
261 static gchar *domain_name = NULL;
263 if (domain_name == NULL) {
264 domain_name = g_strdup(get_domain_name());
265 if (strchr(domain_name, '.') != strrchr(domain_name, '.')
266 && strlen(strchr(domain_name, '.')) > 6) {
267 gchar *tmp = g_strdup(strchr(domain_name, '.')+1);
275 static gchar *get_name_for_mail(void)
277 gchar *name = g_strdup(tmpl.name);
281 while(strstr(name, " "))
282 *strstr(name, " ")='.';
287 #define PARSE_DEFAULT(str) { \
288 gchar *tmp = NULL, *new = NULL; \
290 tmp = g_strdup(str); \
291 if (strstr(str, "$USERNAME")) { \
292 tmp = g_strdup(str); \
293 *strstr(tmp, "$USERNAME") = '\0'; \
294 new = g_strconcat(tmp, g_get_real_name(), \
295 strstr(str, "$USERNAME")+strlen("$USERNAME"), \
302 if (strstr(str, "$LOGIN")) { \
303 tmp = g_strdup(str); \
304 *strstr(tmp, "$LOGIN") = '\0'; \
305 new = g_strconcat(tmp, g_get_user_name(), \
306 strstr(str, "$LOGIN")+strlen("$LOGIN"), \
313 if (strstr(str, "$EMAIL")) { \
314 tmp = g_strdup(str); \
315 *strstr(tmp, "$EMAIL") = '\0'; \
316 new = g_strconcat(tmp, tmpl.email, \
317 strstr(str, "$EMAIL")+strlen("$EMAIL"), \
324 if (strstr(str, "$NAME_MAIL")) { \
325 tmp = g_strdup(str); \
326 *strstr(tmp, "$NAME_MAIL") = '\0'; \
327 new = g_strconcat(tmp, get_name_for_mail(), \
328 strstr(str, "$NAME_MAIL")+strlen("$NAME_MAIL"), \
335 if (strstr(str, "$DEFAULTDOMAIN")) { \
336 tmp = g_strdup(str); \
337 *strstr(tmp, "$DEFAULTDOMAIN") = '\0'; \
338 new = g_strconcat(tmp, wizard_get_default_domain_name(), \
339 strstr(str, "$DEFAULTDOMAIN")+strlen("$DEFAULTDOMAIN"), \
346 if (strstr(str, "$DOMAIN")) { \
347 tmp = g_strdup(str); \
348 *strstr(tmp, "$DOMAIN") = '\0'; \
349 new = g_strconcat(tmp, tmpl.domain, \
350 strstr(str, "$DOMAIN")+strlen("$DOMAIN"), \
359 static void wizard_read_defaults(void)
363 rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "accountrc.tmpl", NULL);
364 if (!is_file_exist(rcpath)) {
365 str_write_to_file(accountrc_tmpl, rcpath);
368 prefs_read_config(template_params, "AccountTemplate", rcpath, NULL);
370 PARSE_DEFAULT(tmpl.domain);
371 PARSE_DEFAULT(tmpl.name);
372 PARSE_DEFAULT(tmpl.email);
373 PARSE_DEFAULT(tmpl.organization);
374 PARSE_DEFAULT(tmpl.smtpserver);
375 PARSE_DEFAULT(tmpl.smtpuser);
376 PARSE_DEFAULT(tmpl.smtppass);
377 PARSE_DEFAULT(tmpl.recvserver);
378 PARSE_DEFAULT(tmpl.recvuser);
379 PARSE_DEFAULT(tmpl.recvpass);
380 PARSE_DEFAULT(tmpl.imapdir);
381 PARSE_DEFAULT(tmpl.mboxfile);
382 PARSE_DEFAULT(tmpl.mailbox);
385 "%s, %s, %s, %s, %s, %d, %s, %s, %s, %s, %s, %s, %d, %d\n",
386 tmpl.name,tmpl.domain,tmpl.email,tmpl.organization,tmpl.smtpserver,
387 tmpl.recvtype,tmpl.recvserver,tmpl.recvuser,tmpl.recvpass,
388 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 Sylpheed-Claws "));
461 head = g_strdup_printf(
468 "Content-Type: text/plain; charset=UTF-8\n",
469 _("Sylpheed-Claws 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 Sylpheed-Claws\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 "You can change your Account Preferences by using the menu\n"
484 "entry '/Configuration/Preferences for current account'\n"
485 "and change the general Preferences by using\n"
486 "'/Configuration/Preferences'.\n"
488 "You can find further information in the Sylpheed-Claws manual,\n"
489 "which can be accessed by using the menu entry '/Help/Manual'\n"
490 "or online at the URL given below.\n"
498 "Mailing Lists: <%s>\n"
502 "Sylpheed-Claws is free software, released under the terms\n"
503 "of the GNU General Public License, version 2 or later, as\n"
504 "published by the Free Software Foundation, 51 Franklin Street,\n"
505 "Fifth Floor, Boston, MA 02110-1301, USA. The license can be\n"
510 "If you wish to donate to the Sylpheed-Claws project you can do\n"
512 HOMEPAGE_URI, MANUAL_URI, FAQ_URI, THEMES_URI, MAILING_LIST_URI,
513 GPL_URI, DONATE_URI);
515 msg = g_strconcat(head, body, NULL);
517 if (inbox && inbox->total_msgs == 0
518 && str_write_to_file(msg, file) >= 0) {
519 MsgFlags flags = { MSG_UNREAD|MSG_NEW, 0};
520 folder_item_add_msg(inbox, file, &flags, FALSE);
530 static gboolean wizard_write_config(WizardWindow *wizard)
532 static gboolean mailbox_ok = FALSE;
533 PrefsAccount *prefs_account = prefs_account_new();
534 GList *account_list = NULL;
535 GtkWidget *menu, *menuitem;
537 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(wizard->recv_type));
538 menuitem = gtk_menu_get_active(GTK_MENU(menu));
539 prefs_account->protocol = GPOINTER_TO_INT
540 (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
543 if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4 &&
544 !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name)))) {
545 alertpanel_error(_("Please enter the mailbox name."));
546 g_free(prefs_account);
547 gtk_notebook_set_current_page (
548 GTK_NOTEBOOK(wizard->notebook),
554 if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4) {
555 mailbox_ok = setup_write_mailbox_path(wizard->mainwin,
557 GTK_ENTRY(wizard->mailbox_name)));
563 /* alertpanel done by setup_write_mailbox_path */
564 g_free(prefs_account);
565 gtk_notebook_set_current_page (
566 GTK_NOTEBOOK(wizard->notebook),
571 if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->full_name)))
572 || !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->email)))) {
573 alertpanel_error(_("Please enter your name and email address."));
574 g_free(prefs_account);
575 gtk_notebook_set_current_page (
576 GTK_NOTEBOOK(wizard->notebook),
581 if (prefs_account->protocol != A_LOCAL) {
582 if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->recv_username)))
583 || !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)))) {
584 alertpanel_error(_("Please enter your receiving server "
586 g_free(prefs_account);
587 gtk_notebook_set_current_page (
588 GTK_NOTEBOOK(wizard->notebook),
593 if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)))) {
594 alertpanel_error(_("Please enter your username."));
595 g_free(prefs_account);
596 gtk_notebook_set_current_page (
597 GTK_NOTEBOOK(wizard->notebook),
603 if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->smtp_server)))) {
604 alertpanel_error(_("Please enter your SMTP server."));
605 g_free(prefs_account);
606 gtk_notebook_set_current_page (
607 GTK_NOTEBOOK(wizard->notebook),
612 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->smtp_auth))) {
613 if (prefs_account->protocol == A_LOCAL
614 && !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->smtp_username)))) {
615 alertpanel_error(_("Please enter your SMTP username."));
616 g_free(prefs_account);
617 gtk_notebook_set_current_page (
618 GTK_NOTEBOOK(wizard->notebook),
621 } /* if it's not local we'll use the reception server */
624 if (prefs_account->protocol != A_LOCAL)
625 prefs_account->account_name = g_strdup_printf("%s@%s",
626 gtk_entry_get_text(GTK_ENTRY(wizard->recv_username)),
627 gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
629 prefs_account->account_name = g_strdup_printf("%s",
630 gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
632 prefs_account->name = g_strdup(
633 gtk_entry_get_text(GTK_ENTRY(wizard->full_name)));
634 prefs_account->address = g_strdup(
635 gtk_entry_get_text(GTK_ENTRY(wizard->email)));
636 prefs_account->organization = g_strdup(
637 gtk_entry_get_text(GTK_ENTRY(wizard->organization)));
638 prefs_account->smtp_server = g_strdup(
639 gtk_entry_get_text(GTK_ENTRY(wizard->smtp_server)));
641 if (prefs_account->protocol != A_LOCAL)
642 prefs_account->recv_server = g_strdup(
643 gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
645 prefs_account->local_mbox = g_strdup(
646 gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
648 prefs_account->userid = g_strdup(
649 gtk_entry_get_text(GTK_ENTRY(wizard->recv_username)));
650 prefs_account->passwd = g_strdup(
651 gtk_entry_get_text(GTK_ENTRY(wizard->recv_password)));
653 prefs_account->smtp_userid = g_strdup(
654 gtk_entry_get_text(GTK_ENTRY(wizard->smtp_username)));
655 prefs_account->smtp_passwd = g_strdup(
656 gtk_entry_get_text(GTK_ENTRY(wizard->smtp_password)));
657 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->smtp_auth))) {
658 prefs_account->use_smtp_auth = TRUE;
662 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->smtp_use_ssl)))
663 prefs_account->ssl_smtp = SSL_TUNNEL;
664 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->recv_use_ssl))) {
665 if (prefs_account->protocol == A_IMAP4)
666 prefs_account->ssl_imap = SSL_TUNNEL;
668 prefs_account->ssl_pop = SSL_TUNNEL;
671 if (prefs_account->protocol == A_IMAP4) {
672 gchar *directory = gtk_editable_get_chars(
673 GTK_EDITABLE(wizard->recv_imap_subdir), 0, -1);
674 if (directory && strlen(directory)) {
675 prefs_account->imap_dir = g_strdup(directory);
680 account_list = g_list_append(account_list, prefs_account);
681 prefs_account_write_config_all(account_list);
682 prefs_account_free(prefs_account);
683 account_read_config_all();
685 initialize_fonts(wizard);
686 if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4)
687 write_welcome_email(wizard);
692 static GtkWidget* create_page (WizardWindow *wizard, const char * title)
700 vbox = gtk_vbox_new (FALSE, 6);
701 gtk_container_set_border_width (GTK_CONTAINER(vbox), 10);
703 /* create the titlebar */
704 hbox = gtk_hbox_new (FALSE, 12);
705 image = stock_pixmap_widget(wizard->window,
706 STOCK_PIXMAP_SYLPHEED_ICON);
707 gtk_box_pack_start (GTK_BOX(hbox), image, FALSE, FALSE, 0);
708 title_string = g_strconcat ("<span size=\"xx-large\" weight=\"ultrabold\">", title ? title : "", "</span>", NULL);
709 w = gtk_label_new (title_string);
710 gtk_label_set_use_markup (GTK_LABEL(w), TRUE);
711 g_free (title_string);
712 gtk_box_pack_start (GTK_BOX(hbox), w, FALSE, FALSE, 0);
714 /* pack the titlebar */
715 gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
717 /* pack the separator */
718 gtk_box_pack_start (GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
721 w = gtk_alignment_new (0, 0, 0, 0);
722 gtk_widget_set_size_request (w, 0, 6);
723 gtk_box_pack_start (GTK_BOX(vbox), w, FALSE, FALSE, 0);
728 #define GTK_TABLE_ADD_ROW_AT(table,text,entry,i) { \
729 GtkWidget *label = gtk_label_new(text); \
730 gtk_table_attach(GTK_TABLE(table), label, \
731 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0); \
732 gtk_label_set_use_markup(GTK_LABEL(label), TRUE); \
733 if (GTK_IS_MISC(label)) \
734 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); \
735 gtk_table_attach(GTK_TABLE(table), entry, \
736 1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0); \
739 static gchar *get_default_server(WizardWindow * wizard, const gchar *type)
741 if (!strcmp(type, "smtp")) {
742 if (!tmpl.smtpserver || !strlen(tmpl.smtpserver))
743 return g_strconcat(type, ".", tmpl.domain, NULL);
745 return g_strdup(tmpl.smtpserver);
747 if (!tmpl.recvserver || !strlen(tmpl.recvserver))
748 return g_strconcat(type, ".", tmpl.domain, NULL);
750 return g_strdup(tmpl.recvserver);
754 static gchar *get_default_account(WizardWindow * wizard)
756 gchar *result = NULL;
758 if (!tmpl.recvuser || !strlen(tmpl.recvuser)) {
759 result = gtk_editable_get_chars(
760 GTK_EDITABLE(wizard->email), 0, -1);
762 if (strstr(result, "@")) {
763 *(strstr(result,"@")) = '\0';
766 result = g_strdup(tmpl.recvuser);
771 static gchar *get_default_smtp_account(WizardWindow * wizard)
773 gchar *result = NULL;
775 if (!tmpl.smtpuser || !strlen(tmpl.smtpuser)) {
778 result = g_strdup(tmpl.smtpuser);
783 static void wizard_email_changed(GtkWidget *widget, gpointer data)
785 WizardWindow *wizard = (WizardWindow *)data;
786 RecvProtocol protocol;
788 protocol = GPOINTER_TO_INT
789 (g_object_get_data(G_OBJECT(wizard->recv_type), MENU_VAL_ID));
791 text = get_default_server(wizard, "smtp");
792 gtk_entry_set_text(GTK_ENTRY(wizard->smtp_server), text);
795 text = get_default_account(wizard);
796 gtk_entry_set_text(GTK_ENTRY(wizard->recv_username), text);
799 if (protocol == A_POP3) {
800 text = get_default_server(wizard, "pop");
801 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
803 } else if (protocol == A_IMAP4) {
804 text = get_default_server(wizard, "imap");
805 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
807 } else if (protocol == A_LOCAL) {
808 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), tmpl.mboxfile?tmpl.mboxfile:"");
813 static GtkWidget* user_page (WizardWindow * wizard)
815 GtkWidget *table = gtk_table_new(3,2, FALSE);
818 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
819 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
821 wizard->full_name = gtk_entry_new();
822 gtk_entry_set_text(GTK_ENTRY(wizard->full_name), tmpl.name?tmpl.name:"");
823 GTK_TABLE_ADD_ROW_AT(table, _("<span weight=\"bold\">Your name:</span>"),
824 wizard->full_name, i); i++;
826 wizard->email = gtk_entry_new();
827 gtk_entry_set_text(GTK_ENTRY(wizard->email), tmpl.email?tmpl.email:"");
828 GTK_TABLE_ADD_ROW_AT(table, _("<span weight=\"bold\">Your email address:</span>"),
829 wizard->email, i); i++;
831 wizard->organization = gtk_entry_new();
832 GTK_TABLE_ADD_ROW_AT(table, _("Your organization:"),
833 wizard->organization, i); i++;
834 gtk_entry_set_text(GTK_ENTRY(wizard->organization), tmpl.organization?tmpl.organization:"");
836 g_signal_connect(G_OBJECT(wizard->email), "changed",
837 G_CALLBACK(wizard_email_changed),
842 static GtkWidget* mailbox_page (WizardWindow * wizard)
844 GtkWidget *table = gtk_table_new(1,2, FALSE);
847 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
848 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
850 wizard->mailbox_name = gtk_entry_new();
851 gtk_entry_set_text(GTK_ENTRY(wizard->mailbox_name), tmpl.mailbox?tmpl.mailbox:"");
852 GTK_TABLE_ADD_ROW_AT(table, _("<span weight=\"bold\">Mailbox name:</span>"),
853 wizard->mailbox_name, i); i++;
858 static void smtp_auth_changed (GtkWidget *btn, gpointer data)
860 WizardWindow *wizard = (WizardWindow *)data;
861 gboolean do_auth = gtk_toggle_button_get_active(
862 GTK_TOGGLE_BUTTON(wizard->smtp_auth));
863 gtk_widget_set_sensitive(wizard->smtp_username, do_auth);
864 gtk_widget_set_sensitive(wizard->smtp_username_label, do_auth);
865 gtk_widget_set_sensitive(wizard->smtp_password, do_auth);
866 gtk_widget_set_sensitive(wizard->smtp_password_label, do_auth);
869 static GtkWidget* smtp_page (WizardWindow * wizard)
871 GtkWidget *table = gtk_table_new(1,4, FALSE);
875 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
876 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
878 wizard->smtp_server = gtk_entry_new();
879 text = get_default_server(wizard, "smtp");
880 gtk_entry_set_text(GTK_ENTRY(wizard->smtp_server), text);
882 GTK_TABLE_ADD_ROW_AT(table, _("<span weight=\"bold\">SMTP server address:</span>"),
883 wizard->smtp_server, i); i++;
884 wizard->smtp_auth = gtk_check_button_new_with_label(
885 _("Use authentication"));
886 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->smtp_auth),
888 g_signal_connect(G_OBJECT(wizard->smtp_auth), "toggled",
889 G_CALLBACK(smtp_auth_changed),
891 gtk_table_attach(GTK_TABLE(table), wizard->smtp_auth,
892 0,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0); i++;
894 text = get_default_smtp_account(wizard);
896 wizard->smtp_username = gtk_entry_new();
897 gtk_entry_set_text(GTK_ENTRY(wizard->smtp_username), text);
899 wizard->smtp_username_label = gtk_label_new(_("SMTP username:\n"
900 "<span size=\"small\">(empty to use the same as reception)</span>"));
901 gtk_label_set_use_markup(GTK_LABEL(wizard->smtp_username_label), TRUE);
902 gtk_table_attach(GTK_TABLE(table), wizard->smtp_username_label,
903 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
904 if (GTK_IS_MISC(wizard->smtp_username_label))
905 gtk_misc_set_alignment(GTK_MISC(wizard->smtp_username_label), 1, 0.5);
906 gtk_table_attach(GTK_TABLE(table), wizard->smtp_username,
907 1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
909 wizard->smtp_password = gtk_entry_new();
910 gtk_entry_set_text(GTK_ENTRY(wizard->smtp_password), tmpl.smtppass?tmpl.smtppass:"");
911 gtk_entry_set_visibility(GTK_ENTRY(wizard->smtp_password), FALSE);
912 wizard->smtp_password_label = gtk_label_new(_("SMTP password:\n"
913 "<span size=\"small\">(empty to use the same as reception)</span>"));
914 gtk_label_set_use_markup(GTK_LABEL(wizard->smtp_password_label), TRUE);
915 gtk_table_attach(GTK_TABLE(table), wizard->smtp_password_label,
916 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
917 if (GTK_IS_MISC(wizard->smtp_password_label))
918 gtk_misc_set_alignment(GTK_MISC(wizard->smtp_password_label), 1, 0.5);
919 gtk_table_attach(GTK_TABLE(table), wizard->smtp_password,
920 1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
922 smtp_auth_changed(NULL, wizard);
926 static void wizard_protocol_change(WizardWindow *wizard, RecvProtocol protocol)
930 if (protocol == A_POP3) {
931 text = get_default_server(wizard, "pop");
932 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
933 gtk_widget_hide(wizard->recv_imap_label);
934 gtk_widget_hide(wizard->recv_imap_subdir);
935 gtk_widget_show(wizard->recv_username);
936 gtk_widget_show(wizard->recv_password);
937 gtk_widget_show(wizard->recv_username_label);
938 gtk_widget_show(wizard->recv_password_label);
939 gtk_label_set_text(GTK_LABEL(wizard->recv_label), _("<span weight=\"bold\">Server address:</span>"));
940 gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
942 } else if (protocol == A_IMAP4) {
943 text = get_default_server(wizard, "imap");
944 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
945 gtk_widget_show(wizard->recv_imap_label);
946 gtk_widget_show(wizard->recv_imap_subdir);
947 gtk_widget_show(wizard->recv_username);
948 gtk_widget_show(wizard->recv_password);
949 gtk_widget_show(wizard->recv_username_label);
950 gtk_widget_show(wizard->recv_password_label);
951 gtk_label_set_text(GTK_LABEL(wizard->recv_label), _("<span weight=\"bold\">Server address:</span>"));
952 gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
954 } else if (protocol == A_LOCAL) {
955 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), tmpl.mboxfile?tmpl.mboxfile:"");
956 gtk_label_set_text(GTK_LABEL(wizard->recv_label), _("<span weight=\"bold\">Local mailbox:</span>"));
957 gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
958 gtk_widget_hide(wizard->recv_imap_label);
959 gtk_widget_hide(wizard->recv_imap_subdir);
960 gtk_widget_hide(wizard->recv_username);
961 gtk_widget_hide(wizard->recv_password);
962 gtk_widget_hide(wizard->recv_username_label);
963 gtk_widget_hide(wizard->recv_password_label);
967 static void wizard_protocol_changed(GtkMenuItem *menuitem, gpointer data)
969 WizardWindow *wizard = (WizardWindow *)data;
970 RecvProtocol protocol;
971 protocol = GPOINTER_TO_INT
972 (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
974 wizard_protocol_change(wizard, protocol);
977 static GtkWidget* recv_page (WizardWindow * wizard)
979 GtkWidget *table = gtk_table_new(5,2, FALSE);
980 GtkWidget *menu = gtk_menu_new();
986 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
987 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
989 wizard->recv_type = gtk_option_menu_new();
991 MENUITEM_ADD (menu, menuitem, _("POP3"), A_POP3);
992 g_signal_connect(G_OBJECT(menuitem), "activate",
993 G_CALLBACK(wizard_protocol_changed),
996 MENUITEM_ADD (menu, menuitem, _("IMAP"), A_IMAP4);
997 g_signal_connect(G_OBJECT(menuitem), "activate",
998 G_CALLBACK(wizard_protocol_changed),
1001 MENUITEM_ADD (menu, menuitem, _("Local mbox file"), A_LOCAL);
1002 g_signal_connect(G_OBJECT(menuitem), "activate",
1003 G_CALLBACK(wizard_protocol_changed),
1006 gtk_option_menu_set_menu (GTK_OPTION_MENU (wizard->recv_type), menu);
1007 switch(tmpl.recvtype) {
1011 #ifdef HAVE_LIBETPAN
1026 gtk_option_menu_set_history(GTK_OPTION_MENU (wizard->recv_type), index);
1027 GTK_TABLE_ADD_ROW_AT(table, _("<span weight=\"bold\">Server type:</span>"),
1028 wizard->recv_type, i); i++;
1030 wizard->recv_server = gtk_entry_new();
1031 text = get_default_server(wizard, "pop");
1032 gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
1035 wizard->recv_label = gtk_label_new(_("<span weight=\"bold\">Server address:</span>"));
1036 gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
1037 gtk_table_attach(GTK_TABLE(table), wizard->recv_label,
1038 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1039 if (GTK_IS_MISC(wizard->recv_label))
1040 gtk_misc_set_alignment(GTK_MISC(wizard->recv_label), 1, 0.5);
1041 gtk_table_attach(GTK_TABLE(table), wizard->recv_server,
1042 1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1045 wizard->recv_username = gtk_entry_new();
1046 wizard->recv_username_label = gtk_label_new(_("<span weight=\"bold\">Username:</span>"));
1047 gtk_label_set_use_markup(GTK_LABEL(wizard->recv_username_label), TRUE);
1048 gtk_table_attach(GTK_TABLE(table), wizard->recv_username_label,
1049 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1050 if (GTK_IS_MISC(wizard->recv_username_label))
1051 gtk_misc_set_alignment(GTK_MISC(wizard->recv_username_label), 1, 0.5);
1052 gtk_table_attach(GTK_TABLE(table), wizard->recv_username,
1053 1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1056 text = get_default_account(wizard);
1057 gtk_entry_set_text(GTK_ENTRY(wizard->recv_username), text);
1060 wizard->recv_password = gtk_entry_new();
1061 gtk_entry_set_text(GTK_ENTRY(wizard->recv_password), tmpl.recvpass?tmpl.recvpass:"");
1062 wizard->recv_password_label = gtk_label_new(_("Password:"));
1063 gtk_table_attach(GTK_TABLE(table), wizard->recv_password_label,
1064 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1065 if (GTK_IS_MISC(wizard->recv_password_label))
1066 gtk_misc_set_alignment(GTK_MISC(wizard->recv_password_label), 1, 0.5);
1067 gtk_table_attach(GTK_TABLE(table), wizard->recv_password,
1068 1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1069 gtk_entry_set_visibility(GTK_ENTRY(wizard->recv_password), FALSE);
1072 wizard->recv_imap_subdir = gtk_entry_new();
1073 gtk_entry_set_text(GTK_ENTRY(wizard->recv_imap_subdir), tmpl.imapdir?tmpl.imapdir:"");
1074 wizard->recv_imap_label = gtk_label_new(_("IMAP server directory:"));
1076 gtk_table_attach(GTK_TABLE(table), wizard->recv_imap_label,
1077 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1078 if (GTK_IS_MISC(wizard->recv_imap_label))
1079 gtk_misc_set_alignment(GTK_MISC(wizard->recv_imap_label), 1, 0.5);
1080 gtk_table_attach(GTK_TABLE(table), wizard->recv_imap_subdir,
1081 1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1089 static GtkWidget* ssl_page (WizardWindow * wizard)
1091 GtkWidget *table = gtk_table_new(2,2, FALSE);
1094 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
1095 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
1097 wizard->smtp_use_ssl = gtk_check_button_new_with_label(
1098 _("Use SSL to connect to SMTP server"));
1099 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->smtp_use_ssl),
1101 gtk_table_attach(GTK_TABLE(table), wizard->smtp_use_ssl,
1102 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0); i++;
1104 wizard->recv_use_ssl = gtk_check_button_new_with_label(
1105 _("Use SSL to connect to receiving server"));
1106 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->recv_use_ssl),
1108 gtk_table_attach(GTK_TABLE(table), wizard->recv_use_ssl,
1109 0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
1116 wizard_response_cb (GtkDialog * dialog, int response, gpointer data)
1118 WizardWindow * wizard = (WizardWindow *)data;
1119 int current_page, num_pages;
1120 GtkWidget *menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(wizard->recv_type));
1121 GtkWidget *menuitem = gtk_menu_get_active(GTK_MENU(menu));
1122 gint protocol = GPOINTER_TO_INT
1123 (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
1124 gboolean skip_mailbox_page = FALSE;
1126 if (protocol == A_IMAP4) {
1127 skip_mailbox_page = TRUE;
1130 num_pages = g_slist_length(wizard->pages);
1132 current_page = gtk_notebook_get_current_page (
1133 GTK_NOTEBOOK(wizard->notebook));
1134 if (response == CANCEL)
1136 wizard->result = FALSE;
1137 wizard->finished = TRUE;
1138 gtk_widget_destroy (GTK_WIDGET(dialog));
1140 else if (response == FINISHED)
1142 if (!wizard_write_config(wizard)) {
1143 current_page = gtk_notebook_get_current_page (
1144 GTK_NOTEBOOK(wizard->notebook));
1147 wizard->result = TRUE;
1148 wizard->finished = TRUE;
1149 gtk_widget_destroy (GTK_WIDGET(dialog));
1153 if (response == GO_BACK)
1155 if (current_page > 0) {
1157 if (current_page == MAILBOX_PAGE && skip_mailbox_page) {
1161 gtk_notebook_set_current_page (
1162 GTK_NOTEBOOK(wizard->notebook),
1166 else if (response == GO_FORWARD)
1168 if (current_page < (num_pages-1)) {
1170 if (current_page == MAILBOX_PAGE && skip_mailbox_page) {
1174 gtk_notebook_set_current_page (
1175 GTK_NOTEBOOK(wizard->notebook),
1180 gtk_dialog_set_response_sensitive (dialog, GO_BACK,
1182 gtk_dialog_set_response_sensitive (dialog, GO_FORWARD,
1183 current_page < (num_pages - 1));
1184 gtk_dialog_set_response_sensitive (dialog, FINISHED,
1185 current_page == (num_pages - 1));
1189 static gint wizard_close_cb(GtkWidget *widget, GdkEventAny *event,
1192 WizardWindow *wizard = (WizardWindow *)data;
1193 wizard->result = FALSE;
1194 wizard->finished = TRUE;
1199 #define PACK_WARNING(text) { \
1200 label = gtk_label_new(text); \
1201 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); \
1202 gtk_box_pack_end(GTK_BOX(widget), label, FALSE, FALSE, 0); \
1205 gboolean run_wizard(MainWindow *mainwin, gboolean create_mailbox) {
1206 WizardWindow *wizard = g_new0(WizardWindow, 1);
1214 wizard->mainwin = mainwin;
1215 wizard->create_mailbox = create_mailbox;
1217 gtk_widget_hide(mainwin->window);
1219 wizard_read_defaults();
1221 wizard->window = gtk_dialog_new_with_buttons (_("Sylpheed-Claws Setup Wizard"),
1223 GTK_STOCK_GO_BACK, GO_BACK,
1224 GTK_STOCK_GO_FORWARD, GO_FORWARD,
1225 GTK_STOCK_SAVE, FINISHED,
1226 GTK_STOCK_CANCEL, CANCEL,
1229 g_signal_connect(wizard->window, "response",
1230 G_CALLBACK(wizard_response_cb), wizard);
1231 gtk_widget_realize(wizard->window);
1232 gtk_dialog_set_default_response(GTK_DIALOG(wizard->window),
1234 gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
1236 gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
1238 gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
1240 gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
1243 wizard->notebook = gtk_notebook_new();
1244 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(wizard->notebook), FALSE);
1245 gtk_notebook_set_show_border(GTK_NOTEBOOK(wizard->notebook), FALSE);
1246 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(wizard->window)->vbox),
1247 wizard->notebook, TRUE, TRUE, 0);
1249 wizard->pages = NULL;
1251 /*welcome page: 0 */
1253 page = create_page(wizard, _("Welcome to Sylpheed-Claws"));
1255 wizard->pages = g_slist_append(wizard->pages, page);
1256 widget = stock_pixmap_widget(wizard->window,
1257 STOCK_PIXMAP_SYLPHEED_LOGO);
1259 gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
1261 text = g_strdup(_("Welcome to the Sylpheed-Claws setup wizard.\n\n"
1262 "We will begin by defining some basic "
1263 "information about you and your most common "
1264 "mail options so that you can start to use "
1265 "Sylpheed-Claws in less than five minutes."));
1266 widget = gtk_label_new(text);
1267 gtk_label_set_line_wrap(GTK_LABEL(widget), TRUE);
1268 gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
1274 widget = create_page (wizard, _("About You"));
1275 gtk_box_pack_start (GTK_BOX(widget), user_page(wizard), FALSE, FALSE, 0);
1276 PACK_WARNING(_("Bold fields must be completed"));
1278 wizard->pages = g_slist_append(wizard->pages, widget);
1280 /* recv+auth page: 2 */
1283 widget = create_page (wizard, _("Receiving mail"));
1284 gtk_box_pack_start (GTK_BOX(widget), recv_page(wizard), FALSE, FALSE, 0);
1285 PACK_WARNING(_("Bold fields must be completed"));
1287 wizard->pages = g_slist_append(wizard->pages, widget);
1292 widget = create_page (wizard, _("Sending mail"));
1293 gtk_box_pack_start (GTK_BOX(widget), smtp_page(wizard), FALSE, FALSE, 0);
1294 PACK_WARNING(_("Bold fields must be completed"));
1296 wizard->pages = g_slist_append(wizard->pages, widget);
1298 /* mailbox page: 4 */
1299 if (create_mailbox) {
1302 widget = create_page (wizard, _("Saving mail on disk"));
1303 gtk_box_pack_start (GTK_BOX(widget), mailbox_page(wizard), FALSE, FALSE, 0);
1304 PACK_WARNING(_("Bold fields must be completed"));
1306 wizard->pages = g_slist_append(wizard->pages, widget);
1312 widget = create_page (wizard, _("Security"));
1313 gtk_box_pack_start (GTK_BOX(widget), ssl_page(wizard), FALSE, FALSE, 0);
1314 PACK_WARNING(_("Bold fields must be completed"));
1316 wizard->pages = g_slist_append(wizard->pages, widget);
1322 page = create_page(wizard, _("Configuration finished"));
1324 wizard->pages = g_slist_append(wizard->pages, page);
1325 widget = stock_pixmap_widget(wizard->window,
1326 STOCK_PIXMAP_SYLPHEED_LOGO);
1328 gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
1330 text = g_strdup(_("Sylpheed-Claws is now ready.\n\n"
1331 "Click Save to start."));
1332 widget = gtk_label_new(text);
1333 gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
1337 for (cur = wizard->pages; cur && cur->data; cur = cur->next) {
1338 gtk_notebook_append_page (GTK_NOTEBOOK(wizard->notebook),
1339 GTK_WIDGET(cur->data), NULL);
1342 g_signal_connect(G_OBJECT(wizard->window), "delete_event",
1343 G_CALLBACK(wizard_close_cb), wizard);
1344 gtk_widget_show_all (wizard->window);
1346 gtk_widget_hide(wizard->recv_imap_label);
1347 gtk_widget_hide(wizard->recv_imap_subdir);
1349 wizard_protocol_change(wizard, tmpl.recvtype);
1351 while (!wizard->finished)
1352 gtk_main_iteration();
1354 result = wizard->result;
1358 gtk_widget_show(mainwin->window);