+
+void
+modest_header_view_refilter (ModestHeaderView *header_view)
+{
+ GtkTreeModel *model;
+
+ g_return_if_fail (MODEST_IS_HEADER_VIEW (header_view));
+
+ /* Hide cut headers */
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (header_view));
+ if (GTK_IS_TREE_MODEL_FILTER (model))
+ gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (model));
+}
+
+/*
+ * Called when an account is removed. If I'm showing a folder of the
+ * account that has been removed then clear the view
+ */
+static void
+on_account_removed (TnyAccountStore *self,
+ TnyAccount *account,
+ gpointer user_data)
+{
+ ModestHeaderViewPrivate *priv = NULL;
+
+ /* Ignore changes in transport accounts */
+ if (TNY_IS_TRANSPORT_ACCOUNT (account))
+ return;
+
+ g_print ("--------------------- HEADER ---------------\n");
+
+ priv = MODEST_HEADER_VIEW_GET_PRIVATE (user_data);
+
+ if (priv->folder) {
+ TnyAccount *my_account;
+
+ my_account = tny_folder_get_account (priv->folder);
+ if (my_account == account)
+ modest_header_view_clear (MODEST_HEADER_VIEW (user_data));
+ g_object_unref (account);
+ }
+}