-static TnyFolder *
-modest_mail_operation_find_trash_folder (ModestMailOperation *mail_op,
- TnyStoreAccount *store_account)
-{
- TnyList *folders;
- TnyIterator *iter;
- gboolean found;
- /*TnyFolderStoreQuery *query;*/
- TnyFolder *trash_folder;
-
- /* Look for Trash folder */
- folders = TNY_LIST (tny_simple_list_new ());
- tny_folder_store_get_folders (TNY_FOLDER_STORE (store_account),
- folders, NULL, NULL); /* FIXME */
- iter = tny_list_create_iterator (folders);
-
- found = FALSE;
- while (!tny_iterator_is_done (iter) && !found) {
-
- trash_folder = TNY_FOLDER (tny_iterator_get_current (iter));
- if (tny_folder_get_folder_type (trash_folder) == TNY_FOLDER_TYPE_TRASH)
- found = TRUE;
- else
- tny_iterator_next (iter);
- }
-
- /* Clean up */
- g_object_unref (G_OBJECT (folders));
- g_object_unref (G_OBJECT (iter));
-
- /* TODO: better error handling management */
- if (!found)
- return NULL;
- else
- return trash_folder;
-}