Commit c2e7f316 authored by Allison Karlitskaya's avatar Allison Karlitskaya Committed by Alberts Muktupāvels

gsettings: cleanup default value lookup

There are a couple of different ways (and soon one more) to access the
default value of a key. Clean up the various places that access this to
avoid duplication.

https://bugzilla.gnome.org/show_bug.cgi?id=746592
parent df28cfe0
......@@ -1204,10 +1204,7 @@ g_settings_get_value (GSettings *settings,
value = g_settings_read_from_backend (settings, &skey, FALSE, FALSE);
if (value == NULL)
value = g_settings_schema_key_get_translated_default (&skey);
if (value == NULL)
value = g_variant_ref (skey.default_value);
value = g_settings_schema_key_get_default_value (&skey);
g_settings_schema_key_clear (&skey);
......@@ -1304,10 +1301,7 @@ g_settings_get_default_value (GSettings *settings,
value = g_settings_read_from_backend (settings, &skey, FALSE, TRUE);
if (value == NULL)
value = g_settings_schema_key_get_translated_default (&skey);
if (value == NULL)
value = g_variant_ref (skey.default_value);
value = g_settings_schema_key_get_default_value (&skey);
g_settings_schema_key_clear (&skey);
......@@ -1360,10 +1354,7 @@ g_settings_get_enum (GSettings *settings,
value = g_settings_read_from_backend (settings, &skey, FALSE, FALSE);
if (value == NULL)
value = g_settings_schema_key_get_translated_default (&skey);
if (value == NULL)
value = g_variant_ref (skey.default_value);
value = g_settings_schema_key_get_default_value (&skey);
result = g_settings_schema_key_to_enum (&skey, value);
g_settings_schema_key_clear (&skey);
......@@ -1473,10 +1464,7 @@ g_settings_get_flags (GSettings *settings,
value = g_settings_read_from_backend (settings, &skey, FALSE, FALSE);
if (value == NULL)
value = g_settings_schema_key_get_translated_default (&skey);
if (value == NULL)
value = g_variant_ref (skey.default_value);
value = g_settings_schema_key_get_default_value (&skey);
result = g_settings_schema_key_to_flags (&skey, value);
g_settings_schema_key_clear (&skey);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment