2007-06-05 Murray Cumming <murrayc@murrayc.com>modest/trunk] > more ChangeLog2
authorMurray Cumming <murrayc@murrayc.com>
Tue, 5 Jun 2007 07:42:54 +0000 (07:42 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Tue, 5 Jun 2007 07:42:54 +0000 (07:42 +0000)
* src/Makefile.am:
        * src/modest-tny-simple-folder-store.c:
        * src/modest-tny-simple-folder-store.h: Removed.

        * src/modest-tny-local-folders-account.h
        * src/modest-tny-local-folders-account.c: Added a derived TnyAccount
        for the local-folders maildir, with an extra TnyMergedFolder containing
        the folders of the per-account outbox store accounts.
        * src/modest-tny-account-store.c: (get_server_accounts):
        Add the outboxes to the special local folders account after creating it.

        * src/modest-tny-account.c:
        (modest_tny_account_new_for_local_folders): Create the derived
        account when creating the main local-folders account.

        * src/maemo/modest-main-window.c: (create_details_widget),
        (modest_main_window_set_contents_style):
        Adapted to the use of the derived account instead of the folder store.

        * src/modest-ui-actions.c:
        (modest_ui_actions_on_folder_selection_changed):
        * src/modest-ui-dimming-rules.c:
        (modest_ui_dimming_rules_on_new_folder):
        * src/widgets/modest-folder-view.c: (text_cell_data),
        (icon_cell_data), (filter_row), (update_model),
        (get_cmp_rows_type_pos):

        * src/modest-tny-send-queue.c: (modest_tny_send_queue_new):
        Do not get the priv struct, because no priv struct has been set,
        to avoid a runtime warning.

pmo-trunk-r2066

17 files changed:
ChangeLog2
src/Makefile.am
src/maemo/easysetup/modest-easysetup-wizard.c
src/maemo/modest-main-window.c
src/maemo/modest-platform.c
src/modest-account-mgr.c
src/modest-tny-account-store.c
src/modest-tny-account-store.h
src/modest-tny-account.c
src/modest-tny-local-folders-account.c [new file with mode: 0644]
src/modest-tny-local-folders-account.h [new file with mode: 0644]
src/modest-tny-send-queue.c
src/modest-tny-simple-folder-store.c
src/modest-tny-simple-folder-store.h
src/modest-ui-actions.c
src/modest-ui-dimming-rules.c
src/widgets/modest-folder-view.c

index e25d43f..3d425c3 100644 (file)
@@ -1,3 +1,41 @@
+2007-06-05  Murray Cumming  <murrayc@murrayc.com>
+
+       * src/Makefile.am:
+       * src/modest-tny-simple-folder-store.c:
+       * src/modest-tny-simple-folder-store.h: Removed.
+       
+       * src/modest-tny-local-folders-account.h
+       * src/modest-tny-local-folders-account.c: Added a derived TnyAccount 
+       for the local-folders maildir, with an extra TnyMergedFolder containing 
+       the folders of the per-account outbox store accounts.
+       * src/modest-tny-account-store.c: (get_server_accounts):
+       Add the outboxes to the special local folders account after creating it.
+               
+       * src/modest-tny-account.c:
+       (modest_tny_account_new_for_local_folders): Create the derived 
+       account when creating the main local-folders account.
+       
+       * src/maemo/modest-main-window.c: (create_details_widget),
+       (modest_main_window_set_contents_style):
+       Adapted to the use of the derived account instead of the folder store.
+       
+       * src/modest-ui-actions.c:
+       (modest_ui_actions_on_folder_selection_changed):
+       * src/modest-ui-dimming-rules.c:
+       (modest_ui_dimming_rules_on_new_folder):
+       * src/widgets/modest-folder-view.c: (text_cell_data),
+       (icon_cell_data), (filter_row), (update_model),
+       (get_cmp_rows_type_pos):
+       
+
+       * src/modest-tny-send-queue.c: (modest_tny_send_queue_new): 
+       Do not get the priv struct, because no priv struct has been set, 
+       to avoid a runtime warning.
+       
+       * src/maemo/modest-platform.c: (modest_platform_show_help): Replace 
+       #ifelse with #else, to fix a warning, to fix the build.
+       
+       
 2007-06-05  Christian Kellner  <ckellner@openismus.com> 
 
        * libmodest-dbus-client/libmodest-dbus-client.c:
index 1b0c3ff..97821b1 100644 (file)
@@ -81,6 +81,8 @@ modest_SOURCES=\
        modest-tny-account-store.h\
        modest-tny-account.c\
        modest-tny-account.h\
+       modest-tny-local-folders-account.c\
+       modest-tny-local-folders-account.h\
        modest-tny-outbox-account.c\
        modest-tny-outbox-account.h\
        modest-tny-folder.c \
@@ -90,8 +92,6 @@ modest_SOURCES=\
        modest-platform.h\
        modest-tny-platform-factory.c \
        modest-tny-platform-factory.h \
-       modest-tny-simple-folder-store.c \
-       modest-tny-simple-folder-store.h \
        modest-tny-send-queue.c\
        modest-tny-send-queue.h\
        modest-ui-actions.c\
index d747152..f4ae2ca 100644 (file)
@@ -26,7 +26,7 @@
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-
 
 #include "modest-easysetup-wizard.h"
 #include <glib/gi18n.h>
index fb77733..a717865 100644 (file)
@@ -1248,7 +1248,7 @@ set_alignment (GtkWidget *widget,
 }
 
 static GtkWidget *
-create_details_widget (TnyFolderStore *folder_store)
+create_details_widget (TnyAccount *account)
 {
        GtkWidget *vbox;
        gchar *label;
@@ -1257,7 +1257,7 @@ create_details_widget (TnyFolderStore *folder_store)
 
        /* Account description: */
        
-       if (modest_tny_folder_store_is_virtual_local_folders (folder_store)) {
+       if (modest_tny_account_is_virtual_local_folders (account)) {
                /* Local folders: */
        
                /* Get device name */
@@ -1270,9 +1270,7 @@ create_details_widget (TnyFolderStore *folder_store)
                gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new (label), FALSE, FALSE, 0);
                g_free (device_name);
                g_free (label);
-       } else if (TNY_IS_ACCOUNT (folder_store)) {
-               TnyAccount *account = TNY_ACCOUNT(folder_store);
-               
+       } else {
                if(!strcmp (tny_account_get_id (account), MODEST_MMC_ACCOUNT_ID)) {
                        gtk_box_pack_start (GTK_BOX (vbox), 
                                gtk_label_new (tny_account_get_name (account)), 
@@ -1297,7 +1295,7 @@ create_details_widget (TnyFolderStore *folder_store)
        }
 
        /* Message count */
-       
+       TnyFolderStore *folder_store = TNY_FOLDER_STORE (account);
        label = g_strdup_printf ("%s: %d", _("mcen_fi_rootfolder_messages"), 
                                 modest_tny_folder_store_get_message_count (folder_store));
        gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new (label), FALSE, FALSE, 0);
@@ -1310,7 +1308,7 @@ create_details_widget (TnyFolderStore *folder_store)
        g_free (label);
 
        /* Size / Date */
-       if (modest_tny_folder_store_is_virtual_local_folders (folder_store)) {
+       if (modest_tny_account_is_virtual_local_folders (account)) {
                /* FIXME: format size */
                label = g_strdup_printf ("%s: %d", _("mcen_fi_rootfolder_size"), 
                                         modest_tny_folder_store_get_local_size (folder_store));
@@ -1386,11 +1384,13 @@ modest_main_window_set_contents_style (ModestMainWindow *self,
                /* TODO: show here account details */
                TnyFolderStore *selected_folderstore = 
                        modest_folder_view_get_selected (priv->folder_view);
-                       
-               priv->details_widget = create_details_widget (selected_folderstore);
+               if (TNY_IS_ACCOUNT (selected_folderstore)) {    
+                       priv->details_widget = create_details_widget (
+                               TNY_ACCOUNT (selected_folderstore));
 
-               wrap_in_scrolled_window (priv->contents_widget, 
-                                priv->details_widget);
+                       wrap_in_scrolled_window (priv->contents_widget, 
+                                        priv->details_widget);
+               }
                break;
        }
        default:
index a00f2f0..4a6a6a3 100644 (file)
@@ -805,7 +805,7 @@ modest_platform_show_help (GtkWindow *parent_window,
        /* Show help */
 #ifdef MODEST_HILDON_VERSION_0
        result = ossohelp_show (osso_context, help_id, OSSO_HELP_SHOW_DIALOG);
-#elsif
+#else
        result = hildon_help_show (osso_context, help_id, OSSO_HELP_SHOW_DIALOG);
 #endif
 
index a129e51..7fef539 100644 (file)
@@ -488,7 +488,7 @@ modest_account_mgr_remove_account (ModestAccountMgr * self,
        g_return_val_if_fail (name, FALSE);
 
        if (!modest_account_mgr_account_exists (self, name, server_account)) {
-               g_printerr ("modest: account '%s' does not exist\n", name);
+               g_printerr ("modest: %s: account '%s' does not exist\n", __FUNCTION__, name);
                return FALSE;
        }
 
index 0952eb4..81f573c 100644 (file)
@@ -46,6 +46,7 @@
 #include <modest-protocol-info.h>
 #include <modest-local-folder-info.h>
 #include <modest-tny-account.h>
+#include <modest-tny-local-folders-account.h>
 #include <modest-account-mgr.h>
 #include <modest-account-mgr-helpers.h>
 #include <widgets/modest-window-mgr.h>
@@ -667,16 +668,7 @@ get_server_accounts  (TnyAccountStore *self, TnyList *list, TnyAccountType type)
                        }
        }
        
-       if (type == TNY_ACCOUNT_TYPE_STORE) {
-               /* Also add the local folder pseudo-account: */
-               TnyAccount *tny_account =
-                       modest_tny_account_new_for_local_folders (priv->account_mgr, 
-                               priv->session, NULL);
-               if (list)
-                       tny_list_prepend (list, G_OBJECT(tny_account));
-               accounts = g_slist_append (accounts, tny_account); /* cache it */
-               
-               
+       if (type == TNY_ACCOUNT_TYPE_STORE) {           
                /* Also add the Memory card account if it is mounted: */
                gboolean mmc_is_mounted = FALSE;
                GnomeVFSVolumeMonitor* monitor = 
@@ -795,6 +787,21 @@ get_server_accounts  (TnyAccountStore *self, TnyList *list, TnyAccountType type)
                                accounts = g_slist_append (accounts, outbox_account);
                        }
                        
+                       
+                       /* Also add the local folder pseudo-account: */
+                       TnyAccount *tny_account =
+                               modest_tny_account_new_for_local_folders (priv->account_mgr, 
+                                       priv->session, NULL);
+                       /* Add a merged folder, merging all the per-account outbox folders: */
+                       modest_tny_local_folders_account_add_merged_outbox_folders (
+                               MODEST_TNY_LOCAL_FOLDERS_ACCOUNT (tny_account), priv->store_accounts_outboxes);
+       
+                       if (list)
+                               tny_list_prepend (list, G_OBJECT(tny_account));
+                       accounts = g_slist_append (accounts, tny_account); /* cache it */
+                       
+                       
+                       /* We have finished with this temporary list, so free it: */
                        account_list_free (priv->store_accounts_outboxes);
                        priv->store_accounts_outboxes = NULL;
                }
@@ -1241,9 +1248,9 @@ modest_tny_account_store_get_transport_account_for_open_connection (ModestTnyAcc
        return account;
 }
 
-gboolean modest_tny_folder_store_is_virtual_local_folders (TnyFolderStore *self)
+gboolean modest_tny_account_is_virtual_local_folders (TnyAccount *self)
 {
-       /* We should make this more sophisticated if we ever use ModestTnySimpleFolderStore 
+       /* We should make this more sophisticated if we ever use ModestTnyLocalFoldersAccount 
         * for anything else. */
-       return MODEST_IS_TNY_SIMPLE_FOLDER_STORE (self);
+       return MODEST_IS_TNY_LOCAL_FOLDERS_ACCOUNT (self);
 }
index 0386769..17018a3 100644 (file)
@@ -39,8 +39,8 @@
 #include <tny-session-camel.h>
 #include <tny-shared.h>
 #include <tny-folder.h>
-#include <modest-tny-simple-folder-store.h>
 #include <modest-account-mgr.h>
+#include <modest-tny-local-folders-account.h>
 
 /* other include files */
 
@@ -123,7 +123,7 @@ TnyAccount* modest_tny_account_store_get_tny_account_by_id  (ModestTnyAccountSto
 TnyAccount* modest_tny_account_store_get_tny_account_by_account (ModestTnyAccountStore *self,
                                                                 const gchar *account_name,
                                                                 TnyAccountType type);
-               
+                                                    
 /**
  * modest_tny_account_store_get_transport_account_for_open_connection
  * @self: a ModestTnyAccountStore instance
@@ -151,14 +151,14 @@ TnyAccount* modest_tny_account_store_get_transport_account_for_open_connection (
 TnySessionCamel*    modest_tny_account_store_get_session    (TnyAccountStore *self);
 
 
-/** modest_tny_folder_store_is_virtual_local_folders:
- * @self A TnyFolderStore.
+/** modest_tny_account_is_virtual_local_folders:
+ * @self A TnyAccount.
  * 
- * A convenience function to identify whether TnyAccount or other TnyFolderStore 
- * is the virtual local folders store, containing the folders from local_folders/
+ * A convenience function to identify whether TnyAccount 
+ * is the virtual local folders account, containing the folders from local_folders/
  * and the outboxes from outboxes/<account-name>/.
  **/
-gboolean modest_tny_folder_store_is_virtual_local_folders (TnyFolderStore *self);
+gboolean modest_tny_account_is_virtual_local_folders (TnyAccount *self);
 
 G_END_DECLS
 
index 67c0988..10e526d 100644 (file)
@@ -30,6 +30,7 @@
 #include <modest-tny-platform-factory.h>
 #include <modest-tny-account.h>
 #include <modest-tny-account-store.h>
+#include <modest-tny-local-folders-account.h>
 #include <modest-runtime.h>
 #include <tny-simple-list.h>
 #include <modest-tny-folder.h>
@@ -443,9 +444,19 @@ modest_tny_account_new_for_local_folders (ModestAccountMgr *account_mgr, TnySess
 
        g_return_val_if_fail (account_mgr, NULL);
        
-       tny_account = tny_camel_store_account_new ();
+       if (!location_filepath) {
+               /* A NULL filepath means that this is the special local-folders maildir 
+                * account: */
+               tny_account = TNY_STORE_ACCOUNT (modest_tny_local_folders_account_new ());
+       }
+       else {
+               /* Else, for instance, a per-account outbox maildir account: */
+               tny_account = TNY_STORE_ACCOUNT (tny_camel_store_account_new ());
+       }
+               
        if (!tny_account) {
-               g_printerr ("modest: cannot create account for local folders");
+               g_printerr ("modest: %s: cannot create account for local folders. filepath=%s", 
+                       __FUNCTION__, location_filepath);
                return NULL;
        }
        tny_camel_account_set_session (TNY_CAMEL_ACCOUNT(tny_account), session);
diff --git a/src/modest-tny-local-folders-account.c b/src/modest-tny-local-folders-account.c
new file mode 100644 (file)
index 0000000..eecb30c
--- /dev/null
@@ -0,0 +1,253 @@
+/* Copyright (c) 2007, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include <config.h>
+#include <glib/gi18n.h>
+
+#include <modest-tny-local-folders-account.h>
+#include <modest-tny-outbox-account.h>
+#include <modest-tny-folder.h>
+#include <tny-merge-folder.h>
+#include <tny-simple-list.h>
+
+#include <string.h>
+#include <stdio.h>
+
+G_DEFINE_TYPE (ModestTnyLocalFoldersAccount, 
+       modest_tny_local_folders_account, 
+       TNY_TYPE_CAMEL_STORE_ACCOUNT);
+
+#define TNY_LOCAL_FOLDERS_ACCOUNT_GET_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEST_TYPE_TNY_LOCAL_FOLDERS_ACCOUNT, ModestTnyLocalFoldersAccountPrivate))
+
+typedef struct _ModestTnyLocalFoldersAccountPrivate ModestTnyLocalFoldersAccountPrivate;
+
+struct _ModestTnyLocalFoldersAccountPrivate
+{
+       GSList *list_extra_folders;
+};
+
+static void
+modest_tny_local_folders_account_dispose (GObject *object)
+{
+  if (G_OBJECT_CLASS (modest_tny_local_folders_account_parent_class)->dispose)
+    G_OBJECT_CLASS (modest_tny_local_folders_account_parent_class)->dispose (object);
+}
+
+
+static void
+modest_tny_local_folders_account_remove_all_extra_folders (ModestTnyLocalFoldersAccount *store)
+{
+       ModestTnyLocalFoldersAccountPrivate *priv = 
+               TNY_LOCAL_FOLDERS_ACCOUNT_GET_PRIVATE (store);
+               
+       GSList *iter = priv->list_extra_folders;
+       while (iter)
+       {
+               TnyFolder *folder = (TnyFolder*)iter->data;
+               if (folder) {
+                       g_object_unref (folder);
+                       iter->data = NULL;
+               }
+                       
+               iter = g_slist_next (iter);
+       }
+       
+       g_slist_free (priv->list_extra_folders);
+       priv->list_extra_folders = NULL;
+}
+
+static void
+modest_tny_local_folders_account_finalize (GObject *object)
+{
+       G_OBJECT_CLASS (modest_tny_local_folders_account_parent_class)->finalize (object);
+  
+       ModestTnyLocalFoldersAccount *self = 
+               MODEST_TNY_LOCAL_FOLDERS_ACCOUNT (object);
+               
+       modest_tny_local_folders_account_remove_all_extra_folders (self);
+}
+
+static void
+get_folders (TnyFolderStore *self, TnyList *list, TnyFolderStoreQuery *query, GError **err);
+
+static void 
+get_folders_async (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, TnyStatusCallback status_callback, gpointer user_data);
+
+static void
+modest_tny_local_folders_account_class_init (ModestTnyLocalFoldersAccountClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       
+       g_type_class_add_private (klass, sizeof (ModestTnyLocalFoldersAccountPrivate));
+       
+       object_class->dispose = modest_tny_local_folders_account_dispose;
+       object_class->finalize = modest_tny_local_folders_account_finalize;
+         
+       /* Override virtual functions from the parent class: */
+       TNY_CAMEL_STORE_ACCOUNT_CLASS(klass)->get_folders_func = get_folders;
+       TNY_CAMEL_STORE_ACCOUNT_CLASS(klass)->get_folders_async_func = get_folders_async;
+}
+
+static void
+modest_tny_local_folders_account_init (ModestTnyLocalFoldersAccount *self)
+{
+}
+
+ModestTnyLocalFoldersAccount*
+modest_tny_local_folders_account_new (void)
+{
+  return g_object_new (MODEST_TYPE_TNY_LOCAL_FOLDERS_ACCOUNT, NULL);
+}
+
+void
+modest_tny_local_folders_account_add_extra_folder (ModestTnyLocalFoldersAccount *store, 
+       TnyFolder *folder)
+{
+       ModestTnyLocalFoldersAccountPrivate *priv = 
+               TNY_LOCAL_FOLDERS_ACCOUNT_GET_PRIVATE (store);
+               
+       /* Check that it isn't already in the list: */
+       GSList *exists = g_slist_find (priv->list_extra_folders, folder);
+       if (exists)
+               return;
+               
+       /* Add it: */
+       /* The reference is released in finalize: */
+       priv->list_extra_folders = g_slist_append (priv->list_extra_folders, folder);
+       g_object_ref (folder);
+}
+
+static void
+get_folders (TnyFolderStore *self, TnyList *list, TnyFolderStoreQuery *query, GError **err)
+{
+       ModestTnyLocalFoldersAccountPrivate *priv = 
+               TNY_LOCAL_FOLDERS_ACCOUNT_GET_PRIVATE (self);
+               
+       /* Call the base class implementation: */
+       TnyCamelStoreAccountClass *parent_class = g_type_class_peek_parent (
+               MODEST_TNY_LOCAL_FOLDERS_ACCOUNT_GET_CLASS (self));
+       parent_class->get_folders_func (self, list, query, err);
+       
+       /* Add our extra folders: */
+       GSList *iter = priv->list_extra_folders;
+       while (iter)
+       {
+               TnyFolder *folder = TNY_FOLDER (iter->data);
+               if (folder)
+                       tny_list_append (list, G_OBJECT (folder));
+                       
+               iter = g_slist_next (iter);
+       }
+}
+
+static void 
+get_folders_async (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, TnyStatusCallback status_callback, gpointer user_data)
+{
+       /* Call the base class implementation: */
+       TnyCamelStoreAccountClass *parent_class = g_type_class_peek_parent (
+               MODEST_TNY_LOCAL_FOLDERS_ACCOUNT_GET_CLASS (self));
+       parent_class->get_folders_async_func (self, list, callback, query, status_callback, user_data);
+}
+
+static void
+add_account_folders_to_merged_folder (TnyAccount *account, TnyMergeFolder* merge_folder)
+{
+       const gchar* account_id = tny_account_get_id (account);
+       const gboolean is_actual_local_folders_account = account_id && 
+               (strcmp (account_id, MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID) == 0);
+               
+       TnyList *list_outbox_folders = tny_simple_list_new ();
+       tny_folder_store_get_folders (TNY_FOLDER_STORE (account), 
+               list_outbox_folders, NULL, NULL);
+               
+       TnyIterator*  iter =  tny_list_create_iterator (list_outbox_folders);
+       while (!tny_iterator_is_done (iter))
+       {
+               TnyFolder *folder = TNY_FOLDER (tny_iterator_get_current (iter));
+               
+               if (folder) {
+                       gboolean add = TRUE;
+                       /* TODO: Do not add outboxes that are inside local-folders/, 
+                        * because these are just left-over from earlier Modest versions 
+                        * that put the outbox there: */
+                       if (is_actual_local_folders_account) {
+                               const TnyFolderType type = modest_tny_folder_get_local_folder_type (folder);
+                               if (type == TNY_FOLDER_TYPE_OUTBOX) {
+                                       add = FALSE;
+                               }
+                       }
+                       
+                       if (add)
+                               tny_merge_folder_add_folder (merge_folder, folder);
+                               
+                       g_object_unref (folder);        
+               }
+               
+               tny_iterator_next (iter);
+       }
+       
+       g_object_unref (list_outbox_folders);
+}
+
+void modest_tny_local_folders_account_add_merged_outbox_folders (ModestTnyLocalFoldersAccount *self, 
+       GSList *accounts)
+{
+       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());
+       
+       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 = g_slist_next (iter);
+       }
+       
+       /* Add the merged outbox folder to the virtual local-folders store: */
+       modest_tny_local_folders_account_add_extra_folder (self, TNY_FOLDER(merged_outbox));
+       g_object_unref (merged_outbox);
+       merged_outbox = NULL;
+}
+
+
diff --git a/src/modest-tny-local-folders-account.h b/src/modest-tny-local-folders-account.h
new file mode 100644 (file)
index 0000000..44a08f1
--- /dev/null
@@ -0,0 +1,83 @@
+/* Copyright (c) 2007, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _MODEST_TNY_LOCAL_FOLDERS_ACCOUNT
+#define _MODEST_TNY_LOCAL_FOLDERS_ACCOUNT
+
+#include <tny-camel-store-account.h>
+
+G_BEGIN_DECLS
+
+#define MODEST_TYPE_TNY_LOCAL_FOLDERS_ACCOUNT modest_tny_local_folders_account_get_type()
+
+#define MODEST_TNY_LOCAL_FOLDERS_ACCOUNT(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+  MODEST_TYPE_TNY_LOCAL_FOLDERS_ACCOUNT, ModestTnyLocalFoldersAccount))
+
+#define MODEST_TNY_LOCAL_FOLDERS_ACCOUNT_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+  MODEST_TYPE_TNY_LOCAL_FOLDERS_ACCOUNT, ModestTnyLocalFoldersAccountClass))
+
+#define MODEST_IS_TNY_LOCAL_FOLDERS_ACCOUNT(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+  MODEST_TYPE_TNY_LOCAL_FOLDERS_ACCOUNT))
+
+#define MODEST_IS_TNY_LOCAL_FOLDERS_ACCOUNT_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+  MODEST_TYPE_TNY_LOCAL_FOLDERS_ACCOUNT))
+
+#define MODEST_TNY_LOCAL_FOLDERS_ACCOUNT_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+  MODEST_TYPE_TNY_LOCAL_FOLDERS_ACCOUNT, ModestTnyLocalFoldersAccountClass))
+
+/** ModestTnyLocalFoldersAccount contains references to folders that exist 
+ * in other folder stores or accounts. It does not instantiate any folders 
+ * of its own.
+ */
+typedef struct {
+  TnyCamelStoreAccount parent;
+} ModestTnyLocalFoldersAccount;
+
+typedef struct {
+  TnyCamelStoreAccountClass parent_class;
+} ModestTnyLocalFoldersAccountClass;
+
+GType modest_tny_local_folders_account_get_type (void);
+
+ModestTnyLocalFoldersAccount* modest_tny_local_folders_account_new (void);
+
+void modest_tny_local_folders_account_add_extra_folder (ModestTnyLocalFoldersAccount *store, 
+       TnyFolder *folder);
+       
+void modest_tny_local_folders_account_add_merged_outbox_folders (ModestTnyLocalFoldersAccount *store, 
+       GSList *accounts);
+
+G_END_DECLS
+
+#endif /* _MODEST_TNY_LOCAL_FOLDERS_ACCOUNT */
index 8fad46e..fde2f2e 100644 (file)
@@ -188,12 +188,10 @@ ModestTnySendQueue*
 modest_tny_send_queue_new (TnyCamelTransportAccount *account)
 {
        ModestTnySendQueue *self;
-       ModestTnySendQueuePrivate *priv;
        
        g_return_val_if_fail (TNY_IS_CAMEL_TRANSPORT_ACCOUNT(account), NULL);
        
        self = MODEST_TNY_SEND_QUEUE(g_object_new(MODEST_TYPE_TNY_SEND_QUEUE, NULL));
-       priv = MODEST_TNY_SEND_QUEUE_GET_PRIVATE(self);
        
        tny_camel_send_queue_set_transport_account (TNY_CAMEL_SEND_QUEUE(self),
                                                    account); 
index 99210ad..e69de29 100644 (file)
@@ -1,187 +0,0 @@
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#include <config.h>
-#include <glib.h>
-#include <glib/gi18n-lib.h>
-
-#include <modest-tny-simple-folder-store.h>
-
-static void
-tny_folder_store_init (TnyFolderStoreIface *klass);
-
-G_DEFINE_TYPE_EXTENDED (ModestTnySimpleFolderStore, 
-       modest_tny_simple_folder_store, 
-       G_TYPE_OBJECT,
-       0,
-       G_IMPLEMENT_INTERFACE (TNY_TYPE_FOLDER_STORE, tny_folder_store_init));
-
-#define TNY_SIMPLE_FOLDER_STORE_GET_PRIVATE(o) \
-  (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEST_TYPE_TNY_SIMPLE_FOLDER_STORE, ModestTnySimpleFolderStorePrivate))
-
-typedef struct _ModestTnySimpleFolderStorePrivate ModestTnySimpleFolderStorePrivate;
-
-struct _ModestTnySimpleFolderStorePrivate
-{
-       GSList *list_folders;
-};
-
-static void
-modest_tny_simple_folder_store_dispose (GObject *object)
-{
-  if (G_OBJECT_CLASS (modest_tny_simple_folder_store_parent_class)->dispose)
-    G_OBJECT_CLASS (modest_tny_simple_folder_store_parent_class)->dispose (object);
-}
-
-static void
-modest_tny_simple_folder_store_finalize (GObject *object)
-{
-  G_OBJECT_CLASS (modest_tny_simple_folder_store_parent_class)->finalize (object);
-  
-  ModestTnySimpleFolderStorePrivate *priv = 
-               TNY_SIMPLE_FOLDER_STORE_GET_PRIVATE (object);
-               
-  GSList *iter = priv->list_folders;
-  while (iter)
-  {
-       TnyFolder *folder = (TnyFolder*)iter->data;
-       if (folder) {
-               g_object_unref (folder);
-               iter->data = NULL;
-       }
-               
-       iter = g_slist_next (iter);
-  }
-
-  g_slist_free (priv->list_folders);
-  priv->list_folders = NULL;
-}
-
-static void
-modest_tny_simple_folder_store_class_init (ModestTnySimpleFolderStoreClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-  g_type_class_add_private (klass, sizeof (ModestTnySimpleFolderStorePrivate));
-
-  object_class->dispose = modest_tny_simple_folder_store_dispose;
-  object_class->finalize = modest_tny_simple_folder_store_finalize;
-}
-
-static void
-modest_tny_simple_folder_store_init (ModestTnySimpleFolderStore *self)
-{
-}
-
-ModestTnySimpleFolderStore*
-modest_tny_simple_folder_store_new (void)
-{
-  return g_object_new (MODEST_TYPE_TNY_SIMPLE_FOLDER_STORE, NULL);
-}
-
-
-static void
-modest_tny_simple_folder_store_remove_folder (TnyFolderStore *self, TnyFolder *folder, GError **err)
-{
-}
-
-static TnyFolder*
-modest_tny_simple_folder_store_create_folder (TnyFolderStore *self, const gchar *name, GError **err)
-{
-       return NULL;
-}
-
-static void
-modest_tny_simple_folder_store_get_folders (TnyFolderStore *self, TnyList *list, TnyFolderStoreQuery *query, GError **err)
-{
-  ModestTnySimpleFolderStorePrivate *priv = 
-               TNY_SIMPLE_FOLDER_STORE_GET_PRIVATE (self);
-               
-  if (!list)
-    return;
-    
-  GSList *iter = priv->list_folders;
-  while (iter)
-  {
-       TnyFolder *folder = (TnyFolder*)iter->data;
-       if (folder) {
-               tny_list_append (list, G_OBJECT (folder));
-       }
-               
-       iter = g_slist_next (iter);
-  }
-  
-}
-
-static void
-modest_tny_simple_folder_store_get_folders_async (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, TnyStatusCallback status_callback, gpointer user_data)
-{
-}
-
-static void
-modest_tny_simple_folder_store_add_observer (TnyFolderStore *self, TnyFolderStoreObserver *observer)
-{
-}
-
-static void
-modest_tny_simple_folder_store_remove_observer (TnyFolderStore *self, TnyFolderStoreObserver *observer)
-{
-}
-
-static void
-tny_folder_store_init (TnyFolderStoreIface *klass)
-{
-       klass->remove_folder_func = modest_tny_simple_folder_store_remove_folder;
-       klass->create_folder_func = modest_tny_simple_folder_store_create_folder;
-       klass->get_folders_func = modest_tny_simple_folder_store_get_folders;
-       klass->get_folders_async_func = modest_tny_simple_folder_store_get_folders_async;
-       klass->add_observer_func = modest_tny_simple_folder_store_add_observer;
-       klass->remove_observer_func = modest_tny_simple_folder_store_remove_observer;
-}
-
-
-void
-modest_tny_simple_folder_store_add_folder (ModestTnySimpleFolderStore *store, 
-       TnyFolder *folder)
-{
-       ModestTnySimpleFolderStorePrivate *priv = 
-               TNY_SIMPLE_FOLDER_STORE_GET_PRIVATE (store);
-               
-       /* Check that it isn't already in the list: */
-       GSList *exists = g_slist_find (priv->list_folders, folder);
-       if (exists)
-               return;
-               
-       /* Add it: */
-       /* The reference is released in finalize: */
-       priv->list_folders = g_slist_append (priv->list_folders, folder);
-       g_object_ref (folder);
-}
-
index 4f0805e..e69de29 100644 (file)
@@ -1,80 +0,0 @@
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- *   contributors may be used to endorse or promote products derived from
- *   this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MODEST_TNY_SIMPLE_FOLDER_STORE
-#define _MODEST_TNY_SIMPLE_FOLDER_STORE
-
-#include <tny-folder-store.h>
-
-G_BEGIN_DECLS
-
-#define MODEST_TYPE_TNY_SIMPLE_FOLDER_STORE modest_tny_simple_folder_store_get_type()
-
-#define MODEST_TNY_SIMPLE_FOLDER_STORE(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-  MODEST_TYPE_TNY_SIMPLE_FOLDER_STORE, ModestTnySimpleFolderStore))
-
-#define MODEST_TNY_SIMPLE_FOLDER_STORE_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), \
-  MODEST_TYPE_TNY_SIMPLE_FOLDER_STORE, ModestTnySimpleFolderStoreClass))
-
-#define MODEST_IS_TNY_SIMPLE_FOLDER_STORE(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-  MODEST_TYPE_TNY_SIMPLE_FOLDER_STORE))
-
-#define MODEST_IS_TNY_SIMPLE_FOLDER_STORE_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-  MODEST_TYPE_TNY_SIMPLE_FOLDER_STORE))
-
-#define MODEST_TNY_SIMPLE_FOLDER_STORE_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-  MODEST_TYPE_TNY_SIMPLE_FOLDER_STORE, ModestTnySimpleFolderStoreClass))
-
-/** ModestTnySimpleFolderStore contains references to folders that exist 
- * in other folder stores or accounts. It does not instantiate any folders 
- * of its own.
- */
-typedef struct {
-  GObject parent;
-} ModestTnySimpleFolderStore;
-
-typedef struct {
-  GObjectClass parent_class;
-} ModestTnySimpleFolderStoreClass;
-
-GType modest_tny_simple_folder_store_get_type (void);
-
-ModestTnySimpleFolderStore* modest_tny_simple_folder_store_new (void);
-
-void modest_tny_simple_folder_store_add_folder (ModestTnySimpleFolderStore *store, 
-       TnyFolder *folder);
-
-G_END_DECLS
-
-#endif /* _MODEST_TNY_SIMPLE_FOLDER_STORE */
index ce30a1f..aec999d 100644 (file)
@@ -1233,9 +1233,6 @@ modest_ui_actions_on_folder_selection_changed (ModestFolderView *folder_view,
                set_active_account_from_tny_account (TNY_ACCOUNT (folder_store), MODEST_WINDOW (main_window));
                /* Show account details */
                modest_main_window_set_contents_style (main_window, MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS);
-       } else if (modest_tny_folder_store_is_virtual_local_folders  (folder_store )) {
-               //TODO: Set the virtual folder store as the "active account" somehow:
-               modest_main_window_set_contents_style (main_window, MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS);
        } else {
                if (TNY_IS_FOLDER (folder_store) && selected) {
                        
index b4db632..e044d9d 100644 (file)
@@ -80,18 +80,21 @@ modest_ui_dimming_rules_on_new_folder (ModestWindow *win, gpointer user_data)
        if (!parent_folder)
                return TRUE;
        
-       /* If it's the local account do not dim */
-       if (modest_tny_folder_store_is_virtual_local_folders (parent_folder)) {
-               return FALSE;
-       } else if (TNY_IS_ACCOUNT (parent_folder)) {
-               /* If it's the MMC root folder then dim it */
-               if (!strcmp (tny_account_get_id (TNY_ACCOUNT (parent_folder)), MODEST_MMC_ACCOUNT_ID)) {
-                       dimmed = TRUE;
-               } else {
-                       const gchar *proto_str = tny_account_get_proto (TNY_ACCOUNT (parent_folder));
-                       /* If it's POP then dim */
-                       dimmed = (modest_protocol_info_get_transport_store_protocol (proto_str) == 
-                                 MODEST_PROTOCOL_STORE_POP) ? TRUE : FALSE;
+       if (TNY_IS_ACCOUNT (parent_folder)) {
+               /* If it's the local account then do not dim */
+               if (modest_tny_account_is_virtual_local_folders (
+                       TNY_ACCOUNT (parent_folder)))
+                       return FALSE;
+               else {
+                       /* If it's the MMC root folder then dim it */
+                       if (!strcmp (tny_account_get_id (TNY_ACCOUNT (parent_folder)), MODEST_MMC_ACCOUNT_ID)) {
+                               dimmed = TRUE;
+                       } else {
+                               const gchar *proto_str = tny_account_get_proto (TNY_ACCOUNT (parent_folder));
+                               /* If it's POP then dim */
+                               dimmed = (modest_protocol_info_get_transport_store_protocol (proto_str) == 
+                                         MODEST_PROTOCOL_STORE_POP) ? TRUE : FALSE;
+                       }
                }
        } else {
                /* TODO: the specs say that only one level of subfolder is allowed, is this true ? */
index 120725b..523873b 100644 (file)
 #include <tny-folder.h>
 #include <tny-camel-folder.h>
 #include <tny-simple-list.h>
-#include <tny-merge-folder.h>
 #include <modest-tny-folder.h>
-#include <modest-tny-simple-folder-store.h>
+#include <modest-tny-local-folders-account.h>
 #include <modest-marshal.h>
 #include <modest-icon-names.h>
 #include <modest-tny-account-store.h>
-#include <modest-tny-outbox-account.h>
 #include <modest-text-utils.h>
 #include <modest-runtime.h>
 #include "modest-folder-view.h"
@@ -298,21 +296,14 @@ text_cell_data  (GtkTreeViewColumn *column,  GtkCellRenderer *renderer,
 
        } else if (TNY_IS_ACCOUNT (instance)) {
                /* If it's a server account */
-               const gchar * account_id = tny_account_get_id (TNY_ACCOUNT (instance));
-               if (!strcmp (account_id, MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID)) {
+               if (modest_tny_account_is_virtual_local_folders (
+                               TNY_ACCOUNT (instance))) {
                        item_name = g_strdup (priv->local_account_name);
+                       item_weight = 400;
                } else {
                        item_name = g_strdup (fname);
+                       item_weight = 800;
                }
-
-               item_weight = 800;
-       } else if (modest_tny_folder_store_is_virtual_local_folders (
-               TNY_FOLDER_STORE(instance)))
-       {
-               /* We use ModestTnySimpleFolder store to group the outboxes and 
-                * the other local folders together: */
-               item_name = g_strdup (priv->local_account_name);
-               item_weight = 400;
        }
        
        if (!item_name)
@@ -373,23 +364,19 @@ icon_cell_data  (GtkTreeViewColumn *column,  GtkCellRenderer *renderer,
        switch (type) {
        case TNY_FOLDER_TYPE_ROOT:
                if (TNY_IS_ACCOUNT (instance)) {
-                       account_id = tny_account_get_id (TNY_ACCOUNT (instance));
-                       /*
-                       if (!strcmp (account_id, MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID)) {
+                       
+                       if (modest_tny_account_is_virtual_local_folders (
+                               TNY_ACCOUNT (instance))) {
                                pixbuf = modest_platform_get_icon (MODEST_FOLDER_ICON_LOCAL_FOLDERS);
-                       } else {
-                       */
+                       }
+                       else {
+                               account_id = tny_account_get_id (TNY_ACCOUNT (instance));
+                               
                                if (!strcmp (account_id, MODEST_MMC_ACCOUNT_ID))
                                        pixbuf = modest_platform_get_icon (MODEST_FOLDER_ICON_MMC);
                                else
                                        pixbuf = modest_platform_get_icon (MODEST_FOLDER_ICON_ACCOUNT);
-                       /*
                        }
-                       */
-               }
-               else if (modest_tny_folder_store_is_virtual_local_folders (
-                       TNY_FOLDER_STORE (instance))) {
-                       pixbuf = modest_platform_get_icon (MODEST_FOLDER_ICON_LOCAL_FOLDERS);
                }
                break;
        case TNY_FOLDER_TYPE_INBOX:
@@ -699,7 +686,8 @@ filter_row (GtkTreeModel *model,
                        
                        /* If it isn't a special folder, 
                         * don't show it unless it is the visible account: */
-                       if (strcmp (account_id, MODEST_MMC_ACCOUNT_ID)) { 
+                       if (!modest_tny_account_is_virtual_local_folders (acc) &&
+                               strcmp (account_id, MODEST_MMC_ACCOUNT_ID)) { 
                                /* Show only the visible account id */
                                ModestFolderViewPrivate *priv = 
                                        MODEST_FOLDER_VIEW_GET_PRIVATE (data);
@@ -726,94 +714,6 @@ static void on_tnylist_accounts_debug_print(gpointer data,  gpointer user_data)
 }
 */
 
-static void
-add_account_folders_to_merged_folder (TnyAccount *account, TnyMergeFolder* merge_folder)
-{
-       const gchar* account_id = tny_account_get_id (account);
-       const gboolean is_actual_local_folders_account = account_id && 
-               (strcmp (account_id, MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID) == 0);
-               
-       TnyList *list_outbox_folders = tny_simple_list_new ();
-       tny_folder_store_get_folders (TNY_FOLDER_STORE (account), 
-               list_outbox_folders, NULL, NULL);
-               
-       TnyIterator*  iter =  tny_list_create_iterator (list_outbox_folders);
-       while (!tny_iterator_is_done (iter))
-       {
-               TnyFolder *folder = TNY_FOLDER (tny_iterator_get_current (iter));
-               
-               if (folder) {
-                       gboolean add = TRUE;
-                       /* TODO: Do not add outboxes that are inside local-folders/, 
-                        * because these are just left-over from earlier Modest versions 
-                        * that put the outbox there: */
-                       if (is_actual_local_folders_account) {
-                               const TnyFolderType type = modest_tny_folder_get_local_folder_type (folder);
-                               if (type == TNY_FOLDER_TYPE_OUTBOX) {
-                                       add = FALSE;
-                               }
-                       }
-                       
-                       if (add)
-                               tny_merge_folder_add_folder (merge_folder, folder);
-                               
-                       g_object_unref (folder);        
-               }
-               
-               tny_iterator_next (iter);
-       }
-       
-       g_object_unref (list_outbox_folders);
-}
-
-
-static void
-add_account_folders_to_simple_folder_store (TnyAccount *account, ModestTnySimpleFolderStore* store)
-{
-       g_return_if_fail (account);
-       g_return_if_fail (store);
-               
-       TnyList *list_outbox_folders = tny_simple_list_new ();
-       tny_folder_store_get_folders (TNY_FOLDER_STORE (account), 
-               list_outbox_folders, NULL, NULL);
-       
-       /* Special handling for the .modest/local-folders account,
-        * to avoid adding unwanted folders.
-        * We cannot prevent them from being in the TnyAccount without 
-        * changing the libtinymail-camel. */
-       const gchar* account_id = tny_account_get_id (account);
-       const gboolean is_actual_local_folders_account = account_id && 
-               (strcmp (account_id, MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID) == 0);
-       
-       TnyIterator*  iter =  tny_list_create_iterator (list_outbox_folders);
-       while (!tny_iterator_is_done (iter))
-       {
-               TnyFolder *folder = TNY_FOLDER (tny_iterator_get_current (iter));
-               
-               if (folder) {
-                       gboolean add = TRUE;
-                       /* TODO: Do not add outboxes that are inside local-folders/, 
-                        * because these are just left-over from earlier Modest versions 
-                        * that put the outbox there: */
-                       if (is_actual_local_folders_account) {
-                               const TnyFolderType type = modest_tny_folder_get_local_folder_type (folder);
-                               if (type == TNY_FOLDER_TYPE_OUTBOX) {
-                                       add = FALSE;
-                               }
-                       }
-                       
-                       if (add)
-                               modest_tny_simple_folder_store_add_folder (store, folder);
-                               
-                       g_object_unref (folder);        
-               }
-               
-               tny_iterator_next (iter);
-       }
-       
-       g_object_unref (list_outbox_folders);
-}
-
 static gboolean
 update_model (ModestFolderView *self, ModestTnyAccountStore *account_store)
 {
@@ -838,68 +738,19 @@ update_model (ModestFolderView *self, ModestTnyAccountStore *account_store)
         * filling the TnyList via a get_accounts() call: */
        TnyList *model_as_list = TNY_LIST(model);
 
-       /* Create a virtual local-folders folder store, 
-        * containing the real local folders and the (merged) various per-account 
-        * outbox folders:
-        */
-       ModestTnySimpleFolderStore *store = modest_tny_simple_folder_store_new ();
-
        /* Get the accounts: */
-       TnyList *account_list = tny_simple_list_new ();
        tny_account_store_get_accounts (TNY_ACCOUNT_STORE(account_store),
-                                       account_list,
+                                       model_as_list,
                                        TNY_ACCOUNT_STORE_STORE_ACCOUNTS);
-       TnyIterator* iter =  tny_list_create_iterator (account_list);
-       
-       /* 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());
-       
-       while (!tny_iterator_is_done (iter))
-       {
-               GObject *cur = tny_iterator_get_current (iter);
-               TnyAccount *account = TNY_ACCOUNT (cur);
-               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);
-                       } else {
-                               const gchar *account_id = tny_account_get_id (account);
-                               if (account_id && !strcmp (account_id, MODEST_ACTUAL_LOCAL_FOLDERS_ACCOUNT_ID)) {
-                                       /* Add the folders to the virtual local-folders store: */
-                                       add_account_folders_to_simple_folder_store (account, store);
-                               }
-                               else {
-                                       /* Just add the account: */
-                                       tny_list_append (model_as_list, G_OBJECT (account));
-                               }
-                       }
-               }
-          
-               g_object_unref (cur);
-               tny_iterator_next (iter);
-       }
-       
-       /* Add the merged outbox folder to the virtual local-folders store: */
-       modest_tny_simple_folder_store_add_folder (store, TNY_FOLDER(merged_outbox));
-       g_object_unref (merged_outbox);
-       merged_outbox = NULL;
-       
-       /* Add the virtual local-folders store to the model: */
-       tny_list_append (model_as_list, G_OBJECT (store));
        
        
-       g_object_unref (account_list);
-       account_list = NULL;
-       
        g_object_unref (model_as_list);
        model_as_list = NULL;   
-               
-       /* tny_list_foreach (account_list, on_tnylist_accounts_debug_print, "update_model: "); */
+       
+       /*      
+       if (account_list)
+               tny_list_foreach (account_list, on_tnylist_accounts_debug_print, "update_model: ");
+    */
                                                      
        GtkTreeModel *filter_model = NULL, *sortable = NULL;
 
@@ -1006,9 +857,9 @@ get_cmp_rows_type_pos (GObject *folder)
        /* Remote accounts -> Local account -> MMC account .*/
        /* 0, 1, 2 */
        
-       if (TNY_IS_FOLDER_STORE (folder) && 
-               modest_tny_folder_store_is_virtual_local_folders (
-                       TNY_FOLDER_STORE (folder))) {
+       if (TNY_IS_ACCOUNT (folder) && 
+               modest_tny_account_is_virtual_local_folders (
+                       TNY_ACCOUNT (folder))) {
                return 1;
        } else if (TNY_IS_ACCOUNT (folder)) {
                TnyAccount *account = TNY_ACCOUNT (folder);