aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-02-20 19:01:43 +0800
committerMilan Crha <mcrha@redhat.com>2013-02-20 19:01:43 +0800
commitf61b0bb332c789bc050452355defd6ce654a7c43 (patch)
tree9bd4c34df5f360ae9ca28a39fbb9d4910af41c80 /widgets
parent9064d9e60105f51bdf63ff1b2aeba51efa003998 (diff)
downloadgsoc2013-evolution-f61b0bb332c789bc050452355defd6ce654a7c43.tar.gz
gsoc2013-evolution-f61b0bb332c789bc050452355defd6ce654a7c43.tar.zst
gsoc2013-evolution-f61b0bb332c789bc050452355defd6ce654a7c43.zip
EAttachment: Use Subject as fallback filename for message attachments
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/e-attachment.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index 8a4ff29cda..14527fdc91 100644
--- a/widgets/misc/e-attachment.c
+++ b/widgets/misc/e-attachment.c
@@ -1840,6 +1840,27 @@ attachment_load_from_mime_part_thread (GSimpleAsyncResult *simple,
if (string == NULL) {
/* Translators: Default attachment filename. */
string = _("attachment.dat");
+
+ if (camel_content_type_is (content_type, "message", "rfc822")) {
+ CamelMimeMessage *msg = NULL;
+ const gchar *subject = NULL;
+
+ if (CAMEL_IS_MIME_MESSAGE (mime_part)) {
+ msg = CAMEL_MIME_MESSAGE (mime_part);
+ } else {
+ CamelDataWrapper *content;
+
+ content = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
+ if (CAMEL_IS_MIME_MESSAGE (content))
+ msg = CAMEL_MIME_MESSAGE (content);
+ }
+
+ if (msg)
+ subject = camel_mime_message_get_subject (msg);
+
+ if (subject && *subject)
+ string = subject;
+ }
} else {
decoded_string = camel_header_decode_string (string, "UTF-8");
if (decoded_string && *decoded_string && !g_str_equal (decoded_string, string)) {