+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:
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 \
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\
* 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>
}
static GtkWidget *
-create_details_widget (TnyFolderStore *folder_store)
+create_details_widget (TnyAccount *account)
{
GtkWidget *vbox;
gchar *label;
/* 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 */
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)),
}
/* 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);
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));
/* 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:
/* 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
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;
}
#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>
}
}
- 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 =
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;
}
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);
}
#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 */
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
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
#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>
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);
--- /dev/null
+/* 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;
+}
+
+
--- /dev/null
+/* 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 */
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);
-/* 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);
-}
-
-/* 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 */
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) {
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 ? */
#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"
} 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)
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:
/* 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);
}
*/
-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)
{
* 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;
/* 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);