Bug 329692 – attachment siz e in composer not shown when reopening
Jean-Christophe BEGUE <[email protected]> Fri, 11 Jan 2008 10:39:38 +0100
| Newsgroups | gmane.comp.gnome.evolution.patches |
|---|---|
| Message-ID | <1200044378.6337.8.camel@jc-ulaptop> |
Hello, This bug implies both evolution and evolution-data-server. I added a function called camel_mime_part_get_content_size () to evolution-data-server/camel/mime-part.c and used it in evolution/widget/misc/attachment.c. There's still a problem: the size displayed is bigger than the real file size because camel_data_wrapper_decode_to_stream () (used with an null stream to get the size) returns size of encoded data. How could i fix it? This is my first patch, I hope i did everything right.(Please tell me what i did wrong.) Sorry for my english. Regards, Jean-Christophe BEGUE _______________________________________________ Evolution-patches mailing list [email protected] http://mail.gnome.org/mailman/listinfo/evolution-patches
evolution329692.diff
(text/x-patch, 461 B)
Index: widgets/misc/e-attachment.c =================================================================== --- widgets/misc/e-attachment.c (révision 34779) +++ widgets/misc/e-attachment.c (copie de travail) @@ -600,7 +600,7 @@ new->body = part; new->guessed_type = FALSE; new->is_available_local = TRUE; - new->size = 0; + new->size = camel_mime_part_get_content_size (part); new->file_name = g_strdup (camel_mime_part_get_filename(part)); return new;
evolution-data-server-329692.diff
(text/x-patch, 1.2 KB)
Index: camel/camel-mime-part.c
===================================================================
--- camel/camel-mime-part.c (révision 8343)
+++ camel/camel-mime-part.c (copie de travail)
@@ -1060,3 +1060,25 @@
medium->content = NULL;
}
}
+
+/**
+ * camel_mime_part_get_content_size
+ * @mime_part: a #CamelMimePart object
+ *
+ * Function used to get the size of the mime part provided data.
+ **/
+
+ssize_t
+camel_mime_part_get_content_size (CamelMimePart *mime_part)
+{
+ ssize_t written;
+ CamelStreamNull *nstream;
+ CamelMedium *medium = CAMEL_MEDIUM (mime_part);
+ CamelDataWrapper *dw = camel_medium_get_content_object (medium);
+
+ nstream = camel_stream_null_new ();
+ written = camel_data_wrapper_write_to_stream (dw, nstream);
+ camel_object_unref (nstream);
+
+ return written;
+}
Index: camel/camel-mime-part.h
===================================================================
--- camel/camel-mime-part.h (révision 8343)
+++ camel/camel-mime-part.h (copie de travail)
@@ -103,6 +103,8 @@
void camel_mime_part_set_content (CamelMimePart *mime_part,
const char *content, int length, const char *type);
+ssize_t camel_mime_part_get_content_size (CamelMimePart *mime_part);
+
G_END_DECLS
#endif /* CAMEL_MIME_PART_H */