Commit 235f4958 authored by Allison Karlitskaya's avatar Allison Karlitskaya Committed by Philip Withnall

gsettings: remove redundancy in 'list-recursive'

Some projects use child schemas in an odd way: they link children which
already have their path pre-defined.  This causes the child schema (and
its keys) to be printed out twice:

 - once because it is, itself, a non-relocatable schema

 - once, as a recursion from its parent

We can avoid this by not recursing into child schemas that are
non-relocatable (on the assumption that they will be enumerated
elsewhere).

https://bugzilla.gnome.org/show_bug.cgi?id=723003
parent 32cc60db
......@@ -262,10 +262,28 @@ list_recursively (GSettings *settings)
children = g_settings_list_children (settings);
for (i = 0; children[i]; i++)
{
gboolean will_see_elsewhere = FALSE;
GSettings *child;
child = g_settings_get_child (settings, children[i]);
list_recursively (child);
if (global_settings == NULL)
{
/* we're listing all non-relocatable settings objects from the
* top-level, so if this one is non-relocatable, don't recurse,
* because we will pick it up later on.
*/
GSettingsSchema *child_schema;
g_object_get (child, "settings-schema", &child_schema, NULL);
will_see_elsewhere = !is_relocatable_schema (child_schema);
g_settings_schema_unref (child_schema);
}
if (!will_see_elsewhere)
list_recursively (child);
g_object_unref (child);
}
......
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