## Application Registry

Application Registry — stores supported MIME types and URIs of various applications

##

# Synopsis

    #define     GNOME_VFS_APPLICATION_REGISTRY_COMMAND
    #define     GNOME_VFS_APPLICATION_REGISTRY_NAME
    #define     GNOME_VFS_APPLICATION_REGISTRY_CAN_OPEN_MULTIPLE_FILES
    #define     GNOME_VFS_APPLICATION_REGISTRY_REQUIRES_TERMINAL
    gboolean    gnome_vfs_application_registry_exists
                                                (const char *app_id);
    GList*      gnome_vfs_application_registry_get_keys
                                                (const char *app_id);
    const char* gnome_vfs_application_registry_peek_value
                                                (const char *app_id,
                                                 const char *key);
    gboolean    gnome_vfs_application_registry_get_bool_value
                                                (const char *app_id,
                                                 const char *key,
                                                 gboolean *got_key);
    void        gnome_vfs_application_registry_remove_application
                                                (const char *app_id);
    void        gnome_vfs_application_registry_set_value
                                                (const char *app_id,
                                                 const char *key,
                                                 const char *value);
    void        gnome_vfs_application_registry_set_bool_value
                                                (const char *app_id,
                                                 const char *key,
                                                 gboolean value);
    void        gnome_vfs_application_registry_unset_key
                                                (const char *app_id,
                                                 const char *key);
    GList*      gnome_vfs_application_registry_get_applications
                                                (const char *mime_type);
    GList*      gnome_vfs_application_registry_get_mime_types
                                                (const char *app_id);
    gboolean    gnome_vfs_application_registry_supports_mime_type
                                                (const char *app_id,
                                                 const char *mime_type);
    gboolean    gnome_vfs_application_registry_supports_uri_scheme
                                                (const char *app_id,
                                                 const char *uri_scheme);
    gboolean    gnome_vfs_application_is_user_owned_application
                                                (const GnomeVFSMimeApplication *application);
    void        gnome_vfs_application_registry_clear_mime_types
                                                (const char *app_id);
    void        gnome_vfs_application_registry_add_mime_type
                                                (const char *app_id,
                                                 const char *mime_type);
    void        gnome_vfs_application_registry_remove_mime_type
                                                (const char *app_id,
                                                 const char *mime_type);
    GnomeVFSResult gnome_vfs_application_registry_sync
                                                (void);
    void        gnome_vfs_application_registry_shutdown
                                                (void);
    void        gnome_vfs_application_registry_reload
                                                (void);
    GnomeVFSMimeApplication* gnome_vfs_application_registry_get_mime_application
                                                (const char *app_id);
    void        gnome_vfs_application_registry_save_mime_application
                                                (const GnomeVFSMimeApplication *application);

## Description

## Details

### GNOME_VFS_APPLICATION_REGISTRY_COMMAND

    #define GNOME_VFS_APPLICATION_REGISTRY_COMMAND "command"

Application registry key for fetching the command to execute an application.

### GNOME_VFS_APPLICATION_REGISTRY_NAME

    #define GNOME_VFS_APPLICATION_REGISTRY_NAME "name"

Application registry key for fetching the name of an application.

### GNOME_VFS_APPLICATION_REGISTRY_CAN_OPEN_MULTIPLE_FILES

    #define GNOME_VFS_APPLICATION_REGISTRY_CAN_OPEN_MULTIPLE_FILES "can_open_multiple_files"

Application registry key for determining if an application can open multiple files in the same invocation.

### GNOME_VFS_APPLICATION_REGISTRY_REQUIRES_TERMINAL

    #define GNOME_VFS_APPLICATION_REGISTRY_REQUIRES_TERMINAL "requires_terminal"

Application registry key for determining if an application needs to run from within a terminal (for example, mpg123)

### gnome_vfs_application_registry_exists ()

    gboolean    gnome_vfs_application_registry_exists
                                                (const char *app_id);

This function will return TRUE if there is an entry for `app_id` in the registry, otherwise FALSE.

`app_id` : | an application ID
Returns : | TRUE if the application is in the registry, FALSE if not

### gnome_vfs_application_registry_get_keys ()

    GList*      gnome_vfs_application_registry_get_keys
                                                (const char *app_id);

This function wil return a list of strings which is the list of keys set for `app_id` in the application registry.

`app_id` : | the application ID for which to get keys
Returns : | A list of the keys set for `app_id`

### gnome_vfs_application_registry_peek_value ()

    const char* gnome_vfs_application_registry_peek_value
                                                (const char *app_id,
                                                 const char *key);

This will return the value associated with `key` for `app_id` in the application registry. There is no need to free the return value.

`app_id` : | the application ID for which to look up a value
`key` : | the key to look up
Returns : | the value associated with the key, or NULL if there is no associated value

### gnome_vfs_application_registry_get_bool_value ()

    gboolean    gnome_vfs_application_registry_get_bool_value
                                                (const char *app_id,
                                                 const char *key,
                                                 gboolean *got_key);

This will look up a key in the structure pointed to by app_id and return the boolean value of that key. It will return false if there are no applications associated with the app_id.

`app_id` : | registry id of the application
`key` : | key to look up
`got_key` : | TRUE if a setting was dound, otherwise FALSE
Returns : | TRUE if `key` is set to "true" or "yes" for `app_id`, otherwise FALSE

### gnome_vfs_application_registry_remove_application ()

    void        gnome_vfs_application_registry_remove_application
                                                (const char *app_id);

Given the registry id this function will remove all applications that has been set by the user. You will need to call gnome_vfs_application_registry_sync to save the changes.

`app_id` : | registry id of the application

