Fix cummulative checking of attachments size on modest_ui_actions_compose_msg
authorJose Dapena Paz <jdapena@igalia.com>
Thu, 14 May 2009 11:13:11 +0000 (13:13 +0200)
committerJose Dapena Paz <jdapena@igalia.com>
Thu, 14 May 2009 11:29:37 +0000 (13:29 +0200)
* src/modest-ui-actions.c (modest_ui_actions_on_compose_msg): fix the
  second calculation of the space allocated by attachments, as it was wrong
  (fixes NB#111542).

src/modest-ui-actions.c

index f94973a..e6fc380 100644 (file)
@@ -931,16 +931,18 @@ modest_ui_actions_compose_msg(ModestWindow *win,
        gtk_widget_show_all (GTK_WIDGET (msg_win));
 
        while (attachments) {
-               total_size +=
+               GnomeVFSFileSize att_size;
+               att_size =
                        modest_msg_edit_window_attach_file_one((ModestMsgEditWindow *)msg_win,
                                                               attachments->data, allowed_size);
+               total_size += att_size;
 
-               if (total_size > allowed_size) {
+               if (att_size > allowed_size) {
                        g_warning ("%s: total size: %u",
                                   __FUNCTION__, (unsigned int)total_size);
                        break;
                }
-               allowed_size -= total_size;
+               allowed_size -= att_size;
 
                attachments = g_slist_next(attachments);
        }