Properly adding a new account in the folders list

This commit is contained in:
Pierre Pronchery 2006-11-05 22:22:08 +00:00
parent f6685deaf9
commit e93e24eb23
3 changed files with 8 additions and 8 deletions

View File

@ -263,6 +263,7 @@ void on_new_mail(GtkWidget * widget, gpointer data)
void on_preferences_ok(GtkWidget * widget, gpointer data)
{
Mailer * mailer = data;
Account * account;
GtkTreeModel * model;
GtkTreeIter iter;
GtkTreeModel * view_model;
@ -277,7 +278,8 @@ void on_preferences_ok(GtkWidget * widget, gpointer data)
{
/* FIXME check if already present, update if needed */
/* else add account with full information */
mailer_account_add(mailer);
gtk_tree_model_get(model, &iter, AC_DATA, &account, -1);
mailer_account_add(mailer, account);
}
while(gtk_tree_model_iter_next(model, &iter) == TRUE);
/* FIXME remove remaining accounts */
@ -636,6 +638,7 @@ static void _on_assistant_apply(GtkWidget * widget, gpointer data)
AC_TITLE, ad->account->title,
AC_TYPE, ad->account->plugin->type, -1);
ad->account = NULL;
/* _on_assistant_close is then automatically called */
}
static GtkWidget * _account_config_update(AccountConfig * config);

View File

@ -348,7 +348,7 @@ int mailer_error(Mailer * mailer, char const * message, int ret)
}
int mailer_account_add(Mailer * mailer)
int mailer_account_add(Mailer * mailer, Account * account)
/* FIXME */
{
Account ** p;
@ -366,15 +366,13 @@ int mailer_account_add(Mailer * mailer)
== NULL)
return mailer_error(mailer, "realloc", FALSE);
mailer->account = p;
if((mailer->account[mailer->account_cnt] = account_new("account",
"mbox")) == NULL)
return FALSE;
mailer->account[mailer->account_cnt] = account;
model = gtk_tree_view_get_model(GTK_TREE_VIEW(mailer->view_folders));
gtk_tree_store_append(GTK_TREE_STORE(model), &iter, NULL);
pixbuf = gtk_icon_theme_load_icon(mailer->theme,
"stock_mail-accounts", 16, 0, NULL);
gtk_tree_store_set(GTK_TREE_STORE(model), &iter, 0, pixbuf, 1,
"Local folders", -1);
account->title, -1);
for(f = account_folders(mailer->account[mailer->account_cnt]);
*f != NULL; f++)
{

View File

@ -47,7 +47,6 @@ void mailer_delete(Mailer * mailer);
/* useful */
int mailer_error(Mailer * mailer, char const * message, int ret);
/* FIXME */
int mailer_account_add(Mailer * mailer);
int mailer_account_add(Mailer * mailer, Account * account);
#endif