Synopsis#include <gio/gio.h> gboolean g_content_type_equals (const char *type1, const char *type2); gboolean g_content_type_is_a (const char *type, const char *supertype); gboolean g_content_type_is_unknown (const char *type); char* g_content_type_get_description (const char *type); char* g_content_type_get_mime_type (const char *type); GIcon* g_content_type_get_icon (const char *type); gboolean g_content_type_can_be_executable (const char *type); char* g_content_type_from_mime_type (const char *mime_type); char* g_content_type_guess (const char *filename, const guchar *data, gsize data_size, gboolean *result_uncertain); char** g_content_type_guess_for_tree (GFile *root); GList* g_content_types_get_registered (void); DescriptionA 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.
Detailsg_content_type_equals ()gboolean g_content_type_equals (const char *type1, const char *type2); Compares two content types for equality.
g_content_type_is_a ()gboolean g_content_type_is_a (const char *type, const char *supertype);
Determines if
g_content_type_is_unknown ()gboolean g_content_type_is_unknown (const char *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 "*".
g_content_type_get_description ()char* g_content_type_get_description (const char *type); Gets the human readable description of the content type.
g_content_type_get_mime_type ()char* g_content_type_get_mime_type (const char *type); Gets the mime-type for the content type. If one is registered
g_content_type_get_icon ()GIcon* g_content_type_get_icon (const char *type); Gets the icon for a content type.
g_content_type_can_be_executable ()gboolean g_content_type_can_be_executable (const char *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).
g_content_type_from_mime_type ()char* g_content_type_from_mime_type (const char *mime_type); Tries to find a content type based on the mime type name.
Since 2.18 g_content_type_guess ()char* g_content_type_guess (const char *filename, const guchar *data, gsize data_size, gboolean *result_uncertain);
Guesses the content type based on example data. If the function is
uncertain,
g_content_type_guess_for_tree ()char** g_content_type_guess_for_tree (GFile *root);
Tries to guess the type of the tree with root 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
Since 2.18 g_content_types_get_registered ()GList* g_content_types_get_registered (void);
Gets a list of strings containing all the registered content types
known to the system. The list and its data should be freed using
|