#define MIMEType ROXMIMEType |
Alias for ROXMIMEType
typedef struct rox_mime_type ROXMIMEType |
Type holding information on a MIME-type
int mime_get_by_content | ( | void | ) |
Return how the MIME system deals with the content of files, see mime_set_by_content().
int mime_get_ignore_exec_bit | ( | void | ) |
Return how the MIME system treats executable files, see mime_set_ignore_exec_bit().
void mime_init | ( | void | ) |
Initialize the MIME type system.
ROXMIMEType* mime_lookup | ( | const char * | path | ) |
ROXMIMEType* mime_lookup_by_name | ( | const char * | name | ) |
Return the type of a file based purely on the name. The file need not exist or be readable.
void mime_set_by_content | ( | int | content | ) |
Set how the MIME system deals with the content of files. If content is FALSE
then the content of the files will never be read to identify the type.
void mime_set_ignore_exec_bit | ( | int | ignore | ) |
Set how the MIME system treats executable files. If ignore is FALSE
then all executable files will be identified as application/executable
const char* mime_type_comment | ( | ROXMIMEType * | type | ) |
Return the comment of a MIME type (the long form of a name, e.g. " Text document")
char* mime_type_name | ( | const ROXMIMEType * | type | ) |
Return the human readable name of the type, in the form media/sub-type
int rox_mime_get_by_content | ( | void | ) |
Return how the MIME system deals with the content of files, see mime_set_by_content().
Currently this flag has no effect as identifying files by content is not yet supported.
GdkPixbuf* rox_mime_get_icon | ( | const ROXMIMEType * | type, | |
int | msize | |||
) |
Return the icon for the specified MIME type, scaled appropriately. This function checks the override icons for media/subtype, then the ROX theme icon for the same type. If neither works it tries again for the generic media icon in the same places. If nothing works, NULL
is returned.
In the future this will detect the icon theme in use, but until then only the ROX theme is checked.
[in] | type | MIME type to look up |
[in] | msize | maximum size in pixels of the icon to return. If 0 or less the default size of 48 is used. |
NULL
if not found. int rox_mime_get_ignore_exec_bit | ( | void | ) |
Return how the MIME system treats executable files, see mime_set_ignore_exec_bit().
ROXMIMEType* rox_mime_get_type | ( | const char * | name, | |
gboolean | can_create | |||
) |
Parse a MIME type name and return the corresponding ROXMIMEType data.
[in] | name | name of the type, as media/sub-type |
[in] | can_create | if TRUE and name is not a currently known type then create a new one and return it, otherwise return NULL |
NULL
if is not known and can_create false, or if is malformed. void rox_mime_init | ( | void | ) |
Initialize the MIME type system. This must be called before the other functions.
ROXMIMEType* rox_mime_lookup | ( | const char * | path | ) |
Return the MIME type of the named object.
If the object does not exist, or is in an unsearchable directory, then the type returned is based purely on the name.
If the object does exist then the type of file is checked. If it is a non-file object (such as a directory) then the appropriate inode/subtype type is returned. If it is a file and is executable and the mime_get_ignore_exec_bit() value is FALSE
then application/executable is returned.
If mime_get_by_content() is not FALSE
and content checking is implemented (it currently is not) and a type is identified it is returned.
If the type can be identified by the name then that is returned.
Finally if the execute bit is set application/executable is returned, otherwise UNKNOWN.
[in] | path | path to object to check, or a name of a non-existant file |
ROXMIMEType* rox_mime_lookup_by_name | ( | const char * | name | ) |
Return the type of a file based purely on the name. The file need not exist or be readable.
[in] | name | name of file |
void rox_mime_set_by_content | ( | int | content | ) |
Set how the MIME system deals with the content of files. If content is FALSE
then the content of the files will never be read to identify the type.
Currently this flag has no effect as identifying files by content is not yet supported.
[in] | content | the new value of the by_cotnent flag. |
void rox_mime_set_ignore_exec_bit | ( | int | ignore | ) |
Set how the MIME system treats executable files. If ignore is FALSE
then all executable files will be identified as application/executable
[in] | ignore | the new value of the ignore_exec flag. |
const char* rox_mime_type_comment | ( | ROXMIMEType * | type | ) |
Return the comment of a MIME type (the long form of a name, e.g. " Text document")
[in] | type | the type |
char* rox_mime_type_name | ( | const ROXMIMEType * | type | ) |
Return the human readable name of the type, in the form media/sub-type
[in] | type | type to return name of. |
Default for executable file
Default for binary file
Block device file
Character device file
A directory
Door file, similar to sockets, not available on all operating systems
A directory used as a mount point
A named pipe
UNIX domain socket
Unknown type, probably broken symbolic link
Default for plain file