* Fixes NB#81095, cancel the retrieval operations before disconnecting the account...
authorSergio Villar Senin <svillar@igalia.com>
Fri, 14 Mar 2008 12:34:55 +0000 (12:34 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Fri, 14 Mar 2008 12:34:55 +0000 (12:34 +0000)
* Do not show error messages when the message retrieval is canceled

pmo-trunk-r4312

src/modest-mail-operation.c
src/modest-tny-account-store.c
src/modest-ui-actions.c

index 6f7d2ab..f1ecaa5 100644 (file)
@@ -2183,10 +2183,10 @@ get_msg_async_cb (TnyFolder *folder,
        }
 
        /* If canceled by the user, ignore the error given by Tinymail */
        }
 
        /* If canceled by the user, ignore the error given by Tinymail */
-       if (priv->status == MODEST_MAIL_OPERATION_STATUS_CANCELED) {
+       if (priv->status == MODEST_MAIL_OPERATION_STATUS_CANCELED || canceled) {
                canceled = TRUE;
                finished = TRUE;
                canceled = TRUE;
                finished = TRUE;
-       } else if (canceled || err) {
+       } else if (err) {
                priv->status = MODEST_MAIL_OPERATION_STATUS_FINISHED_WITH_ERRORS;
                if (err) {
                        priv->error = g_error_copy ((const GError *) err);
                priv->status = MODEST_MAIL_OPERATION_STATUS_FINISHED_WITH_ERRORS;
                if (err) {
                        priv->error = g_error_copy ((const GError *) err);
index 05f8fc2..22bb121 100644 (file)
@@ -1693,12 +1693,12 @@ on_account_disconnect_when_removing (TnyCamelAccount *account,
        /* Notify the observers */
        g_signal_emit (G_OBJECT (self), signals [ACCOUNT_REMOVED_SIGNAL], 
                       0, account);
        /* Notify the observers */
        g_signal_emit (G_OBJECT (self), signals [ACCOUNT_REMOVED_SIGNAL], 
                       0, account);
-       
-       /* Unref the extra reference added by get_server_account */
-       g_object_unref (account);
 
        /* Cancel all pending operations */
        tny_account_cancel (TNY_ACCOUNT (account));
 
        /* Cancel all pending operations */
        tny_account_cancel (TNY_ACCOUNT (account));
+       
+       /* Unref the extra reference added by get_server_account */
+       g_object_unref (account);
 
        /* Clear the cache if it's an store account */
        if (TNY_IS_STORE_ACCOUNT (account))
 
        /* Clear the cache if it's an store account */
        if (TNY_IS_STORE_ACCOUNT (account))
@@ -1726,6 +1726,9 @@ on_account_removed (ModestAccountMgr *acc_mgr,
        /* If there was any problem creating the account, for example,
           with the configuration system this could not exist */
        if (store_account) {
        /* If there was any problem creating the account, for example,
           with the configuration system this could not exist */
        if (store_account) {
+               /* Cancel all pending operations */
+               tny_account_cancel (TNY_ACCOUNT (store_account));
+
                /* Disconnect before deleting the cache, because the
                   disconnection will rewrite the cache to the
                   disk */
                /* Disconnect before deleting the cache, because the
                   disconnection will rewrite the cache to the
                   disk */
@@ -1759,6 +1762,9 @@ on_account_removed (ModestAccountMgr *acc_mgr,
                        g_warning ("Removing a transport account that has no outbox");
                }
 
                        g_warning ("Removing a transport account that has no outbox");
                }
 
+               /* Cancel all pending operations */
+               tny_account_cancel (TNY_ACCOUNT (transport_account));
+
                /* Disconnect and notify the observers. The callback will free the reference */
                tny_camel_account_set_online (TNY_CAMEL_ACCOUNT (transport_account), FALSE,
                                              on_account_disconnect_when_removing, self);
                /* Disconnect and notify the observers. The callback will free the reference */
                tny_camel_account_set_online (TNY_CAMEL_ACCOUNT (transport_account), FALSE,
                                              on_account_disconnect_when_removing, self);
index 9cad865..efa8abc 100644 (file)
@@ -981,24 +981,26 @@ modest_ui_actions_disk_operations_error_handler (ModestMailOperation *mail_op,
 {
        const GError *error;
        GObject *win = NULL;
 {
        const GError *error;
        GObject *win = NULL;
+       ModestMailOperationStatus status;
 
        win = modest_mail_operation_get_source (mail_op);
        error = modest_mail_operation_get_error (mail_op);
 
        win = modest_mail_operation_get_source (mail_op);
        error = modest_mail_operation_get_error (mail_op);
+       status = modest_mail_operation_get_status (mail_op);
 
 
-       /* Show error */
-       if (error->code == TNY_SYSTEM_ERROR_MEMORY ||
-           error->code == TNY_IO_ERROR_WRITE ||
-           error->code == TNY_IO_ERROR_READ) {
-               ModestMailOperationStatus st = modest_mail_operation_get_status (mail_op);
-               /* If the mail op has been cancelled then it's not an error: don't show any message */
-               if (st != MODEST_MAIL_OPERATION_STATUS_CANCELED) {
+       /* If the mail op has been cancelled then it's not an error:
+          don't show any message */
+       if (status != MODEST_MAIL_OPERATION_STATUS_CANCELED) {
+               /* Show error */
+               if (error->code == TNY_SYSTEM_ERROR_MEMORY ||
+                   error->code == TNY_IO_ERROR_WRITE ||
+                   error->code == TNY_IO_ERROR_READ) {
                        modest_platform_information_banner ((GtkWidget *) win,
                                                            NULL, dgettext("ke-recv",
                                                                           "cerm_device_memory_full"));
                        modest_platform_information_banner ((GtkWidget *) win,
                                                            NULL, dgettext("ke-recv",
                                                                           "cerm_device_memory_full"));
+               } else if (user_data) {
+                       modest_platform_information_banner ((GtkWidget *) win, 
+                                                           NULL, user_data);
                }
                }
-       } else if (user_data) {
-               modest_platform_information_banner ((GtkWidget *) win, 
-                                                   NULL, user_data);
        }
 
        if (win)
        }
 
        if (win)