File Types

File Types — functions for getting information about files based on their MIME type

Synopsis




#define     GNOME_VFS_MIME_TYPE_UNKNOWN
const char* gnome_vfs_get_mime_type_for_data
                                            (gconstpointer data,
                                             int data_size);
char*       gnome_vfs_get_mime_type         (const char *text_uri);
enum        GnomeVFSMimeActionType;
enum        GnomeVFSMimeApplicationArgumentType;
typedef     GnomeVFSMimeApplication;
GnomeVFSMimeApplication* gnome_vfs_mime_application_copy
                                            (GnomeVFSMimeApplication *application);
GnomeVFSMimeActionType gnome_vfs_mime_get_default_action_type
                                            (const char *mime_type);
GnomeVFSMimeAction* gnome_vfs_mime_get_default_action
                                            (const char *mime_type);
GnomeVFSMimeApplication* gnome_vfs_mime_get_default_application
                                            (const char *mime_type);
Bonobo_ServerInfo* gnome_vfs_mime_get_default_component
                                            (const char *mime_type);
GList*      gnome_vfs_mime_get_short_list_applications
                                            (const char *mime_type);
GList*      gnome_vfs_mime_get_short_list_components
                                            (const char *mime_type);
GList*      gnome_vfs_mime_get_all_applications
                                            (const char *mime_type);
GList*      gnome_vfs_mime_get_all_components
                                            (const char *mime_type);
GnomeVFSResult gnome_vfs_mime_set_default_action_type
                                            (const char *mime_type,
                                             GnomeVFSMimeActionType action_type);
GnomeVFSResult gnome_vfs_mime_set_default_application
                                            (const char *mime_type,
                                             const char *application_id);
GnomeVFSResult gnome_vfs_mime_set_default_component
                                            (const char *mime_type,
                                             const char *component_iid);
const char* gnome_vfs_mime_get_icon         (const char *mime_type);
GnomeVFSResult gnome_vfs_mime_set_icon      (const char *mime_type,
                                             const char *filename);
const char* gnome_vfs_mime_get_description  (const char *mime_type);
GnomeVFSResult gnome_vfs_mime_set_description
                                            (const char *mime_type,
                                             const char *description);
gboolean    gnome_vfs_mime_can_be_executable
                                            (const char *mime_type);
GnomeVFSResult gnome_vfs_mime_set_can_be_executable
                                            (const char *mime_type,
                                             gboolean new_value);
GnomeVFSResult gnome_vfs_mime_set_short_list_applications
                                            (const char *mime_type,
                                             GList *application_ids);
GnomeVFSResult gnome_vfs_mime_set_short_list_components
                                            (const char *mime_type,
                                             GList *component_iids);
GnomeVFSResult gnome_vfs_mime_add_application_to_short_list
                                            (const char *mime_type,
                                             const char *application_id);
GnomeVFSResult gnome_vfs_mime_remove_application_from_short_list
                                            (const char *mime_type,
                                             const char *application_id);
GnomeVFSResult gnome_vfs_mime_add_component_to_short_list
                                            (const char *mime_type,
                                             const char *iid);
GnomeVFSResult gnome_vfs_mime_remove_component_from_short_list
                                            (const char *mime_type,
                                             const char *iid);
GnomeVFSResult gnome_vfs_mime_add_extension (const char *mime_type,
                                             const char *extension);
GnomeVFSResult gnome_vfs_mime_remove_extension
                                            (const char *mime_type,
                                             const char *extension);
GnomeVFSResult gnome_vfs_mime_extend_all_applications
                                            (const char *mime_type,
                                             GList *application_ids);
GnomeVFSResult gnome_vfs_mime_remove_from_all_applications
                                            (const char *mime_type,
                                             GList *application_ids);
GnomeVFSMimeApplication* gnome_vfs_mime_application_new_from_id
                                            (const char *id);
void        gnome_vfs_mime_application_free (GnomeVFSMimeApplication *application);
void        gnome_vfs_mime_action_free      (GnomeVFSMimeAction *action);
void        gnome_vfs_mime_application_list_free
                                            (GList *list);
void        gnome_vfs_mime_component_list_free
                                            (GList *list);
