diff --git a/src/callbacks.c b/src/callbacks.c index 22f642d..06f624c 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -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); diff --git a/src/mailer.c b/src/mailer.c index 074c74d..66a6a05 100644 --- a/src/mailer.c +++ b/src/mailer.c @@ -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++) { diff --git a/src/mailer.h b/src/mailer.h index 46e229f..4751db7 100644 --- a/src/mailer.h +++ b/src/mailer.h @@ -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