MIME typing

MIME typing —

Synopsis




void        gnome_vfs_mime_shutdown         (void);
const char* gnome_vfs_mime_type_from_name   (const char *filename);
const char* gnome_vfs_mime_type_from_name_or_default
                                            (const char *filename,
                                             const char *defaultv);
const char* gnome_vfs_get_mime_type_common  (GnomeVFSURI *uri);
const char* gnome_vfs_get_mime_type_from_uri
                                            (GnomeVFSURI *uri);
const char* gnome_vfs_get_mime_type_from_file_data
                                            (GnomeVFSURI *uri);
const char* gnome_vfs_get_file_mime_type    (const char *path,
                                             const struct stat *optional_stat_info,
                                             gboolean suffix_only);
gboolean    gnome_vfs_mime_type_is_supertype
                                            (const char *mime_type);
char*       gnome_vfs_get_supertype_from_mime_type
                                            (const char *mime_type);

Description

Details

gnome_vfs_mime_shutdown ()

void        gnome_vfs_mime_shutdown         (void);

Unload the MIME database from memory.


gnome_vfs_mime_type_from_name ()

const char* gnome_vfs_mime_type_from_name   (const char *filename);

Determined the mime type for filename.

filename : A filename (the file does not necessarily exist).
Returns :the mime-type for this filename.

gnome_vfs_mime_type_from_name_or_default ()

const char* gnome_vfs_mime_type_from_name_or_default
                                            (const char *filename,
                                             const char *defaultv);

This routine tries to determine the mime-type of the filename only by looking at the filename from the GNOME database of mime-types.

filename : A filename (the file does not necesarily exist).
defaultv : A default value to be returned if no match is found
Returns :the mime-type of the filename. If no value could be determined, it will return defaultv.

gnome_vfs_get_mime_type_common ()

const char* gnome_vfs_get_mime_type_common  (GnomeVFSURI *uri);

Tries to guess the mime type of the file represented by uir. Favors using the file data to the uri extension. Handles passing uri of a non-existent file by falling back on returning a type based on the extension.

FIXME: This function will not necessarily return the same mime type as doing a get file info on the text uri.

uri : a real file or a non-existent uri.
Returns : the mime-type for this uri.

gnome_vfs_get_mime_type_from_uri ()

const char* gnome_vfs_get_mime_type_from_uri
                                            (GnomeVFSURI *uri);

Tries to guess the mime type of the file uri by checking the file name extension. Works on non-existent files.

uri : A file uri.
Returns :the mime-type for this filename.

gnome_vfs_get_mime_type_from_file_data ()

const char* gnome_vfs_get_mime_type_from_file_data
                                            (GnomeVFSURI *uri);

Tries to guess the mime type of the file uri by checking the file data using the magic patterns. Does not handle text files properly

uri : A file uri.
Returns :the mime-type for this filename.

gnome_vfs_get_file_mime_type ()

const char* gnome_vfs_get_file_mime_type    (const char *path,
                                             const struct stat *optional_stat_info,
                                             gboolean suffix_only);

Tries to guess the mime type of the file represented by path. If suffix_only is false, uses the mime-magic based lookup first. Handles passing path of a non-existent file by falling back on returning a type based on the extension.

path : a path of a file.
optional_stat_info : optional stat buffer.
suffix_only : whether or not to do a magic-based lookup.
Returns : the mime-type for this path

gnome_vfs_mime_type_is_supertype ()

gboolean    gnome_vfs_mime_type_is_supertype
                                            (const char *mime_type);

mime_type :
Returns :

gnome_vfs_get_supertype_from_mime_type ()

char*       gnome_vfs_get_supertype_from_mime_type
                                            (const char *mime_type);

mime_type :
Returns :