File Types

Name

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"

The value returned for the MIME type when a file did not match any entries in the MIME database. May be treated as a file of an unknown type.


gnome_vfs_get_mime_type_for_data ()

const char* gnome_vfs_get_mime_type_for_data
                                            (gconstpointer data,
                                             int data_size);

Tries to guess the mime type of the data in data using the magic patterns.


gnome_vfs_get_mime_type ()

char*       gnome_vfs_get_mime_type         (const char *text_uri);

Determine the mime type of text_uri. The mime type is determined in the same way as by gnome_vfs_get_file_info(). This is meant as a convenience function for times when you only want the mime type.


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);

Creates a newly referenced copy of a GnomeVFSMimeApplication object.


gnome_vfs_mime_get_default_action_type ()

GnomeVFSMimeActionType gnome_vfs_mime_get_default_action_type
                                            (const char *mime_type);

Query the MIME database for the type of action to be performed on a particular MIME type by default.


gnome_vfs_mime_get_default_action ()

GnomeVFSMimeAction* gnome_vfs_mime_get_default_action
                                            (const char *mime_type);

Query the MIME database for default action associated with a particular MIME type mime_type.


gnome_vfs_mime_get_default_application ()

GnomeVFSMimeApplication* gnome_vfs_mime_get_default_application
                                            (const char *mime_type);

Query the MIME database for the application to be executed on files of MIME type mime_type by default.


gnome_vfs_mime_get_default_component ()

Bonobo_ServerInfo* gnome_vfs_mime_get_default_component
                                            (const char *mime_type);

Query the MIME database for the default Bonobo component to be activated to view files of MIME type mime_type.


gnome_vfs_mime_get_short_list_applications ()

GList*      gnome_vfs_mime_get_short_list_applications
                                            (const char *mime_type);

Return an alphabetically sorted list of GnomeVFSMimeApplication data structures for the requested mime type. The short list contains "select" applications recommended for handling this MIME type, appropriate for display to the user.


gnome_vfs_mime_get_short_list_components ()

GList*      gnome_vfs_mime_get_short_list_components
                                            (const char *mime_type);

Return an unsorted sorted list of Bonobo_ServerInfo * data structures for the requested mime type. The short list contains "select" components recommended for handling this MIME type, appropriate for display to the user.


gnome_vfs_mime_get_all_applications ()

GList*      gnome_vfs_mime_get_all_applications
                                            (const char *mime_type);

Return an alphabetically sorted list of GnomeVFSMimeApplication data structures representing all applications in the MIME database registered to handle files of MIME type mime_type (and supertypes).


gnome_vfs_mime_get_all_components ()

GList*      gnome_vfs_mime_get_all_components
                                            (const char *mime_type);

Return an alphabetically sorted list of Bonobo_ServerInfo data structures representing all Bonobo components registered to handle files of MIME type mime_type (and supertypes).


gnome_vfs_mime_set_default_action_type ()

GnomeVFSResult gnome_vfs_mime_set_default_action_type
                                            (const char *mime_type,
                                             GnomeVFSMimeActionType action_type);

Sets the default action type to be performed on files of MIME type mime_type.


gnome_vfs_mime_set_default_application ()

GnomeVFSResult gnome_vfs_mime_set_default_application
                                            (const char *mime_type,
                                             const char *application_id);

Sets the default application to be run on files of MIME type mime_type.


gnome_vfs_mime_set_default_component ()

GnomeVFSResult gnome_vfs_mime_set_default_component
                                            (const char *mime_type,
                                             const char *component_iid);

Sets the default component to be activated for files of MIME type mime_type.


gnome_vfs_mime_get_icon ()

const char* gnome_vfs_mime_get_icon         (const char *mime_type);

Query the MIME database for an icon representing the specified MIME type.


gnome_vfs_mime_set_icon ()

GnomeVFSResult gnome_vfs_mime_set_icon      (const char *mime_type,
                                             const char *filename);

Set the icon entry for a particular MIME type in the MIME database. Note that icon entries need not necessarily contain the full path, and do not necessarily need to specify an extension. So "i-regular", "my-special-icon.png", and "some-icon" are all valid icon filenames.


gnome_vfs_mime_get_description ()

const char* gnome_vfs_mime_get_description  (const char *mime_type);

Query the MIME database for a description of the specified MIME type.


gnome_vfs_mime_set_description ()

GnomeVFSResult gnome_vfs_mime_set_description
                                            (const char *mime_type,
                                             const char *description);

