Method

GioSettingsget_default_value

since: 2.40

Declaration [src]

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

Description [src]

Gets the “default value” of a key.

This is the value that would be read if g_settings_reset() were to be called on the key.

Note that this may be a different value than returned by g_settings_schema_key_get_default_value() if the system administrator has provided a default value.

Comparing the return values of g_settings_get_default_value() and g_settings_get_value() is not sufficient for determining if a value has been set because the user may have explicitly set the value to something that happens to be equal to the default. The difference here is that if the default changes in the future, the user’s key will still be set.

This function may be useful for adding an indication to a UI of what the default value was before the user set it.

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 default value for.

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

Return value

Type: GVariant

The default value.

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