- /* If the removed account is the currently viewed one then
- clear the configuration value. The new visible account will be the default account */
- if (!strcmp (priv->visible_account_id, tny_account_get_id (account))) {
- modest_folder_view_set_account_id_of_visible_server_account (self, NULL);
- }
+ priv = MODEST_FOLDER_VIEW_GET_PRIVATE (user_data);
+
+ /* If we're adding a new account, and there is no previous
+ one, we need to select the visible server account */
+ if (priv->style == MODEST_FOLDER_VIEW_STYLE_SHOW_ONE &&
+ !priv->visible_account_id)
+ modest_widget_memory_restore (modest_runtime_get_conf(),
+ G_OBJECT (user_data),
+ MODEST_CONF_FOLDER_VIEW_KEY);
+
+ /* Get the inner model */
+ filter_model = gtk_tree_view_get_model (GTK_TREE_VIEW (user_data));
+ sort_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (filter_model));
+
+ /* Insert the account in the model */
+ tny_list_append (TNY_LIST (gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (sort_model))),
+ G_OBJECT (account));
+}
+
+
+static void
+on_account_changed (TnyAccountStore *account_store, TnyAccount *tny_account,
+ gpointer user_data)
+{
+ g_warning ("%s: account_id = %s", __FUNCTION__, tny_account_get_id(tny_account));