Set the description of this MIME type in the MIME database. The description should be something like "Gnumeric spreadsheet".


gnome_vfs_mime_can_be_executable ()

gboolean    gnome_vfs_mime_can_be_executable
                                            (const char *mime_type);

Check whether files of this MIME type might conceivably be executable. Default for known types if FALSE. Default for unknown types is TRUE.


gnome_vfs_mime_set_can_be_executable ()

GnomeVFSResult gnome_vfs_mime_set_can_be_executable
                                            (const char *mime_type,
                                             gboolean new_value);

Set whether files of this MIME type might conceivably be executable.


gnome_vfs_mime_set_short_list_applications ()

GnomeVFSResult gnome_vfs_mime_set_short_list_applications
                                            (const char *mime_type,
                                             GList *application_ids);

Set the short list of applications for the specified MIME type. The short list contains applications recommended for possible selection by the user.


gnome_vfs_mime_set_short_list_components ()

GnomeVFSResult gnome_vfs_mime_set_short_list_components
                                            (const char *mime_type,
                                             GList *component_iids);

Set the short list of components for the specified MIME type. The short list contains companents recommended for possible selection by the user. *


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);

Add an application to the short list for MIME type mime_type. The short list contains applications recommended for display as choices to the user for a particular MIME type.


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);

Remove an application from the short list for MIME type mime_type. The short list contains applications recommended for display as choices to the user for a particular MIME type.


gnome_vfs_mime_add_component_to_short_list ()

GnomeVFSResult gnome_vfs_mime_add_component_to_short_list
                                            (const char *mime_type,
                                             const char *iid);

Add a component to the short list for MIME type mime_type. The short list contains components recommended for display as choices to the user for a particular MIME type.


gnome_vfs_mime_remove_component_from_short_list ()

GnomeVFSResult gnome_vfs_mime_remove_component_from_short_list
                                            (const char *mime_type,
                                             const char *iid);

Remove a component from the short list for MIME type mime_type. The short list contains components recommended for display as choices to the user for a particular MIME type.


gnome_vfs_mime_add_extension ()

GnomeVFSResult gnome_vfs_mime_add_extension (const char *mime_type,
                                             const char *extension);

Add a file extension to the specificed MIME type in the MIME database.


gnome_vfs_mime_remove_extension ()

GnomeVFSResult gnome_vfs_mime_remove_extension
                                            (const char *mime_type,
                                             const char *extension);

Removes a file extension from the specificed MIME type in the MIME database.


gnome_vfs_mime_extend_all_applications ()

GnomeVFSResult gnome_vfs_mime_extend_all_applications
                                            (const char *mime_type,
                                             GList *application_ids);

Register mime_type as being handled by all applications list in application_ids.


gnome_vfs_mime_remove_from_all_applications ()

GnomeVFSResult gnome_vfs_mime_remove_from_all_applications
                                            (const char *mime_type,
                                             GList *application_ids);

Remove mime_type as a handled type from every application in application_ids


gnome_vfs_mime_application_new_from_id ()

GnomeVFSMimeApplication* gnome_vfs_mime_application_new_from_id
                                            (const char *id);

Fetches the GnomeVFSMimeApplication associated with the specified application ID from the MIME database.


gnome_vfs_mime_application_free ()

void        gnome_vfs_mime_application_free (GnomeVFSMimeApplication *application);

Frees a GnomeVFSMimeApplication *.


gnome_vfs_mime_action_free ()

void        gnome_vfs_mime_action_free      (GnomeVFSMimeAction *action);

Frees a GnomeVFSMimeAction *.


gnome_vfs_mime_application_list_free ()

void        gnome_vfs_mime_application_list_free
                                            (GList *list);

Frees lists of GnomeVFSApplications, as returned from functions such as gnome_vfs_get_all_applications().


gnome_vfs_mime_component_list_free ()

void        gnome_vfs_mime_component_list_free
                                            (GList *list);

Frees lists of Bonobo_ServerInfo * (as returned from functions such as gnome_vfs_get_all_components)


gnome_vfs_mime_id_in_application_list ()

gboolean    gnome_vfs_mime_id_in_application_list
                                            (const char *id,
                                             GList *applications);

Check whether an application id is in a list of GnomeVFSMimeApplications.


gnome_vfs_mime_id_in_component_list ()

gboolean    gnome_vfs_mime_id_in_component_list
                                            (const char *iid,
                                             GList *components);

Check whether a component iid is in a list of Bonobo_ServerInfos.


gnome_vfs_mime_remove_application_from_list ()

