## MIME Database MIME Database — functions for getting information about applications and components associated with MIME types. |

## Synopsis

                        GnomeVFSMimeApplication;
    GnomeVFSMimeApplication * gnome_vfs_mime_get_default_application
                                                            (const char *mime_type);
    GnomeVFSMimeApplication * gnome_vfs_mime_get_default_application_for_uri
                                                            (const char *uri,
                                                             const char *mime_type);
    GList *                   gnome_vfs_mime_get_all_applications
                                                            (const char *mime_type);
    GList *			          gnome_vfs_mime_get_all_applications_for_uri
                                                            (const char *uri,
                                                             const char *mime_type);
    GList *             gnome_vfs_mime_get_all_desktop_entries
                                                            (const char *mime_type);
    gchar *             gnome_vfs_mime_get_default_desktop_entry
                                                            (const char *mime_type);
    Bonobo_ServerInfo * gnome_vfs_mime_get_default_component
                                                            (const char *mime_type);
    GList *             gnome_vfs_mime_get_all_components   (const char *mime_type);
    const char *        gnome_vfs_mime_get_icon             (const char *mime_type);
    const char *        gnome_vfs_mime_get_description      (const char *mime_type);
    gboolean            gnome_vfs_mime_can_be_executable    (const char *mime_type);
    GnomeVFSMimeApplication * gnome_vfs_mime_application_new_from_desktop_id
                                                            (const char *id);
    GnomeVFSResult      gnome_vfs_mime_application_launch   (GnomeVFSMimeApplication *app,
                                                             GList *uris);
    GnomeVFSResult      gnome_vfs_mime_application_launch_with_env
                                                            (GnomeVFSMimeApplication *app,
                                                             GList *uris,
                                                             char **envp);
    const char *        gnome_vfs_mime_application_get_desktop_id
                                                            (GnomeVFSMimeApplication *app);
    const char *        gnome_vfs_mime_application_get_desktop_file_path
                                                            (GnomeVFSMimeApplication *app);
    const char *        gnome_vfs_mime_application_get_name (GnomeVFSMimeApplication *app);
    const char *        gnome_vfs_mime_application_get_generic_name
                                                            (GnomeVFSMimeApplication *app);
    const char *        gnome_vfs_mime_application_get_icon (GnomeVFSMimeApplication *app);
    const char *        gnome_vfs_mime_application_get_exec (GnomeVFSMimeApplication *app);
    const char *        gnome_vfs_mime_application_get_binary_name
                                                            (GnomeVFSMimeApplication *app);
    gboolean            gnome_vfs_mime_application_requires_terminal
                                                            (GnomeVFSMimeApplication *app);
    gboolean            gnome_vfs_mime_application_supports_uris
                                                            (GnomeVFSMimeApplication *app);
    gboolean            gnome_vfs_mime_application_supports_startup_notification
                                                            (GnomeVFSMimeApplication *app);
    const char *        gnome_vfs_mime_application_get_startup_wm_class
                                                            (GnomeVFSMimeApplication *app);
    gboolean            gnome_vfs_mime_application_equal    (GnomeVFSMimeApplication *app_a,
                                                             GnomeVFSMimeApplication *app_b);
    GnomeVFSMimeApplication * gnome_vfs_mime_application_copy
                                                            (GnomeVFSMimeApplication *application);
    void                gnome_vfs_mime_application_free     (GnomeVFSMimeApplication *application);
    void                gnome_vfs_mime_application_list_free
                                                            (GList *list);
    void                gnome_vfs_mime_component_list_free  (GList *list);

## Description

This API can be used to query the applications and components associated with particular MIME types, and to collect extra information about them, and also provides a convenience function for launching them. Applications can register themselves for particular MIME types by adhering to the Freedesktop.Org Desktop Entry Specification.

## Details

### GnomeVFSMimeApplication

    typedef struct {
    	char *id;
    	char *name;
    } GnomeVFSMimeApplication;

A struct encapsulating information about an application known to the MIME database.

Only very few fields of this information are actually public, most of them must be queried using the `gnome_vfs_mime_application_*()` API.

char *`id`; | The desktop ID of the application.
char *`name`; | The user-visible name of the application.

### 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.

If you know the actual uri of the file you should use gnome_vfs_mime_get_default_application_for_uri instead, as it will then be able to pick a better app. For instance it won't pick an app that claims to only handle local files for a remote uri.

`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_application_for_uri ()

    GnomeVFSMimeApplication * gnome_vfs_mime_get_default_application_for_uri
                                                            (const char *uri,
                                                             const char *mime_type);

`uri` : |
`mime_type` : |
Returns : |

### 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).

`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_applications_for_uri ()

    GList *			          gnome_vfs_mime_get_all_applications_for_uri
                                                            (const char *uri,
                                                             const char *mime_type);

Return an alphabetically sorted list of GnomeVFSMimeApplication data structures representing all applications in the MIME database able to handle the file identified by `uri` of `mime_type` (and supertypes).

`uri` : | a stringified uri.
`mime_type` : | a const char * containing a mime type, e.g. "application/x-php".
Returns : | a GList * where the elements are GnomeVFSMimeApplication * representing all possible handlers

