mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-09 12:25:48 +01:00
Support NULL value for g_settings_set_strv()
Allow easy setting of the empty array that we lost with the last patch.
This commit is contained in:
parent
bf9edb5cd5
commit
b5c8496b4c
@ -1833,13 +1833,14 @@ g_settings_get_strv (GSettings *settings,
|
|||||||
* g_settings_set_strv:
|
* g_settings_set_strv:
|
||||||
* @settings: a #GSettings object
|
* @settings: a #GSettings object
|
||||||
* @key: the name of the key to set
|
* @key: the name of the key to set
|
||||||
* @value: the value to set it to
|
* @value: the value to set it to, or %NULL
|
||||||
* @returns: %TRUE if setting the key succeeded,
|
* @returns: %TRUE if setting the key succeeded,
|
||||||
* %FALSE if the key was not writable
|
* %FALSE if the key was not writable
|
||||||
*
|
*
|
||||||
* Sets @key in @settings to @value.
|
* Sets @key in @settings to @value.
|
||||||
*
|
*
|
||||||
* A convenience variant of g_settings_set() for string arrays.
|
* A convenience variant of g_settings_set() for string arrays. If
|
||||||
|
* @value is %NULL, then @key is set to be the empty array.
|
||||||
*
|
*
|
||||||
* It is a programmer error to pass a @key that isn't valid for
|
* It is a programmer error to pass a @key that isn't valid for
|
||||||
* @settings or is not of type 'string array'.
|
* @settings or is not of type 'string array'.
|
||||||
@ -1851,7 +1852,14 @@ g_settings_set_strv (GSettings *settings,
|
|||||||
const gchar *key,
|
const gchar *key,
|
||||||
const gchar * const *value)
|
const gchar * const *value)
|
||||||
{
|
{
|
||||||
return g_settings_set_value (settings, key, g_variant_new_strv (value, -1));
|
GVariant *array;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
array = g_variant_new_strv (value, -1);
|
||||||
|
else
|
||||||
|
array = g_variant_new_strv (NULL, 0);
|
||||||
|
|
||||||
|
return g_settings_set_value (settings, key, array);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define __G_SETTINGS_C__
|
#define __G_SETTINGS_C__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user