Method

GioSettingsget_user_value

since: 2.40

Declaration

GVariant*
g_settings_get_user_value (
  GSettings* settings,
  const gchar* key
)

Description

Checks the “user value” of a key, if there is one.

The user value of a key is the last value that was set by the user.

After calling g_settings_reset() this function should always return NULL (assuming something is not wrong with the system configuration).

It is possible that g_settings_get_value() will return a different value than this function. This can happen in the case that the user set a value for a key that was subsequently locked down by the system administrator — this function will return the user’s old value.

This function may be useful for adding a “reset” option to a UI or for providing indication that a particular value has been changed.

It is a programmer error to give a key that isn’t contained in the schema for settings.

Available since: 2.40

Parameters

key

Type: const gchar*

The key to get the user value for.

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

Return value

Type: GVariant

The user’s value, if set.

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