diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-02-04 03:31:39 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-02-04 03:31:39 +0800 |
commit | a25698c1973869bfd63ea8c71e1cf88b26105cf1 (patch) | |
tree | 160c159390b62369c7bf215a9343425ac995ae09 | |
parent | 362511859678492f0deadfb4992d58e982d35728 (diff) | |
download | gsoc2013-evolution-a25698c1973869bfd63ea8c71e1cf88b26105cf1.tar gsoc2013-evolution-a25698c1973869bfd63ea8c71e1cf88b26105cf1.tar.gz gsoc2013-evolution-a25698c1973869bfd63ea8c71e1cf88b26105cf1.tar.bz2 gsoc2013-evolution-a25698c1973869bfd63ea8c71e1cf88b26105cf1.tar.lz gsoc2013-evolution-a25698c1973869bfd63ea8c71e1cf88b26105cf1.tar.xz gsoc2013-evolution-a25698c1973869bfd63ea8c71e1cf88b26105cf1.tar.zst gsoc2013-evolution-a25698c1973869bfd63ea8c71e1cf88b26105cf1.zip |
Just use gnome_vfs_get_mime_type_from_name() so we can forget all the crap
2003-02-03 Jeffrey Stedfast <fejj@ximian.com>
* mail-identify.c (mail_identify_mime_part): Just use
gnome_vfs_get_mime_type_from_name() so we can forget all the crap
I implemented before.
svn path=/trunk/; revision=19714
-rw-r--r-- | mail/mail-identify.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/mail/mail-identify.c b/mail/mail-identify.c index c51831fc63..bb05b2f72c 100644 --- a/mail/mail-identify.c +++ b/mail/mail-identify.c @@ -30,6 +30,7 @@ #include <string.h> #include <glib.h> +#include <libgnomevfs/gnome-vfs-mime.h> #include <libgnomevfs/gnome-vfs-utils.h> #include <libgnomevfs/gnome-vfs-mime-utils.h> #include "mail.h" @@ -50,9 +51,8 @@ static const char *identify_by_magic (CamelDataWrapper *data, MailDisplay *md); char * mail_identify_mime_part (CamelMimePart *part, MailDisplay *md) { - const char *filename, *magic_type = NULL; + const char *filename, *name_type = NULL, *magic_type = NULL; CamelDataWrapper *data; - char *name_type = NULL; filename = camel_mime_part_get_filename (part); if (filename) { @@ -60,7 +60,7 @@ mail_identify_mime_part (CamelMimePart *part, MailDisplay *md) if (!strcmp (filename, "winmail.dat")) return g_strdup ("application/vnd.ms-tnef"); - name_type = gnome_vfs_get_mime_type_from_name (filename); + name_type = gnome_vfs_mime_type_from_name (filename); } data = camel_medium_get_content_object (CAMEL_MEDIUM (part)); @@ -74,26 +74,24 @@ mail_identify_mime_part (CamelMimePart *part, MailDisplay *md) * that instead. */ if (!strcmp (magic_type, "text/plain")) - return name_type; + return g_strdup (name_type); /* If if returns "application/octet-stream" try to * do better with the filename check. */ if (!strcmp (magic_type, "application/octet-stream")) - return name_type; + return g_strdup (name_type); } /* If the MIME part data was online, and the magic check * returned something, use that, since it's more reliable. */ - if (magic_type) { - g_free (name_type); + if (magic_type) return g_strdup (magic_type); - } /* Otherwise try guessing based on the filename */ if (name_type) - return name_type; + return g_strdup (name_type); /* Another possibility to try is the x-mac-type / x-mac-creator * parameter to Content-Type used by some Mac email clients. That |