aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog25
-rw-r--r--mail/mail-account-editor.c133
-rw-r--r--mail/mail-config-druid.c107
-rw-r--r--mail/mail-config.c24
4 files changed, 199 insertions, 90 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index e7258dcc1e..3a07712f10 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,28 @@
+2001-01-16 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-account-editor.c (apply_changes): Modify to be able to
+ handle a NULL source_url.
+ (source_auth_init): Allow for a NULL source url.
+ (source_check): Same.
+
+ * mail-config.c (mail_config_write): Allow for NULL source
+ URLs. And while we're at it, NULL transport URLs as well. Might as
+ well save the use_ssl variable too.
+ (config_read): Same.
+
+ * mail-config-druid.c (druid_finish): Modify to allow a NULL
+ source url.
+ (incoming_next): Modify to check for a NULL source and jump to the
+ transport page if one is encountered (this means the user decided
+ not to config a source).
+ (incoming_type_changed): Modify to set all widgets insensitive if
+ the user selected the "None" source menu item (aka NULL provider).
+ (incoming_check): Modify to allow the user to go to the next page
+ when he/she has chosen "None" for their source type.
+ (mail_config_druid_get_source_url): Return NULL if the provider is
+ NULL.
+ (mail_config_druid_get_transport_url): Same.
+
2001-01-16 Dan Winship <danw@ximian.com>
* mail-display.c (on_object_requested): Don't do thumbnails for
diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c
index 7c727c63b0..dc19646f75 100644
--- a/mail/mail-account-editor.c
+++ b/mail/mail-account-editor.c
@@ -108,7 +108,7 @@ apply_changes (MailAccountEditor *editor)
{
MailConfigAccount *account;
char *host, *pport, *str;
- CamelURL *source_url, *transport_url;
+ CamelURL *source_url = NULL, *transport_url;
gboolean retval = TRUE;
int port;
@@ -143,40 +143,42 @@ apply_changes (MailAccountEditor *editor)
}
/* source */
- source_url = camel_url_new (account->source->url, NULL);
-
- g_free (source_url->user);
- str = gtk_entry_get_text (editor->source_user);
- source_url->user = str && *str ? g_strdup (str) : NULL;
-
- g_free (source_url->passwd);
- str = gtk_entry_get_text (editor->source_passwd);
- source_url->passwd = str && *str ? g_strdup (str) : NULL;
-
- g_free (source_url->authmech);
- str = gtk_object_get_data (GTK_OBJECT (editor), "source_authmech");
- source_url->authmech = str && *str ? g_strdup (str) : NULL;
-
- g_free (source_url->host);
- host = g_strdup (gtk_entry_get_text (editor->source_host));
- if (host && (pport = strchr (host, ':'))) {
- *pport = '\0';
- port = atoi (pport + 1);
- } else {
- port = 0;
+ if (account->source->url) {
+ source_url = camel_url_new (account->source->url, NULL);
+
+ g_free (source_url->user);
+ str = gtk_entry_get_text (editor->source_user);
+ source_url->user = str && *str ? g_strdup (str) : NULL;
+
+ g_free (source_url->passwd);
+ str = gtk_entry_get_text (editor->source_passwd);
+ source_url->passwd = str && *str ? g_strdup (str) : NULL;
+
+ g_free (source_url->authmech);
+ str = gtk_object_get_data (GTK_OBJECT (editor), "source_authmech");
+ source_url->authmech = str && *str ? g_strdup (str) : NULL;
+
+ g_free (source_url->host);
+ host = g_strdup (gtk_entry_get_text (editor->source_host));
+ if (host && (pport = strchr (host, ':'))) {
+ *pport = '\0';
+ port = atoi (pport + 1);
+ } else {
+ port = 0;
+ }
+ source_url->host = host;
+ source_url->port = port;
+
+ g_free (source_url->path);
+ str = gtk_entry_get_text (editor->source_path);
+ source_url->path = str && *str ? g_strdup (str) : NULL;
+
+ account->source->save_passwd = GTK_TOGGLE_BUTTON (editor->save_passwd)->active;
+ account->source->keep_on_server = GTK_TOGGLE_BUTTON (editor->keep_on_server)->active;
+
+ if (editor->source_ssl)
+ account->source->use_ssl = GTK_TOGGLE_BUTTON (editor->source_ssl)->active;
}
- source_url->host = host;
- source_url->port = port;
-
- g_free (source_url->path);
- str = gtk_entry_get_text (editor->source_path);
- source_url->path = str && *str ? g_strdup (str) : NULL;
-
- account->source->save_passwd = GTK_TOGGLE_BUTTON (editor->save_passwd)->active;
- account->source->keep_on_server = GTK_TOGGLE_BUTTON (editor->keep_on_server)->active;
-
- if (editor->source_ssl)
- account->source->use_ssl = GTK_TOGGLE_BUTTON (editor->source_ssl)->active;
/* transport */
transport_url = g_new0 (CamelURL, 1);
@@ -209,20 +211,22 @@ apply_changes (MailAccountEditor *editor)
*/
/* check to make sure the source works */
- if (!mail_config_check_service (source_url, CAMEL_PROVIDER_STORE, NULL)) {
- /* set the new source url */
- g_free (account->source->url);
- account->source->url = camel_url_to_string (source_url, FALSE);
-
- /* save the password if we were requested to do so */
- if (account->source->save_passwd && source_url->passwd) {
- mail_session_set_password (account->source->url, source_url->passwd);
- mail_session_remember_password (account->source->url);
+ if (source_url) {
+ if (!mail_config_check_service (source_url, CAMEL_PROVIDER_STORE, NULL)) {
+ /* set the new source url */
+ g_free (account->source->url);
+ account->source->url = camel_url_to_string (source_url, FALSE);
+
+ /* save the password if we were requested to do so */
+ if (account->source->save_passwd && source_url->passwd) {
+ mail_session_set_password (account->source->url, source_url->passwd);
+ mail_session_remember_password (account->source->url);
+ }
+ } else {
+ retval = FALSE;
}
- } else {
- retval = FALSE;
+ camel_url_free (source_url);
}
- camel_url_free (source_url);
/* check to make sure the transport works */
if (mail_config_check_service (transport_url, CAMEL_PROVIDER_TRANSPORT, NULL)) {
@@ -299,8 +303,7 @@ source_auth_init (MailAccountEditor *editor, CamelURL *url)
menu = gtk_menu_new ();
gtk_option_menu_remove_menu (editor->source_auth);
- /* If we can't connect, don't let them continue. */
- if (!mail_config_check_service (url, CAMEL_PROVIDER_STORE, &authtypes)) {
+ if (!url || !mail_config_check_service (url, CAMEL_PROVIDER_STORE, &authtypes)) {
gtk_option_menu_set_menu (editor->source_auth, menu);
return;
@@ -364,7 +367,7 @@ transport_construct_authmenu (MailAccountEditor *editor, CamelURL *url)
menu = gtk_menu_new ();
gtk_option_menu_remove_menu (editor->transport_auth);
- if (!mail_config_check_service (url, CAMEL_PROVIDER_TRANSPORT, &authtypes)) {
+ if (!url || !mail_config_check_service (url, CAMEL_PROVIDER_TRANSPORT, &authtypes)) {
gtk_option_menu_set_menu (editor->transport_auth, menu);
return;
@@ -516,18 +519,18 @@ source_check (MailAccountEditor *editor, CamelURL *url)
}
if (provider->object_types[CAMEL_PROVIDER_STORE] && provider->flags & CAMEL_PROVIDER_IS_SOURCE) {
- if (!g_strcasecmp (provider->protocol, url->protocol)) {
+ if (!url || !g_strcasecmp (provider->protocol, url->protocol)) {
GtkWidget *label;
/* keep-on-server */
- if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
+ if (url && !(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
gtk_widget_set_sensitive (GTK_WIDGET (editor->keep_on_server), TRUE);
else
gtk_widget_set_sensitive (GTK_WIDGET (editor->keep_on_server), FALSE);
/* host */
label = glade_xml_get_widget (editor->gui, "lblSourceHost");
- if (provider->url_flags & CAMEL_URL_ALLOW_HOST) {
+ if (url && provider->url_flags & CAMEL_URL_ALLOW_HOST) {
gtk_widget_set_sensitive (GTK_WIDGET (editor->source_host), TRUE);
gtk_widget_set_sensitive (label, TRUE);
} else {
@@ -537,7 +540,7 @@ source_check (MailAccountEditor *editor, CamelURL *url)
/* user */
label = glade_xml_get_widget (editor->gui, "lblSourceUser");
- if (provider->url_flags & CAMEL_URL_ALLOW_USER) {
+ if (url && provider->url_flags & CAMEL_URL_ALLOW_USER) {
gtk_widget_set_sensitive (GTK_WIDGET (editor->source_user), TRUE);
gtk_widget_set_sensitive (label, TRUE);
} else {
@@ -547,7 +550,7 @@ source_check (MailAccountEditor *editor, CamelURL *url)
/* path */
label = glade_xml_get_widget (editor->gui, "lblSourcePath");
- if (provider->url_flags & CAMEL_URL_ALLOW_PATH) {
+ if (url && provider->url_flags & CAMEL_URL_ALLOW_PATH) {
gtk_widget_set_sensitive (GTK_WIDGET (editor->source_path), TRUE);
gtk_widget_set_sensitive (label, TRUE);
} else {
@@ -557,7 +560,7 @@ source_check (MailAccountEditor *editor, CamelURL *url)
/* auth */
label = glade_xml_get_widget (editor->gui, "lblSourceAuth");
- if (provider->url_flags & CAMEL_URL_ALLOW_AUTH) {
+ if (url && provider->url_flags & CAMEL_URL_ALLOW_AUTH) {
gtk_widget_set_sensitive (GTK_WIDGET (editor->source_auth), TRUE);
gtk_widget_set_sensitive (label, TRUE);
} else {
@@ -567,7 +570,7 @@ source_check (MailAccountEditor *editor, CamelURL *url)
/* passwd */
label = glade_xml_get_widget (editor->gui, "lblSourcePasswd");
- if (provider->url_flags & CAMEL_URL_ALLOW_PASSWORD) {
+ if (url && provider->url_flags & CAMEL_URL_ALLOW_PASSWORD) {
gtk_widget_set_sensitive (GTK_WIDGET (editor->source_passwd), TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (editor->save_passwd), TRUE);
gtk_widget_set_sensitive (label, TRUE);
@@ -645,23 +648,23 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account)
url = camel_url_new (account->source->url, NULL);
editor->source_type = glade_xml_get_widget (gui, "txtSourceType");
if (GTK_IS_LABEL (editor->source_type))
- gtk_label_set_text (GTK_LABEL (editor->source_type), url->protocol);
+ gtk_label_set_text (GTK_LABEL (editor->source_type), url ? url->protocol : _("None"));
else
- gtk_entry_set_text (GTK_ENTRY (editor->source_type), url->protocol);
+ gtk_entry_set_text (GTK_ENTRY (editor->source_type), url ? url->protocol : _("None"));
editor->source_host = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourceHost"));
- gtk_entry_set_text (editor->source_host, url->host ? url->host : "");
- if (url->port) {
+ gtk_entry_set_text (editor->source_host, url && url->host ? url->host : "");
+ if (url && url->port) {
char port[10];
g_snprintf (port, 9, ":%d", url->port);
gtk_entry_append_text (editor->source_host, port);
}
editor->source_user = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourceUser"));
- gtk_entry_set_text (editor->source_user, url->user ? url->user : "");
+ gtk_entry_set_text (editor->source_user, url && url->user ? url->user : "");
editor->source_passwd = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourcePasswd"));
- gtk_entry_set_text (editor->source_passwd, url->passwd ? url->passwd : "");
+ gtk_entry_set_text (editor->source_passwd, url && url->passwd ? url->passwd : "");
editor->source_path = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourcePath"));
- gtk_entry_set_text (editor->source_path, url->path);
+ gtk_entry_set_text (editor->source_path, url && url->path);
editor->save_passwd = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkSavePasswd"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->save_passwd), account->source->save_passwd);
editor->source_auth = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuSourceAuth"));
@@ -679,8 +682,8 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account)
url = camel_url_new (account->transport->url, NULL);
editor->transport_type = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuTransportType"));
editor->transport_host = GTK_ENTRY (glade_xml_get_widget (gui, "txtTransportHost"));
- gtk_entry_set_text (editor->transport_host, url->host ? url->host : "");
- if (url->port) {
+ gtk_entry_set_text (editor->transport_host, url && url->host ? url->host : "");
+ if (url && url->port) {
char port[10];
g_snprintf (port, 9, ":%d", url->port);
diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c
index 67c1663839..ba9537593e 100644
--- a/mail/mail-config-druid.c
+++ b/mail/mail-config-druid.c
@@ -204,14 +204,16 @@ druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data)
source->keep_on_server = mail_config_druid_get_keep_mail_on_server (druid);
source->save_passwd = mail_config_druid_get_save_password (druid);
str = mail_config_druid_get_source_url (druid);
- url = camel_url_new (str, NULL);
- g_free (str);
- source->url = camel_url_to_string (url, FALSE);
- if (source->save_passwd && url->passwd) {
- mail_session_set_password (source->url, url->passwd);
- mail_session_remember_password (source->url);
+ if (str) {
+ /* cache the password and rewrite the url without the password part */
+ url = camel_url_new (str, NULL);
+ source->url = camel_url_to_string (url, FALSE);
+ if (source->save_passwd && url->passwd) {
+ mail_session_set_password (source->url, url->passwd);
+ mail_session_remember_password (source->url);
+ }
+ camel_url_free (url);
}
- camel_url_free (url);
/* construct the transport */
transport = g_new0 (MailConfigService, 1);
@@ -275,13 +277,13 @@ incoming_check (MailConfigDruid *druid)
gboolean host = TRUE, user = TRUE, path = TRUE;
gboolean next_sensitive = TRUE;
- if (prov->url_flags & CAMEL_URL_NEED_HOST)
+ if (prov && prov->url_flags & CAMEL_URL_NEED_HOST)
host = gtk_entry_get_text (druid->incoming_hostname) != NULL;
- if (prov->url_flags & CAMEL_URL_NEED_USER)
+ if (prov && prov->url_flags & CAMEL_URL_NEED_USER)
user = gtk_entry_get_text (druid->incoming_username) != NULL;
- if (prov->url_flags & CAMEL_URL_NEED_PATH)
+ if (prov && prov->url_flags & CAMEL_URL_NEED_PATH)
path = gtk_entry_get_text (druid->incoming_path) != NULL;
next_sensitive = host && user && path;
@@ -332,6 +334,18 @@ incoming_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
config->have_auth_page = TRUE;
source_url = mail_config_druid_get_source_url (config);
+ if (!source_url) {
+ /* User opted to not setup a source for this account,
+ * so jump past the auth page */
+
+ /* Skip to transport page. */
+ config->have_auth_page = FALSE;
+ transport_page = glade_xml_get_widget (config->gui, "druidTransportPage");
+ gnome_druid_set_page (config->druid, GNOME_DRUID_PAGE (transport_page));
+
+ return TRUE;
+ }
+
url = camel_url_new (source_url, NULL);
g_free (source_url);
@@ -388,7 +402,7 @@ incoming_type_changed (GtkWidget *widget, gpointer user_data)
/* hostname */
label = glade_xml_get_widget (druid->gui, "lblSourceHost");
- if (provider->url_flags & CAMEL_URL_ALLOW_HOST) {
+ if (provider && provider->url_flags & CAMEL_URL_ALLOW_HOST) {
dwidget = GTK_WIDGET (druid->incoming_hostname);
gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_hostname), TRUE);
gtk_widget_set_sensitive (label, TRUE);
@@ -400,7 +414,7 @@ incoming_type_changed (GtkWidget *widget, gpointer user_data)
/* username */
label = glade_xml_get_widget (druid->gui, "lblSourceUser");
- if (provider->url_flags & CAMEL_URL_ALLOW_USER) {
+ if (provider && provider->url_flags & CAMEL_URL_ALLOW_USER) {
if (!dwidget)
dwidget = GTK_WIDGET (druid->incoming_username);
gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_username), TRUE);
@@ -413,7 +427,7 @@ incoming_type_changed (GtkWidget *widget, gpointer user_data)
/* password */
label = glade_xml_get_widget (druid->gui, "lblSourcePasswd");
- if (provider->url_flags & CAMEL_URL_ALLOW_PASSWORD) {
+ if (provider && provider->url_flags & CAMEL_URL_ALLOW_PASSWORD) {
if (!dwidget)
dwidget = GTK_WIDGET (druid->password);
gtk_widget_set_sensitive (GTK_WIDGET (druid->password), TRUE);
@@ -426,7 +440,7 @@ incoming_type_changed (GtkWidget *widget, gpointer user_data)
/* auth */
label = glade_xml_get_widget (druid->gui, "lblSourceAuth");
- if (provider->url_flags & CAMEL_URL_ALLOW_AUTH) {
+ if (provider && provider->url_flags & CAMEL_URL_ALLOW_AUTH) {
gtk_widget_set_sensitive (GTK_WIDGET (druid->auth_type), TRUE);
gtk_widget_set_sensitive (label, TRUE);
} else {
@@ -436,7 +450,7 @@ incoming_type_changed (GtkWidget *widget, gpointer user_data)
/* path */
label = glade_xml_get_widget (druid->gui, "lblSourcePath");
- if (provider->url_flags & CAMEL_URL_ALLOW_PATH) {
+ if (provider && provider->url_flags & CAMEL_URL_ALLOW_PATH) {
if (!dwidget)
dwidget = GTK_WIDGET (druid->incoming_path);
@@ -456,7 +470,7 @@ incoming_type_changed (GtkWidget *widget, gpointer user_data)
}
/* keep mail on server */
- if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
+ if (provider && !(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_keep_mail), TRUE);
else
gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_keep_mail), FALSE);
@@ -719,11 +733,27 @@ management_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
return FALSE;
}
+static gint
+provider_compare (const CamelProvider *p1, const CamelProvider *p2)
+{
+ /* sort providers based on "location" (ie. local or remote) */
+ if (p1->flags & CAMEL_PROVIDER_IS_REMOTE) {
+ if (p2->flags & CAMEL_PROVIDER_IS_REMOTE)
+ return 0;
+ return -1;
+ } else {
+ if (p2->flags & CAMEL_PROVIDER_IS_REMOTE)
+ return 1;
+ return 0;
+ }
+}
+
static void
set_defaults (MailConfigDruid *druid)
{
- GtkWidget *stores, *transports;
+ GtkWidget *stores, *transports, *item;
GtkWidget *fstore = NULL, *ftransport = NULL;
+ int si = 0, hstore = 0, ti = 0, htransport = 0;
char *user, *realname;
char hostname[1024];
char domain[1024];
@@ -753,6 +783,10 @@ set_defaults (MailConfigDruid *druid)
stores = gtk_menu_new ();
transports = gtk_menu_new ();
druid->providers = camel_session_list_providers (session, TRUE);
+
+ /* sort the providers, remote first */
+ druid->providers = g_list_sort (druid->providers, (GCompareFunc) provider_compare);
+
l = druid->providers;
while (l) {
CamelProvider *provider = l->data;
@@ -763,8 +797,6 @@ set_defaults (MailConfigDruid *druid)
}
if (provider->object_types[CAMEL_PROVIDER_STORE] && provider->flags & CAMEL_PROVIDER_IS_SOURCE) {
- GtkWidget *item;
-
item = gtk_menu_item_new_with_label (provider->name);
gtk_object_set_data (GTK_OBJECT (item), "provider", provider);
gtk_signal_connect (GTK_OBJECT (item), "activate",
@@ -775,13 +807,15 @@ set_defaults (MailConfigDruid *druid)
gtk_widget_show (item);
- if (!fstore)
+ if (!fstore) {
fstore = item;
+ hstore = si;
+ }
+
+ si++;
}
if (provider->object_types[CAMEL_PROVIDER_TRANSPORT]) {
- GtkWidget *item;
-
item = gtk_menu_item_new_with_label (provider->name);
gtk_object_set_data (GTK_OBJECT (item), "provider", provider);
gtk_signal_connect (GTK_OBJECT (item), "activate",
@@ -792,18 +826,41 @@ set_defaults (MailConfigDruid *druid)
gtk_widget_show (item);
- if (!ftransport)
+ if (!ftransport) {
ftransport = item;
+ htransport = ti;
+ }
+
+ ti++;
}
l = l->next;
}
+ /* add a "None" option to the stores menu */
+ item = gtk_menu_item_new_with_label (_("None"));
+ gtk_object_set_data (GTK_OBJECT (item), "provider", NULL);
+ gtk_signal_connect (GTK_OBJECT (item), "activate",
+ GTK_SIGNAL_FUNC (incoming_type_changed),
+ druid);
+
+ gtk_menu_append (GTK_MENU (stores), item);
+
+ gtk_widget_show (item);
+
+ if (!fstore) {
+ fstore = item;
+ hstore = si;
+ }
+
+ /* set the menus on the optionmenus */
gtk_option_menu_remove_menu (druid->incoming_type);
gtk_option_menu_set_menu (druid->incoming_type, stores);
+ gtk_option_menu_set_history (druid->incoming_type, hstore);
gtk_option_menu_remove_menu (druid->outgoing_type);
gtk_option_menu_set_menu (druid->outgoing_type, transports);
+ gtk_option_menu_set_history (druid->outgoing_type, htransport);
if (fstore)
gtk_signal_emit_by_name (GTK_OBJECT (fstore), "activate", druid);
@@ -1036,6 +1093,8 @@ mail_config_druid_get_source_url (MailConfigDruid *druid)
g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), NULL);
provider = druid->source_provider;
+ if (!provider)
+ return NULL;
url = g_new0 (CamelURL, 1);
url->protocol = g_strdup (provider->protocol);
@@ -1095,6 +1154,8 @@ mail_config_druid_get_transport_url (MailConfigDruid *druid)
g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), NULL);
provider = druid->transport_provider;
+ if (!provider)
+ return NULL;
url = g_new0 (CamelURL, 1);
url->protocol = g_strdup (provider->protocol);
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 04d59f7f17..47a2392767 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -246,12 +246,22 @@ config_read (void)
path = g_strdup_printf ("source_url_%d", i);
source->url = gnome_config_get_string (path);
g_free (path);
+
+ if (!*source->url) {
+ /* no source associated with this account */
+ g_free (source->url);
+ source->url = NULL;
+ }
+
path = g_strdup_printf ("source_keep_on_server_%d", i);
source->keep_on_server = gnome_config_get_bool (path);
g_free (path);
path = g_strdup_printf ("source_save_passwd_%d", i);
source->save_passwd = gnome_config_get_bool (path);
g_free (path);
+ path = g_strdup_printf ("source_use_ssl_%d", i);
+ source->use_ssl = gnome_config_get_bool (path);
+ g_free (path);
/* get the transport */
transport = g_new0 (MailConfigService, 1);
@@ -259,6 +269,16 @@ config_read (void)
transport->url = gnome_config_get_string (path);
g_free (path);
+ if (!*transport->url) {
+ /* no transport associated with this account */
+ g_free (transport->url);
+ transport->url = NULL;
+ }
+
+ path = g_strdup_printf ("transport_use_ssl_%d", i);
+ transport->use_ssl = gnome_config_get_bool (path);
+ g_free (path);
+
account->id = id;
account->source = source;
account->transport = transport;
@@ -357,7 +377,7 @@ mail_config_write (void)
/* source info */
path = g_strdup_printf ("source_url_%d", i);
- gnome_config_set_string (path, account->source->url);
+ gnome_config_set_string (path, account->source->url ? account->source->url : "");
g_free (path);
path = g_strdup_printf ("source_keep_on_server_%d", i);
gnome_config_set_bool (path, account->source->keep_on_server);
@@ -368,7 +388,7 @@ mail_config_write (void)
/* transport info */
path = g_strdup_printf ("transport_url_%d", i);
- gnome_config_set_string (path, account->transport->url);
+ gnome_config_set_string (path, account->transport->url ? account->transport->url : "");
g_free (path);
}
gnome_config_pop_prefix ();