Since 2.10

### gnome_vfs_mime_get_all_desktop_entries ()

    GList *             gnome_vfs_mime_get_all_desktop_entries
                                                            (const char *mime_type);

### Warning

`gnome_vfs_mime_get_all_desktop_entries` is deprecated and should not be used in newly-written code.

Returns all the desktop filenames for `mime_type`. The desktop files are listed in an order so that default applications are listed before non-default ones, and handlers for inherited mimetypes are listed after the base ones.

`mime_type` : | a mime type.
Returns : | a GList containing the desktop filenames containing the `mime_type`.

### gnome_vfs_mime_get_default_desktop_entry ()

    gchar *             gnome_vfs_mime_get_default_desktop_entry
                                                            (const char *mime_type);

### Warning

`gnome_vfs_mime_get_default_desktop_entry` is deprecated and should not be used in newly-written code.

Returns the default desktop filename for `mime_type`.

`mime_type` : | a mime type.
Returns : | the default desktop filename for `mime_type`.

### gnome_vfs_mime_get_default_component ()

    Bonobo_ServerInfo * gnome_vfs_mime_get_default_component
                                                            (const char *mime_type);

### Warning

`gnome_vfs_mime_get_default_component` is deprecated and should not be used in newly-written code.

`mime_type` : |
Returns : |

### gnome_vfs_mime_get_all_components ()

    GList *             gnome_vfs_mime_get_all_components   (const char *mime_type);

### Warning

`gnome_vfs_mime_get_all_components` is deprecated and should not be used in newly-written code.

`mime_type` : |
Returns : |

### gnome_vfs_mime_get_icon ()

    const char *        gnome_vfs_mime_get_icon             (const char *mime_type);

### Warning

`gnome_vfs_mime_get_icon` is deprecated and should not be used in newly-written code. Use `gnome_icon_lookup()` function in libgnomeui instead.

Query the MIME database for an icon representing the `mime_type`.

It usually returns 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.

`mime_type` : | a const char * containing a MIME type.
Returns : | The filename of the icon as listed in the MIME database.

### 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 `mime_type`.

`mime_type` : | the mime type.
Returns : | description of MIME type `mime_type`.

### gnome_vfs_mime_can_be_executable ()

    gboolean            gnome_vfs_mime_can_be_executable    (const char *mime_type);

Check whether files of `mime_type` might conceivably be executable. Default for known types if `FALSE`. Default for unknown types is `TRUE`.

`mime_type` : | a const char * containing a mime type.
Returns : | `TRUE` if files of `mime_type` can be executable, `FALSE` otherwise.

### gnome_vfs_mime_application_new_from_desktop_id ()

    GnomeVFSMimeApplication * gnome_vfs_mime_application_new_from_desktop_id
                                                            (const char *id);

Returns a new GnomeVFSMimeApplication for the `id`.

`id` : | the identifier of a desktop entry.
Returns : | a GnomeVFSMimeApplication.

Since 2.10

### gnome_vfs_mime_application_launch ()

    GnomeVFSResult      gnome_vfs_mime_application_launch   (GnomeVFSMimeApplication *app,
                                                             GList *uris);

Launches the given mime application with the given parameters. Command line parameters will be expanded as required by the application. The application will also be launched in a terminal if that is required. If the application only supports one argument per instance then multiple instances of the application will be launched.

`app` : | the GnomeVFSMimeApplication to launch.
`uris` : | parameters for the GnomeVFSMimeApplication.
Returns : | `GNOME_VFS_OK` if the application was launched. `GNOME_VFS_ERROR_NOT_SUPPORTED` if the uri protocol is not supported by the application. `GNOME_VFS_ERROR_PARSE` if the application command can not be parsed. `GNOME_VFS_ERROR_LAUNCH` if the application command can not be launched. `GNOME_VFS_ERROR_INTERNAL` for other internal and GConf errors.

Since 2.4

### gnome_vfs_mime_application_launch_with_env ()

    GnomeVFSResult      gnome_vfs_mime_application_launch_with_env
                                                            (GnomeVFSMimeApplication *app,
                                                             GList *uris,
                                                             char **envp);

Same as `gnome_vfs_mime_application_launch()` except that the application will be launched with the given environment.

`app` : | the GnomeVFSMimeApplication to launch.
`uris` : | parameters for the GnomeVFSMimeApplication.
`envp` : | the environment to use for the application.
Returns : | same as `gnome_vfs_mime_application_launch()`.

Since 2.4

### gnome_vfs_mime_application_get_desktop_id ()

    const char *        gnome_vfs_mime_application_get_desktop_id
                                                            (GnomeVFSMimeApplication *app);

Returns the identifier of the desktop entry.

`app` : | a GnomeVFSMimeApplication.
Returns : | the identifier of the desktop entry.

Since 2.10

### gnome_vfs_mime_application_get_desktop_file_path ()

    const char *        gnome_vfs_mime_application_get_desktop_file_path
                                                            (GnomeVFSMimeApplication *app);