gboolean    gnome_vfs_mime_id_in_application_list
                                            (const char *id,
                                             GList *applications);
gboolean    gnome_vfs_mime_id_in_component_list
                                            (const char *iid,
                                             GList *components);
GList*      gnome_vfs_mime_remove_application_from_list
                                            (GList *applications,
                                             const char *application_id,
                                             gboolean *did_remove);
GList*      gnome_vfs_mime_remove_component_from_list
                                            (GList *components,
                                             const char *iid,
                                             gboolean *did_remove);
GList*      gnome_vfs_mime_id_list_from_component_list
                                            (GList *components);
GList*      gnome_vfs_mime_id_list_from_application_list
                                            (GList *applications);
void        gnome_vfs_mime_freeze           (void);
void        gnome_vfs_mime_thaw             (void);
void        gnome_vfs_mime_info_reload      (void);
gboolean    gnome_vfs_mime_type_is_known    (const char *mime_type);
const char* gnome_vfs_mime_get_value        (const char *mime_type,
                                             const char *key);
GnomeVFSResult gnome_vfs_mime_set_value     (const char *mime_type,
                                             const char *key,
                                             const char *value);
GList*      gnome_vfs_mime_get_key_list     (const char *mime_type);
void        gnome_vfs_mime_keys_list_free   (GList *mime_type_list);
GList*      gnome_vfs_mime_get_extensions_list
                                            (const char *mime_type);
void        gnome_vfs_mime_extensions_list_free
                                            (GList *list);
char*       gnome_vfs_mime_get_extensions_string
                                            (const char *mime_type);
char*       gnome_vfs_mime_get_extensions_pretty_string
                                            (const char *mime_type);
GList*      gnome_vfs_get_registered_mime_types
                                            (void);
void        gnome_vfs_mime_registered_mime_type_list_free
                                            (GList *list);
GnomeVFSResult gnome_vfs_mime_set_registered_type_key
                                            (const char *mime_type,
                                             const char *key,
                                             const char *data);
GnomeVFSResult gnome_vfs_mime_set_extensions_list
                                            (const char *mime_type,
                                             const char *extensions_list);
void        gnome_vfs_mime_registered_mime_type_delete
                                            (const char *mime_type);
void        gnome_vfs_mime_reset            (void);

Description

Details

GNOME_VFS_MIME_TYPE_UNKNOWN

#define GNOME_VFS_MIME_TYPE_UNKNOWN "application/octet-stream"

gnome_vfs_get_mime_type_for_data ()

const char* gnome_vfs_get_mime_type_for_data
                                            (gconstpointer data,
                                             int data_size);
data : A pointer to data in memory.
data_size : Size of the data.
Returns :the mime-type for this filename.

gnome_vfs_get_mime_type ()

char*       gnome_vfs_get_mime_type         (const char *text_uri);
text_uri : URI of the file for which to get the mime type
Returns : The mime type, or NULL if there is an error reading the file.

enum GnomeVFSMimeActionType

typedef enum {
	GNOME_VFS_MIME_ACTION_TYPE_NONE,
	GNOME_VFS_MIME_ACTION_TYPE_APPLICATION,
	GNOME_VFS_MIME_ACTION_TYPE_COMPONENT
} GnomeVFSMimeActionType;

enum GnomeVFSMimeApplicationArgumentType

typedef enum {
	GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS,
	GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_PATHS,
	GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS_FOR_NON_FILES
} GnomeVFSMimeApplicationArgumentType;

GnomeVFSMimeApplication

typedef struct {
	char *id;
	char *name;
	char *command;
	gboolean can_open_multiple_files;
	GnomeVFSMimeApplicationArgumentType expects_uris;
	GList *supported_uri_schemes;
	gboolean requires_terminal;

	/* Padded to avoid future breaks in ABI compatibility */
	void *reserved1;
	void *reserved2;

} GnomeVFSMimeApplication;

gnome_vfs_mime_application_copy ()

GnomeVFSMimeApplication* gnome_vfs_mime_application_copy
                                            (GnomeVFSMimeApplication *application);
application : The GnomeVFSMimeApplication to be duplicated.
Returns : A copy of application

gnome_vfs_mime_get_default_action_type ()

