ModestMailOperation *mail_op;
/* TODO: add confirmation dialog */
- mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_DELETE);
+ mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_DELETE, G_OBJECT(win));
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
TnyList *header_list;
guint reply_forward_type;
TnyHeader *header;
-/* TnyFolder *folder; */
GetMsgAsyncHelper *helper;
ReplyForwardHelper *rf_helper;
reply_forward_func (msg, helper);
} else {
header = TNY_HEADER (tny_iterator_get_current (helper->iter));
-
-/* folder = tny_header_get_folder (header); */
-/* if (folder) { */
-/* /\* The callback will call it per each header *\/ */
-/* tny_folder_get_msg_async (folder, header, get_msg_cb, NULL, helper); */
-/* g_object_unref (G_OBJECT (folder)); */
-/* } else */
-/* g_printerr ("modest: no folder for header\n"); */
- helper->mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE);
+ helper->mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE, G_OBJECT(win));
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), helper->mail_op);
modest_mail_operation_process_msg (helper->mail_op, header, helper->num_ops, get_msg_cb, helper);
static gboolean
-action_receive (const gchar* account_name)
+action_receive (const gchar* account_name,
+ ModestWindow *win)
{
TnyAccount *tny_account;
ModestMailOperation *mail_op;
/* Create the mail operation */
/* TODO: The spec wants us to first do any pending deletions, before receiving. */
- mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE);
+ mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE, G_OBJECT(win));
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op);
modest_mail_operation_update_account (mail_op, TNY_STORE_ACCOUNT(tny_account));
* for SMTP we should send,
* first receiving, then sending:
*/
- if (!action_receive(account_name))
+ if (!action_receive(account_name, win))
g_printerr ("modest: failed to receive\n");
if (!action_send(account_name))
g_printerr ("modest: failed to send\n");
* for SMTP we should send,
* first receiving, then sending:
*/
- if (!action_receive(account_name))
+ if (!action_receive(account_name, win))
g_printerr ("modest: failed to receive for account %s\n", account_name);
if (!action_send(account_name))
g_printerr ("modest: failed to send for account %s\n", account_name);
headers = tny_iterator_get_list (helper->iter);
g_object_unref (G_OBJECT (headers));
g_object_unref (G_OBJECT (helper->iter));
+ g_object_unref (G_OBJECT (helper->mail_op));
if (rf_helper != NULL) {
g_free (rf_helper->account_name);
g_slice_free (ReplyForwardHelper, rf_helper);
} else {
TnyHeader *header;
header = TNY_HEADER (tny_iterator_get_current (helper->iter));
-/* tny_folder_get_msg_async (folder, header, */
-/* get_msg_cb, NULL, helper); */
modest_mail_operation_process_msg (helper->mail_op, header, helper->num_ops, get_msg_cb, helper);
g_object_unref (G_OBJECT(header));
ModestWindow *win = NULL;
TnyFolder *folder = NULL;
TnyMsg *msg = NULL;
+ TnyFolderType folder_type = TNY_FOLDER_TYPE_UNKNOWN;
ModestWindowMgr *mgr;
GtkTreeModel *model;
GtkTreeIter iter;
g_printerr ("modest: cannot get folder for header\n");
return;
}
+ if (modest_tny_folder_is_local_folder (folder))
+ folder_type = modest_tny_folder_get_local_folder_type (folder);
/* FIXME: make async?; check error */
msg = tny_folder_get_msg (folder, header, NULL);
if (sel_list != NULL) {
gtk_tree_model_get_iter (model, &iter, (GtkTreePath *) sel_list->data);
- win = modest_msg_view_window_new_with_header_model (msg, account, model, iter);
+ switch (folder_type) {
+ case TNY_FOLDER_TYPE_DRAFTS:
+ win = modest_msg_edit_window_new (msg, account);
+ break;
+ default:
+ win = modest_msg_view_window_new_with_header_model (msg, account, model, iter);
+ }
+
g_list_foreach (sel_list, (GFunc) gtk_tree_path_free, NULL);
g_list_free (sel_list);
} else {
from = modest_account_mgr_get_from_string (account_mgr, account_name);
/* Create the mail operation */
- mail_operation = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_INFO);
+ mail_operation = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_INFO, G_OBJECT(edit_window));
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_operation);
modest_mail_operation_save_to_drafts (mail_operation,
from = modest_account_mgr_get_from_string (account_mgr, account_name);
/* Create the mail operation */
- mail_operation = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_SEND);
+ mail_operation = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_SEND, G_OBJECT(edit_window));
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_operation);
modest_mail_operation_send_new_mail (mail_operation,
if (result == GTK_RESPONSE_REJECT) {
finished = TRUE;
} else {
- ModestMailOperation *mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_INFO);
+ ModestMailOperation *mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_INFO, G_OBJECT(main_window));
TnyFolder *new_folder = NULL;
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
if (folder_name != NULL && strlen (folder_name) > 0) {
ModestMailOperation *mail_op;
- mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_INFO);
+ mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_INFO, G_OBJECT(main_window));
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
g_free (message);
if (response == GTK_RESPONSE_OK) {
- ModestMailOperation *mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_DELETE);
+ ModestMailOperation *mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_DELETE, G_OBJECT(main_window));
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
src_folder = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view));
if (TNY_IS_FOLDER (src_folder)) {
- mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE);
+ mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE, G_OBJECT(win));
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
/* Transfer messages */
if (response == GTK_RESPONSE_OK) {
- mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE);
+ mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE, G_OBJECT(win));
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
ModestMailOperation *mail_op;
/* Create mail op */
- mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE);
+ mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE, G_OBJECT(win));
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);