Returns the path of the desktop entry, a configuration file describing the properties of a particular program like it's name, how it is to be launched, how it appears in menus.

`app` : | a GnomeVFSMimeApplication.
Returns : | the path of the .desktop file.

Since 2.10

### gnome_vfs_mime_application_get_name ()

    const char *        gnome_vfs_mime_application_get_name (GnomeVFSMimeApplication *app);

Returns the name of the application `app`

`app` : | a GnomeVFSMimeApplication.
Returns : | the name of the application.

Since 2.10

### gnome_vfs_mime_application_get_generic_name ()

    const char *        gnome_vfs_mime_application_get_generic_name
                                                            (GnomeVFSMimeApplication *app);

Returns the generic name of the application.

`app` : | a GnomeVFSMimeApplication.
Returns : | the generic name of the application.

Since 2.10

### gnome_vfs_mime_application_get_icon ()

    const char *        gnome_vfs_mime_application_get_icon (GnomeVFSMimeApplication *app);

Returns an icon representing the specified application.

`app` : | a GnomeVFSMimeApplication.
Returns : | the filename of the icon usually without path information, e.g. "gedit-icon.png", and sometimes does not have an extension, e.g. "gnome-pdf" if the icon is supposed to be image type agnostic between icon themes. Icons are generic, and not theme specific.

Since 2.10

### gnome_vfs_mime_application_get_exec ()

    const char *        gnome_vfs_mime_application_get_exec (GnomeVFSMimeApplication *app);

Returns the program to execute, possibly with arguments and parameter variables, as specified by the Desktop Entry Specification.

`app` : | a GnomeVFSMimeApplication.
Returns : | the command line to execute.

Since 2.10

### gnome_vfs_mime_application_get_binary_name ()

    const char *        gnome_vfs_mime_application_get_binary_name
                                                            (GnomeVFSMimeApplication *app);

Returns the binary name of the specified application. Useful to implement startup notification. Note that this only provides partial information about application execution, it misses arguments and macros. DO NOT USE it to launch the application. Use gnome_vfs_mime_application_launch or `gnome_vfs_mime_application_get_exec()` if you really need to write a custom launcher.

`app` : | a GnomeVFSMimeApplication.
Returns : | the application's binary name.

Since 2.10

### gnome_vfs_mime_application_requires_terminal ()

    gboolean            gnome_vfs_mime_application_requires_terminal
                                                            (GnomeVFSMimeApplication *app);

Returns whether the application runs in a terminal window.

`app` : | a GnomeVFSMimeApplication.
Returns : | `TRUE` if the application runs in a terminal.

Since 2.10

### gnome_vfs_mime_application_supports_uris ()

    gboolean            gnome_vfs_mime_application_supports_uris
                                                            (GnomeVFSMimeApplication *app);

Returns whether the application accept uris as command lines arguments.

`app` : | a GnomeVFSMimeApplication.
Returns : | `TRUE` if the application can handle uris.

Since 2.10

### gnome_vfs_mime_application_supports_startup_notification ()

    gboolean            gnome_vfs_mime_application_supports_startup_notification
                                                            (GnomeVFSMimeApplication *app);

Returns whether the application supports startup notification. If true, it is KNOWN that the application will send a "remove" message when started with the DESKTOP_LAUNCH_ID environment variable set.

`app` : | a GnomeVFSMimeApplication.
Returns : | `TRUE` if the application supports startup notification.

Since 2.10

### gnome_vfs_mime_application_get_startup_wm_class ()

    const char *        gnome_vfs_mime_application_get_startup_wm_class
                                                            (GnomeVFSMimeApplication *app);

Returns the WM class of the main window of the application.

`app` : | a GnomeVFSMimeApplication
Returns : | The WM class of the application's window

Since 2.10

### gnome_vfs_mime_application_equal ()

    gboolean            gnome_vfs_mime_application_equal    (GnomeVFSMimeApplication *app_a,
                                                             GnomeVFSMimeApplication *app_b);

Compare `app_a` and `app_b`.

`app_a` : | a GnomeVFSMimeApplication.
`app_b` : | a GnomeVFSMimeApplication.
Returns : | `TRUE` if `app_a` and `app_b` are equal, `FALSE` otherwise.

Since 2.10

### gnome_vfs_mime_application_copy ()

    GnomeVFSMimeApplication * gnome_vfs_mime_application_copy
                                                            (GnomeVFSMimeApplication *application);

Creates a newly referenced copy of a GnomeVFSMimeApplication object.

`application` : | a GnomeVFSMimeApplication to be duplicated.
Returns : | a copy of `application`.

### gnome_vfs_mime_application_free ()

    void                gnome_vfs_mime_application_free     (GnomeVFSMimeApplication *application);

Frees a GnomeVFSMimeApplication *.

`application` : | a GnomeVFSMimeApplication to be freed.

### 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()`.

`list` : | a GList of GnomeVFSApplication * to be freed.

### gnome_vfs_mime_component_list_free ()

    void                gnome_vfs_mime_component_list_free  (GList *list);

### Warning

`gnome_vfs_mime_component_list_free` is deprecated and should not be used in newly-written code.

`list` : |