GnomeVFSMimeActionType gnome_vfs_mime_get_default_action_type
                                            (const char *mime_type);
mime_type : A const char * containing a mime type, e.g. "application/x-php"
Returns : The type of action to be performed on a file of MIME type, mime_type by default.

gnome_vfs_mime_get_default_action ()

GnomeVFSMimeAction* gnome_vfs_mime_get_default_action
                                            (const char *mime_type);
mime_type : A const char * containing a mime type, e.g. "application/x-php"
Returns : A GnomeVFSMimeAction representing the default action to perform upon file of type mime_type.

gnome_vfs_mime_get_default_application ()

GnomeVFSMimeApplication* gnome_vfs_mime_get_default_application
                                            (const char *mime_type);
mime_type : A const char * containing a mime type, e.g. "image/png"
Returns : A GnomeVFSMimeApplication representing the default handler of mime_type

gnome_vfs_mime_get_default_component ()

Bonobo_ServerInfo* gnome_vfs_mime_get_default_component
                                            (const char *mime_type);
mime_type : A const char * containing a mime type, e.g. "image/png"
Returns : An Bonobo_ServerInfo * representing the OAF server to be activated to get a reference to the proper component.

gnome_vfs_mime_get_short_list_applications ()

GList*      gnome_vfs_mime_get_short_list_applications
                                            (const char *mime_type);
mime_type : A const char * containing a mime type, e.g. "image/png"
Returns : A GList * where the elements are GnomeVFSMimeApplication * representing various applications to display in the short list for mime_type.

gnome_vfs_mime_get_short_list_components ()

GList*      gnome_vfs_mime_get_short_list_components
                                            (const char *mime_type);
mime_type : A const char * containing a mime type, e.g. "image/png"
Returns : A GList * where the elements are Bonobo_ServerInfo * representing various components to display in the short list for mime_type.

gnome_vfs_mime_get_all_applications ()

GList*      gnome_vfs_mime_get_all_applications
                                            (const char *mime_type);
mime_type : A const char * containing a mime type, e.g. "image/png"
Returns : A GList * where the elements are GnomeVFSMimeApplication * representing applications that handle MIME type mime_type.

gnome_vfs_mime_get_all_components ()

GList*      gnome_vfs_mime_get_all_components
                                            (const char *mime_type);
mime_type : A const char * containing a mime type, e.g. "image/png"
Returns : A GList * where the elements are Bonobo_ServerInfo * representing components that can handle MIME type mime_type.

gnome_vfs_mime_set_default_action_type ()

GnomeVFSResult gnome_vfs_mime_set_default_action_type
                                            (const char *mime_type,
                                             GnomeVFSMimeActionType action_type);
mime_type : A const char * containing a mime type, e.g. "image/png"
action_type : A GnomeVFSMimeActionType containing the action to perform by default
Returns : A GnomeVFSResult indicating the success of the operation or reporting any errors encountered.

gnome_vfs_mime_set_default_application ()

GnomeVFSResult gnome_vfs_mime_set_default_application
                                            (const char *mime_type,
                                             const char *application_id);
mime_type : A const char * containing a mime type, e.g. "application/x-php"
application_id : A key representing an application in the MIME database (GnomeVFSMimeApplication->id, for example)
Returns : A GnomeVFSResult indicating the success of the operation or reporting any errors encountered.

gnome_vfs_mime_set_default_component ()

GnomeVFSResult gnome_vfs_mime_set_default_component
                                            (const char *mime_type,
                                             const char *component_iid);
mime_type : A const char * containing a mime type, e.g. "application/x-php"
component_iid : The OAFIID of a component
Returns : A GnomeVFSResult indicating the success of the operation or reporting any errors encountered.

gnome_vfs_mime_get_icon ()

const char* gnome_vfs_mime_get_icon         (const char *mime_type);
mime_type : A const char * containing a MIME type
Returns : The filename of the icon as listed in the MIME database. This is usually a filename without path information, e.g. "i-chardev.png", and sometimes does not have an extension, e.g. "i-regular" if the icon is supposed to be image type agnostic between icon themes. Icons are generic, and not theme specific. These will not necessarily match with the icons a user sees in Nautilus, you have been warned.

