return g_utf8_collate((const gchar*)a, (const gchar*)b);
}
-
-static void
-free_element (gpointer data, gpointer user_data)
-{
- g_free (data);
-}
-
gboolean
modest_account_mgr_set_first_account_as_default (ModestAccountMgr *self)
{
gboolean result = FALSE;
GSList *account_names = modest_account_mgr_account_names (self, TRUE /* only enabled */);
+
+ /* Return TRUE if there is no account */
+ if (!account_names)
+ return TRUE;
/* Get the first one, alphabetically, by title: */
GSList* list_sorted = g_slist_sort (account_names,
if (account_name)
result = modest_account_mgr_set_default_account (self, account_name);
}
-
- g_slist_foreach (account_names, free_element, NULL);
- g_slist_free (account_names);
-
+
+ modest_account_mgr_free_account_names (account_names);
+ account_names = NULL;
+
return result;
}