+void
+modest_attachments_view_get_sizes (ModestAttachmentsView *attachments_view,
+ gint *attachments_count,
+ guint64 *attachments_size)
+{
+ ModestAttachmentsViewPrivate *priv;
+ GList *children, *node;
+
+ g_return_if_fail (MODEST_IS_ATTACHMENTS_VIEW (attachments_view));
+ g_return_if_fail (attachments_count != NULL && attachments_size != NULL);
+
+ *attachments_count = 0;
+ *attachments_size = 0;
+
+ priv = MODEST_ATTACHMENTS_VIEW_GET_PRIVATE (attachments_view);
+
+ children = gtk_container_get_children (GTK_CONTAINER (priv->box));
+ for (node = children; node != NULL; node = g_list_next (node)) {
+ GtkWidget *att_view = (GtkWidget *) node->data;
+ TnyMimePart *part = tny_mime_part_view_get_part (TNY_MIME_PART_VIEW (att_view));
+
+ if (!tny_mime_part_is_purged (part)) {
+ guint64 size;
+ (*attachments_count) ++;
+ size = modest_attachment_view_get_size (MODEST_ATTACHMENT_VIEW (att_view));
+ if (size == 0) {
+ /* we do a random estimation of the size of an attachment */
+ size = 32768;
+ }
+ *attachments_size += size;
+
+ }
+ g_object_unref (part);
+ }
+ g_list_free (children);
+}
+