* src/modest-ui-actions.c:
authorJose Dapena Paz <jdapena@igalia.com>
Wed, 11 Jul 2007 12:43:35 +0000 (12:43 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Wed, 11 Jul 2007 12:43:35 +0000 (12:43 +0000)
        * Removed annoying warning for check retrieval in message open
          handler. THis was appearing everytime we cancelled a
          message retrieval.
* src/modest-mail-operation.c:
        * Now we notify the end of the mail operation before
          unreferencing. This prevents a crash.
        * Now we do a tny_account_cancel in status handler when we
          get a cancel status. This way we properly cancel the
          message download (and then we can try again to open the
          message as expected (fixes NB#62444).

pmo-trunk-r2696

src/modest-mail-operation.c
src/modest-ui-actions.c

index b21a831..26c8c94 100644 (file)
@@ -1962,13 +1962,13 @@ get_msg_cb (TnyFolder *folder,
                gdk_threads_leave ();   
        }
 
                gdk_threads_leave ();   
        }
 
+       /* Notify about operation end */
+       modest_mail_operation_notify_end (self);
        /* Free */
        g_object_unref (helper->mail_op);
        g_object_unref (helper->header);
        g_slice_free (GetMsgAsyncHelper, helper);
                
        /* Free */
        g_object_unref (helper->mail_op);
        g_object_unref (helper->header);
        g_slice_free (GetMsgAsyncHelper, helper);
                
-       /* Notify about operation end */
-       modest_mail_operation_notify_end (self);
 }
 
 static void     
 }
 
 static void     
@@ -1990,8 +1990,20 @@ get_msg_status_cb (GObject *obj,
        self = helper->mail_op;
        priv = MODEST_MAIL_OPERATION_GET_PRIVATE(self);
 
        self = helper->mail_op;
        priv = MODEST_MAIL_OPERATION_GET_PRIVATE(self);
 
-       if(priv->status == MODEST_MAIL_OPERATION_STATUS_CANCELED)
+       if(priv->status == MODEST_MAIL_OPERATION_STATUS_CANCELED) {
+               TnyFolder *folder = tny_header_get_folder (helper->header);
+               if (folder) {
+                       TnyAccount *account;
+                       account = tny_folder_get_account (folder);
+                       if (account) {
+                               tny_account_cancel (account);
+                               g_object_unref (account);
+                       }
+                       g_object_unref (folder);
+               }
+              
                return;
                return;
+       }
 
        priv->done = 1;
        priv->total = 1;
 
        priv->done = 1;
        priv->total = 1;
@@ -2118,7 +2130,7 @@ get_msgs_full_thread (gpointer thr_user_data)
                                                         info_notify, NULL);
                                }
                                g_object_unref (msg);
                                                         info_notify, NULL);
                                }
                                g_object_unref (msg);
-                       }
+                       } 
                } else {
                        /* Set status failed and set an error */
                        priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
                } else {
                        /* Set status failed and set an error */
                        priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
index 14a7f28..bfd986d 100644 (file)
@@ -701,8 +701,6 @@ open_msg_cb (ModestMailOperation *mail_op,
           operation. The error will be shown by the error_handler of
           the mail operation */
        if (!modest_ui_actions_msg_retrieval_check (mail_op, header, msg)) {
           operation. The error will be shown by the error_handler of
           the mail operation */
        if (!modest_ui_actions_msg_retrieval_check (mail_op, header, msg)) {
-               printf ("DEBUG: %s: modest_ui_actions_msg_retrieval_check() failed.\n", 
-                       __FUNCTION__);
                return;
        }
 
                return;
        }