diff options
author | Radek Doulik <rodo@helixcode.com> | 2000-11-08 21:04:59 +0800 |
---|---|---|
committer | Radek Doulik <rodo@src.gnome.org> | 2000-11-08 21:04:59 +0800 |
commit | 413284362ffbc5185e72dd2e246ba88f912ffbdb (patch) | |
tree | afda74bae4af39be83a1bf854ab3ec6e9a0a848f /camel/camel-mime-utils.c | |
parent | 494b8db2bc3146db573f45ce7a74f63c1472a7ee (diff) | |
download | gsoc2013-evolution-413284362ffbc5185e72dd2e246ba88f912ffbdb.tar.gz gsoc2013-evolution-413284362ffbc5185e72dd2e246ba88f912ffbdb.tar.zst gsoc2013-evolution-413284362ffbc5185e72dd2e246ba88f912ffbdb.zip |
new function, moved from composer
2000-11-08 Radek Doulik <rodo@helixcode.com>
* camel-mime-utils.c (mime_guess_type_from_file_name): new
function, moved from composer
svn path=/trunk/; revision=6506
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r-- | camel/camel-mime-utils.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index f1dbe6de4c..18c005e3fb 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -40,6 +40,8 @@ #include <ctype.h> #include <errno.h> +#include <libgnomevfs/gnome-vfs.h> + #include "camel-mime-utils.h" #include "camel-charset-map.h" @@ -3089,3 +3091,22 @@ header_msgid_generate (void) return g_strdup_printf ("%d.%d.%d.camel@%s.%s", (gint) time (NULL), getpid (), count++, host, domain); } + +gchar * +mime_guess_type_from_file_name (const gchar *file_name) +{ + GnomeVFSFileInfo info; + GnomeVFSResult result; + + result = gnome_vfs_get_file_info (file_name, &info, + GNOME_VFS_FILE_INFO_GET_MIME_TYPE | + GNOME_VFS_FILE_INFO_FOLLOW_LINKS); + if (result == GNOME_VFS_OK) { + gchar *type; + + type = g_strdup (gnome_vfs_file_info_get_mime_type (&info)); + gnome_vfs_file_info_unref (&info); + return type; + } else + return NULL; +} |