* src/modest-mail-operation.c:
authorJose Dapena Paz <jdapena@igalia.com>
Thu, 22 Nov 2007 12:16:12 +0000 (12:16 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Thu, 22 Nov 2007 12:16:12 +0000 (12:16 +0000)
        * Removed the message sending information banner here.
        * Now we allocate the send queue handler only when we really
          send the message.
        * Removed notify end in send new mail cb, as this should be done
          in send mail handlers. Added also to send mail operation
          branch where we don't attach to the send queue.
* src/modest-ui-actions.c:
        * Added mail sending information banner.

pmo-trunk-r3794

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

index b90a826..61e449e 100644 (file)
@@ -596,7 +596,7 @@ modest_mail_operation_send_mail (ModestMailOperation *self,
 {
        TnySendQueue *send_queue = NULL;
        ModestMailOperationPrivate *priv;
-       SendMsgInfo *info = g_slice_new0 (SendMsgInfo);
+       SendMsgInfo *info;
        
        g_return_if_fail (MODEST_IS_MAIL_OPERATION (self));
        g_return_if_fail (TNY_IS_TRANSPORT_ACCOUNT (transport_account));
@@ -616,6 +616,7 @@ modest_mail_operation_send_mail (ModestMailOperation *self,
                             MODEST_MAIL_OPERATION_ERROR_ITEM_NOT_FOUND,
                             "modest: could not find send queue for account\n");
                priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
+               modest_mail_operation_notify_end (self);
 
        } else {
                /* Add the msg to the queue */
@@ -624,18 +625,17 @@ modest_mail_operation_send_mail (ModestMailOperation *self,
                                           msg, 
                                           &(priv->error));
 
-               priv->status = MODEST_MAIL_OPERATION_STATUS_SUCCESS;
-       }
+               priv->status = MODEST_MAIL_OPERATION_STATUS_IN_PROGRESS;
 
-       if (priv->status == MODEST_MAIL_OPERATION_STATUS_SUCCESS)
-               modest_platform_information_banner (NULL, NULL, _("mcen_ib_outbox_waiting_to_be_sent"));
+               info = g_slice_new0 (SendMsgInfo);
 
-       info->mail_op = g_object_ref (self);
-       info->msg = g_object_ref (msg);
-       info->msg_sent_handler = g_signal_connect (G_OBJECT (send_queue), "msg-sent",
-                                                  G_CALLBACK (send_mail_msg_sent_handler), info);
-       info->error_happened_handler = g_signal_connect (G_OBJECT (send_queue), "error-happened",
-                                                        G_CALLBACK (send_mail_error_happened_handler), info);
+               info->mail_op = g_object_ref (self);
+               info->msg = g_object_ref (msg);
+               info->msg_sent_handler = g_signal_connect (G_OBJECT (send_queue), "msg-sent",
+                                                          G_CALLBACK (send_mail_msg_sent_handler), info);
+               info->error_happened_handler = g_signal_connect (G_OBJECT (send_queue), "error-happened",
+                                                                G_CALLBACK (send_mail_error_happened_handler), info);
+       }
 
 }
 
@@ -880,7 +880,6 @@ end:
        if (info->transport_account)
                g_object_unref (info->transport_account);
        g_slice_free (SendNewMailInfo, info);
-       modest_mail_operation_notify_end (self);
 }
 
 void
index 9708e5c..e887e02 100644 (file)
@@ -2399,6 +2399,10 @@ modest_ui_actions_on_send (GtkWidget *widget, ModestMsgEditWindow *edit_window)
                                             data->attachments,
                                             data->images,
                                             data->priority_flags);
+
+       if (modest_mail_operation_get_status (mail_operation) == MODEST_MAIL_OPERATION_STATUS_IN_PROGRESS)
+               modest_platform_information_banner (NULL, NULL, _("mcen_ib_outbox_waiting_to_be_sent"));
+
                                             
        /* Free data: */
        g_free (from);