Merge branch 'settings-action-per-desktop-default' into 'main'

gsettings: Support per-desktop overrides in GSettingsAction

See merge request GNOME/glib!3193
This commit is contained in:
Marco Trevisan 2023-01-16 13:30:53 +00:00
commit dabb650ad4
2 changed files with 11 additions and 4 deletions

View File

@ -3223,10 +3223,7 @@ g_settings_action_get_state (GAction *action)
value = g_settings_read_from_backend (gsa->settings, &gsa->key, FALSE, FALSE);
if (value == NULL)
value = g_settings_schema_key_get_translated_default (&gsa->key);
if (value == NULL)
value = g_variant_ref (gsa->key.default_value);
value = g_settings_schema_key_get_default_value (&gsa->key);
return value;
}

View File

@ -2886,6 +2886,7 @@ static void
test_per_desktop (void)
{
GSettings *settings;
GAction *action_string;
TestObject *obj;
gpointer p;
gchar *str;
@ -2918,6 +2919,10 @@ test_per_desktop (void)
g_assert_cmpstr (str, ==, "GNOME");
g_free (str);
action_string = g_settings_create_action (settings, "desktop");
check_and_free (g_action_get_state (action_string), "'GNOME'");
g_clear_object (&action_string);
g_object_unref (settings);
g_object_unref (obj);
}
@ -2929,6 +2934,7 @@ static void
test_per_desktop_subprocess (void)
{
GSettings *settings;
GAction *action_string;
TestObject *obj;
gpointer p;
gchar *str;
@ -2956,6 +2962,10 @@ test_per_desktop_subprocess (void)
g_assert_cmpstr (str, ==, "GNOME Classic");
g_free (str);
action_string = g_settings_create_action (settings, "desktop");
check_and_free (g_action_get_state (action_string), "'GNOME Classic'");
g_clear_object (&action_string);
g_object_unref (settings);
g_object_unref (obj);
}