gnome_vfs_mime_set_icon ()

GnomeVFSResult gnome_vfs_mime_set_icon      (const char *mime_type,
                                             const char *filename);
mime_type : A const char * containing a MIME type
filename : a const char * containing an image filename
Returns : A GnomeVFSResult indicating the success of the operation or any errors that may have occurred.

gnome_vfs_mime_get_description ()

const char* gnome_vfs_mime_get_description  (const char *mime_type);
mime_type : the mime type
Returns : A description of MIME type mime_type

gnome_vfs_mime_set_description ()

GnomeVFSResult gnome_vfs_mime_set_description
                                            (const char *mime_type,
                                             const char *description);
mime_type : A const char * containing a mime type
description : A description of this MIME type
Returns : GnomeVFSResult indicating the success of the operation or any errors that may have occurred.

gnome_vfs_mime_can_be_executable ()

gboolean    gnome_vfs_mime_can_be_executable
                                            (const char *mime_type);
mime_type : A const char * containing a mime type
Returns : gboolean containing TRUE if some files of this MIME type are registered as being executable, and false otherwise.

gnome_vfs_mime_set_can_be_executable ()

GnomeVFSResult gnome_vfs_mime_set_can_be_executable
                                            (const char *mime_type,
                                             gboolean new_value);
mime_type : A const char * containing a mime type
new_value : A boolean value indicating whether mime_type could be executable.
Returns : GnomeVFSResult indicating the success of the operation or any errors that may have occurred.

gnome_vfs_mime_set_short_list_applications ()

GnomeVFSResult gnome_vfs_mime_set_short_list_applications
                                            (const char *mime_type,
                                             GList *application_ids);
mime_type : A const char * containing a mime type, e.g. "application/x-php"
application_ids : GList of const char * application ids
Returns : A GnomeVFSResult indicating the success of the operation or reporting any errors encountered.

gnome_vfs_mime_set_short_list_components ()

GnomeVFSResult gnome_vfs_mime_set_short_list_components
                                            (const char *mime_type,
                                             GList *component_iids);
mime_type : A const char * containing a mime type, e.g. "application/x-php"
component_iids : GList of const char * OAF IIDs
Returns : A GnomeVFSResult indicating the success of the operation or reporting any errors encountered.

gnome_vfs_mime_add_application_to_short_list ()

GnomeVFSResult gnome_vfs_mime_add_application_to_short_list
                                            (const char *mime_type,
                                             const char *application_id);
mime_type : A const char * containing a mime type, e.g. "application/x-php"
application_id : const char * containing the application's id in the MIME database
Returns : A GnomeVFSResult indicating the success of the operation or reporting any errors encountered.

gnome_vfs_mime_remove_application_from_short_list ()

GnomeVFSResult gnome_vfs_mime_remove_application_from_short_list
                                            (const char *mime_type,
                                             const char *application_id);
mime_type : A const char * containing a mime type, e.g. "application/x-php"
application_id : const char * containing the application's id in the MIME database
Returns : A GnomeVFSResult indicating the success of the operation or reporting any errors encountered.

gnome_vfs_mime_add_component_to_short_list ()

GnomeVFSResult gnome_vfs_mime_add_component_to_short_list
                                            (const char *mime_type,
                                             const char *iid);
mime_type : A const char * containing a mime type, e.g. "application/x-php"
iid : const char * containing the component's OAF IID
Returns : A GnomeVFSResult indicating the success of the operation or reporting any errors encountered.

gnome_vfs_mime_remove_component_from_short_list ()

GnomeVFSResult gnome_vfs_mime_remove_component_from_short_list
                                            (const char *mime_type,
                                             const char *iid);
mime_type : A const char * containing a mime type, e.g. "application/x-php"
iid : const char * containing the component's OAF IID
Returns : A GnomeVFSResult indicating the success of the operation or reporting any errors encountered.

gnome_vfs_mime_add_extension ()

GnomeVFSResult gnome_vfs_mime_add_extension (const char *mime_type,
                                             const char *extension);
mime_type : The mime type to add the mapping to.
extension : The extension to add (e.g. "txt")
Returns : GnomeVFSResult indicating the success of the operation or any errors that may have occurred.

