gnome-vfs-mime-utils

gnome-vfs-mime-utils

Functions

Types and Values

Description

Functions

gnome_vfs_mime_type_get_equivalence ()

GnomeVFSMimeEquivalence
gnome_vfs_mime_type_get_equivalence (const char *mime_type,
                                     const char *base_mime_type);

Compares mime_type to base_mime_type . There are three possible relationships between the two strings.

  • If they are identical and mime_type is the same as base_mime_type, then GNOME_VFS_MIME_IDENTICAL is returned. This would be the case if "audio/midi" and "audio/x-midi" are passed in.

  • If base_mime_type is a parent type of mime_type, then GNOME_VFS_MIME_PARENT is returned. As an example, "text/plain" is a parent of "text/rss", "image" is a parent of "image/png", and "application/octet-stream" is a parent of almost all types.

  • Finally, if the two mime types are unrelated, then GNOME_VFS_MIME_UNRELATED is returned.

Parameters

mime_type

a const char * containing a mime type, e.g. "image/png".

 

base_mime_type

a const char * containing either a mime type or a base mime type.

 

Returns

A GnomeVFSMimeEquivalence indicating the relationship between mime_type and base_mime_type .


gnome_vfs_mime_type_is_equal ()

gboolean
gnome_vfs_mime_type_is_equal (const char *a,
                              const char *b);

Compares two mime types to determine if they are equivalent. They are equivalent if and only if they refer to the same mime type.

Parameters

a

a const char * containing a mime type, e.g. "image/png".

 

b

a const char * containing a mime type, e.g. "image/png".

 

Returns

TRUE, if a and b are equivalent mime types.


gnome_vfs_get_mime_type_for_name ()

const char *
gnome_vfs_get_mime_type_for_name (const char *filename);

Determine the mime type for filename . The file filename may not exist, this function does not access the actual file. If the mime-type cannot be determined, GNOME_VFS_MIME_TYPE_UNKNOWN is returned.

Parameters

filename

a filename.

 

Returns

the mime-type for this filename or GNOME_VFS_MIME_TYPE_UNKNOWN if mime-type could not be determined.

Since: 2.14


gnome_vfs_get_mime_type_for_data ()

const char *
gnome_vfs_get_mime_type_for_data (gconstpointer data,
                                  int data_size);

Tries to guess the mime type of the data in data using the magic patterns.

Parameters

data

a pointer to data in memory.

 

data_size

size of the data.

 

Returns

the mime-type for data .


gnome_vfs_get_mime_type_for_name_and_data ()

const char *
gnome_vfs_get_mime_type_for_name_and_data
                               (const char *filename,
                                gconstpointer data,
                                gssize data_size);

Determine the mime-type for filename and data . This function tries to be smart (e.g. mime subclassing) about returning the right mime-type by looking at both the data and the filename . The file will not be accessed. If the mime-type cannot be determined, GNOME_VFS_MIME_TYPE_UNKNOWN is returned.

Parameters

filename

a filename.

 

data

a pointer to the data in the memory

 

data_size

the size of data

 

Returns

the mime-type for this filename or GNOME_VFS_MIME_TYPE_UNKNOWN if mime-type could not be determined.

Since: 2.14


gnome_vfs_get_mime_type ()

char *
gnome_vfs_get_mime_type (const char *text_uri);

Determine the mime type of text_uri . The mime type is determined in the same way as by gnome_vfs_get_file_info(). This is meant as a convenient function for times when you only want the mime type.

Parameters

text_uri

path of the file for which to get the mime type.

 

Returns

The mime type, or NULL if there is an error reading the file.


gnome_vfs_get_slow_mime_type ()

char *
gnome_vfs_get_slow_mime_type (const char *text_uri);

Determine the mime type of text_uri . The mime type is determined in the same way as by gnome_vfs_get_file_info(). This is meant as a convenience function for times when you only want the mime type.

Parameters

text_uri

URI of the file for which to get the mime type

 

Returns

The mime type, or NULL if there is an error reading the file.

Since: 2.14

Types and Values

GNOME_VFS_MIME_TYPE_UNKNOWN

#define GNOME_VFS_MIME_TYPE_UNKNOWN "application/octet-stream"

The value returned for the MIME type when a file did not match any entries in the MIME database. May be treated as a file of an unknown type.


enum GnomeVFSMimeEquivalence

Describes the possible relationship between two MIME types, returned by gnome_vfs_mime_type_get_equivalence().

Members

GNOME_VFS_MIME_UNRELATED

The two MIME types are not related.

 

GNOME_VFS_MIME_IDENTICAL

The two MIME types are identical.

 

GNOME_VFS_MIME_PARENT

One of the two MIME types is a parent of the other one. Note that this relationship is transient, i.e. if a is a parent of b and b is a parent of c, a is also considered a parent of c.