+/*
+ * HACK: we use this function to implement the
+ * MODEST_FOLDER_VIEW_STYLE_SHOW_ONE style. This implementation
+ * assumes that the model has the following order (which is currently
+ * true) Remote folders->Local folders->MMC folders, so the rows of
+ * the first level (that represent the accounts) are received in the
+ * same order. So basically it uses a static variable to register that
+ * a remote account has already being shown to hide the others
+ * (returning NULL). When the function evaluates the local or the MMC
+ * accounts is time to reset the static variable in order to get it
+ * ready for the next time the tree model needs to be shown.
+ */
+static gboolean
+filter_row (GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ static gboolean found = FALSE;
+ gboolean retval;
+ gint type;
+ GObject *instance;
+
+ gtk_tree_model_get (model, iter,
+ TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, &type,
+ TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &instance,
+ -1);
+
+ if (type == TNY_FOLDER_TYPE_ROOT) {
+ const gchar *account_id = tny_account_get_id (TNY_ACCOUNT (instance));
+
+ if (strcmp (account_id, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) &&
+ strcmp (account_id, MODEST_MMC_ACCOUNT_ID)) {
+
+ if (!found) {
+ found = TRUE;
+ retval = TRUE;
+ } else
+ retval = FALSE;
+ } else {
+ found = FALSE;
+ retval = TRUE;
+ }
+ } else
+ retval = TRUE;
+
+ return retval;
+}
+