+
+ /* Remove the old model as observer of the local folder account */
+ local_account =
+ modest_tny_account_store_get_tny_account_by_account (modest_runtime_get_account_store (),
+ MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID,
+ TNY_ACCOUNT_TYPE_STORE);
+ old_model = gtk_tree_view_get_model (GTK_TREE_VIEW (self));
+ if (old_model) {
+ GtkTreeModel *sorted, *model;
+
+ if (GTK_IS_TREE_MODEL_FILTER (old_model))
+ sorted = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (old_model));
+ else
+ sorted = old_model;
+
+ model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (sorted));
+
+ tny_folder_store_remove_observer (TNY_FOLDER_STORE (local_account),
+ TNY_FOLDER_STORE_OBSERVER (model));
+ }
+