gnome_vfs_mime_remove_extension ()

GnomeVFSResult gnome_vfs_mime_remove_extension
                                            (const char *mime_type,
                                             const char *extension);
mime_type : The mime type to remove the extension from
extension : The extension to remove
Returns : GnomeVFSResult indicating the success of the operation or any errors that may have occurred.

gnome_vfs_mime_extend_all_applications ()

GnomeVFSResult gnome_vfs_mime_extend_all_applications
                                            (const char *mime_type,
                                             GList *application_ids);
mime_type : A const char * containing a mime type, e.g. "application/x-php"
application_ids : a GList of const char * containing application ids
Returns : A GnomeVFSResult indicating the success of the operation or reporting any errors encountered.

gnome_vfs_mime_remove_from_all_applications ()

GnomeVFSResult gnome_vfs_mime_remove_from_all_applications
                                            (const char *mime_type,
                                             GList *application_ids);
mime_type : A const char * containing a mime type, e.g. "application/x-php"
application_ids : a GList of const char * containing application ids
Returns : A GnomeVFSResult indicating the success of the operation or reporting any errors encountered.

gnome_vfs_mime_application_new_from_id ()

GnomeVFSMimeApplication* gnome_vfs_mime_application_new_from_id
                                            (const char *id);
id : A const char * containing an application id
Returns : GnomeVFSMimeApplication * corresponding to id

gnome_vfs_mime_application_free ()

void        gnome_vfs_mime_application_free (GnomeVFSMimeApplication *application);
application : The GnomeVFSMimeApplication to be freed

gnome_vfs_mime_action_free ()

void        gnome_vfs_mime_action_free      (GnomeVFSMimeAction *action);
action : The GnomeVFSMimeAction to be freed

gnome_vfs_mime_application_list_free ()

void        gnome_vfs_mime_application_list_free
                                            (GList *list);
list : a GList of GnomeVFSApplication * to be freed

gnome_vfs_mime_component_list_free ()

void        gnome_vfs_mime_component_list_free
                                            (GList *list);
list : a GList of Bonobo_ServerInfo * to be freed

gnome_vfs_mime_id_in_application_list ()

gboolean    gnome_vfs_mime_id_in_application_list
                                            (const char *id,
                                             GList *applications);
id : An application id.
applications : A GList * whose nodes are GnomeVFSMimeApplications, such as the result of gnome_vfs_mime_get_short_list_applications().
Returns : TRUE if an application whose id matches id is in applications.

gnome_vfs_mime_id_in_component_list ()

gboolean    gnome_vfs_mime_id_in_component_list
                                            (const char *iid,
                                             GList *components);
iid : A component iid.
components : A GList * whose nodes are Bonobo_ServerInfos, such as the result of gnome_vfs_mime_get_short_list_components().
Returns : TRUE if a component whose iid matches iid is in components.

gnome_vfs_mime_remove_application_from_list ()

GList*      gnome_vfs_mime_remove_application_from_list
                                            (GList *applications,
                                             const char *application_id,
                                             gboolean *did_remove);
applications : A GList * whose nodes are GnomeVFSMimeApplications, such as the result of gnome_vfs_mime_get_short_list_applications().
application_id : The id of an application to remove from applications.
did_remove : If non-NULL, this is filled in with TRUE if the application was found in the list, FALSE otherwise.
Returns : The modified list. If the application is not found, the list will be unchanged.

gnome_vfs_mime_remove_component_from_list ()

GList*      gnome_vfs_mime_remove_component_from_list
                                            (GList *components,
                                             const char *iid,
                                             gboolean *did_remove);
components : A GList * whose nodes are Bonobo_ServerInfos, such as the result of gnome_vfs_mime_get_short_list_components().
iid : The iid of a component to remove from components.
did_remove : If non-NULL, this is filled in with TRUE if the component was found in the list, FALSE otherwise.
Returns : The modified list. If the component is not found, the list will be unchanged.

gnome_vfs_mime_id_list_from_component_list ()

GList*      gnome_vfs_mime_id_list_from_component_list
                                            (GList *components);
components : A GList * whose nodes are Bonobo_ServerInfos, such as the result of gnome_vfs_mime_get_short_list_components().
Returns : A new list where each Bonobo_ServerInfo in the original list is replaced by a char * with the component's iid. The original list is not modified.

