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
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:41:37 +0800
commit391e21025ae5ff0a5b7f0c5280886b329c993ec5 (patch)
tree23aac589f4ead8a24ec1e65bc202b94bb1273395 /widgets/misc/e-attachment.c
parent410dbf8e7ab784df090650104d3e2334487c110e (diff)
downloadgsoc2013-evolution-391e21025ae5ff0a5b7f0c5280886b329c993ec5.tar
gsoc2013-evolution-391e21025ae5ff0a5b7f0c5280886b329c993ec5.tar.gz
gsoc2013-evolution-391e21025ae5ff0a5b7f0c5280886b329c993ec5.tar.bz2
gsoc2013-evolution-391e21025ae5ff0a5b7f0c5280886b329c993ec5.tar.lz
gsoc2013-evolution-391e21025ae5ff0a5b7f0c5280886b329c993ec5.tar.xz
gsoc2013-evolution-391e21025ae5ff0a5b7f0c5280886b329c993ec5.tar.zst
gsoc2013-evolution-391e21025ae5ff0a5b7f0c5280886b329c993ec5.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;