g_object_unref (info->mail_op);
g_slice_free (CreateMsgInfo, info);
+ if (new_msg) g_object_unref(new_msg);
return NULL;
}
modest_account_mgr_set_account_busy (modest_runtime_get_account_mgr (), account_name, TRUE);
modest_mail_operation_notify_start (self);
+ /* notify about the start of the operation */
+ ModestMailOperationState *state;
+ state = modest_mail_operation_clone_state (self);
+ state->done = 0;
+ state->total = 0;
+ g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL],
+ 0, state, NULL);
+
/* Get all folders and continue in the callback */
folders = tny_simple_list_new ();
tny_folder_store_get_folders_async (TNY_FOLDER_STORE (store_account),
helper->total_bytes = tny_header_get_message_size (header);
modest_mail_operation_notify_start (self);
+
+ /* notify about the start of the operation */
+ ModestMailOperationState *state;
+ state = modest_mail_operation_clone_state (self);
+ state->done = 0;
+ state->total = 0;
+ g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL],
+ 0, state, NULL);
+
tny_folder_get_msg_async (folder, header, get_msg_async_cb, get_msg_status_cb, helper);
g_object_unref (G_OBJECT (folder));
modest_mail_operation_notify_start (self);
iter = tny_list_create_iterator (header_list);
while (!tny_iterator_is_done (iter)) {
+ /* notify about the start of the operation */
+ ModestMailOperationState *state;
+ state = modest_mail_operation_clone_state (self);
+ state->done = 0;
+ state->total = 0;
+ g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL],
+ 0, state, NULL);
+
GetMsgInfo *msg_info = NULL;
TnyHeader *header = TNY_HEADER (tny_iterator_get_current (iter));
TnyFolder *folder = tny_header_get_folder (header);
gboolean expunge, leave_on_server;
const gchar *account_name;
TnyAccount *account;
+ ModestTransportStoreProtocol account_proto;
tny_header_set_flag (header, TNY_HEADER_FLAG_DELETED);
tny_header_set_flag (header, TNY_HEADER_FLAG_SEEN);
modest_account_mgr_get_leave_on_server (modest_runtime_get_account_mgr (),
account_name);
- if (TNY_IS_CAMEL_POP_FOLDER (folder) && !leave_on_server)
+ account_proto = modest_protocol_info_get_transport_store_protocol (tny_account_get_proto (account));
+
+ if (((account_proto == MODEST_PROTOCOL_STORE_POP) && !leave_on_server) ||
+ modest_tny_folder_is_remote_folder (folder) == FALSE)
expunge = TRUE;
else
expunge = FALSE;
tny_folder_remove_msgs (folder, remove_headers, &(priv->error));
if (!priv->error) {
- if (TNY_IS_CAMEL_IMAP_FOLDER (folder) ||
- TNY_IS_CAMEL_POP_FOLDER (folder))
- tny_folder_sync_async(folder, FALSE, NULL, NULL, NULL); /* FALSE --> don't expunge */
+ gboolean expunge, leave_on_server;
+ const gchar *account_name;
+ TnyAccount *account;
+ ModestTransportStoreProtocol account_proto;
+
+ account = tny_folder_get_account (folder);
+ account_name = modest_tny_account_get_parent_modest_account_name_for_server_account (account);
+ leave_on_server =
+ modest_account_mgr_get_leave_on_server (modest_runtime_get_account_mgr (),
+ account_name);
+
+ account_proto = modest_protocol_info_get_transport_store_protocol (tny_account_get_proto (account));
+
+ if (((account_proto == MODEST_PROTOCOL_STORE_POP) && !leave_on_server) ||
+ modest_tny_folder_is_remote_folder (folder) == FALSE)
+ expunge = TRUE;
else
- /* local folders */
- tny_folder_sync_async(folder, TRUE, NULL, NULL, NULL); /* TRUE --> expunge */
+ expunge = FALSE;
+
+ /* Sync folder */
+ tny_folder_sync_async(folder, expunge, NULL, NULL, NULL);
+
+ g_object_unref (account);
}
updates before the callback call then this could happen. We
must review the design */
modest_mail_operation_notify_start (self);
+
+ /* notify that the operation was started */
+ ModestMailOperationState *state;
+ state = modest_mail_operation_clone_state (self);
+ state->done = 0;
+ state->total = 0;
+ g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL],
+ 0, state, NULL);
+
tny_folder_refresh_async (folder,
on_refresh_folder,
on_refresh_folder_status_update,