| GIO Reference Manual | ||||
|---|---|---|---|---|
#include <gio/gio.h>gboolean g_content_type_equals (constchar *type1, constchar *type2);gboolean g_content_type_is_a (constchar *type, constchar *supertype);gboolean g_content_type_is_unknown (constchar *type);char * g_content_type_get_description (constchar *type);char * g_content_type_get_mime_type (constchar *type); GIcon* g_content_type_get_icon (constchar *type);gboolean g_content_type_can_be_executable (constchar *type);char * g_content_type_from_mime_type (constchar *mime_type);char * g_content_type_guess (constchar *filename, constguchar *data,gsize data_size,gboolean *result_uncertain);GList * g_content_types_get_registered (void);
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.
gboolean g_content_type_equals (constchar *type1, constchar *type2);
Compares two content types for equality.
type1 : |
a content type string. |
type2 : |
a content type string. |
| Returns : | TRUEFALSE |
gboolean g_content_type_is_a (constchar *type, constchar *supertype);
Determines if type is a subset of supertype.
type : |
a content type string. |
supertype : |
a string. |
| Returns : | TRUEtype is a kind of supertype,
FALSE |
gboolean g_content_type_is_unknown (constchar *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 "*".
type : |
a content type string. |
| Returns : | TRUE |
char * g_content_type_get_description (constchar *type);
Gets the human readable description of the content type.
type : |
a content type string. |
| Returns : | a short description of the content type type.
|
char * g_content_type_get_mime_type (constchar *type);
Gets the mime-type for the content type. If one is registered
type : |
a content type string. |
| Returns : | the registered mime-type for the given type, or NULL if unknown.
|
GIcon* g_content_type_get_icon (constchar *type);
Gets the icon for a content type.
type : |
a content type string. |
| Returns : | GIcon corresponding to the content type. |
gboolean g_content_type_can_be_executable (constchar *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).
type : |
a content type string. |
| Returns : | TRUEFALSE |
char * g_content_type_from_mime_type (constchar *mime_type);
Tries to find a content type based on the mime type name.
mime_type : |
a mime type string. |
| Returns : | Newly allocated string with content type or NULL when does not know. |
Since 2.18
char * g_content_type_guess (constchar *filename, constguchar *data,gsize data_size,gboolean *result_uncertain);
Guesses the content type based on example data. If the function is
uncertain, result_uncertain will be set to TRUE
filename : |
a string. |
data : |
a stream of data. |
data_size : |
the size of data.
|
result_uncertain : |
a flag indicating the certainty of the result. |
| Returns : | a string indicating a guessed content type for the given data. |
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
g_list_foreach(list, g_free, NULL) and g_list_free(list)
| Returns : | |