mime.h File Reference

Shared MIME database functions for ROX-CLib. More...


Data Structures

struct  rox_mime_type

Defines

#define MIMEType   ROXMIMEType

Typedefs

typedef rox_mime_type ROXMIMEType

Functions

void rox_mime_init (void)
ROXMIMETyperox_mime_get_type (const char *name, gboolean can_create)
ROXMIMETyperox_mime_lookup (const char *path)
ROXMIMETyperox_mime_lookup_by_name (const char *name)
char * rox_mime_type_name (const ROXMIMEType *type)
const char * rox_mime_type_comment (ROXMIMEType *type)
void rox_mime_set_ignore_exec_bit (int ignore)
int rox_mime_get_ignore_exec_bit (void)
void rox_mime_set_by_content (int content)
int rox_mime_get_by_content (void)
GdkPixbuf * rox_mime_get_icon (const ROXMIMEType *type, int msize)
void mime_init (void)
ROXMIMETypemime_lookup (const char *path)
ROXMIMETypemime_lookup_by_name (const char *name)
char * mime_type_name (const ROXMIMEType *type)
const char * mime_type_comment (ROXMIMEType *type)
void mime_set_ignore_exec_bit (int ignore)
int mime_get_ignore_exec_bit (void)
void mime_set_by_content (int content)
int mime_get_by_content (void)

Variables

ROXMIMETypetext_plain
ROXMIMETypeapplication_executable
ROXMIMETypeapplication_octet_stream
ROXMIMETypeinode_directory
ROXMIMETypeinode_mountpoint
ROXMIMETypeinode_pipe
ROXMIMETypeinode_socket
ROXMIMETypeinode_block
ROXMIMETypeinode_char
ROXMIMETypeinode_door
ROXMIMETypeinode_unknown


Detailed Description

Shared MIME database functions for ROX-CLib.

Author:
Thomas Leonard, Stephen Watson
Version:
Id
mime.h,v 1.7 2006/10/03 20:45:58 stephen Exp

Define Documentation

#define MIMEType   ROXMIMEType

Alias for ROXMIMEType


Typedef Documentation

typedef struct rox_mime_type ROXMIMEType

Type holding information on a MIME-type


Function Documentation

int mime_get_by_content ( void   ) 

Return how the MIME system deals with the content of files, see mime_set_by_content().

Deprecated:
Use rox_mime_get_by_content()

int mime_get_ignore_exec_bit ( void   ) 

Return how the MIME system treats executable files, see mime_set_ignore_exec_bit().

Deprecated:
Use rox_mime_get_ignore_exec_bit().

void mime_init ( void   ) 

Initialize the MIME type system.

Deprecated:
Use rox_mime_init() instead.

ROXMIMEType* mime_lookup ( const char *  path  ) 

Return the MIME type of the named object.

Deprecated:
Use rox_mime_lookup().

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.

Deprecated:
use rox_mime_lookup_by_name()

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.

Deprecated:
Use rox_mime_set_by_content()

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

Deprecated:
Use rox_mime_set_ignore_exec_bit().

const char* mime_type_comment ( ROXMIMEType type  ) 

Return the comment of a MIME type (the long form of a name, e.g. " Text document")

Deprecated:
use rox_mime_type_comment().

char* mime_type_name ( const ROXMIMEType type  ) 

Return the human readable name of the type, in the form media/sub-type

Deprecated:
use rox_mime_type_name().

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.

Returns:
the value of the by_content flag.

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.

Parameters:
[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.
Returns:
the icon, or 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().

Returns:
the value of the ignore_exec flag.

ROXMIMEType* rox_mime_get_type ( const char *  name,
gboolean  can_create 
)

Parse a MIME type name and return the corresponding ROXMIMEType data.

Parameters:
[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
Returns:
the type, or 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.

Parameters:
[in] path path to object to check, or a name of a non-existant file
Returns:
the identified type.

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.

Parameters:
[in] name name of file
Returns:
the identified type.

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.

Parameters:
[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

Parameters:
[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")

Parameters:
[in] type the type
Returns:
the comment

char* rox_mime_type_name ( const ROXMIMEType type  ) 

Return the human readable name of the type, in the form media/sub-type

Parameters:
[in] type type to return name of.
Returns:
the name, pass to g_free() when done.


Variable Documentation

ROXMIMEType* application_executable

Default for executable file

ROXMIMEType* application_octet_stream

Default for binary file

ROXMIMEType* inode_block

Block device file

ROXMIMEType* inode_char

Character device file

ROXMIMEType* inode_directory

A directory

ROXMIMEType* inode_door

Door file, similar to sockets, not available on all operating systems

ROXMIMEType* inode_mountpoint

A directory used as a mount point

ROXMIMEType* inode_pipe

A named pipe

ROXMIMEType* inode_socket

UNIX domain socket

ROXMIMEType* inode_unknown

Unknown type, probably broken symbolic link

ROXMIMEType* text_plain

Default for plain file


Generated on Sat Oct 13 17:22:45 2007 for ROX-CLib by  doxygen 1.5.0