2004-08-25 00:46:53 +02:00
|
|
|
/*
|
|
|
|
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
|
2006-11-07 11:47:23 +01:00
|
|
|
* Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Claws Mail team
|
2004-08-25 00:46:53 +02:00
|
|
|
* This file (C) 2004 Colin Leroy
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-09-21 20:22:51 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-08-25 00:46:53 +02:00
|
|
|
*/
|
2005-10-06 21:31:50 +02:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
#include "defs.h"
|
|
|
|
|
|
|
|
#include <glib.h>
|
2005-02-10 13:06:07 +01:00
|
|
|
#include <glib/gi18n.h>
|
2004-08-25 00:46:53 +02:00
|
|
|
#include <gdk/gdkkeysyms.h>
|
|
|
|
#include <gtk/gtkwidget.h>
|
|
|
|
#include <gtk/gtkvbox.h>
|
|
|
|
#include <gtk/gtkbox.h>
|
|
|
|
#include <gtk/gtktable.h>
|
|
|
|
#include <gtk/gtkentry.h>
|
|
|
|
#include <gtk/gtklabel.h>
|
|
|
|
#include <gtk/gtknotebook.h>
|
2004-08-25 12:35:53 +02:00
|
|
|
#include <gtk/gtktogglebutton.h>
|
|
|
|
#include <gtk/gtkcheckbutton.h>
|
2004-08-25 00:46:53 +02:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "utils.h"
|
|
|
|
#include "gtk/menu.h"
|
2006-09-21 19:10:04 +02:00
|
|
|
#include "plugin.h"
|
2004-08-26 08:45:58 +02:00
|
|
|
#include "account.h"
|
2004-08-25 00:46:53 +02:00
|
|
|
#include "prefs_account.h"
|
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "stock_pixmap.h"
|
|
|
|
#include "setup.h"
|
2004-08-25 01:19:35 +02:00
|
|
|
#include "folder.h"
|
2005-11-24 13:37:29 +01:00
|
|
|
#include "alertpanel.h"
|
2004-08-25 12:35:53 +02:00
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
#include "ssl.h"
|
|
|
|
#endif
|
2005-10-16 15:19:35 +02:00
|
|
|
#include "prefs_common.h"
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GO_BACK,
|
|
|
|
GO_FORWARD,
|
|
|
|
CANCEL,
|
|
|
|
FINISHED
|
|
|
|
} PageNavigation;
|
|
|
|
|
2005-11-24 13:37:29 +01:00
|
|
|
int WELCOME_PAGE = -1;
|
|
|
|
int USER_PAGE = -1;
|
|
|
|
int SMTP_PAGE = -1;
|
|
|
|
int RECV_PAGE = -1;
|
|
|
|
int MAILBOX_PAGE = -1;
|
|
|
|
int DONE_PAGE = -1;
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GtkWidget *window;
|
|
|
|
GSList *pages;
|
|
|
|
GtkWidget *notebook;
|
|
|
|
|
|
|
|
MainWindow *mainwin;
|
|
|
|
|
|
|
|
GtkWidget *email;
|
|
|
|
GtkWidget *full_name;
|
|
|
|
GtkWidget *organization;
|
|
|
|
|
|
|
|
GtkWidget *mailbox_name;
|
|
|
|
|
|
|
|
GtkWidget *smtp_server;
|
2006-04-05 18:49:00 +02:00
|
|
|
GtkWidget *smtp_auth;
|
|
|
|
GtkWidget *smtp_username;
|
|
|
|
GtkWidget *smtp_password;
|
|
|
|
GtkWidget *smtp_username_label;
|
|
|
|
GtkWidget *smtp_password_label;
|
2004-08-25 12:35:53 +02:00
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
GtkWidget *recv_type;
|
2005-10-03 19:11:47 +02:00
|
|
|
GtkWidget *recv_label;
|
2004-08-25 00:46:53 +02:00
|
|
|
GtkWidget *recv_server;
|
|
|
|
GtkWidget *recv_username;
|
|
|
|
GtkWidget *recv_password;
|
2005-10-03 19:11:47 +02:00
|
|
|
GtkWidget *recv_username_label;
|
|
|
|
GtkWidget *recv_password_label;
|
|
|
|
GtkWidget *recv_imap_label;
|
|
|
|
GtkWidget *recv_imap_subdir;
|
2006-10-07 18:03:36 +02:00
|
|
|
GtkWidget *no_imap_warning;
|
2004-08-25 12:35:53 +02:00
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
GtkWidget *smtp_use_ssl;
|
|
|
|
GtkWidget *recv_use_ssl;
|
2006-12-12 22:58:07 +01:00
|
|
|
GtkWidget *smtp_use_tls;
|
|
|
|
GtkWidget *recv_use_tls;
|
2004-08-25 12:35:53 +02:00
|
|
|
#endif
|
2004-08-25 00:46:53 +02:00
|
|
|
|
|
|
|
gboolean create_mailbox;
|
|
|
|
gboolean finished;
|
2004-08-26 08:45:58 +02:00
|
|
|
gboolean result;
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
} WizardWindow;
|
|
|
|
|
2006-04-05 18:49:00 +02:00
|
|
|
typedef struct _AccountTemplate {
|
|
|
|
gchar *name;
|
|
|
|
gchar *domain;
|
|
|
|
gchar *email;
|
|
|
|
gchar *organization;
|
|
|
|
gchar *smtpserver;
|
|
|
|
gboolean smtpauth;
|
|
|
|
gchar *smtpuser;
|
|
|
|
gchar *smtppass;
|
|
|
|
RecvProtocol recvtype;
|
|
|
|
gchar *recvserver;
|
|
|
|
gchar *recvuser;
|
|
|
|
gchar *recvpass;
|
|
|
|
gchar *imapdir;
|
|
|
|
gchar *mboxfile;
|
|
|
|
gchar *mailbox;
|
|
|
|
gboolean smtpssl;
|
|
|
|
gboolean recvssl;
|
|
|
|
} AccountTemplate;
|
|
|
|
|
|
|
|
static AccountTemplate tmpl;
|
|
|
|
|
|
|
|
static PrefParam template_params[] = {
|
|
|
|
{"name", "$USERNAME",
|
|
|
|
&tmpl.name, P_STRING, NULL, NULL, NULL},
|
|
|
|
{"domain", "$DEFAULTDOMAIN",
|
|
|
|
&tmpl.domain, P_STRING, NULL, NULL, NULL},
|
|
|
|
{"email", "$NAME_MAIL@$DOMAIN",
|
|
|
|
&tmpl.email, P_STRING, NULL, NULL, NULL},
|
|
|
|
{"organization", "",
|
|
|
|
&tmpl.organization, P_STRING, NULL, NULL, NULL},
|
|
|
|
{"smtpserver", "smtp.$DOMAIN",
|
|
|
|
&tmpl.smtpserver, P_STRING, NULL, NULL, NULL},
|
|
|
|
{"smtpauth", "FALSE",
|
|
|
|
&tmpl.smtpauth, P_BOOL, NULL, NULL, NULL},
|
|
|
|
{"smtpuser", "",
|
|
|
|
&tmpl.smtpuser, P_STRING, NULL, NULL, NULL},
|
|
|
|
{"smtppass", "",
|
|
|
|
&tmpl.smtppass, P_STRING, NULL, NULL, NULL},
|
|
|
|
{"recvtype", A_POP3,
|
|
|
|
&tmpl.recvtype, P_INT, NULL, NULL, NULL},
|
|
|
|
{"recvserver", "pop.$DOMAIN",
|
|
|
|
&tmpl.recvserver, P_STRING, NULL, NULL, NULL},
|
|
|
|
{"recvuser", "$LOGIN",
|
|
|
|
&tmpl.recvuser, P_STRING, NULL, NULL, NULL},
|
|
|
|
{"recvpass", "",
|
|
|
|
&tmpl.recvpass, P_STRING, NULL, NULL, NULL},
|
|
|
|
{"imapdir", "",
|
|
|
|
&tmpl.imapdir, P_STRING, NULL, NULL, NULL},
|
|
|
|
{"mboxfile", "/var/mail/$LOGIN",
|
|
|
|
&tmpl.mboxfile, P_STRING, NULL, NULL, NULL},
|
|
|
|
{"mailbox", "Mail",
|
|
|
|
&tmpl.mailbox, P_STRING, NULL, NULL, NULL},
|
2006-12-12 22:58:07 +01:00
|
|
|
{"smtpssl", "0",
|
|
|
|
&tmpl.smtpssl, P_INT, NULL, NULL, NULL},
|
|
|
|
{"recvssl", "0",
|
|
|
|
&tmpl.recvssl, P_INT, NULL, NULL, NULL},
|
2006-04-05 18:49:00 +02:00
|
|
|
{NULL, NULL, NULL, P_INT, NULL, NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static gchar *accountrc_tmpl =
|
|
|
|
"[AccountTemplate]\n"
|
|
|
|
"#you can use $DEFAULTDOMAIN here\n"
|
|
|
|
"#domain must be defined before the variables that use it\n"
|
|
|
|
"#by default, domain is extracted from the hostname\n"
|
|
|
|
"#domain=\n"
|
|
|
|
"\n"
|
|
|
|
"#you can use $USERNAME for name (this is the default)\n"
|
|
|
|
"#name=\n"
|
|
|
|
"\n"
|
|
|
|
"#you can use $LOGIN, $NAME_MAIL and $DOMAIN here \n"
|
|
|
|
"#$NAME_MAIL is the name without uppercase and with dots instead\n"
|
|
|
|
"#of spaces\n"
|
|
|
|
"#the default is $NAME_MAIL@$DOMAIN\n"
|
|
|
|
"#email=\n"
|
|
|
|
"\n"
|
|
|
|
"#you can use $DOMAIN here\n"
|
|
|
|
"#the default organization is empty\n"
|
|
|
|
"#organization=\n"
|
|
|
|
"\n"
|
|
|
|
"#you can use $DOMAIN here \n"
|
|
|
|
"#the default is stmp.$DOMAIN\n"
|
|
|
|
"#smtpserver=\n"
|
|
|
|
"\n"
|
|
|
|
"#Whether to use smtp authentication\n"
|
|
|
|
"#the default is 0 (no)\n"
|
|
|
|
"#smtpauth=\n"
|
|
|
|
"\n"
|
|
|
|
"#SMTP username\n"
|
|
|
|
"#you can use $LOGIN, $NAME_MAIL, $DOMAIN or $EMAIL here\n"
|
|
|
|
"#the default is empty (same as reception username)\n"
|
|
|
|
"#smtpuser=\n"
|
|
|
|
"\n"
|
|
|
|
"#SMTP password\n"
|
|
|
|
"#the default is empty (same as reception password)\n"
|
|
|
|
"#smtppass=\n"
|
|
|
|
"\n"
|
|
|
|
"#recvtype can be:\n"
|
|
|
|
"#0 for pop3\n"
|
|
|
|
"#3 for imap\n"
|
|
|
|
"#5 for a local mbox file\n"
|
|
|
|
"#recvtype=\n"
|
|
|
|
"\n"
|
|
|
|
"#you can use $DOMAIN here \n"
|
|
|
|
"#the default is {pop,imap}.$DOMAIN\n"
|
|
|
|
"#recvserver=\n"
|
|
|
|
"\n"
|
|
|
|
"#you can use $LOGIN, $NAME_MAIL, $DOMAIN or $EMAIL here\n"
|
|
|
|
"#default is $LOGIN\n"
|
|
|
|
"#recvuser=\n"
|
|
|
|
"\n"
|
|
|
|
"#default is empty\n"
|
|
|
|
"#recvpass=\n"
|
|
|
|
"\n"
|
|
|
|
"#imap dir if imap (relative to the home on the server\n"
|
|
|
|
"#default is empty\n"
|
|
|
|
"#imapdir=\n"
|
|
|
|
"\n"
|
|
|
|
"#mbox file if local\n"
|
|
|
|
"#you can use $LOGIN here\n"
|
|
|
|
"#default is /var/mail/$LOGIN\n"
|
|
|
|
"#mboxfile=\n"
|
|
|
|
"\n"
|
|
|
|
"#mailbox name if pop3 or local\n"
|
|
|
|
"#relative path from the user's home\n"
|
|
|
|
"#default is \"Mail\"\n"
|
|
|
|
"#mailbox=\n"
|
|
|
|
"\n"
|
|
|
|
"#whether to use ssl on STMP connections\n"
|
2006-12-12 22:58:07 +01:00
|
|
|
"#default is 0, 1 is ssl, 2 is starttls\n"
|
2006-04-05 18:49:00 +02:00
|
|
|
"#smtpssl=\n"
|
|
|
|
"\n"
|
|
|
|
"#whether to use ssl on pop or imap connections\n"
|
2006-12-12 22:58:07 +01:00
|
|
|
"#default is 0, 1 is ssl, 2 is starttls\n"
|
2006-04-05 18:49:00 +02:00
|
|
|
"#recvssl=\n";
|
|
|
|
|
|
|
|
static gchar *wizard_get_default_domain_name(void)
|
|
|
|
{
|
|
|
|
static gchar *domain_name = NULL;
|
|
|
|
|
|
|
|
if (domain_name == NULL) {
|
|
|
|
domain_name = g_strdup(get_domain_name());
|
|
|
|
if (strchr(domain_name, '.') != strrchr(domain_name, '.')
|
|
|
|
&& strlen(strchr(domain_name, '.')) > 6) {
|
|
|
|
gchar *tmp = g_strdup(strchr(domain_name, '.')+1);
|
|
|
|
g_free(domain_name);
|
|
|
|
domain_name = tmp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return domain_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *get_name_for_mail(void)
|
|
|
|
{
|
|
|
|
gchar *name = g_strdup(tmpl.name);
|
|
|
|
if (name == NULL)
|
|
|
|
return NULL;
|
|
|
|
g_strdown(name);
|
|
|
|
while(strstr(name, " "))
|
|
|
|
*strstr(name, " ")='.';
|
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define PARSE_DEFAULT(str) { \
|
|
|
|
gchar *tmp = NULL, *new = NULL; \
|
|
|
|
if (str != NULL) { \
|
|
|
|
tmp = g_strdup(str); \
|
|
|
|
if (strstr(str, "$USERNAME")) { \
|
|
|
|
tmp = g_strdup(str); \
|
|
|
|
*strstr(tmp, "$USERNAME") = '\0'; \
|
|
|
|
new = g_strconcat(tmp, g_get_real_name(), \
|
|
|
|
strstr(str, "$USERNAME")+strlen("$USERNAME"), \
|
|
|
|
NULL); \
|
|
|
|
g_free(tmp); \
|
|
|
|
g_free(str); \
|
|
|
|
str = new; \
|
|
|
|
new = NULL; \
|
|
|
|
} \
|
|
|
|
if (strstr(str, "$LOGIN")) { \
|
|
|
|
tmp = g_strdup(str); \
|
|
|
|
*strstr(tmp, "$LOGIN") = '\0'; \
|
|
|
|
new = g_strconcat(tmp, g_get_user_name(), \
|
|
|
|
strstr(str, "$LOGIN")+strlen("$LOGIN"), \
|
|
|
|
NULL); \
|
|
|
|
g_free(tmp); \
|
|
|
|
g_free(str); \
|
|
|
|
str = new; \
|
|
|
|
new = NULL; \
|
|
|
|
} \
|
|
|
|
if (strstr(str, "$EMAIL")) { \
|
|
|
|
tmp = g_strdup(str); \
|
|
|
|
*strstr(tmp, "$EMAIL") = '\0'; \
|
|
|
|
new = g_strconcat(tmp, tmpl.email, \
|
|
|
|
strstr(str, "$EMAIL")+strlen("$EMAIL"), \
|
|
|
|
NULL); \
|
|
|
|
g_free(tmp); \
|
|
|
|
g_free(str); \
|
|
|
|
str = new; \
|
|
|
|
new = NULL; \
|
|
|
|
} \
|
|
|
|
if (strstr(str, "$NAME_MAIL")) { \
|
|
|
|
tmp = g_strdup(str); \
|
|
|
|
*strstr(tmp, "$NAME_MAIL") = '\0'; \
|
|
|
|
new = g_strconcat(tmp, get_name_for_mail(), \
|
|
|
|
strstr(str, "$NAME_MAIL")+strlen("$NAME_MAIL"), \
|
|
|
|
NULL); \
|
|
|
|
g_free(tmp); \
|
|
|
|
g_free(str); \
|
|
|
|
str = new; \
|
|
|
|
new = NULL; \
|
|
|
|
} \
|
|
|
|
if (strstr(str, "$DEFAULTDOMAIN")) { \
|
|
|
|
tmp = g_strdup(str); \
|
|
|
|
*strstr(tmp, "$DEFAULTDOMAIN") = '\0'; \
|
|
|
|
new = g_strconcat(tmp, wizard_get_default_domain_name(), \
|
|
|
|
strstr(str, "$DEFAULTDOMAIN")+strlen("$DEFAULTDOMAIN"), \
|
|
|
|
NULL); \
|
|
|
|
g_free(tmp); \
|
|
|
|
g_free(str); \
|
|
|
|
str = new; \
|
|
|
|
new = NULL; \
|
|
|
|
} \
|
|
|
|
if (strstr(str, "$DOMAIN")) { \
|
|
|
|
tmp = g_strdup(str); \
|
|
|
|
*strstr(tmp, "$DOMAIN") = '\0'; \
|
|
|
|
new = g_strconcat(tmp, tmpl.domain, \
|
|
|
|
strstr(str, "$DOMAIN")+strlen("$DOMAIN"), \
|
|
|
|
NULL); \
|
|
|
|
g_free(tmp); \
|
|
|
|
g_free(str); \
|
|
|
|
str = new; \
|
|
|
|
new = NULL; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
static void wizard_read_defaults(void)
|
|
|
|
{
|
|
|
|
gchar *rcpath;
|
|
|
|
|
|
|
|
rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "accountrc.tmpl", NULL);
|
|
|
|
if (!is_file_exist(rcpath)) {
|
|
|
|
str_write_to_file(accountrc_tmpl, rcpath);
|
|
|
|
}
|
|
|
|
|
|
|
|
prefs_read_config(template_params, "AccountTemplate", rcpath, NULL);
|
|
|
|
|
|
|
|
PARSE_DEFAULT(tmpl.domain);
|
|
|
|
PARSE_DEFAULT(tmpl.name);
|
|
|
|
PARSE_DEFAULT(tmpl.email);
|
|
|
|
PARSE_DEFAULT(tmpl.organization);
|
|
|
|
PARSE_DEFAULT(tmpl.smtpserver);
|
|
|
|
PARSE_DEFAULT(tmpl.smtpuser);
|
|
|
|
PARSE_DEFAULT(tmpl.smtppass);
|
|
|
|
PARSE_DEFAULT(tmpl.recvserver);
|
|
|
|
PARSE_DEFAULT(tmpl.recvuser);
|
|
|
|
PARSE_DEFAULT(tmpl.recvpass);
|
|
|
|
PARSE_DEFAULT(tmpl.imapdir);
|
|
|
|
PARSE_DEFAULT(tmpl.mboxfile);
|
|
|
|
PARSE_DEFAULT(tmpl.mailbox);
|
|
|
|
/*
|
|
|
|
printf("defaults:"
|
|
|
|
"%s, %s, %s, %s, %s, %d, %s, %s, %s, %s, %s, %s, %d, %d\n",
|
|
|
|
tmpl.name,tmpl.domain,tmpl.email,tmpl.organization,tmpl.smtpserver,
|
|
|
|
tmpl.recvtype,tmpl.recvserver,tmpl.recvuser,tmpl.recvpass,
|
|
|
|
tmpl.imapdir,tmpl.mboxfile,tmpl.mailbox,tmpl.smtpssl,tmpl.recvssl);
|
|
|
|
*/
|
|
|
|
g_free(rcpath);
|
|
|
|
}
|
|
|
|
|
2005-10-16 17:07:23 +02:00
|
|
|
static void initialize_fonts(WizardWindow *wizard)
|
|
|
|
{
|
|
|
|
GtkWidget *widget = wizard->email;
|
|
|
|
gint size = pango_font_description_get_size(
|
|
|
|
widget->style->font_desc)
|
|
|
|
/PANGO_SCALE;
|
|
|
|
gchar *tmp, *new;
|
|
|
|
|
|
|
|
tmp = g_strdup(prefs_common.textfont);
|
|
|
|
if (strrchr(tmp, ' ')) {
|
|
|
|
*(strrchr(tmp, ' ')) = '\0';
|
|
|
|
new = g_strdup_printf("%s %d", tmp, size);
|
|
|
|
g_free(prefs_common.textfont);
|
|
|
|
prefs_common.textfont = new;
|
|
|
|
}
|
|
|
|
g_free(tmp);
|
|
|
|
|
|
|
|
tmp = g_strdup(prefs_common.smallfont);
|
|
|
|
if (strrchr(tmp, ' ')) {
|
|
|
|
*(strrchr(tmp, ' ')) = '\0';
|
|
|
|
new = g_strdup_printf("%s %d", tmp, size);
|
|
|
|
g_free(prefs_common.smallfont);
|
|
|
|
prefs_common.smallfont = new;
|
|
|
|
}
|
|
|
|
g_free(tmp);
|
|
|
|
|
|
|
|
tmp = g_strdup(prefs_common.normalfont);
|
|
|
|
if (strrchr(tmp, ' ')) {
|
|
|
|
*(strrchr(tmp, ' ')) = '\0';
|
|
|
|
new = g_strdup_printf("%s %d", tmp, size);
|
|
|
|
g_free(prefs_common.normalfont);
|
|
|
|
prefs_common.normalfont = new;
|
|
|
|
}
|
|
|
|
g_free(tmp);
|
|
|
|
}
|
|
|
|
|
2005-10-25 14:09:08 +02:00
|
|
|
#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"
|
2006-06-11 10:17:49 +02:00
|
|
|
#define FACE "iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEUTGBYnS3BCUE9KVC9acyRy\n\
|
|
|
|
kC6LjITZdGiumnF/p7yrq6jJzc/5+vf7GI+IAAACZ0lEQVQ4y5XUvW/UMBQA8LRl6VZ3QLqNNhVS\n\
|
|
|
|
YSnKFfExEg9lbJNK3QqVoiPHzgpFnAIs5Do9ORNDVOwuFVIgduZWOfuP4vlyybVVkeCdTpHe7z1/\n\
|
|
|
|
RHYc85dw/gEUxi2gS5ZlDKqbUDcpzarroMEOpDU2VtcAmFKlxn+t2VWQUNa1BmAlGrsCqWKMwetv\n\
|
|
|
|
MMbnFaixFn9rh47DFCuzDs6hxPyrxXuOA7WqWQcp2Fhx7gTOcga6bGHSS6FHCHFouLcMJptuaQbp\n\
|
|
|
|
+kff90P6Yn0TMpXN4DxNVz+FQZ8Gob8DGWSsBUIG23seDXwaBBnU0EJKVhNvqx/6aHTHrmMGhNw9\n\
|
|
|
|
XlqkgbdEX/gh1PUcVj84G4HnuHTXDQ+6Dk3IyqFL/UfEpXvj7RChaoEsUX9rYeGE7o83wp0WcCjS\n\
|
|
|
|
9/01AifhLrj0oINeuuJ53kIP+uF+7uL03eQpGWx5yzDu05fM3Z53AJDkvdODwvOfmbH3uOuwcLz+\n\
|
|
|
|
UBWLR8/N+MHnDsoeG4zecDl5Mhqa74NR90p+VEYmo+ioSEan8WnytANhDB8kX06TJFZJcowvfrZz\n\
|
|
|
|
XIMS2vxMIlHJfHMTRLOqC7TovlJFEVVGF7yafFVTkGgij+I851hZCHP5Tk8BWXObjuxhl2fm8pdu\n\
|
|
|
|
O0wluZDKHgJ91nVMKhuKN6cZQf9uQAs85lrjGDYmwmqzDynwClRKTCF/OwfDub0dQyzHxVUt6DzK\n\
|
|
|
|
eY5NseIxb8abwoVSMpZDhJyL9kJamGAxplC7izkHyaXM5/nZHFiNeRHfBFNwLjhOr+fAmw1G3OYl\n\
|
|
|
|
bwoijGGzD40pdeu3ROv/+Pr8AWPP4vVXbP0VAAAAAElFTkSuQmCC"
|
2005-10-25 14:09:08 +02:00
|
|
|
|
2005-10-16 17:07:23 +02:00
|
|
|
static void write_welcome_email(WizardWindow *wizard)
|
|
|
|
{
|
|
|
|
gchar buf_date[64];
|
2005-10-17 13:13:58 +02:00
|
|
|
gchar *head=NULL;
|
2005-10-16 17:07:23 +02:00
|
|
|
gchar *body=NULL;
|
2005-10-17 13:13:58 +02:00
|
|
|
gchar *msg=NULL;
|
2005-10-16 17:07:23 +02:00
|
|
|
const gchar *mailbox = gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name));
|
|
|
|
Folder *folder = folder_find_from_path(mailbox);
|
|
|
|
FolderItem *inbox = folder ? folder->inbox:NULL;
|
|
|
|
gchar *file = get_tmp_file();
|
2006-12-05 10:22:12 +01:00
|
|
|
gchar enc_from_name[BUFFSIZE], enc_to_name[BUFFSIZE], enc_subject[BUFFSIZE];
|
2005-10-16 17:07:23 +02:00
|
|
|
|
|
|
|
get_rfc822_date(buf_date, sizeof(buf_date));
|
|
|
|
|
2006-12-05 10:22:12 +01:00
|
|
|
conv_encode_header_full(enc_subject, sizeof(enc_subject),
|
2006-12-15 17:41:15 +01:00
|
|
|
Q_("Welcome Mail Subject|Welcome to Claws Mail"),
|
2006-12-05 10:22:12 +01:00
|
|
|
strlen("Subject: "), FALSE, CS_INTERNAL);
|
|
|
|
conv_encode_header_full(enc_to_name, sizeof(enc_to_name),
|
|
|
|
gtk_entry_get_text(GTK_ENTRY(wizard->full_name)),
|
|
|
|
strlen("To: "), TRUE, CS_INTERNAL);
|
|
|
|
conv_encode_header_full(enc_from_name, sizeof(enc_from_name),
|
2006-12-15 17:41:15 +01:00
|
|
|
_("The Claws Mail Team"),
|
2006-12-05 10:22:12 +01:00
|
|
|
strlen("From: "), TRUE, CS_INTERNAL);
|
2005-10-17 13:13:58 +02:00
|
|
|
|
|
|
|
head = g_strdup_printf(
|
2006-05-18 13:18:28 +02:00
|
|
|
"From: %s <%s>\n"
|
2005-10-16 17:07:23 +02:00
|
|
|
"To: %s <%s>\n"
|
|
|
|
"Date: %s\n"
|
2005-10-19 18:22:42 +02:00
|
|
|
"Subject: %s\n"
|
2005-10-25 14:09:08 +02:00
|
|
|
"X-Face: %s\n"
|
2006-06-11 10:17:49 +02:00
|
|
|
"Face: %s\n"
|
2005-10-19 18:22:42 +02:00
|
|
|
"Content-Type: text/plain; charset=UTF-8\n",
|
2006-12-05 10:22:12 +01:00
|
|
|
enc_from_name,
|
2006-05-18 13:18:28 +02:00
|
|
|
USERS_ML_ADDR,
|
2006-12-05 10:22:12 +01:00
|
|
|
enc_to_name,
|
2005-10-17 13:13:58 +02:00
|
|
|
gtk_entry_get_text(GTK_ENTRY(wizard->email)),
|
2006-12-05 10:22:12 +01:00
|
|
|
buf_date, enc_subject, XFACE, FACE);
|
2005-10-17 13:13:58 +02:00
|
|
|
body = g_strdup_printf(
|
|
|
|
_("\n"
|
2006-11-07 11:47:23 +01:00
|
|
|
"Welcome to Claws Mail\n"
|
2006-12-15 17:41:15 +01:00
|
|
|
"---------------------\n"
|
2005-10-16 18:03:03 +02:00
|
|
|
"\n"
|
|
|
|
"Now that you have set up your account you can fetch your\n"
|
2005-10-17 13:13:58 +02:00
|
|
|
"mail by clicking the 'Get Mail' button at the left of the\n"
|
2005-10-16 18:03:03 +02:00
|
|
|
"toolbar.\n"
|
|
|
|
"\n"
|
2006-11-07 11:47:23 +01:00
|
|
|
"Claws Mail has lots of extra features accessible via plugins,\n"
|
2006-09-16 17:32:28 +02:00
|
|
|
"like anti-spam filtering and learning (via the Bogofilter or\n"
|
2006-09-18 11:10:11 +02:00
|
|
|
"SpamAssassin plugins), privacy protection (via PGP/Mime), an RSS\n"
|
2006-09-16 17:32:28 +02:00
|
|
|
"aggregator, a calendar, and much more. You can load them from\n"
|
|
|
|
"the menu entry '/Configuration/Plugins'.\n"
|
|
|
|
"\n"
|
2005-10-16 18:03:03 +02:00
|
|
|
"You can change your Account Preferences by using the menu\n"
|
|
|
|
"entry '/Configuration/Preferences for current account'\n"
|
|
|
|
"and change the general Preferences by using\n"
|
|
|
|
"'/Configuration/Preferences'.\n"
|
|
|
|
"\n"
|
2006-11-07 11:47:23 +01:00
|
|
|
"You can find further information in the Claws Mail manual,\n"
|
2005-10-16 18:03:03 +02:00
|
|
|
"which can be accessed by using the menu entry '/Help/Manual'\n"
|
|
|
|
"or online at the URL given below.\n"
|
|
|
|
"\n"
|
|
|
|
"Useful URLs\n"
|
|
|
|
"-----------\n"
|
2005-10-17 13:13:58 +02:00
|
|
|
"Homepage: <%s>\n"
|
|
|
|
"Manual: <%s>\n"
|
|
|
|
"FAQ: <%s>\n"
|
|
|
|
"Themes: <%s>\n"
|
|
|
|
"Mailing Lists: <%s>\n"
|
2005-10-16 18:03:03 +02:00
|
|
|
"\n"
|
|
|
|
"LICENSE\n"
|
|
|
|
"-------\n"
|
2006-11-07 11:47:23 +01:00
|
|
|
"Claws Mail is free software, released under the terms\n"
|
2005-10-16 18:03:03 +02:00
|
|
|
"of the GNU General Public License, version 2 or later, as\n"
|
|
|
|
"published by the Free Software Foundation, 51 Franklin Street,\n"
|
|
|
|
"Fifth Floor, Boston, MA 02110-1301, USA. The license can be\n"
|
2005-10-17 13:13:58 +02:00
|
|
|
"found at <%s>.\n"
|
2005-10-16 18:03:03 +02:00
|
|
|
"\n"
|
|
|
|
"DONATIONS\n"
|
|
|
|
"---------\n"
|
2006-11-07 11:47:23 +01:00
|
|
|
"If you wish to donate to the Claws Mail project you can do\n"
|
2005-10-17 13:13:58 +02:00
|
|
|
"so at <%s>.\n\n"),
|
|
|
|
HOMEPAGE_URI, MANUAL_URI, FAQ_URI, THEMES_URI, MAILING_LIST_URI,
|
|
|
|
GPL_URI, DONATE_URI);
|
2005-10-16 17:07:23 +02:00
|
|
|
|
2005-10-17 13:13:58 +02:00
|
|
|
msg = g_strconcat(head, body, NULL);
|
|
|
|
|
2005-10-16 17:07:23 +02:00
|
|
|
if (inbox && inbox->total_msgs == 0
|
2005-10-17 13:13:58 +02:00
|
|
|
&& str_write_to_file(msg, file) >= 0) {
|
2005-10-16 17:07:23 +02:00
|
|
|
MsgFlags flags = { MSG_UNREAD|MSG_NEW, 0};
|
|
|
|
folder_item_add_msg(inbox, file, &flags, FALSE);
|
|
|
|
}
|
2005-10-17 13:13:58 +02:00
|
|
|
g_free(head);
|
2005-10-16 17:07:23 +02:00
|
|
|
g_free(body);
|
2005-10-17 13:13:58 +02:00
|
|
|
g_free(msg);
|
|
|
|
g_unlink(file);
|
2005-10-16 17:07:23 +02:00
|
|
|
}
|
2005-10-25 14:09:08 +02:00
|
|
|
#undef XFACE
|
|
|
|
|
2005-10-08 21:13:41 +02:00
|
|
|
static gboolean wizard_write_config(WizardWindow *wizard)
|
2004-08-25 00:46:53 +02:00
|
|
|
{
|
2005-11-23 19:26:57 +01:00
|
|
|
static gboolean mailbox_ok = FALSE;
|
2004-08-25 00:46:53 +02:00
|
|
|
PrefsAccount *prefs_account = prefs_account_new();
|
|
|
|
GList *account_list = NULL;
|
2004-08-25 01:19:35 +02:00
|
|
|
GtkWidget *menu, *menuitem;
|
2006-12-11 19:08:20 +01:00
|
|
|
gchar *smtp_server, *recv_server;
|
|
|
|
gint smtp_port, recv_port;
|
2006-12-12 22:58:07 +01:00
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
SSLType smtp_ssl_type, recv_ssl_type;
|
|
|
|
#endif
|
2006-12-11 19:08:20 +01:00
|
|
|
|
2005-10-03 19:11:47 +02:00
|
|
|
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(wizard->recv_type));
|
|
|
|
menuitem = gtk_menu_get_active(GTK_MENU(menu));
|
|
|
|
prefs_account->protocol = GPOINTER_TO_INT
|
|
|
|
(g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
|
2005-10-16 17:07:23 +02:00
|
|
|
|
2005-11-23 19:26:57 +01:00
|
|
|
|
2005-11-24 13:37:29 +01:00
|
|
|
if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4 &&
|
|
|
|
!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name)))) {
|
|
|
|
alertpanel_error(_("Please enter the mailbox name."));
|
|
|
|
g_free(prefs_account);
|
|
|
|
gtk_notebook_set_current_page (
|
|
|
|
GTK_NOTEBOOK(wizard->notebook),
|
|
|
|
MAILBOX_PAGE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-11-23 19:26:57 +01:00
|
|
|
if (!mailbox_ok) {
|
|
|
|
if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4) {
|
|
|
|
mailbox_ok = setup_write_mailbox_path(wizard->mainwin,
|
|
|
|
gtk_entry_get_text(
|
|
|
|
GTK_ENTRY(wizard->mailbox_name)));
|
|
|
|
} else
|
|
|
|
mailbox_ok = TRUE;
|
|
|
|
}
|
2005-10-08 21:13:41 +02:00
|
|
|
|
|
|
|
if (!mailbox_ok) {
|
2005-11-23 19:26:57 +01:00
|
|
|
/* alertpanel done by setup_write_mailbox_path */
|
|
|
|
g_free(prefs_account);
|
2005-10-08 21:13:41 +02:00
|
|
|
gtk_notebook_set_current_page (
|
|
|
|
GTK_NOTEBOOK(wizard->notebook),
|
2005-11-24 13:37:29 +01:00
|
|
|
MAILBOX_PAGE);
|
2005-10-08 21:13:41 +02:00
|
|
|
return FALSE;
|
2004-08-25 00:46:53 +02:00
|
|
|
}
|
2005-10-08 21:13:41 +02:00
|
|
|
|
2005-11-23 19:26:57 +01:00
|
|
|
if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->full_name)))
|
|
|
|
|| !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->email)))) {
|
2005-11-24 13:37:29 +01:00
|
|
|
alertpanel_error(_("Please enter your name and email address."));
|
2005-11-23 19:26:57 +01:00
|
|
|
g_free(prefs_account);
|
|
|
|
gtk_notebook_set_current_page (
|
|
|
|
GTK_NOTEBOOK(wizard->notebook),
|
2005-11-24 13:37:29 +01:00
|
|
|
USER_PAGE);
|
2005-11-23 19:26:57 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (prefs_account->protocol != A_LOCAL) {
|
|
|
|
if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->recv_username)))
|
|
|
|
|| !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)))) {
|
2005-11-24 13:37:29 +01:00
|
|
|
alertpanel_error(_("Please enter your receiving server "
|
2005-11-23 19:26:57 +01:00
|
|
|
"and username."));
|
|
|
|
g_free(prefs_account);
|
|
|
|
gtk_notebook_set_current_page (
|
|
|
|
GTK_NOTEBOOK(wizard->notebook),
|
2005-11-24 13:37:29 +01:00
|
|
|
RECV_PAGE);
|
2005-11-23 19:26:57 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)))) {
|
2005-11-24 13:37:29 +01:00
|
|
|
alertpanel_error(_("Please enter your username."));
|
2005-11-23 19:26:57 +01:00
|
|
|
g_free(prefs_account);
|
|
|
|
gtk_notebook_set_current_page (
|
|
|
|
GTK_NOTEBOOK(wizard->notebook),
|
2005-11-24 13:37:29 +01:00
|
|
|
RECV_PAGE);
|
2005-11-23 19:26:57 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
2006-04-05 18:49:00 +02:00
|
|
|
|
2005-11-23 19:26:57 +01:00
|
|
|
if (!strlen(gtk_entry_get_text(GTK_ENTRY(wizard->smtp_server)))) {
|
2005-11-24 13:37:29 +01:00
|
|
|
alertpanel_error(_("Please enter your SMTP server."));
|
2005-11-23 19:26:57 +01:00
|
|
|
g_free(prefs_account);
|
|
|
|
gtk_notebook_set_current_page (
|
|
|
|
GTK_NOTEBOOK(wizard->notebook),
|
2005-11-24 13:37:29 +01:00
|
|
|
SMTP_PAGE);
|
2005-11-23 19:26:57 +01:00
|
|
|
return FALSE;
|
2006-04-05 18:49:00 +02:00
|
|
|
}
|
2005-11-23 19:26:57 +01:00
|
|
|
|
2006-04-05 18:49:00 +02:00
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->smtp_auth))) {
|
|
|
|
if (prefs_account->protocol == A_LOCAL
|
|
|
|
&& !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->smtp_username)))) {
|
|
|
|
alertpanel_error(_("Please enter your SMTP username."));
|
|
|
|
g_free(prefs_account);
|
|
|
|
gtk_notebook_set_current_page (
|
|
|
|
GTK_NOTEBOOK(wizard->notebook),
|
|
|
|
SMTP_PAGE);
|
|
|
|
return FALSE;
|
|
|
|
} /* if it's not local we'll use the reception server */
|
2005-11-23 19:26:57 +01:00
|
|
|
}
|
|
|
|
|
2005-10-03 19:11:47 +02:00
|
|
|
if (prefs_account->protocol != A_LOCAL)
|
|
|
|
prefs_account->account_name = g_strdup_printf("%s@%s",
|
2004-08-25 12:35:53 +02:00
|
|
|
gtk_entry_get_text(GTK_ENTRY(wizard->recv_username)),
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
|
2005-10-03 19:11:47 +02:00
|
|
|
else
|
|
|
|
prefs_account->account_name = g_strdup_printf("%s",
|
|
|
|
gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
|
|
|
|
|
2006-12-11 19:08:20 +01:00
|
|
|
recv_server = g_strdup(gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
|
|
|
|
smtp_server = g_strdup(gtk_entry_get_text(GTK_ENTRY(wizard->smtp_server)));
|
|
|
|
|
|
|
|
if (prefs_account->protocol != A_LOCAL && strstr(recv_server, ":")) {
|
|
|
|
recv_port = atoi(strstr(recv_server, ":")+1);
|
|
|
|
*(strstr(recv_server, ":")) = '\0';
|
|
|
|
if (prefs_account->protocol == A_IMAP4) {
|
|
|
|
prefs_account->set_imapport = TRUE;
|
|
|
|
prefs_account->imapport = recv_port;
|
|
|
|
} else if (prefs_account->protocol == A_POP3) {
|
|
|
|
prefs_account->set_popport = TRUE;
|
|
|
|
prefs_account->popport = recv_port;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (strstr(smtp_server, ":")) {
|
|
|
|
smtp_port = atoi(strstr(smtp_server, ":")+1);
|
|
|
|
*(strstr(smtp_server, ":")) = '\0';
|
|
|
|
prefs_account->set_smtpport = TRUE;
|
|
|
|
prefs_account->smtpport = smtp_port;
|
|
|
|
}
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
prefs_account->name = g_strdup(
|
|
|
|
gtk_entry_get_text(GTK_ENTRY(wizard->full_name)));
|
|
|
|
prefs_account->address = g_strdup(
|
|
|
|
gtk_entry_get_text(GTK_ENTRY(wizard->email)));
|
|
|
|
prefs_account->organization = g_strdup(
|
|
|
|
gtk_entry_get_text(GTK_ENTRY(wizard->organization)));
|
2006-12-11 19:08:20 +01:00
|
|
|
prefs_account->smtp_server = g_strdup(smtp_server);
|
2005-10-03 19:11:47 +02:00
|
|
|
|
|
|
|
if (prefs_account->protocol != A_LOCAL)
|
2006-12-11 19:08:20 +01:00
|
|
|
prefs_account->recv_server = g_strdup(recv_server);
|
2005-10-03 19:11:47 +02:00
|
|
|
else
|
2006-12-11 19:08:20 +01:00
|
|
|
prefs_account->local_mbox = g_strdup(recv_server);
|
|
|
|
|
|
|
|
g_free(recv_server);
|
|
|
|
g_free(smtp_server);
|
2005-10-03 19:11:47 +02:00
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
prefs_account->userid = g_strdup(
|
|
|
|
gtk_entry_get_text(GTK_ENTRY(wizard->recv_username)));
|
|
|
|
prefs_account->passwd = g_strdup(
|
|
|
|
gtk_entry_get_text(GTK_ENTRY(wizard->recv_password)));
|
2004-08-25 01:19:35 +02:00
|
|
|
|
2006-04-05 18:49:00 +02:00
|
|
|
prefs_account->smtp_userid = g_strdup(
|
|
|
|
gtk_entry_get_text(GTK_ENTRY(wizard->smtp_username)));
|
|
|
|
prefs_account->smtp_passwd = g_strdup(
|
|
|
|
gtk_entry_get_text(GTK_ENTRY(wizard->smtp_password)));
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->smtp_auth))) {
|
|
|
|
prefs_account->use_smtp_auth = TRUE;
|
|
|
|
}
|
|
|
|
|
2006-12-12 22:58:07 +01:00
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
smtp_ssl_type = SSL_NONE;
|
|
|
|
recv_ssl_type = SSL_NONE;
|
|
|
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->smtp_use_ssl))) {
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->smtp_use_tls)))
|
|
|
|
smtp_ssl_type = SSL_STARTTLS;
|
|
|
|
else
|
|
|
|
smtp_ssl_type = SSL_TUNNEL;
|
|
|
|
}
|
2005-07-15 09:18:11 +02:00
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->recv_use_ssl))) {
|
2006-12-12 22:58:07 +01:00
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wizard->recv_use_tls)))
|
|
|
|
recv_ssl_type = SSL_STARTTLS;
|
2004-08-25 12:35:53 +02:00
|
|
|
else
|
2006-12-12 22:58:07 +01:00
|
|
|
recv_ssl_type = SSL_TUNNEL;
|
2004-09-01 18:04:19 +02:00
|
|
|
}
|
2006-12-12 22:58:07 +01:00
|
|
|
|
|
|
|
prefs_account->ssl_smtp = smtp_ssl_type;
|
|
|
|
|
|
|
|
if (prefs_account->protocol == A_IMAP4)
|
|
|
|
prefs_account->ssl_imap = recv_ssl_type;
|
|
|
|
else
|
|
|
|
prefs_account->ssl_pop = recv_ssl_type;
|
|
|
|
|
2004-08-25 12:35:53 +02:00
|
|
|
#endif
|
2005-10-03 19:11:47 +02:00
|
|
|
if (prefs_account->protocol == A_IMAP4) {
|
|
|
|
gchar *directory = gtk_editable_get_chars(
|
|
|
|
GTK_EDITABLE(wizard->recv_imap_subdir), 0, -1);
|
|
|
|
if (directory && strlen(directory)) {
|
|
|
|
prefs_account->imap_dir = g_strdup(directory);
|
|
|
|
}
|
|
|
|
g_free(directory);
|
|
|
|
}
|
2004-08-25 01:19:35 +02:00
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
account_list = g_list_append(account_list, prefs_account);
|
|
|
|
prefs_account_write_config_all(account_list);
|
|
|
|
prefs_account_free(prefs_account);
|
2004-08-26 08:45:58 +02:00
|
|
|
account_read_config_all();
|
2005-10-16 17:07:23 +02:00
|
|
|
|
|
|
|
initialize_fonts(wizard);
|
|
|
|
if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4)
|
|
|
|
write_welcome_email(wizard);
|
2005-10-08 21:13:41 +02:00
|
|
|
|
2006-09-21 19:10:04 +02:00
|
|
|
#ifndef G_OS_WIN32
|
|
|
|
plugin_load_standard_plugins();
|
|
|
|
#endif
|
2005-10-08 21:13:41 +02:00
|
|
|
return TRUE;
|
2004-08-25 00:46:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget* create_page (WizardWindow *wizard, const char * title)
|
|
|
|
{
|
|
|
|
GtkWidget *w;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *image;
|
|
|
|
char *title_string;
|
|
|
|
|
|
|
|
vbox = gtk_vbox_new (FALSE, 6);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER(vbox), 10);
|
|
|
|
|
|
|
|
/* create the titlebar */
|
|
|
|
hbox = gtk_hbox_new (FALSE, 12);
|
|
|
|
image = stock_pixmap_widget(wizard->window,
|
2006-11-07 11:47:23 +01:00
|
|
|
STOCK_PIXMAP_CLAWS_MAIL_ICON);
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_box_pack_start (GTK_BOX(hbox), image, FALSE, FALSE, 0);
|
|
|
|
title_string = g_strconcat ("<span size=\"xx-large\" weight=\"ultrabold\">", title ? title : "", "</span>", NULL);
|
|
|
|
w = gtk_label_new (title_string);
|
|
|
|
gtk_label_set_use_markup (GTK_LABEL(w), TRUE);
|
|
|
|
g_free (title_string);
|
|
|
|
gtk_box_pack_start (GTK_BOX(hbox), w, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
/* pack the titlebar */
|
|
|
|
gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
/* pack the separator */
|
|
|
|
gtk_box_pack_start (GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
/* pack space */
|
|
|
|
w = gtk_alignment_new (0, 0, 0, 0);
|
2005-05-05 10:18:20 +02:00
|
|
|
gtk_widget_set_size_request (w, 0, 6);
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_box_pack_start (GTK_BOX(vbox), w, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
return vbox;
|
|
|
|
}
|
|
|
|
|
2005-11-24 13:37:29 +01:00
|
|
|
#define GTK_TABLE_ADD_ROW_AT(table,text,entry,i) { \
|
2004-08-25 00:46:53 +02:00
|
|
|
GtkWidget *label = gtk_label_new(text); \
|
|
|
|
gtk_table_attach(GTK_TABLE(table), label, \
|
|
|
|
0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0); \
|
2005-11-24 13:37:29 +01:00
|
|
|
gtk_label_set_use_markup(GTK_LABEL(label), TRUE); \
|
2004-09-24 14:48:20 +02:00
|
|
|
if (GTK_IS_MISC(label)) \
|
|
|
|
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); \
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_table_attach(GTK_TABLE(table), entry, \
|
|
|
|
1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0); \
|
|
|
|
}
|
|
|
|
|
2006-04-05 18:49:00 +02:00
|
|
|
static gchar *get_default_server(WizardWindow * wizard, const gchar *type)
|
2004-08-25 00:46:53 +02:00
|
|
|
{
|
2006-04-05 18:49:00 +02:00
|
|
|
if (!strcmp(type, "smtp")) {
|
|
|
|
if (!tmpl.smtpserver || !strlen(tmpl.smtpserver))
|
|
|
|
return g_strconcat(type, ".", tmpl.domain, NULL);
|
|
|
|
else
|
|
|
|
return g_strdup(tmpl.smtpserver);
|
|
|
|
} else {
|
|
|
|
if (!tmpl.recvserver || !strlen(tmpl.recvserver))
|
|
|
|
return g_strconcat(type, ".", tmpl.domain, NULL);
|
|
|
|
else
|
|
|
|
return g_strdup(tmpl.recvserver);
|
2004-08-25 00:46:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-05 18:49:00 +02:00
|
|
|
static gchar *get_default_account(WizardWindow * wizard)
|
2004-09-24 14:48:20 +02:00
|
|
|
{
|
2006-04-05 18:49:00 +02:00
|
|
|
gchar *result = NULL;
|
2004-09-24 14:48:20 +02:00
|
|
|
|
2006-04-05 18:49:00 +02:00
|
|
|
if (!tmpl.recvuser || !strlen(tmpl.recvuser)) {
|
|
|
|
result = gtk_editable_get_chars(
|
|
|
|
GTK_EDITABLE(wizard->email), 0, -1);
|
|
|
|
|
|
|
|
if (strstr(result, "@")) {
|
|
|
|
*(strstr(result,"@")) = '\0';
|
|
|
|
}
|
2005-10-25 14:09:08 +02:00
|
|
|
} else {
|
2006-04-05 18:49:00 +02:00
|
|
|
result = g_strdup(tmpl.recvuser);
|
2004-09-24 14:48:20 +02:00
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2006-04-05 18:49:00 +02:00
|
|
|
static gchar *get_default_smtp_account(WizardWindow * wizard)
|
2005-10-25 14:09:08 +02:00
|
|
|
{
|
2006-04-05 18:49:00 +02:00
|
|
|
gchar *result = NULL;
|
2005-10-25 14:09:08 +02:00
|
|
|
|
2006-04-05 18:49:00 +02:00
|
|
|
if (!tmpl.smtpuser || !strlen(tmpl.smtpuser)) {
|
|
|
|
return g_strdup("");
|
|
|
|
} else {
|
|
|
|
result = g_strdup(tmpl.smtpuser);
|
|
|
|
}
|
2005-10-25 14:09:08 +02:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2004-09-24 14:48:20 +02:00
|
|
|
static void wizard_email_changed(GtkWidget *widget, gpointer data)
|
|
|
|
{
|
|
|
|
WizardWindow *wizard = (WizardWindow *)data;
|
|
|
|
RecvProtocol protocol;
|
|
|
|
gchar *text;
|
|
|
|
protocol = GPOINTER_TO_INT
|
|
|
|
(g_object_get_data(G_OBJECT(wizard->recv_type), MENU_VAL_ID));
|
|
|
|
|
|
|
|
text = get_default_server(wizard, "smtp");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->smtp_server), text);
|
|
|
|
g_free(text);
|
|
|
|
|
2005-10-25 14:09:08 +02:00
|
|
|
text = get_default_account(wizard);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->recv_username), text);
|
|
|
|
g_free(text);
|
|
|
|
|
2004-09-24 14:48:20 +02:00
|
|
|
if (protocol == A_POP3) {
|
|
|
|
text = get_default_server(wizard, "pop");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
|
|
|
|
g_free(text);
|
2005-10-03 19:11:47 +02:00
|
|
|
} else if (protocol == A_IMAP4) {
|
2004-09-24 14:48:20 +02:00
|
|
|
text = get_default_server(wizard, "imap");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
|
|
|
|
g_free(text);
|
2005-10-03 19:11:47 +02:00
|
|
|
} else if (protocol == A_LOCAL) {
|
2006-04-05 18:49:00 +02:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), tmpl.mboxfile?tmpl.mboxfile:"");
|
2004-09-24 14:48:20 +02:00
|
|
|
}
|
2005-10-25 14:09:08 +02:00
|
|
|
|
2004-09-24 14:48:20 +02:00
|
|
|
}
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
static GtkWidget* user_page (WizardWindow * wizard)
|
|
|
|
{
|
|
|
|
GtkWidget *table = gtk_table_new(3,2, FALSE);
|
|
|
|
gint i = 0;
|
|
|
|
|
|
|
|
gtk_table_set_row_spacings(GTK_TABLE(table), 4);
|
|
|
|
gtk_table_set_col_spacings(GTK_TABLE(table), 8);
|
|
|
|
|
|
|
|
wizard->full_name = gtk_entry_new();
|
2006-04-05 18:49:00 +02:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->full_name), tmpl.name?tmpl.name:"");
|
2005-11-24 13:37:29 +01:00
|
|
|
GTK_TABLE_ADD_ROW_AT(table, _("<span weight=\"bold\">Your name:</span>"),
|
2004-08-25 00:46:53 +02:00
|
|
|
wizard->full_name, i); i++;
|
|
|
|
|
|
|
|
wizard->email = gtk_entry_new();
|
2006-04-05 18:49:00 +02:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->email), tmpl.email?tmpl.email:"");
|
2005-11-24 13:37:29 +01:00
|
|
|
GTK_TABLE_ADD_ROW_AT(table, _("<span weight=\"bold\">Your email address:</span>"),
|
2004-08-25 00:46:53 +02:00
|
|
|
wizard->email, i); i++;
|
|
|
|
|
|
|
|
wizard->organization = gtk_entry_new();
|
2005-11-24 13:37:29 +01:00
|
|
|
GTK_TABLE_ADD_ROW_AT(table, _("Your organization:"),
|
2004-08-25 00:46:53 +02:00
|
|
|
wizard->organization, i); i++;
|
2006-04-05 18:49:00 +02:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->organization), tmpl.organization?tmpl.organization:"");
|
2004-08-25 00:46:53 +02:00
|
|
|
|
2004-09-24 14:48:20 +02:00
|
|
|
g_signal_connect(G_OBJECT(wizard->email), "changed",
|
|
|
|
G_CALLBACK(wizard_email_changed),
|
|
|
|
wizard);
|
2004-08-25 00:46:53 +02:00
|
|
|
return table;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget* mailbox_page (WizardWindow * wizard)
|
|
|
|
{
|
|
|
|
GtkWidget *table = gtk_table_new(1,2, FALSE);
|
|
|
|
gint i = 0;
|
|
|
|
|
|
|
|
gtk_table_set_row_spacings(GTK_TABLE(table), 4);
|
|
|
|
gtk_table_set_col_spacings(GTK_TABLE(table), 8);
|
|
|
|
|
|
|
|
wizard->mailbox_name = gtk_entry_new();
|
2006-04-05 18:49:00 +02:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->mailbox_name), tmpl.mailbox?tmpl.mailbox:"");
|
2005-11-24 13:37:29 +01:00
|
|
|
GTK_TABLE_ADD_ROW_AT(table, _("<span weight=\"bold\">Mailbox name:</span>"),
|
2004-08-25 00:46:53 +02:00
|
|
|
wizard->mailbox_name, i); i++;
|
|
|
|
|
|
|
|
return table;
|
|
|
|
}
|
|
|
|
|
2006-04-05 18:49:00 +02:00
|
|
|
static void smtp_auth_changed (GtkWidget *btn, gpointer data)
|
|
|
|
{
|
|
|
|
WizardWindow *wizard = (WizardWindow *)data;
|
|
|
|
gboolean do_auth = gtk_toggle_button_get_active(
|
|
|
|
GTK_TOGGLE_BUTTON(wizard->smtp_auth));
|
|
|
|
gtk_widget_set_sensitive(wizard->smtp_username, do_auth);
|
|
|
|
gtk_widget_set_sensitive(wizard->smtp_username_label, do_auth);
|
|
|
|
gtk_widget_set_sensitive(wizard->smtp_password, do_auth);
|
|
|
|
gtk_widget_set_sensitive(wizard->smtp_password_label, do_auth);
|
|
|
|
}
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
static GtkWidget* smtp_page (WizardWindow * wizard)
|
|
|
|
{
|
2006-11-30 13:43:50 +01:00
|
|
|
#ifdef USE_OPENSSL
|
2006-12-12 22:58:07 +01:00
|
|
|
GtkWidget *table = gtk_table_new(6, 2, FALSE);
|
2006-11-30 13:43:50 +01:00
|
|
|
#else
|
|
|
|
GtkWidget *table = gtk_table_new(4, 2, FALSE);
|
|
|
|
#endif
|
2006-12-11 23:49:38 +01:00
|
|
|
GtkTooltips *tips = gtk_tooltips_new();
|
2004-08-25 00:46:53 +02:00
|
|
|
gchar *text;
|
|
|
|
gint i = 0;
|
|
|
|
|
|
|
|
gtk_table_set_row_spacings(GTK_TABLE(table), 4);
|
|
|
|
gtk_table_set_col_spacings(GTK_TABLE(table), 8);
|
|
|
|
|
|
|
|
wizard->smtp_server = gtk_entry_new();
|
2004-09-24 14:48:20 +02:00
|
|
|
text = get_default_server(wizard, "smtp");
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->smtp_server), text);
|
|
|
|
g_free(text);
|
2006-12-11 23:49:38 +01:00
|
|
|
|
|
|
|
gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), wizard->smtp_server,
|
|
|
|
_("You can specify the port number by appending it at the end: "
|
|
|
|
"\"mail.example.com:25\""),
|
|
|
|
NULL);
|
|
|
|
|
2005-11-24 13:37:29 +01:00
|
|
|
GTK_TABLE_ADD_ROW_AT(table, _("<span weight=\"bold\">SMTP server address:</span>"),
|
2004-08-25 00:46:53 +02:00
|
|
|
wizard->smtp_server, i); i++;
|
2006-04-05 18:49:00 +02:00
|
|
|
wizard->smtp_auth = gtk_check_button_new_with_label(
|
|
|
|
_("Use authentication"));
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->smtp_auth),
|
|
|
|
tmpl.smtpauth);
|
|
|
|
g_signal_connect(G_OBJECT(wizard->smtp_auth), "toggled",
|
|
|
|
G_CALLBACK(smtp_auth_changed),
|
|
|
|
wizard);
|
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->smtp_auth,
|
|
|
|
0,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0); i++;
|
|
|
|
|
|
|
|
text = get_default_smtp_account(wizard);
|
|
|
|
|
|
|
|
wizard->smtp_username = gtk_entry_new();
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->smtp_username), text);
|
|
|
|
g_free(text);
|
|
|
|
wizard->smtp_username_label = gtk_label_new(_("SMTP username:\n"
|
|
|
|
"<span size=\"small\">(empty to use the same as reception)</span>"));
|
|
|
|
gtk_label_set_use_markup(GTK_LABEL(wizard->smtp_username_label), TRUE);
|
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->smtp_username_label,
|
|
|
|
0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
|
|
|
|
if (GTK_IS_MISC(wizard->smtp_username_label))
|
|
|
|
gtk_misc_set_alignment(GTK_MISC(wizard->smtp_username_label), 1, 0.5);
|
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->smtp_username,
|
|
|
|
1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
|
|
|
|
i++;
|
|
|
|
wizard->smtp_password = gtk_entry_new();
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->smtp_password), tmpl.smtppass?tmpl.smtppass:"");
|
|
|
|
gtk_entry_set_visibility(GTK_ENTRY(wizard->smtp_password), FALSE);
|
|
|
|
wizard->smtp_password_label = gtk_label_new(_("SMTP password:\n"
|
|
|
|
"<span size=\"small\">(empty to use the same as reception)</span>"));
|
|
|
|
gtk_label_set_use_markup(GTK_LABEL(wizard->smtp_password_label), TRUE);
|
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->smtp_password_label,
|
|
|
|
0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
|
|
|
|
if (GTK_IS_MISC(wizard->smtp_password_label))
|
|
|
|
gtk_misc_set_alignment(GTK_MISC(wizard->smtp_password_label), 1, 0.5);
|
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->smtp_password,
|
|
|
|
1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
|
|
|
|
i++;
|
2006-11-30 13:43:50 +01:00
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
wizard->smtp_use_ssl = gtk_check_button_new_with_label(
|
|
|
|
_("Use SSL to connect to SMTP server"));
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->smtp_use_ssl),
|
2006-12-12 22:58:07 +01:00
|
|
|
tmpl.smtpssl != 0);
|
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->smtp_use_ssl,
|
2006-11-30 13:43:50 +01:00
|
|
|
0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
|
|
|
|
i++;
|
2006-12-12 22:58:07 +01:00
|
|
|
wizard->smtp_use_tls = gtk_check_button_new_with_label(
|
|
|
|
_("Use SSL via STARTTLS"));
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->smtp_use_tls),
|
|
|
|
tmpl.smtpssl == 2);
|
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->smtp_use_tls,
|
|
|
|
0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 16, 0);
|
|
|
|
i++;
|
|
|
|
SET_TOGGLE_SENSITIVITY (wizard->smtp_use_ssl, wizard->smtp_use_tls);
|
2006-11-30 13:43:50 +01:00
|
|
|
#endif
|
2006-04-05 18:49:00 +02:00
|
|
|
smtp_auth_changed(NULL, wizard);
|
2004-08-25 00:46:53 +02:00
|
|
|
return table;
|
|
|
|
}
|
|
|
|
|
2006-04-05 18:49:00 +02:00
|
|
|
static void wizard_protocol_change(WizardWindow *wizard, RecvProtocol protocol)
|
2004-08-25 01:19:35 +02:00
|
|
|
{
|
|
|
|
gchar *text;
|
|
|
|
|
|
|
|
if (protocol == A_POP3) {
|
2004-09-24 14:48:20 +02:00
|
|
|
text = get_default_server(wizard, "pop");
|
2004-08-25 01:19:35 +02:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
|
2005-10-03 19:11:47 +02:00
|
|
|
gtk_widget_hide(wizard->recv_imap_label);
|
|
|
|
gtk_widget_hide(wizard->recv_imap_subdir);
|
|
|
|
gtk_widget_show(wizard->recv_username);
|
|
|
|
gtk_widget_show(wizard->recv_password);
|
|
|
|
gtk_widget_show(wizard->recv_username_label);
|
|
|
|
gtk_widget_show(wizard->recv_password_label);
|
2006-10-07 18:03:36 +02:00
|
|
|
gtk_widget_hide(wizard->no_imap_warning);
|
2006-11-30 13:43:50 +01:00
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
gtk_widget_show(wizard->recv_use_ssl);
|
2006-12-12 22:58:07 +01:00
|
|
|
gtk_widget_show(wizard->recv_use_tls);
|
2006-11-30 13:43:50 +01:00
|
|
|
#endif
|
2005-11-24 13:37:29 +01:00
|
|
|
gtk_label_set_text(GTK_LABEL(wizard->recv_label), _("<span weight=\"bold\">Server address:</span>"));
|
|
|
|
gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
|
2006-10-07 18:03:36 +02:00
|
|
|
gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, TRUE);
|
2004-08-25 01:19:35 +02:00
|
|
|
g_free(text);
|
2005-10-03 19:11:47 +02:00
|
|
|
} else if (protocol == A_IMAP4) {
|
2006-10-07 18:03:36 +02:00
|
|
|
#ifdef HAVE_LIBETPAN
|
2004-09-24 14:48:20 +02:00
|
|
|
text = get_default_server(wizard, "imap");
|
2004-08-25 01:19:35 +02:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
|
2005-10-03 19:11:47 +02:00
|
|
|
gtk_widget_show(wizard->recv_imap_label);
|
|
|
|
gtk_widget_show(wizard->recv_imap_subdir);
|
|
|
|
gtk_widget_show(wizard->recv_username);
|
|
|
|
gtk_widget_show(wizard->recv_password);
|
|
|
|
gtk_widget_show(wizard->recv_username_label);
|
|
|
|
gtk_widget_show(wizard->recv_password_label);
|
2006-10-07 18:03:36 +02:00
|
|
|
gtk_widget_hide(wizard->no_imap_warning);
|
2006-11-30 13:43:50 +01:00
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
gtk_widget_show(wizard->recv_use_ssl);
|
2006-12-12 22:58:07 +01:00
|
|
|
gtk_widget_show(wizard->recv_use_tls);
|
2006-11-30 13:43:50 +01:00
|
|
|
#endif
|
2005-11-24 13:37:29 +01:00
|
|
|
gtk_label_set_text(GTK_LABEL(wizard->recv_label), _("<span weight=\"bold\">Server address:</span>"));
|
|
|
|
gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
|
2006-10-07 18:03:36 +02:00
|
|
|
gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, TRUE);
|
2004-08-25 01:19:35 +02:00
|
|
|
g_free(text);
|
2006-10-07 18:03:36 +02:00
|
|
|
#else
|
|
|
|
gtk_widget_hide(wizard->recv_imap_label);
|
|
|
|
gtk_widget_hide(wizard->recv_imap_subdir);
|
|
|
|
gtk_widget_hide(wizard->recv_username);
|
|
|
|
gtk_widget_hide(wizard->recv_password);
|
|
|
|
gtk_widget_hide(wizard->recv_username_label);
|
|
|
|
gtk_widget_hide(wizard->recv_password_label);
|
|
|
|
gtk_widget_show(wizard->no_imap_warning);
|
2006-11-30 13:43:50 +01:00
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
gtk_widget_hide(wizard->recv_use_ssl);
|
2006-12-12 22:58:07 +01:00
|
|
|
gtk_widget_hide(wizard->recv_use_tls);
|
2006-11-30 13:43:50 +01:00
|
|
|
#endif
|
2006-10-07 18:03:36 +02:00
|
|
|
gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, FALSE);
|
|
|
|
#endif
|
2005-10-03 19:11:47 +02:00
|
|
|
} else if (protocol == A_LOCAL) {
|
2006-04-05 18:49:00 +02:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), tmpl.mboxfile?tmpl.mboxfile:"");
|
2005-11-24 13:37:29 +01:00
|
|
|
gtk_label_set_text(GTK_LABEL(wizard->recv_label), _("<span weight=\"bold\">Local mailbox:</span>"));
|
|
|
|
gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
|
2006-10-07 18:03:36 +02:00
|
|
|
gtk_widget_hide(wizard->no_imap_warning);
|
2005-10-03 19:11:47 +02:00
|
|
|
gtk_widget_hide(wizard->recv_imap_label);
|
|
|
|
gtk_widget_hide(wizard->recv_imap_subdir);
|
|
|
|
gtk_widget_hide(wizard->recv_username);
|
|
|
|
gtk_widget_hide(wizard->recv_password);
|
|
|
|
gtk_widget_hide(wizard->recv_username_label);
|
|
|
|
gtk_widget_hide(wizard->recv_password_label);
|
2006-11-30 13:43:50 +01:00
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
gtk_widget_hide(wizard->recv_use_ssl);
|
2006-12-12 22:58:07 +01:00
|
|
|
gtk_widget_hide(wizard->recv_use_tls);
|
2006-11-30 13:43:50 +01:00
|
|
|
#endif
|
2006-10-07 18:03:36 +02:00
|
|
|
gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, TRUE);
|
2004-08-25 01:19:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-05 18:49:00 +02:00
|
|
|
static void wizard_protocol_changed(GtkMenuItem *menuitem, gpointer data)
|
|
|
|
{
|
|
|
|
WizardWindow *wizard = (WizardWindow *)data;
|
|
|
|
RecvProtocol protocol;
|
|
|
|
protocol = GPOINTER_TO_INT
|
|
|
|
(g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
|
|
|
|
|
|
|
|
wizard_protocol_change(wizard, protocol);
|
|
|
|
}
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
static GtkWidget* recv_page (WizardWindow * wizard)
|
|
|
|
{
|
2006-11-30 13:43:50 +01:00
|
|
|
#ifdef USE_OPENSSL
|
2006-12-12 22:58:07 +01:00
|
|
|
GtkWidget *table = gtk_table_new(7,2, FALSE);
|
2006-11-30 13:43:50 +01:00
|
|
|
#else
|
2004-08-25 00:46:53 +02:00
|
|
|
GtkWidget *table = gtk_table_new(5,2, FALSE);
|
2006-11-30 13:43:50 +01:00
|
|
|
#endif
|
2004-08-25 00:46:53 +02:00
|
|
|
GtkWidget *menu = gtk_menu_new();
|
|
|
|
GtkWidget *menuitem;
|
2006-12-11 23:49:38 +01:00
|
|
|
GtkTooltips *tips = gtk_tooltips_new();
|
2004-08-25 00:46:53 +02:00
|
|
|
gchar *text;
|
|
|
|
gint i = 0;
|
2006-04-05 18:49:00 +02:00
|
|
|
gint index = 0;
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_table_set_row_spacings(GTK_TABLE(table), 4);
|
|
|
|
gtk_table_set_col_spacings(GTK_TABLE(table), 8);
|
|
|
|
|
|
|
|
wizard->recv_type = gtk_option_menu_new();
|
|
|
|
|
|
|
|
MENUITEM_ADD (menu, menuitem, _("POP3"), A_POP3);
|
2004-08-25 01:19:35 +02:00
|
|
|
g_signal_connect(G_OBJECT(menuitem), "activate",
|
|
|
|
G_CALLBACK(wizard_protocol_changed),
|
|
|
|
wizard);
|
2006-10-07 18:03:36 +02:00
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
MENUITEM_ADD (menu, menuitem, _("IMAP"), A_IMAP4);
|
2004-08-25 01:19:35 +02:00
|
|
|
g_signal_connect(G_OBJECT(menuitem), "activate",
|
|
|
|
G_CALLBACK(wizard_protocol_changed),
|
|
|
|
wizard);
|
2006-10-07 18:03:36 +02:00
|
|
|
|
2005-10-03 19:11:47 +02:00
|
|
|
MENUITEM_ADD (menu, menuitem, _("Local mbox file"), A_LOCAL);
|
|
|
|
g_signal_connect(G_OBJECT(menuitem), "activate",
|
|
|
|
G_CALLBACK(wizard_protocol_changed),
|
|
|
|
wizard);
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (wizard->recv_type), menu);
|
2006-04-05 18:49:00 +02:00
|
|
|
switch(tmpl.recvtype) {
|
|
|
|
case A_POP3:
|
|
|
|
index = 0;
|
|
|
|
break;
|
|
|
|
case A_IMAP4:
|
|
|
|
index = 1;
|
|
|
|
break;
|
|
|
|
case A_LOCAL:
|
|
|
|
index = 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
index = 0;
|
|
|
|
}
|
|
|
|
gtk_option_menu_set_history(GTK_OPTION_MENU (wizard->recv_type), index);
|
2005-11-24 13:37:29 +01:00
|
|
|
GTK_TABLE_ADD_ROW_AT(table, _("<span weight=\"bold\">Server type:</span>"),
|
2004-08-25 00:46:53 +02:00
|
|
|
wizard->recv_type, i); i++;
|
|
|
|
|
|
|
|
wizard->recv_server = gtk_entry_new();
|
2004-09-24 14:48:20 +02:00
|
|
|
text = get_default_server(wizard, "pop");
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
|
|
|
|
g_free(text);
|
2005-10-03 19:11:47 +02:00
|
|
|
|
2006-12-11 23:49:38 +01:00
|
|
|
gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), wizard->recv_server,
|
|
|
|
_("You can specify the port number by appending it at the end: "
|
|
|
|
"\"mail.example.com:110\""),
|
|
|
|
NULL);
|
|
|
|
|
2005-11-24 13:37:29 +01:00
|
|
|
wizard->recv_label = gtk_label_new(_("<span weight=\"bold\">Server address:</span>"));
|
|
|
|
gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
|
2005-10-03 19:11:47 +02:00
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->recv_label,
|
|
|
|
0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
|
|
|
|
if (GTK_IS_MISC(wizard->recv_label))
|
|
|
|
gtk_misc_set_alignment(GTK_MISC(wizard->recv_label), 1, 0.5);
|
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->recv_server,
|
|
|
|
1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
|
|
|
|
i++;
|
2004-08-25 00:46:53 +02:00
|
|
|
|
|
|
|
wizard->recv_username = gtk_entry_new();
|
2005-11-24 13:37:29 +01:00
|
|
|
wizard->recv_username_label = gtk_label_new(_("<span weight=\"bold\">Username:</span>"));
|
|
|
|
gtk_label_set_use_markup(GTK_LABEL(wizard->recv_username_label), TRUE);
|
2005-10-03 19:11:47 +02:00
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->recv_username_label,
|
|
|
|
0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
|
|
|
|
if (GTK_IS_MISC(wizard->recv_username_label))
|
|
|
|
gtk_misc_set_alignment(GTK_MISC(wizard->recv_username_label), 1, 0.5);
|
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->recv_username,
|
|
|
|
1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
|
|
|
|
i++;
|
2004-08-25 00:46:53 +02:00
|
|
|
|
2005-10-25 14:09:08 +02:00
|
|
|
text = get_default_account(wizard);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->recv_username), text);
|
|
|
|
g_free(text);
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
wizard->recv_password = gtk_entry_new();
|
2006-04-05 18:49:00 +02:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->recv_password), tmpl.recvpass?tmpl.recvpass:"");
|
2005-10-03 19:11:47 +02:00
|
|
|
wizard->recv_password_label = gtk_label_new(_("Password:"));
|
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->recv_password_label,
|
|
|
|
0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
|
|
|
|
if (GTK_IS_MISC(wizard->recv_password_label))
|
|
|
|
gtk_misc_set_alignment(GTK_MISC(wizard->recv_password_label), 1, 0.5);
|
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->recv_password,
|
|
|
|
1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_entry_set_visibility(GTK_ENTRY(wizard->recv_password), FALSE);
|
2005-10-03 19:11:47 +02:00
|
|
|
i++;
|
|
|
|
|
|
|
|
wizard->recv_imap_subdir = gtk_entry_new();
|
2006-04-05 18:49:00 +02:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(wizard->recv_imap_subdir), tmpl.imapdir?tmpl.imapdir:"");
|
2005-10-03 19:11:47 +02:00
|
|
|
wizard->recv_imap_label = gtk_label_new(_("IMAP server directory:"));
|
|
|
|
|
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->recv_imap_label,
|
|
|
|
0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
|
|
|
|
if (GTK_IS_MISC(wizard->recv_imap_label))
|
|
|
|
gtk_misc_set_alignment(GTK_MISC(wizard->recv_imap_label), 1, 0.5);
|
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->recv_imap_subdir,
|
|
|
|
1,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
|
|
|
|
|
|
|
|
i++;
|
2004-08-25 00:46:53 +02:00
|
|
|
|
2006-10-07 18:03:36 +02:00
|
|
|
wizard->no_imap_warning = gtk_label_new(_(
|
2006-11-07 11:47:23 +01:00
|
|
|
"<span weight=\"bold\">Warning: this version of Claws Mail\n"
|
2006-10-07 18:03:36 +02:00
|
|
|
"has been built without IMAP support.</span>"));
|
|
|
|
gtk_label_set_use_markup(GTK_LABEL(wizard->no_imap_warning), TRUE);
|
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->no_imap_warning,
|
|
|
|
0,2,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
|
2004-08-25 12:35:53 +02:00
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
wizard->recv_use_ssl = gtk_check_button_new_with_label(
|
|
|
|
_("Use SSL to connect to receiving server"));
|
2006-04-05 18:49:00 +02:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->recv_use_ssl),
|
2006-12-12 22:58:07 +01:00
|
|
|
tmpl.recvssl != 0);
|
2004-08-25 12:35:53 +02:00
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->recv_use_ssl,
|
|
|
|
0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
|
2006-11-30 13:43:50 +01:00
|
|
|
i++;
|
2006-12-12 22:58:07 +01:00
|
|
|
wizard->recv_use_tls = gtk_check_button_new_with_label(
|
|
|
|
_("Use SSL via STARTTLS"));
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->recv_use_tls),
|
|
|
|
tmpl.recvssl == 2);
|
|
|
|
gtk_table_attach(GTK_TABLE(table), wizard->recv_use_tls,
|
|
|
|
0,1,i,i+1, GTK_EXPAND|GTK_FILL, 0, 16, 0);
|
|
|
|
i++;
|
|
|
|
SET_TOGGLE_SENSITIVITY (wizard->recv_use_ssl, wizard->recv_use_tls);
|
2006-11-30 13:43:50 +01:00
|
|
|
#endif
|
2004-08-25 12:35:53 +02:00
|
|
|
return table;
|
|
|
|
}
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
static void
|
|
|
|
wizard_response_cb (GtkDialog * dialog, int response, gpointer data)
|
|
|
|
{
|
|
|
|
WizardWindow * wizard = (WizardWindow *)data;
|
|
|
|
int current_page, num_pages;
|
2005-10-03 19:11:47 +02:00
|
|
|
GtkWidget *menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(wizard->recv_type));
|
|
|
|
GtkWidget *menuitem = gtk_menu_get_active(GTK_MENU(menu));
|
|
|
|
gint protocol = GPOINTER_TO_INT
|
|
|
|
(g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
|
|
|
|
gboolean skip_mailbox_page = FALSE;
|
|
|
|
|
|
|
|
if (protocol == A_IMAP4) {
|
|
|
|
skip_mailbox_page = TRUE;
|
|
|
|
}
|
2004-08-25 00:46:53 +02:00
|
|
|
|
|
|
|
num_pages = g_slist_length(wizard->pages);
|
2005-10-08 21:13:41 +02:00
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
current_page = gtk_notebook_get_current_page (
|
|
|
|
GTK_NOTEBOOK(wizard->notebook));
|
|
|
|
if (response == CANCEL)
|
|
|
|
{
|
2004-08-26 08:45:58 +02:00
|
|
|
wizard->result = FALSE;
|
2005-10-12 19:22:33 +02:00
|
|
|
wizard->finished = TRUE;
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_widget_destroy (GTK_WIDGET(dialog));
|
|
|
|
}
|
|
|
|
else if (response == FINISHED)
|
|
|
|
{
|
2005-10-08 21:13:41 +02:00
|
|
|
if (!wizard_write_config(wizard)) {
|
|
|
|
current_page = gtk_notebook_get_current_page (
|
|
|
|
GTK_NOTEBOOK(wizard->notebook));
|
|
|
|
goto set_sens;
|
|
|
|
}
|
2004-08-26 08:45:58 +02:00
|
|
|
wizard->result = TRUE;
|
2005-10-12 19:22:33 +02:00
|
|
|
wizard->finished = TRUE;
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_widget_destroy (GTK_WIDGET(dialog));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (response == GO_BACK)
|
|
|
|
{
|
2005-10-03 19:11:47 +02:00
|
|
|
if (current_page > 0) {
|
|
|
|
current_page--;
|
2005-11-24 13:37:29 +01:00
|
|
|
if (current_page == MAILBOX_PAGE && skip_mailbox_page) {
|
2005-10-03 19:11:47 +02:00
|
|
|
/* mailbox */
|
|
|
|
current_page--;
|
|
|
|
}
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_notebook_set_current_page (
|
|
|
|
GTK_NOTEBOOK(wizard->notebook),
|
2005-10-03 19:11:47 +02:00
|
|
|
current_page);
|
|
|
|
}
|
2004-08-25 00:46:53 +02:00
|
|
|
}
|
|
|
|
else if (response == GO_FORWARD)
|
|
|
|
{
|
2005-10-03 19:11:47 +02:00
|
|
|
if (current_page < (num_pages-1)) {
|
|
|
|
current_page++;
|
2005-11-24 13:37:29 +01:00
|
|
|
if (current_page == MAILBOX_PAGE && skip_mailbox_page) {
|
2005-10-03 19:11:47 +02:00
|
|
|
/* mailbox */
|
|
|
|
current_page++;
|
|
|
|
}
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_notebook_set_current_page (
|
|
|
|
GTK_NOTEBOOK(wizard->notebook),
|
2005-10-03 19:11:47 +02:00
|
|
|
current_page);
|
|
|
|
}
|
2004-08-25 00:46:53 +02:00
|
|
|
}
|
2005-10-08 21:13:41 +02:00
|
|
|
set_sens:
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_dialog_set_response_sensitive (dialog, GO_BACK,
|
|
|
|
current_page > 0);
|
|
|
|
gtk_dialog_set_response_sensitive (dialog, GO_FORWARD,
|
|
|
|
current_page < (num_pages - 1));
|
|
|
|
gtk_dialog_set_response_sensitive (dialog, FINISHED,
|
|
|
|
current_page == (num_pages - 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-12 19:22:33 +02:00
|
|
|
static gint wizard_close_cb(GtkWidget *widget, GdkEventAny *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
WizardWindow *wizard = (WizardWindow *)data;
|
|
|
|
wizard->result = FALSE;
|
|
|
|
wizard->finished = TRUE;
|
2005-10-16 15:19:35 +02:00
|
|
|
|
|
|
|
return FALSE;
|
2005-10-12 19:22:33 +02:00
|
|
|
}
|
2004-08-25 00:46:53 +02:00
|
|
|
|
2005-11-24 13:37:29 +01:00
|
|
|
#define PACK_WARNING(text) { \
|
|
|
|
label = gtk_label_new(text); \
|
|
|
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0); \
|
|
|
|
gtk_box_pack_end(GTK_BOX(widget), label, FALSE, FALSE, 0); \
|
|
|
|
}
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
gboolean run_wizard(MainWindow *mainwin, gboolean create_mailbox) {
|
|
|
|
WizardWindow *wizard = g_new0(WizardWindow, 1);
|
|
|
|
GtkWidget *page;
|
|
|
|
GtkWidget *widget;
|
2005-11-24 13:37:29 +01:00
|
|
|
GtkWidget *label;
|
2004-08-25 00:46:53 +02:00
|
|
|
gchar *text;
|
2004-08-26 08:45:58 +02:00
|
|
|
GSList *cur;
|
|
|
|
gboolean result;
|
2005-11-24 13:37:29 +01:00
|
|
|
gint i = 0;
|
2004-08-25 00:46:53 +02:00
|
|
|
wizard->mainwin = mainwin;
|
|
|
|
wizard->create_mailbox = create_mailbox;
|
|
|
|
|
|
|
|
gtk_widget_hide(mainwin->window);
|
|
|
|
|
2006-04-05 18:49:00 +02:00
|
|
|
wizard_read_defaults();
|
|
|
|
|
2006-11-07 11:47:23 +01:00
|
|
|
wizard->window = gtk_dialog_new_with_buttons (_("Claws Mail Setup Wizard"),
|
2004-08-25 00:46:53 +02:00
|
|
|
NULL, 0,
|
|
|
|
GTK_STOCK_GO_BACK, GO_BACK,
|
|
|
|
GTK_STOCK_GO_FORWARD, GO_FORWARD,
|
|
|
|
GTK_STOCK_SAVE, FINISHED,
|
2005-10-17 13:13:58 +02:00
|
|
|
GTK_STOCK_CANCEL, CANCEL,
|
2004-08-25 00:46:53 +02:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
g_signal_connect(wizard->window, "response",
|
|
|
|
G_CALLBACK(wizard_response_cb), wizard);
|
|
|
|
gtk_widget_realize(wizard->window);
|
|
|
|
gtk_dialog_set_default_response(GTK_DIALOG(wizard->window),
|
|
|
|
GO_FORWARD);
|
|
|
|
gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
|
|
|
|
GO_BACK, FALSE);
|
|
|
|
gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
|
|
|
|
GO_FORWARD, TRUE);
|
|
|
|
gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
|
|
|
|
FINISHED, FALSE);
|
|
|
|
gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard->window),
|
|
|
|
CANCEL, TRUE);
|
|
|
|
|
|
|
|
wizard->notebook = gtk_notebook_new();
|
|
|
|
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(wizard->notebook), FALSE);
|
|
|
|
gtk_notebook_set_show_border(GTK_NOTEBOOK(wizard->notebook), FALSE);
|
|
|
|
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(wizard->window)->vbox),
|
|
|
|
wizard->notebook, TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
wizard->pages = NULL;
|
|
|
|
|
2005-10-03 19:11:47 +02:00
|
|
|
/*welcome page: 0 */
|
2005-11-24 13:37:29 +01:00
|
|
|
WELCOME_PAGE = i;
|
2006-11-07 11:47:23 +01:00
|
|
|
page = create_page(wizard, _("Welcome to Claws Mail"));
|
2004-08-25 00:46:53 +02:00
|
|
|
|
|
|
|
wizard->pages = g_slist_append(wizard->pages, page);
|
|
|
|
widget = stock_pixmap_widget(wizard->window,
|
2006-11-07 11:47:23 +01:00
|
|
|
STOCK_PIXMAP_CLAWS_MAIL_LOGO);
|
2004-08-25 00:46:53 +02:00
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
|
|
|
|
|
2006-11-07 11:47:23 +01:00
|
|
|
text = g_strdup(_("Welcome to the Claws Mail setup wizard.\n\n"
|
2005-10-17 13:13:58 +02:00
|
|
|
"We will begin by defining some basic "
|
|
|
|
"information about you and your most common "
|
|
|
|
"mail options so that you can start to use "
|
2006-11-07 11:47:23 +01:00
|
|
|
"Claws Mail in less than five minutes."));
|
2004-08-25 00:46:53 +02:00
|
|
|
widget = gtk_label_new(text);
|
2005-10-17 13:13:58 +02:00
|
|
|
gtk_label_set_line_wrap(GTK_LABEL(widget), TRUE);
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
|
|
|
|
g_free(text);
|
|
|
|
|
2005-10-03 19:11:47 +02:00
|
|
|
/* user page: 1 */
|
2005-11-24 13:37:29 +01:00
|
|
|
i++;
|
|
|
|
USER_PAGE = i;
|
2004-08-25 00:46:53 +02:00
|
|
|
widget = create_page (wizard, _("About You"));
|
|
|
|
gtk_box_pack_start (GTK_BOX(widget), user_page(wizard), FALSE, FALSE, 0);
|
2005-11-24 13:37:29 +01:00
|
|
|
PACK_WARNING(_("Bold fields must be completed"));
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
wizard->pages = g_slist_append(wizard->pages, widget);
|
|
|
|
|
2006-04-05 18:49:00 +02:00
|
|
|
/* recv+auth page: 2 */
|
2005-11-24 13:37:29 +01:00
|
|
|
i++;
|
2006-04-05 18:49:00 +02:00
|
|
|
RECV_PAGE = i;
|
|
|
|
widget = create_page (wizard, _("Receiving mail"));
|
|
|
|
gtk_box_pack_start (GTK_BOX(widget), recv_page(wizard), FALSE, FALSE, 0);
|
2005-11-24 13:37:29 +01:00
|
|
|
PACK_WARNING(_("Bold fields must be completed"));
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
wizard->pages = g_slist_append(wizard->pages, widget);
|
|
|
|
|
2006-04-05 18:49:00 +02:00
|
|
|
/*smtp page: 3 */
|
2005-11-24 13:37:29 +01:00
|
|
|
i++;
|
2006-04-05 18:49:00 +02:00
|
|
|
SMTP_PAGE = i;
|
|
|
|
widget = create_page (wizard, _("Sending mail"));
|
|
|
|
gtk_box_pack_start (GTK_BOX(widget), smtp_page(wizard), FALSE, FALSE, 0);
|
2005-11-24 13:37:29 +01:00
|
|
|
PACK_WARNING(_("Bold fields must be completed"));
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
wizard->pages = g_slist_append(wizard->pages, widget);
|
|
|
|
|
2005-10-03 19:11:47 +02:00
|
|
|
/* mailbox page: 4 */
|
|
|
|
if (create_mailbox) {
|
2005-11-24 13:37:29 +01:00
|
|
|
i++;
|
|
|
|
MAILBOX_PAGE = i;
|
2005-10-03 19:11:47 +02:00
|
|
|
widget = create_page (wizard, _("Saving mail on disk"));
|
|
|
|
gtk_box_pack_start (GTK_BOX(widget), mailbox_page(wizard), FALSE, FALSE, 0);
|
2005-11-24 13:37:29 +01:00
|
|
|
PACK_WARNING(_("Bold fields must be completed"));
|
|
|
|
|
2005-10-03 19:11:47 +02:00
|
|
|
wizard->pages = g_slist_append(wizard->pages, widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* done page: 6 */
|
2005-11-24 13:37:29 +01:00
|
|
|
i++;
|
|
|
|
DONE_PAGE = i;
|
2005-10-17 13:13:58 +02:00
|
|
|
page = create_page(wizard, _("Configuration finished"));
|
2004-08-25 12:35:53 +02:00
|
|
|
|
2005-10-03 19:11:47 +02:00
|
|
|
wizard->pages = g_slist_append(wizard->pages, page);
|
|
|
|
widget = stock_pixmap_widget(wizard->window,
|
2006-11-07 11:47:23 +01:00
|
|
|
STOCK_PIXMAP_CLAWS_MAIL_LOGO);
|
2005-10-03 19:11:47 +02:00
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
|
|
|
|
|
2006-11-07 11:47:23 +01:00
|
|
|
text = g_strdup(_("Claws Mail is now ready.\n\n"
|
2005-10-03 19:11:47 +02:00
|
|
|
"Click Save to start."));
|
|
|
|
widget = gtk_label_new(text);
|
|
|
|
gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
|
|
|
|
g_free(text);
|
|
|
|
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
for (cur = wizard->pages; cur && cur->data; cur = cur->next) {
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK(wizard->notebook),
|
|
|
|
GTK_WIDGET(cur->data), NULL);
|
|
|
|
}
|
|
|
|
|
2005-10-12 19:22:33 +02:00
|
|
|
g_signal_connect(G_OBJECT(wizard->window), "delete_event",
|
|
|
|
G_CALLBACK(wizard_close_cb), wizard);
|
2004-08-25 00:46:53 +02:00
|
|
|
gtk_widget_show_all (wizard->window);
|
2005-10-12 19:22:33 +02:00
|
|
|
|
2005-10-03 19:11:47 +02:00
|
|
|
gtk_widget_hide(wizard->recv_imap_label);
|
|
|
|
gtk_widget_hide(wizard->recv_imap_subdir);
|
2004-08-25 00:46:53 +02:00
|
|
|
|
2006-04-05 18:49:00 +02:00
|
|
|
wizard_protocol_change(wizard, tmpl.recvtype);
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
while (!wizard->finished)
|
|
|
|
gtk_main_iteration();
|
|
|
|
|
2004-08-26 08:45:58 +02:00
|
|
|
result = wizard->result;
|
|
|
|
|
2004-08-25 00:46:53 +02:00
|
|
|
GTK_EVENTS_FLUSH();
|
|
|
|
|
|
|
|
gtk_widget_show(mainwin->window);
|
|
|
|
g_free(wizard);
|
|
|
|
|
2004-08-26 08:45:58 +02:00
|
|
|
return result;
|
2004-08-25 00:46:53 +02:00
|
|
|
}
|