ContentType

Description A content type is a platform specific string that defines the type of a file. On unix it is a mime type, on win32 it is an extension string like ".doc", ".txt" or a percieved string like "audio". Such strings can be looked up in the registry at HKEY_CLASSES_ROOT.

Members

Static functions

canBeExecutable
int canBeExecutable(string type)

Checks if a content type can be executable. Note that for instance things like text files can be executables (i.e. scripts and batch files).

equals
int equals(string type1, string type2)

Compares two content types for equality.

fromMimeType
string fromMimeType(string mimeType)

Tries to find a content type based on the mime type name. Since 2.18

gContentTypesGetRegistered
ListG gContentTypesGetRegistered()

Gets a list of strings containing all the registered content types known to the system. The list and its data should be freed using g_list_foreach (list, g_free, NULL); g_list_free (list);

getDescription
string getDescription(string type)

Gets the human readable description of the content type.

getIcon
IconIF getIcon(string type)

Gets the icon for a content type.

getMimeType
string getMimeType(string type)

Gets the mime type for the content type, if one is registered.

guess
string guess(string filename, char[] data, int resultUncertain)

Guesses the content type based on example data. If the function is uncertain, result_uncertain will be set to TRUE. Either filename or data may be NULL, in which case the guess will be based solely on the other argument.

guessForTree
string[] guessForTree(File root)

Tries to guess the type of the tree with root root, by looking at the files it contains. The result is an array of content types, with the best guess coming first. The types returned all have the form x-content/foo, e.g. x-content/audio-cdda (for audio CDs) or x-content/image-dcf (for a camera memory card). See the shared-mime-info specification for more on x-content types. This function is useful in the implementation of g_mount_guess_content_type(). Since 2.18

isA
int isA(string type, string supertype)

Determines if type is a subset of supertype.

isUnknown
int isUnknown(string type)

Checks if the content type is the generic "unknown" type. On UNIX this is the "application/octet-stream" mimetype, while on win32 it is "*".

Meta