gnome_vfs_mime_id_list_from_application_list ()

GList*      gnome_vfs_mime_id_list_from_application_list
                                            (GList *applications);
applications : A GList * whose nodes are GnomeVFSMimeApplications, such as the result of gnome_vfs_mime_get_short_list_applications().
Returns : A new list where each GnomeVFSMimeApplication in the original list is replaced by a char * with the application's id. The original list is not modified.

gnome_vfs_mime_freeze ()

void        gnome_vfs_mime_freeze           (void);

gnome_vfs_mime_thaw ()

void        gnome_vfs_mime_thaw             (void);

gnome_vfs_mime_info_reload ()

void        gnome_vfs_mime_info_reload      (void);

gnome_vfs_mime_type_is_known ()

gboolean    gnome_vfs_mime_type_is_known    (const char *mime_type);
mime_type : a mime type.
Returns : TRUE if anything is known about mime_type, otherwise FALSE

gnome_vfs_mime_get_value ()

const char* gnome_vfs_mime_get_value        (const char *mime_type,
                                             const char *key);
mime_type : a mime type.
key : A key to lookup for the given mime-type
Returns : GNOME_VFS_OK if the operation succeeded, otherwise an error code

gnome_vfs_mime_set_value ()

GnomeVFSResult gnome_vfs_mime_set_value     (const char *mime_type,
                                             const char *key,
                                             const char *value);
mime_type : a mime type.
key : a key to store the value in.
value : the value to store in the key.
Returns : GNOME_VFS_OK if the operation succeeded, otherwise an error code

gnome_vfs_mime_get_key_list ()

GList*      gnome_vfs_mime_get_key_list     (const char *mime_type);
mime_type : the MIME type to lookup
Returns : a GList of const char * representing keys associated with mime_type

gnome_vfs_mime_keys_list_free ()

void        gnome_vfs_mime_keys_list_free   (GList *mime_type_list);
mime_type_list : A mime type list to free.

gnome_vfs_mime_get_extensions_list ()

GList*      gnome_vfs_mime_get_extensions_list
                                            (const char *mime_type);
mime_type : type to get the extensions of
Returns : a GList of char *s

gnome_vfs_mime_extensions_list_free ()

void        gnome_vfs_mime_extensions_list_free
                                            (GList *list);
list : the extensions list

gnome_vfs_mime_get_extensions_string ()

char*       gnome_vfs_mime_get_extensions_string
                                            (const char *mime_type);
mime_type : the mime type
Returns : a string containing space seperated extensions for mime_type

gnome_vfs_mime_get_extensions_pretty_string ()

char*       gnome_vfs_mime_get_extensions_pretty_string
                                            (const char *mime_type);
mime_type : the mime type
Returns : a string containing comma seperated extensions for this mime-type

gnome_vfs_get_registered_mime_types ()

GList*      gnome_vfs_get_registered_mime_types
                                            (void);
Returns :

gnome_vfs_mime_registered_mime_type_list_free ()

void        gnome_vfs_mime_registered_mime_type_list_free
                                            (GList *list);
list : the extensions list

gnome_vfs_mime_set_registered_type_key ()

GnomeVFSResult gnome_vfs_mime_set_registered_type_key
                                            (const char *mime_type,
                                             const char *key,
                                             const char *data);
mime_type : Mime type to set key for
key : The key to set
data : The data to set for the key
Returns : GNOME_VFS_OK if the operation succeeded, otherwise an error code

gnome_vfs_mime_set_extensions_list ()

GnomeVFSResult gnome_vfs_mime_set_extensions_list
                                            (const char *mime_type,
                                             const char *extensions_list);
mime_type : the mime type.
extensions_list : a whitespace-separated list of the extensions to set for this mime type.
Returns : GNOME_VFS_OK if the operation succeeded, otherwise an error code.

gnome_vfs_mime_registered_mime_type_delete ()

void        gnome_vfs_mime_registered_mime_type_delete
                                            (const char *mime_type);
mime_type : string representing the existing type to delete

gnome_vfs_mime_reset ()

void        gnome_vfs_mime_reset            (void);