diff options
Diffstat (limited to 'mail/mail-accounts.c')
-rw-r--r-- | mail/mail-accounts.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c index 9d0fd7090c..f48e33120d 100644 --- a/mail/mail-accounts.c +++ b/mail/mail-accounts.c @@ -209,19 +209,20 @@ mail_delete (GtkButton *button, gpointer data) MailConfigAccount *account; if (dialog->accounts_row >= 0) { - int row, len; + int sel, row, len; - account = gtk_clist_get_row_data (dialog->mail_accounts, dialog->accounts_row); + sel = dialog->accounts_row; + + account = gtk_clist_get_row_data (dialog->mail_accounts, sel); g_slist_remove ((GSList *) dialog->accounts, account); account_destroy (account); mail_config_write (); - gtk_clist_remove (dialog->mail_accounts, dialog->accounts_row); + gtk_clist_remove (dialog->mail_accounts, sel); len = g_slist_length ((GSList *) dialog->accounts); if (len > 0) { - row = dialog->accounts_row; - row = row >= len ? len - 1 : row; + row = sel >= len ? len - 1 : sel; gtk_clist_select_row (dialog->mail_accounts, row, 0); } else { dialog->accounts_row = -1; @@ -239,10 +240,14 @@ mail_default (GtkButton *button, gpointer data) const MailConfigAccount *account; if (dialog->accounts_row >= 0) { - account = gtk_clist_get_row_data (dialog->mail_accounts, dialog->accounts_row); + int row; + + row = dialog->accounts_row; + account = gtk_clist_get_row_data (dialog->mail_accounts, row); mail_config_set_default_account (account); mail_config_write (); load_accounts (dialog); + gtk_clist_select_row (dialog->mail_accounts, row, 0); } } |