2007-06-07 Murray Cumming <murrayc@murrayc.com>
+ * src/modest-tny-account-store.h:
+ * src/modest-tny-account-store.c:
+ Added modest_tny_account_store_get_local_folders_account().
+
+ * src/modest-tny-folder.h:
+ * src/modest-tny-folder.c:
+ (modest_tny_folder_get_account):
+ Added this replacement for tny_folder_get_account() which returns
+ the local-folders account for TnyMergeFolders, to avoid the
+ warning about the unimplemented get_account_func() vfunc().
+
+ (modest_tny_folder_get_rules),
+ * src/modest-ui-actions.c:
+ (modest_ui_actions_on_folder_selection_changed):
+ * src/modest-mail-operation.c:
+ (modest_mail_operation_remove_folder),
+ (modest_mail_operation_xfer_folder),
+ (modest_mail_operation_rename_folder),
+ (modest_mail_operation_get_msg),
+ (modest_mail_operation_get_msgs_full),
+ (modest_mail_operation_remove_msg),
+ (modest_mail_operation_xfer_msgs),
+ (modest_mail_operation_refresh_folder):
+ Use modest_tny_folder_get_account() instead of tny_folder_get_account().
+
+2007-06-07 Murray Cumming <murrayc@murrayc.com>
+
* src/modest-account-mgr-helpers.c: (get_security_for_conf_string),
(modest_server_account_set_security):
* src/modest-defs.h: Add comments explaining that our
}
/* Get the account */
- account = tny_folder_get_account (folder);
+ account = modest_tny_folder_get_account (folder);
priv->account = g_object_ref(account);
/* Delete folder or move to trash */
priv = MODEST_MAIL_OPERATION_GET_PRIVATE (self);
/* Get account and set it into mail_operation */
- priv->account = tny_folder_get_account (TNY_FOLDER(folder));
+ priv->account = modest_tny_folder_get_account (TNY_FOLDER(folder));
priv->status = MODEST_MAIL_OPERATION_STATUS_IN_PROGRESS;
/* Get folder rules */
priv = MODEST_MAIL_OPERATION_GET_PRIVATE (self);
/* Get account and set it into mail_operation */
- priv->account = tny_folder_get_account (TNY_FOLDER(folder));
+ priv->account = modest_tny_folder_get_account (TNY_FOLDER(folder));
/* Check folder rules */
rules = modest_tny_folder_get_rules (TNY_FOLDER (folder));
/* Get message from folder */
if (folder) {
/* Get account and set it into mail_operation */
- priv->account = tny_folder_get_account (TNY_FOLDER(folder));
+ priv->account = modest_tny_folder_get_account (TNY_FOLDER(folder));
helper = g_slice_new0 (GetMsgAsyncHelper);
helper->mail_op = self;
iter = tny_list_create_iterator (header_list);
header = TNY_HEADER (tny_iterator_get_current (iter));
folder = tny_header_get_folder (header);
- priv->account = tny_folder_get_account (TNY_FOLDER(folder));
+ priv->account = modest_tny_folder_get_account (TNY_FOLDER(folder));
g_object_unref (header);
g_object_unref (folder);
folder = tny_header_get_folder (header);
/* Get account and set it into mail_operation */
- priv->account = tny_folder_get_account (TNY_FOLDER(folder));
+ priv->account = modest_tny_folder_get_account (TNY_FOLDER(folder));
priv->status = MODEST_MAIL_OPERATION_STATUS_IN_PROGRESS;
TnyFolder *trash_folder;
TnyStoreAccount *store_account;
- store_account = TNY_STORE_ACCOUNT (tny_folder_get_account (folder));
+ store_account = TNY_STORE_ACCOUNT (modest_tny_folder_get_account (folder));
trash_folder = modest_tny_account_get_special_folder (TNY_ACCOUNT(store_account),
TNY_FOLDER_TYPE_TRASH);
if (trash_folder) {
g_object_unref (iter);
/* Get account and set it into mail_operation */
- priv->account = tny_folder_get_account (src_folder);
+ priv->account = modest_tny_folder_get_account (src_folder);
/* Transfer messages */
tny_folder_transfer_msgs_async (src_folder,
priv->status = MODEST_MAIL_OPERATION_STATUS_IN_PROGRESS;
/* Get account and set it into mail_operation */
- priv->account = tny_folder_get_account (folder);
+ priv->account = modest_tny_folder_get_account (folder);
/* Refresh the folder. TODO: tinymail could issue a status
updates before the callback call then this could happen. We
* for anything else. */
return MODEST_IS_TNY_LOCAL_FOLDERS_ACCOUNT (self);
}
+
+TnyAccount* modest_tny_account_store_get_local_folders_account (TnyAccountStore *self)
+{
+ TnyAccount *account = NULL;
+ ModestTnyAccountStorePrivate *priv;
+ GSList *cursor;
+
+ g_return_val_if_fail (self, NULL);
+
+ priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
+
+ for (cursor = priv->store_accounts; cursor ; cursor = cursor->next) {
+ TnyAccount *this_account = TNY_ACCOUNT(cursor->data);
+ if (modest_tny_account_is_virtual_local_folders (this_account)) {
+ account = this_account;
+ break;
+ }
+ }
+
+ if (account)
+ g_object_ref (G_OBJECT(account));
+
+ return account;
+}
*/
TnySessionCamel* modest_tny_account_store_get_session (TnyAccountStore *self);
+/** modest_tny_account_store_get_local_folders_account:
+ * @self: a TnyAccountStore instance
+ *
+ * Get the user-visible local folders account.
+ **/
+TnyAccount * modest_tny_account_store_get_local_folders_account (TnyAccountStore *self);
/** modest_tny_account_is_virtual_local_folders:
* @self A TnyAccount.
#include <tny-merge-folder.h>
#include <camel/camel-folder.h>
#include <modest-protocol-info.h>
+#include <modest-runtime.h>
+#include <modest-tny-account-store.h>
TnyFolderType
modest_tny_folder_guess_folder_type_from_name (const gchar* name)
} else {
ModestTransportStoreProtocol proto;
TnyAccount *account =
- tny_folder_get_account ((TnyFolder*)folder);
+ modest_tny_folder_get_account ((TnyFolder*)folder);
if (!account)
return -1; /* no account: nothing is allowed */
return retval;
}
+
+TnyAccount *modest_tny_folder_get_account (TnyFolder *folder)
+{
+ TnyAccount *account = NULL;
+
+ if (TNY_IS_MERGE_FOLDER (folder)) {
+ /* TnyMergeFolder does not support get_account(),
+ * because it could be merging folders from multiple accounts.
+ * So we assume that this is the local folders account: */
+
+ account = modest_tny_account_store_get_local_folders_account (
+ TNY_ACCOUNT_STORE (modest_runtime_get_account_store()));
+ } else {
+ account = tny_folder_get_account (folder);
+ }
+
+ return account;
+}
+
*/
gboolean modest_tny_folder_is_outbox_for_account (TnyFolder *folder,
TnyAccount *account);
+
+/**
+ * modest_tny_folder_get_account:
+ * @folder: a folder
+ *
+ * Get the parent account of the folder or, for TnyMergeFolder
+ * instances, get the local-folders account.
+ *
+ * Returns: the account. You should call g_object_unref() on this.
+ */
+TnyAccount *modest_tny_folder_get_account (TnyFolder *folder);
/**
* modest_tny_msg_get_header_unique_id:
if (!TNY_IS_MERGE_FOLDER (folder_store)) { /* TnyMergeFolder can have no get_account() implementation. */
/* Update the active account */
- TnyAccount *account = tny_folder_get_account (TNY_FOLDER (folder_store));
+ TnyAccount *account = modest_tny_folder_get_account (TNY_FOLDER (folder_store));
set_active_account_from_tny_account (account, MODEST_WINDOW (main_window));
g_object_unref (account);
}