MIME Database

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

## Synopsis

                        MateVFSMimeApplication;
    MateVFSMimeApplication * mate_vfs_mime_get_default_application
                                                            (const char *mime_type);
    MateVFSMimeApplication * mate_vfs_mime_get_default_application_for_uri
                                                            (const char *uri,
                                                             const char *mime_type);
    GList *                   mate_vfs_mime_get_all_applications
                                                            (const char *mime_type);
    GList *			          mate_vfs_mime_get_all_applications_for_uri
                                                            (const char *uri,
                                                             const char *mime_type);
    GList *             mate_vfs_mime_get_all_desktop_entries
                                                            (const char *mime_type);
    gchar *             mate_vfs_mime_get_default_desktop_entry
                                                            (const char *mime_type);
    MateComponent_ServerInfo * mate_vfs_mime_get_default_component
                                                            (const char *mime_type);
    GList *             mate_vfs_mime_get_all_components   (const char *mime_type);
    const char *        mate_vfs_mime_get_icon             (const char *mime_type);
    const char *        mate_vfs_mime_get_description      (const char *mime_type);
    gboolean            mate_vfs_mime_can_be_executable    (const char *mime_type);
    MateVFSMimeApplication * mate_vfs_mime_application_new_from_desktop_id
                                                            (const char *id);
    MateVFSResult      mate_vfs_mime_application_launch   (MateVFSMimeApplication *app,
                                                             GList *uris);
    MateVFSResult      mate_vfs_mime_application_launch_with_env
                                                            (MateVFSMimeApplication *app,
                                                             GList *uris,
                                                             char **envp);
    const char *        mate_vfs_mime_application_get_desktop_id
                                                            (MateVFSMimeApplication *app);
    const char *        mate_vfs_mime_application_get_desktop_file_path
                                                            (MateVFSMimeApplication *app);
    const char *        mate_vfs_mime_application_get_name (MateVFSMimeApplication *app);
    const char *        mate_vfs_mime_application_get_generic_name
                                                            (MateVFSMimeApplication *app);
    const char *        mate_vfs_mime_application_get_icon (MateVFSMimeApplication *app);
    const char *        mate_vfs_mime_application_get_exec (MateVFSMimeApplication *app);
    const char *        mate_vfs_mime_application_get_binary_name
                                                            (MateVFSMimeApplication *app);
    gboolean            mate_vfs_mime_application_requires_terminal
                                                            (MateVFSMimeApplication *app);
    gboolean            mate_vfs_mime_application_supports_uris
                                                            (MateVFSMimeApplication *app);
    gboolean            mate_vfs_mime_application_supports_startup_notification
                                                            (MateVFSMimeApplication *app);
    const char *        mate_vfs_mime_application_get_startup_wm_class
                                                            (MateVFSMimeApplication *app);
    gboolean            mate_vfs_mime_application_equal    (MateVFSMimeApplication *app_a,
                                                             MateVFSMimeApplication *app_b);
    MateVFSMimeApplication * mate_vfs_mime_application_copy
                                                            (MateVFSMimeApplication *application);
    void                mate_vfs_mime_application_free     (MateVFSMimeApplication *application);
    void                mate_vfs_mime_application_list_free
                                                            (GList *list);
    void                mate_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

### MateVFSMimeApplication

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

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 `mate_vfs_mime_application_*()` API.

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

### mate_vfs_mime_get_default_application ()

    MateVFSMimeApplication * mate_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 mate_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 MateVFSMimeApplication representing the default handler of `mime_type`.

### mate_vfs_mime_get_default_application_for_uri ()

    MateVFSMimeApplication * mate_vfs_mime_get_default_application_for_uri
                                                            (const char *uri,
                                                             const char *mime_type);

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

### mate_vfs_mime_get_all_applications ()

    GList *                   mate_vfs_mime_get_all_applications
                                                            (const char *mime_type);

Return an alphabetically sorted list of MateVFSMimeApplication 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 MateVFSMimeApplication * representing applications that handle MIME type `mime_type`.

### mate_vfs_mime_get_all_applications_for_uri ()

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

Return an alphabetically sorted list of MateVFSMimeApplication 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 MateVFSMimeApplication * representing all possible handlers

Since 2.10

### mate_vfs_mime_get_all_desktop_entries ()

    GList *             mate_vfs_mime_get_all_desktop_entries
                                                            (const char *mime_type);

### Warning

`mate_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`.

### mate_vfs_mime_get_default_desktop_entry ()

    gchar *             mate_vfs_mime_get_default_desktop_entry
                                                            (const char *mime_type);

### Warning

`mate_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`.

### mate_vfs_mime_get_default_component ()

    MateComponent_ServerInfo * mate_vfs_mime_get_default_component
                                                            (const char *mime_type);

### Warning

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

`mime_type` : |
Returns : |

### mate_vfs_mime_get_all_components ()

    GList *             mate_vfs_mime_get_all_components   (const char *mime_type);

### Warning

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

`mime_type` : |
Returns : |

### mate_vfs_mime_get_icon ()

    const char *        mate_vfs_mime_get_icon             (const char *mime_type);

### Warning

