[evolution] Use message subject for attachment description if no filename provided



commit 8b0f78bb9c5ab6f3903b99a62704c3bb2a018467
Author: Milan Crha <mcrha redhat com>
Date:   Thu Mar 10 11:43:25 2011 +0100

    Use message subject for attachment description if no filename provided

 em-format/em-format.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/em-format/em-format.c b/em-format/em-format.c
index e71e2a9..a4300a9 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -1458,6 +1458,13 @@ em_format_describe_part (CamelMimePart *part,
 	filename = camel_mime_part_get_filename (part);
 	description = camel_mime_part_get_description (part);
 
+	if (!filename || !*filename) {
+		CamelDataWrapper *content = camel_medium_get_content (CAMEL_MEDIUM (part));
+
+		if (content && CAMEL_IS_MIME_MESSAGE (content))
+			filename = camel_mime_message_get_subject (CAMEL_MIME_MESSAGE (content));
+	}
+
 	if (filename != NULL && *filename != '\0') {
 		gchar *basename = g_path_get_basename (filename);
 		g_string_append_printf (stext, " (%s)", basename);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]