### gnome_vfs_application_registry_set_value ()

    void        gnome_vfs_application_registry_set_value
                                                (const char *app_id,
                                                 const char *key,
                                                 const char *value);

This function will set values pertaining to registry entry pointed to by app_id. You will need to call gnome_vfs_application_registry_sync to realize the changes.

`app_id` : | registry id of the application
`key` : | target key
`value` : | value to set the target key to

### gnome_vfs_application_registry_set_bool_value ()

    void        gnome_vfs_application_registry_set_bool_value
                                                (const char *app_id,
                                                 const char *key,
                                                 gboolean value);

This function will modify those registry values that are of type boolean to a value specified by the user. You will need to call gnome_vfs_application_registry_sync to save your changes.

`app_id` : | registry id of the application
`key` : | target key
`value` : | value you want to set the target key to

### gnome_vfs_application_registry_unset_key ()

    void        gnome_vfs_application_registry_unset_key
                                                (const char *app_id,
                                                 const char *key);

This function given the application and the target will wipe the current value that the key contains.

`app_id` : | registry id of the application
`key` : | search key

### gnome_vfs_application_registry_get_applications ()

    GList*      gnome_vfs_application_registry_get_applications
                                                (const char *mime_type);

This will return all applications from the registry that are associated with the given mime type string, if NULL it returns all applications.

`mime_type` : | mime type string
Returns : | a list of the application IDs for all applications which support the given mime type.

### gnome_vfs_application_registry_get_mime_types ()

    GList*      gnome_vfs_application_registry_get_mime_types
                                                (const char *app_id);

This function returns a list of strings that represent the mime types that can be handled by an application.

`app_id` : | registry id of application
Returns : | a list of the mime types supported

### gnome_vfs_application_registry_supports_mime_type ()

    gboolean    gnome_vfs_application_registry_supports_mime_type
                                                (const char *app_id,
                                                 const char *mime_type);

Use this function to see if there is an application associated with a given mime type. The function will return true or false.

`app_id` : | registry id of application
`mime_type` : | mime type string
Returns : | TRUE if `app_id` supports `mime_type`, otherwise FALSE.

### gnome_vfs_application_registry_supports_uri_scheme ()

    gboolean    gnome_vfs_application_registry_supports_uri_scheme
                                                (const char *app_id,
                                                 const char *uri_scheme);

Given the id of the application this function will determine if the uri scheme will given is supported.

`app_id` : | registry id of application
`uri_scheme` : | uri schme string
Returns : | TRUE if `app_id` supports `uri_scheme`, otherwise FALSE

### gnome_vfs_application_is_user_owned_application ()

    gboolean    gnome_vfs_application_is_user_owned_application
                                                (const GnomeVFSMimeApplication *application);

This function will determine if a mime application is user owned or not. By user ownered this means that the application is not a system application located in the prerequisite /usr area but rather in the user's area.

`application` : | data structure of the mime application
Returns : | gboolean

### gnome_vfs_application_registry_clear_mime_types ()

    void        gnome_vfs_application_registry_clear_mime_types
                                                (const char *app_id);

This function will remove the mime types associated with the application. Changes are not realized until the gnome_vfs_application_registry_sync function is called to save the changes to the file.

`app_id` : | Application id

### gnome_vfs_application_registry_add_mime_type ()

    void        gnome_vfs_application_registry_add_mime_type
                                                (const char *app_id,
                                                 const char *mime_type);

This function will associate a mime type with an application given the application registry id and the mime type. Changes are not realized until the gnome_vfs_application_registry_sync function is called to save the changes to the file.

`app_id` : | registry id of application
`mime_type` : | mime type string

### gnome_vfs_application_registry_remove_mime_type ()

    void        gnome_vfs_application_registry_remove_mime_type
                                                (const char *app_id,
                                                 const char *mime_type);

This function will de-associate a mime type from an application registry. Given the application registry id and the mime type. Changes are not realized until the gnome_vfs_application_registry_sync function is called to save the changes to the file.

`app_id` : | registry id of the application
`mime_type` : | mime type string

### gnome_vfs_application_registry_sync ()

    GnomeVFSResult gnome_vfs_application_registry_sync
                                                (void);

This function will sync the registry. Typically you would use this function after a modification of the registry. When you modify the registry a dirty flag is set. Calling this function will save your modifications to disk and reset the flag.

If successful, will return GNOME_VFS_OK

Returns : | GnomeVFSResult

### gnome_vfs_application_registry_shutdown ()

    void        gnome_vfs_application_registry_shutdown
                                                (void);

Synchronize gnome-vfs application registry data to disk, and free resources.

### gnome_vfs_application_registry_reload ()

    void        gnome_vfs_application_registry_reload
                                                (void);

If this function is called for the first time it will initialize the registry. Subsequent calls to the function will clear out the current registry contents and load registry contents from the save file. Make certain that you've saved your registry before calling this function. It will destroy unsaved changes.

### gnome_vfs_application_registry_get_mime_application ()

    GnomeVFSMimeApplication* gnome_vfs_application_registry_get_mime_application
                                                (const char *app_id);

Returns a structure that contains the application that handles the mime type associated by the application referred by app_id.

`app_id` : | registry id of the application
Returns : | GnomeVFSMimeApplication

### gnome_vfs_application_registry_save_mime_application ()

    void        gnome_vfs_application_registry_save_mime_application
                                                (const GnomeVFSMimeApplication *application);

This will save to the registry the application that will be associated with a defined mime type. The defined mime type is located within the GnomeVFSMimeApplication structure. Changes are not realized until the gnome_vfs_application_registry_sync function is called.

`application` : | application associated with the mime type