Method

GioSettingsget_mapped

Declaration [src]

gpointer
g_settings_get_mapped (
  GSettings* settings,
  const gchar* key,
  GSettingsGetMapping mapping,
  gpointer user_data
)

Description [src]

Gets the value that is stored at key in settings, subject to application-level validation/mapping.

You should use this function when the application needs to perform some processing on the value of the key (for example, parsing). The mapping function performs that processing. If the function indicates that the processing was unsuccessful (due to a parse error, for example) then the mapping is tried again with another value.

This allows a robust ‘fall back to defaults’ behaviour to be implemented somewhat automatically.

The first value that is tried is the user’s setting for the key. If the mapping function fails to map this value, other values may be tried in an unspecified order (system or site defaults, translated schema default values, untranslated schema default values, etc).

If the mapping function fails for all possible values, one additional attempt is made: the mapping function is called with a NULL value. If the mapping function still indicates failure at this point then the application will be aborted.

The result parameter for the mapping function is pointed to a

gpointer which is initially set to NULL. The same pointer is given

to each invocation of mapping. The final value of that #gpointer is what is returned by this function. NULL is valid; it is returned just as any other value would be.

Parameters

key

Type: const gchar*

The key to get the value for.

The data is owned by the caller of the method.
The value is a NUL terminated UTF-8 string.
mapping

Type: GSettingsGetMapping

The function to map the value in the settings database to the value used by the application.

user_data

Type: gpointer

User data for mapping.

The argument can be NULL.
The data is owned by the caller of the method.

Return value

Type: gpointer

The result, which may be NULL.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.
The return value can be NULL.