GList*      gnome_vfs_mime_remove_application_from_list
                                            (GList *applications,
                                             const char *application_id,
                                             gboolean *did_remove);

Remove an application specified by id from a list of GnomeVFSMimeApplications.


gnome_vfs_mime_remove_component_from_list ()

GList*      gnome_vfs_mime_remove_component_from_list
                                            (GList *components,
                                             const char *iid,
                                             gboolean *did_remove);

Remove a component specified by iid from a list of Bonobo_ServerInfos.


gnome_vfs_mime_id_list_from_component_list ()

GList*      gnome_vfs_mime_id_list_from_component_list
                                            (GList *components);

Create a list of component iids from a list of Bonobo_ServerInfos.


gnome_vfs_mime_id_list_from_application_list ()

GList*      gnome_vfs_mime_id_list_from_application_list
                                            (GList *applications);

Create a list of application ids from a list of GnomeVFSMimeApplications.


gnome_vfs_mime_freeze ()

void        gnome_vfs_mime_freeze           (void);

Freezes the mime data so that you can do multiple updates to the dat in one batch without needing to back the files to disk or readind them


gnome_vfs_mime_thaw ()

void        gnome_vfs_mime_thaw             (void);

UnFreezes the mime data so that you can do multiple updates to the dat in one batch without needing to back the files to disk or readind them


gnome_vfs_mime_info_reload ()

void        gnome_vfs_mime_info_reload      (void);

Reload the MIME database from disk and notify any listeners holding active GnomeVFSMIMEMonitor objects.


gnome_vfs_mime_type_is_known ()

gboolean    gnome_vfs_mime_type_is_known    (const char *mime_type);

This function returns TRUE if mime_type is in the MIME database at all.


gnome_vfs_mime_get_value ()

const char* gnome_vfs_mime_get_value        (const char *mime_type,
                                             const char *key);

This function retrieves the value associated with key in the given GnomeMimeContext. The string is private, you should not free the result.


gnome_vfs_mime_set_value ()

GnomeVFSResult gnome_vfs_mime_set_value     (const char *mime_type,
                                             const char *key,
                                             const char *value);

This function is going to set the value associated to the key and it will save it to the user' file if necessary. You should not free the key/values passed to this function. They are used internally.


gnome_vfs_mime_get_key_list ()

GList*      gnome_vfs_mime_get_key_list     (const char *mime_type);

Gets a list of all keys associated with mime_type.


gnome_vfs_mime_keys_list_free ()

void        gnome_vfs_mime_keys_list_free   (GList *mime_type_list);

Frees the mime type list.


gnome_vfs_mime_get_extensions_list ()

GList*      gnome_vfs_mime_get_extensions_list
                                            (const char *mime_type);

Get the file extensions associated with mime type mime_type.


gnome_vfs_mime_extensions_list_free ()

void        gnome_vfs_mime_extensions_list_free
                                            (GList *list);

Call this function on the list returned by gnome_vfs_mime_extensions to free the list and all of its elements.


gnome_vfs_mime_get_extensions_string ()

char*       gnome_vfs_mime_get_extensions_string
                                            (const char *mime_type);

Retrieves the extensions associated with mime_type as a single space seperated string.


gnome_vfs_mime_get_extensions_pretty_string ()

char*       gnome_vfs_mime_get_extensions_pretty_string
                                            (const char *mime_type);

Returns the supported extensions for mime_type as a comma-seperated list.


gnome_vfs_get_registered_mime_types ()

GList*      gnome_vfs_get_registered_mime_types
                                            (void);


gnome_vfs_mime_registered_mime_type_list_free ()

void        gnome_vfs_mime_registered_mime_type_list_free
                                            (GList *list);

Call this function on the list returned by gnome_vfs_get_registered_mime_types to free the list and all of its elements.


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);

This function sets the key data for the registered mime type's hash table.


gnome_vfs_mime_set_extensions_list ()

GnomeVFSResult gnome_vfs_mime_set_extensions_list
                                            (const char *mime_type,
                                             const char *extensions_list);

Sets the extensions for a given mime type. Overrides the previously set extensions.


gnome_vfs_mime_registered_mime_type_delete ()

void        gnome_vfs_mime_registered_mime_type_delete
                                            (const char *mime_type);

Delete a mime type for the user which runs this command. You can undo this only by calling gnome_vfs_mime_reset


gnome_vfs_mime_reset ()

void        gnome_vfs_mime_reset            (void);

resets the user's mime database to the system defaults.