From 81b94116a84854d2323771c2d023c8ff72f45891 Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Thu, 18 Oct 2007 10:20:25 +0000 Subject: [PATCH] * src/dbus_api/modest-dbus-callbacks.c: * Now get_folders method also obtains folders from mmc (fixes NB#65058). * src/modest-tny-account-store.[ch]: * Added new method to obtain the mmc account. pmo-trunk-r3527 --- src/dbus_api/modest-dbus-callbacks.c | 24 ++++++++++++++++++------ src/modest-tny-account-store.c | 10 ++++++++++ src/modest-tny-account-store.h | 10 ++++++++++ 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/dbus_api/modest-dbus-callbacks.c b/src/dbus_api/modest-dbus-callbacks.c index 07b1f96..ac7c768 100644 --- a/src/dbus_api/modest-dbus-callbacks.c +++ b/src/dbus_api/modest-dbus-callbacks.c @@ -1477,18 +1477,21 @@ static void on_dbus_method_get_folders (DBusConnection *con, DBusMessage *message) { DBusMessage *reply = NULL; + ModestAccountMgr *account_mgr = NULL; + gchar *account_name = NULL; + GList *folder_names = NULL; + TnyAccount *account_local = NULL; + TnyAccount *account_mmc = NULL; /* Get the TnyStoreAccount so we can get the folders: */ - ModestAccountMgr *account_mgr = modest_runtime_get_account_mgr(); - gchar *account_name = modest_account_mgr_get_default_account (account_mgr); + account_mgr = modest_runtime_get_account_mgr(); + account_name = modest_account_mgr_get_default_account (account_mgr); if (!account_name) { g_printerr ("modest: no account found\n"); } - GList *folder_names = NULL; - - TnyAccount *account = NULL; if (account_name) { + TnyAccount *account = NULL; if (account_mgr) { account = modest_tny_account_store_get_server_account ( modest_runtime_get_account_store(), account_name, @@ -1513,13 +1516,22 @@ on_dbus_method_get_folders (DBusConnection *con, DBusMessage *message) * because they are (currently) used with all accounts: * TODO: This is not working. It seems to get only the Merged Folder (with an ID of "" (not NULL)). */ - TnyAccount *account_local = + account_local = modest_tny_account_store_get_local_folders_account (modest_runtime_get_account_store()); add_folders_to_list (TNY_FOLDER_STORE (account_local), &folder_names); g_object_unref (account_local); account_local = NULL; + /* Obtain the mmc account */ + account_mmc = + modest_tny_account_store_get_mmc_folders_account (modest_runtime_get_account_store()); + if (account_mmc) { + add_folders_to_list (TNY_FOLDER_STORE (account_mmc), &folder_names); + g_object_unref (account_mmc); + account_mmc = NULL; + } + /* specs require us to sort the folder names, although * this is really not the place to do that... */ diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index 3a08292..94b1f46 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -1437,6 +1437,16 @@ modest_tny_account_store_get_local_folders_account (ModestTnyAccountStore *self) return account; } +TnyAccount* +modest_tny_account_store_get_mmc_folders_account (ModestTnyAccountStore *self) +{ + g_return_val_if_fail (MODEST_IS_TNY_ACCOUNT_STORE (self), NULL); + + return modest_tny_account_store_get_tny_account_by (self, MODEST_TNY_ACCOUNT_STORE_QUERY_ID, + MODEST_MMC_ACCOUNT_ID); + +} + /*********************************************************************************/ static void add_existing_accounts (ModestTnyAccountStore *self) diff --git a/src/modest-tny-account-store.h b/src/modest-tny-account-store.h index b116c71..4c326be 100644 --- a/src/modest-tny-account-store.h +++ b/src/modest-tny-account-store.h @@ -169,6 +169,16 @@ TnySessionCamel* modest_tny_account_store_get_session (TnyAccountStore *se **/ TnyAccount * modest_tny_account_store_get_local_folders_account (ModestTnyAccountStore *self); +/** + * modest_tny_account_store_get_mmc_folders_account: + * @self: a TnyAccountStore instance + * + * Get the mmc folders account. + * + * Returns: a #TnyAccount, or %NULL if no mmc account is available now. + */ +TnyAccount * modest_tny_account_store_get_mmc_folders_account (ModestTnyAccountStore *self); + /** modest_tny_account_store_forget_already_asked: * @self: a TnyAccountStore instance * @account: the account to forget the already asked status for -- 1.7.9.5