mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 07:23:41 +02:00
gsettingsschema: Allow per-desktop overrides
Recognise a new 'd' option in schema keys which gives a dictionary of per-desktop default values. This dictionary is searched for the items found in XDG_CURRENT_DESKTOP, in the order. If nothing matches (or if the option is missing) then the default value is used as before. This feature was requested by Alberts Muktupāvels and this patch is based on an approach devised by them. https://bugzilla.gnome.org/show_bug.cgi?id=746592
This commit is contained in:
committed by
Alberts Muktupāvels
parent
c2e7f31697
commit
6ca449672d
@@ -1739,6 +1739,13 @@ g_settings_get_mapped (GSettings *settings,
|
||||
if (okay) goto okay;
|
||||
}
|
||||
|
||||
if ((value = g_settings_schema_key_get_per_desktop_default (&skey)))
|
||||
{
|
||||
okay = mapping (value, &result, user_data);
|
||||
g_variant_unref (value);
|
||||
if (okay) goto okay;
|
||||
}
|
||||
|
||||
if (mapping (skey.default_value, &result, user_data))
|
||||
goto okay;
|
||||
|
||||
@@ -2646,6 +2653,20 @@ g_settings_binding_key_changed (GSettings *settings,
|
||||
}
|
||||
}
|
||||
|
||||
if (variant == NULL)
|
||||
{
|
||||
variant = g_settings_schema_key_get_per_desktop_default (&binding->key);
|
||||
if (variant &&
|
||||
!binding->get_mapping (&value, variant, binding->user_data))
|
||||
{
|
||||
g_error ("Per-desktop default value for key '%s' in schema '%s' "
|
||||
"was rejected by the binding mapping function.",
|
||||
binding->key.name, g_settings_schema_get_id (binding->key.schema));
|
||||
g_variant_unref (variant);
|
||||
variant = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (variant == NULL)
|
||||
{
|
||||
variant = g_variant_ref (binding->key.default_value);
|
||||
|
Reference in New Issue
Block a user