aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-attachment.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-02-23 00:00:10 +0800
committerMilan Crha <mcrha@redhat.com>2011-02-23 00:00:10 +0800
commitcb2362dee06e672ddc4b300ba677188ae4a6dc42 (patch)
treeb1aa2d580bf2c4c9413d70fb4ee58c2086c1a897 /widgets/misc/e-attachment.c
parent3c516cb10a9ec929143b7b806bcdc5be491c0924 (diff)
downloadgsoc2013-evolution-cb2362dee06e672ddc4b300ba677188ae4a6dc42.tar
gsoc2013-evolution-cb2362dee06e672ddc4b300ba677188ae4a6dc42.tar.gz
gsoc2013-evolution-cb2362dee06e672ddc4b300ba677188ae4a6dc42.tar.bz2
gsoc2013-evolution-cb2362dee06e672ddc4b300ba677188ae4a6dc42.tar.lz
gsoc2013-evolution-cb2362dee06e672ddc4b300ba677188ae4a6dc42.tar.xz
gsoc2013-evolution-cb2362dee06e672ddc4b300ba677188ae4a6dc42.tar.zst
gsoc2013-evolution-cb2362dee06e672ddc4b300ba677188ae4a6dc42.zip
Bug #623593 - Cannot drag&drop attached messages from mails
Diffstat (limited to 'widgets/misc/e-attachment.c')
-rw-r--r--widgets/misc/e-attachment.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index 0a3bfabb05..a96f7ed4ad 100644
--- a/widgets/misc/e-attachment.c
+++ b/widgets/misc/e-attachment.c
@@ -1358,26 +1358,49 @@ e_attachment_get_thumbnail_path (EAttachment *attachment)
return g_file_info_get_attribute_byte_string (file_info, attribute);
}
-gboolean
-e_attachment_is_rfc822 (EAttachment *attachment)
+/**
+ * e_attachment_get_mime_type:
+ *
+ * Returns mime_type part of the file_info as a newly allocated string,
+ * which should be freed with g_free().
+ * Returns NULL, if mime_type not found or set on the attachment.
+ **/
+gchar *
+e_attachment_get_mime_type (EAttachment *attachment)
{
GFileInfo *file_info;
const gchar *content_type;
gchar *mime_type;
- gboolean is_rfc822;
- g_return_val_if_fail (E_IS_ATTACHMENT (attachment), FALSE);
+ g_return_val_if_fail (E_IS_ATTACHMENT (attachment), NULL);
file_info = e_attachment_get_file_info (attachment);
if (file_info == NULL)
- return FALSE;
+ return NULL;
content_type = g_file_info_get_content_type (file_info);
if (content_type == NULL)
- return FALSE;
+ return NULL;
mime_type = g_content_type_get_mime_type (content_type);
- is_rfc822 = (g_ascii_strcasecmp (mime_type, "message/rfc822") == 0);
+ if (!mime_type)
+ return NULL;
+
+ camel_strdown (mime_type);
+
+ return mime_type;
+}
+
+gboolean
+e_attachment_is_rfc822 (EAttachment *attachment)
+{
+ gchar *mime_type;
+ gboolean is_rfc822;
+
+ g_return_val_if_fail (E_IS_ATTACHMENT (attachment), FALSE);
+
+ mime_type = e_attachment_get_mime_type (attachment);
+ is_rfc822 = mime_type && g_ascii_strcasecmp (mime_type, "message/rfc822") == 0;
g_free (mime_type);
return is_rfc822;