aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-09-21 08:58:28 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-09-21 08:58:28 +0800
commit24364797eff3d4416fa93fa860bfdd79349a0b23 (patch)
tree9ce9c3a99323c5d28ab5be1028025713e431f3be /mail
parenta68b5681353d9999b208cdbada9b40586eb09c18 (diff)
downloadgsoc2013-evolution-24364797eff3d4416fa93fa860bfdd79349a0b23.tar
gsoc2013-evolution-24364797eff3d4416fa93fa860bfdd79349a0b23.tar.gz
gsoc2013-evolution-24364797eff3d4416fa93fa860bfdd79349a0b23.tar.bz2
gsoc2013-evolution-24364797eff3d4416fa93fa860bfdd79349a0b23.tar.lz
gsoc2013-evolution-24364797eff3d4416fa93fa860bfdd79349a0b23.tar.xz
gsoc2013-evolution-24364797eff3d4416fa93fa860bfdd79349a0b23.tar.zst
gsoc2013-evolution-24364797eff3d4416fa93fa860bfdd79349a0b23.zip
Do not add the account here as this is taken care of in
2001-09-20 Jeffrey Stedfast <fejj@ximian.com> * mail-config-druid.c (wizard_finish_cb): Do not add the account here as this is taken care of in mail_account_gui_save() since it has to be able to set the default account. * mail-config.c (mail_config_set_default_account): Don't allow the index to become invalid. * mail-account-gui.c (mail_account_gui_save): Add the account before setting it as the default. svn path=/trunk/; revision=13037
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog12
-rw-r--r--mail/mail-account-gui.c7
-rw-r--r--mail/mail-accounts.c19
-rw-r--r--mail/mail-config-druid.c10
-rw-r--r--mail/mail-config.c38
5 files changed, 48 insertions, 38 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 04bc6ce808..9c4e32a437 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,15 @@
+2001-09-20 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-config-druid.c (wizard_finish_cb): Do not add the account
+ here as this is taken care of in mail_account_gui_save() since it
+ has to be able to set the default account.
+
+ * mail-config.c (mail_config_set_default_account): Don't allow the
+ index to become invalid.
+
+ * mail-account-gui.c (mail_account_gui_save): Add the account
+ before setting it as the default.
+
2001-09-20 <NotZed@Ximian.com>
* folder-browser.c (folder_browser_set_shell_view): Update the
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index d80934b632..9189283afb 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -1615,9 +1615,6 @@ mail_account_gui_save (MailAccountGui *gui)
g_free (account->name);
account->name = new_name;
- if (gtk_toggle_button_get_active (gui->default_account))
- mail_config_set_default_account (account);
-
/* construct the identity */
identity_destroy (account->id);
account->id = g_new0 (MailConfigIdentity, 1);
@@ -1660,6 +1657,10 @@ mail_account_gui_save (MailAccountGui *gui)
account->smime_encrypt_to_self = gtk_toggle_button_get_active (gui->smime_encrypt_to_self);
account->smime_always_sign = gtk_toggle_button_get_active (gui->smime_always_sign);
+ mail_config_add_account (account);
+ if (gtk_toggle_button_get_active (gui->default_account))
+ mail_config_set_default_account (account);
+
mail_autoreceive_setup_account (account->source);
return TRUE;
diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c
index 391d4f0aaa..5e3086182d 100644
--- a/mail/mail-accounts.c
+++ b/mail/mail-accounts.c
@@ -117,20 +117,19 @@ mail_accounts_dialog_finalise (GtkObject *obj)
static void
load_accounts (MailAccountsDialog *dialog)
{
- const MailConfigAccount *account;
+ const MailConfigAccount *account, *default_account;
const GSList *node = dialog->accounts;
int i = 0;
- int default_account;
-
+
gtk_clist_freeze (dialog->mail_accounts);
gtk_clist_clear (dialog->mail_accounts);
- default_account = mail_config_get_default_account_num ();
-
+ default_account = mail_config_get_default_account ();
+
while (node) {
CamelURL *url;
- gchar *text[3];
+ char *text[3];
account = node->data;
@@ -142,7 +141,7 @@ load_accounts (MailAccountsDialog *dialog)
text[0] = "";
text[1] = e_utf8_to_gtk_string (GTK_WIDGET (dialog->mail_accounts), account->name);
text[2] = g_strdup_printf ("%s%s", url && url->protocol ? url->protocol : _("None"),
- (i == default_account) ? _(" (default)") : "");
+ (account == default_account) ? _(" (default)") : "");
if (url)
camel_url_free (url);
@@ -155,7 +154,7 @@ load_accounts (MailAccountsDialog *dialog)
gtk_clist_set_pixmap (dialog->mail_accounts, i, 0,
dialog->mark_pixmap,
dialog->mark_bitmap);
-
+
/* set the account on the row */
gtk_clist_set_row_data (dialog->mail_accounts, i, (gpointer) account);
@@ -164,7 +163,7 @@ load_accounts (MailAccountsDialog *dialog)
}
gtk_clist_thaw (dialog->mail_accounts);
-
+
/*
* The selection gets cleared when we rebuild the clist, but no
* unselect event is emitted. So we simulate it here.
@@ -180,7 +179,7 @@ mail_select (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpoi
{
MailAccountsDialog *dialog = data;
MailConfigAccount *account = gtk_clist_get_row_data (clist, row);
-
+
dialog->accounts_row = row;
gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), TRUE);
diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c
index 13b5919224..34f62c54b2 100644
--- a/mail/mail-config-druid.c
+++ b/mail/mail-config-druid.c
@@ -816,19 +816,15 @@ wizard_finish_cb (EvolutionWizard *wizard,
MailConfigWizard *w)
{
MailAccountGui *gui = w->gui;
-
+
/* Save the settings for that account */
if (mail_account_gui_save (gui) == FALSE)
/* problem. Um, how to keep the druid alive? */
return;
-
- /* Add the account to our list (do it early because future
- steps might want to access config->accounts) */
- mail_config_add_account (gui->account);
-
+
if (gui->account->source)
gui->account->source->enabled = TRUE;
-
+
/* Write out the config info */
mail_config_write ();
mail_account_gui_destroy (gui);
diff --git a/mail/mail-config.c b/mail/mail-config.c
index a45a735775..709bde47c3 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -1373,16 +1373,16 @@ const MailConfigAccount *
mail_config_get_default_account (void)
{
MailConfigAccount *account;
-
+
if (config == NULL) {
mail_config_init ();
}
-
+
if (!config->accounts)
return NULL;
account = g_slist_nth_data (config->accounts,
- config->default_account);
+ config->default_account);
/* Looks like we have no default, so make the first account
the default */
@@ -1624,7 +1624,7 @@ void
mail_config_add_account (MailConfigAccount *account)
{
config->accounts = g_slist_append (config->accounts, account);
-
+
if (account->source && account->source->url)
new_source_created (account);
}
@@ -1720,12 +1720,14 @@ mail_config_set_default_account_num (gint new_default)
void
mail_config_set_default_account (const MailConfigAccount *account)
{
- int position;
-
- position = g_slist_index (config->accounts, (void*)account);
-
- config->default_account = position;
-
+ int index;
+
+ index = g_slist_index (config->accounts, (void *) account);
+ if (index == -1)
+ return;
+
+ config->default_account = index;
+
return;
}
@@ -1958,15 +1960,15 @@ impl_GNOME_Evolution_MailConfig_addAccount (PortableServer_Servant servant,
MailConfigAccount *mail_account;
MailConfigService *mail_service;
MailConfigIdentity *mail_id;
-
+
if (mail_config_get_account_by_name (account->name)) {
/* FIXME: we need an exception. */
return;
}
-
+
mail_account = g_new0 (MailConfigAccount, 1);
mail_account->name = g_strdup (account->name);
-
+
/* Copy ID */
id = account->id;
mail_id = g_new0 (MailConfigIdentity, 1);
@@ -1976,9 +1978,9 @@ impl_GNOME_Evolution_MailConfig_addAccount (PortableServer_Servant servant,
mail_id->signature = g_strdup (id.signature);
mail_id->html_signature = g_strdup (id.html_signature);
mail_id->has_html_signature = id.has_html_signature;
-
+
mail_account->id = mail_id;
-
+
/* Copy source */
source = account->source;
mail_service = g_new0 (MailConfigService, 1);
@@ -1994,7 +1996,7 @@ impl_GNOME_Evolution_MailConfig_addAccount (PortableServer_Servant servant,
mail_service->enabled = source.enabled;
mail_account->source = mail_service;
-
+
/* Copy transport */
transport = account->transport;
mail_service = g_new0 (MailConfigService, 1);
@@ -2004,9 +2006,9 @@ impl_GNOME_Evolution_MailConfig_addAccount (PortableServer_Servant servant,
mail_service->auto_check_time = transport.auto_check_time;
mail_service->save_passwd = transport.save_passwd;
mail_service->enabled = transport.enabled;
-
+
mail_account->transport = mail_service;
-
+
/* Add new account */
mail_config_add_account (mail_account);
}