`mate_vfs_mime_get_icon` is deprecated and should not be used in newly-written code. Use `mate_icon_lookup()` function in libmateui 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 Caja, 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.

### mate_vfs_mime_get_description ()

    const char *        mate_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`.

### mate_vfs_mime_can_be_executable ()

    gboolean            mate_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.

### mate_vfs_mime_application_new_from_desktop_id ()

    MateVFSMimeApplication * mate_vfs_mime_application_new_from_desktop_id
                                                            (const char *id);

Returns a new MateVFSMimeApplication for the `id`.

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

Since 2.10

### mate_vfs_mime_application_launch ()

    MateVFSResult      mate_vfs_mime_application_launch   (MateVFSMimeApplication *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 MateVFSMimeApplication to launch.
`uris` : | parameters for the MateVFSMimeApplication.
Returns : | `MATE_VFS_OK` if the application was launched. `MATE_VFS_ERROR_NOT_SUPPORTED` if the uri protocol is not supported by the application. `MATE_VFS_ERROR_PARSE` if the application command can not be parsed. `MATE_VFS_ERROR_LAUNCH` if the application command can not be launched. `MATE_VFS_ERROR_INTERNAL` for other internal and MateConf errors.

Since 2.4

### mate_vfs_mime_application_launch_with_env ()

    MateVFSResult      mate_vfs_mime_application_launch_with_env
                                                            (MateVFSMimeApplication *app,
                                                             GList *uris,
                                                             char **envp);

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

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

Since 2.4

### mate_vfs_mime_application_get_desktop_id ()

    const char *        mate_vfs_mime_application_get_desktop_id
                                                            (MateVFSMimeApplication *app);

Returns the identifier of the desktop entry.

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

Since 2.10

### mate_vfs_mime_application_get_desktop_file_path ()

    const char *        mate_vfs_mime_application_get_desktop_file_path
                                                            (MateVFSMimeApplication *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 MateVFSMimeApplication.
Returns : | the path of the .desktop file.

Since 2.10

### mate_vfs_mime_application_get_name ()

    const char *        mate_vfs_mime_application_get_name (MateVFSMimeApplication *app);

Returns the name of the application `app`

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

Since 2.10

### mate_vfs_mime_application_get_generic_name ()

    const char *        mate_vfs_mime_application_get_generic_name
                                                            (MateVFSMimeApplication *app);

Returns the generic name of the application.

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

Since 2.10

### mate_vfs_mime_application_get_icon ()

    const char *        mate_vfs_mime_application_get_icon (MateVFSMimeApplication *app);

Returns an icon representing the specified application.

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

Since 2.10

### mate_vfs_mime_application_get_exec ()

    const char *        mate_vfs_mime_application_get_exec (MateVFSMimeApplication *app);

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

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

Since 2.10

### mate_vfs_mime_application_get_binary_name ()

    const char *        mate_vfs_mime_application_get_binary_name
                                                            (MateVFSMimeApplication *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 mate_vfs_mime_application_launch or `mate_vfs_mime_application_get_exec()` if you really need to write a custom launcher.

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

Since 2.10

### mate_vfs_mime_application_requires_terminal ()

    gboolean            mate_vfs_mime_application_requires_terminal
                                                            (MateVFSMimeApplication *app);

Returns whether the application runs in a terminal window.

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

Since 2.10

### mate_vfs_mime_application_supports_uris ()

    gboolean            mate_vfs_mime_application_supports_uris
                                                            (MateVFSMimeApplication *app);

Returns whether the application accept uris as command lines arguments.

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

Since 2.10

### mate_vfs_mime_application_supports_startup_notification ()

    gboolean            mate_vfs_mime_application_supports_startup_notification
                                                            (MateVFSMimeApplication *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 MateVFSMimeApplication.
Returns : | `TRUE` if the application supports startup notification.

Since 2.10

### mate_vfs_mime_application_get_startup_wm_class ()

    const char *        mate_vfs_mime_application_get_startup_wm_class
                                                            (MateVFSMimeApplication *app);

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

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

Since 2.10

### mate_vfs_mime_application_equal ()

    gboolean            mate_vfs_mime_application_equal    (MateVFSMimeApplication *app_a,
                                                             MateVFSMimeApplication *app_b);

Compare `app_a` and `app_b`.

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

Since 2.10

### mate_vfs_mime_application_copy ()

    MateVFSMimeApplication * mate_vfs_mime_application_copy
                                                            (MateVFSMimeApplication *application);

Creates a newly referenced copy of a MateVFSMimeApplication object.

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

### mate_vfs_mime_application_free ()

    void                mate_vfs_mime_application_free     (MateVFSMimeApplication *application);

Frees a MateVFSMimeApplication *.

`application` : | a MateVFSMimeApplication to be freed.

### mate_vfs_mime_application_list_free ()

    void                mate_vfs_mime_application_list_free
                                                            (GList *list);

Frees lists of MateVFSApplications, as returned from functions such as `mate_vfs_get_all_applications()`.

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

### mate_vfs_mime_component_list_free ()

    void                mate_vfs_mime_component_list_free  (GList *list);

### Warning

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

`list` : |