+
+ GSList *result = NULL;
+
+ /* Filter-out the disabled accounts if requested: */
+ if (only_enabled) {
+ GSList *iter = accounts;
+ while (iter) {
+ if (!(iter->data))
+ continue;
+
+ const gchar* account_name = (const gchar*)iter->data;
+ if (account_name && modest_account_mgr_get_enabled (self, account_name))
+ result = g_slist_append (result, g_strdup (account_name));
+
+ iter = g_slist_next (iter);
+ }
+
+ /* TODO: Free the strings too? */
+ g_slist_free (accounts);
+ accounts = NULL;
+ }
+ else
+ result = accounts;
+
+
+ return result;