Properly adding a new account in the folders list
This commit is contained in:
parent
f6685deaf9
commit
e93e24eb23
@ -263,6 +263,7 @@ void on_new_mail(GtkWidget * widget, gpointer data)
|
|||||||
void on_preferences_ok(GtkWidget * widget, gpointer data)
|
void on_preferences_ok(GtkWidget * widget, gpointer data)
|
||||||
{
|
{
|
||||||
Mailer * mailer = data;
|
Mailer * mailer = data;
|
||||||
|
Account * account;
|
||||||
GtkTreeModel * model;
|
GtkTreeModel * model;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GtkTreeModel * view_model;
|
GtkTreeModel * view_model;
|
||||||
@ -277,7 +278,8 @@ void on_preferences_ok(GtkWidget * widget, gpointer data)
|
|||||||
{
|
{
|
||||||
/* FIXME check if already present, update if needed */
|
/* FIXME check if already present, update if needed */
|
||||||
/* else add account with full information */
|
/* 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);
|
while(gtk_tree_model_iter_next(model, &iter) == TRUE);
|
||||||
/* FIXME remove remaining accounts */
|
/* FIXME remove remaining accounts */
|
||||||
@ -636,6 +638,7 @@ static void _on_assistant_apply(GtkWidget * widget, gpointer data)
|
|||||||
AC_TITLE, ad->account->title,
|
AC_TITLE, ad->account->title,
|
||||||
AC_TYPE, ad->account->plugin->type, -1);
|
AC_TYPE, ad->account->plugin->type, -1);
|
||||||
ad->account = NULL;
|
ad->account = NULL;
|
||||||
|
/* _on_assistant_close is then automatically called */
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget * _account_config_update(AccountConfig * config);
|
static GtkWidget * _account_config_update(AccountConfig * config);
|
||||||
|
@ -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 */
|
/* FIXME */
|
||||||
{
|
{
|
||||||
Account ** p;
|
Account ** p;
|
||||||
@ -366,15 +366,13 @@ int mailer_account_add(Mailer * mailer)
|
|||||||
== NULL)
|
== NULL)
|
||||||
return mailer_error(mailer, "realloc", FALSE);
|
return mailer_error(mailer, "realloc", FALSE);
|
||||||
mailer->account = p;
|
mailer->account = p;
|
||||||
if((mailer->account[mailer->account_cnt] = account_new("account",
|
mailer->account[mailer->account_cnt] = account;
|
||||||
"mbox")) == NULL)
|
|
||||||
return FALSE;
|
|
||||||
model = gtk_tree_view_get_model(GTK_TREE_VIEW(mailer->view_folders));
|
model = gtk_tree_view_get_model(GTK_TREE_VIEW(mailer->view_folders));
|
||||||
gtk_tree_store_append(GTK_TREE_STORE(model), &iter, NULL);
|
gtk_tree_store_append(GTK_TREE_STORE(model), &iter, NULL);
|
||||||
pixbuf = gtk_icon_theme_load_icon(mailer->theme,
|
pixbuf = gtk_icon_theme_load_icon(mailer->theme,
|
||||||
"stock_mail-accounts", 16, 0, NULL);
|
"stock_mail-accounts", 16, 0, NULL);
|
||||||
gtk_tree_store_set(GTK_TREE_STORE(model), &iter, 0, pixbuf, 1,
|
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]);
|
for(f = account_folders(mailer->account[mailer->account_cnt]);
|
||||||
*f != NULL; f++)
|
*f != NULL; f++)
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,6 @@ void mailer_delete(Mailer * mailer);
|
|||||||
/* useful */
|
/* useful */
|
||||||
int mailer_error(Mailer * mailer, char const * message, int ret);
|
int mailer_error(Mailer * mailer, char const * message, int ret);
|
||||||
|
|
||||||
/* FIXME */
|
int mailer_account_add(Mailer * mailer, Account * account);
|
||||||
int mailer_account_add(Mailer * mailer);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user