* Some more changes related to the migration to the new tinymail "architecture"
[modest] / src / modest-tny-local-folders-account.c
index 2efb499..5fb942d 100644 (file)
@@ -132,7 +132,7 @@ modest_tny_local_folders_account_new (void)
 
 void
 modest_tny_local_folders_account_add_extra_folder (ModestTnyLocalFoldersAccount *store, 
-       TnyFolder *folder)
+                                                  TnyFolder *folder)
 {
        ModestTnyLocalFoldersAccountPrivate *priv = 
                TNY_LOCAL_FOLDERS_ACCOUNT_GET_PRIVATE (store);
@@ -260,41 +260,43 @@ add_account_folders_to_merged_folder (TnyAccount *account, TnyMergeFolder* merge
        g_object_unref (list_outbox_folders);
 }
 
-void modest_tny_local_folders_account_add_merged_outbox_folders (ModestTnyLocalFoldersAccount *self, 
-       GSList *accounts)
+void 
+modest_tny_local_folders_account_add_merged_outbox_folders (ModestTnyLocalFoldersAccount *self, 
+                                                           TnyList *accounts)
 {
+       TnyMergeFolder *merged_outbox = NULL;
+       TnyIterator *iter = NULL;
+
        modest_tny_local_folders_account_remove_all_extra_folders (self);
        
        /* All per-account outbox folders are merged into one folders
         * so that they appear as one outbox to the user: */
-       TnyMergeFolder *merged_outbox = TNY_MERGE_FOLDER (tny_merge_folder_new(_("mcen_me_folder_outbox")));
+       merged_outbox = TNY_MERGE_FOLDER (tny_merge_folder_new(_("mcen_me_folder_outbox")));
        
-       /* Set type to outbox (NB#61580) */
+       /* Set type to outbox */
        tny_merge_folder_set_folder_type (merged_outbox, TNY_FOLDER_TYPE_OUTBOX);
        
-       GSList *iter = accounts;
-       while (iter)
-       {
-               TnyAccount *account = TNY_ACCOUNT (iter->data);
-               if (account) {
-                       /* Add both outbox account and local-folders account folders
-                        * to our one combined account:
-                        */
-                       if (MODEST_IS_TNY_OUTBOX_ACCOUNT (account)) {
-                               /* Add the folder to the merged folder.
-                                * We will add it later to the virtual local-folders store: */
-                               add_account_folders_to_merged_folder (account, merged_outbox);
-                       }
+       iter = tny_list_create_iterator (accounts);
+       while (!tny_iterator_is_done (iter)){
+
+               TnyAccount *account = TNY_ACCOUNT (tny_iterator_get_current (iter));
+
+               /* Add both outbox account and local-folders account folders
+                * to our one combined account:
+                */
+               if (MODEST_IS_TNY_OUTBOX_ACCOUNT (account)) {
+                       /* Add the folder to the merged folder.
+                        * We will add it later to the virtual local-folders store: */
+                       add_account_folders_to_merged_folder (account, merged_outbox);
                }
-          
-               iter = g_slist_next (iter);
+               g_object_unref (account);
+               tny_iterator_next (iter);
        }
+       g_object_unref (iter);
        
        /* Add the merged outbox folder to the virtual local-folders store: */
-       /* printf ("Debug: %s: adding merged outbox.\n", __FUNCTION__); */
        modest_tny_local_folders_account_add_extra_folder (self, TNY_FOLDER(merged_outbox));
        g_object_unref (merged_outbox);
-       merged_outbox = NULL;
 }
 
 gboolean