mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-07 19:35:50 +01:00
Allow to list keys in all schemas
Make the schema argument to gsettings list-recursively optional. This allows to search for not exactly known keys by going gsettings list-recursively | grep 'font'
This commit is contained in:
parent
51dd7c5e4a
commit
766d70729b
@ -22,7 +22,7 @@
|
|||||||
<command>gsettings</command>
|
<command>gsettings</command>
|
||||||
<arg choice="plain">monitor</arg>
|
<arg choice="plain">monitor</arg>
|
||||||
<arg choice="plain"><replaceable>SCHEMA</replaceable><arg choice="opt">:<replaceable>PATH</replaceable></arg></arg>
|
<arg choice="plain"><replaceable>SCHEMA</replaceable><arg choice="opt">:<replaceable>PATH</replaceable></arg></arg>
|
||||||
<arg choice="plain"><replaceable>KEY</replaceable></arg>
|
<arg choice="opt"><replaceable>KEY</replaceable></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>gsettings</command>
|
<command>gsettings</command>
|
||||||
@ -70,7 +70,7 @@
|
|||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>gsettings</command>
|
<command>gsettings</command>
|
||||||
<arg choice="plain">list-recursively</arg>
|
<arg choice="plain">list-recursively</arg>
|
||||||
<arg choice="plain"><replaceable>SCHEMA</replaceable><arg choice="opt">:<replaceable>PATH</replaceable></arg></arg>
|
<arg choice="opt"><replaceable>SCHEMA</replaceable><arg choice="opt">:<replaceable>PATH</replaceable></arg></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>gsettings</command>
|
<command>gsettings</command>
|
||||||
@ -116,7 +116,8 @@ The value is printed out as a serialised
|
|||||||
<term><option>monitor</option></term>
|
<term><option>monitor</option></term>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
Monitors <replaceable>KEY</replaceable> for changes and prints the changed
|
Monitors <replaceable>KEY</replaceable> for changes and prints the changed
|
||||||
values. Monitoring will continue until the process is terminated.
|
values. If no <replaceable>KEY</replaceable> is specified, all keys in the
|
||||||
|
schema are monitored. Monitoring will continue until the process is terminated.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@ -185,7 +186,8 @@ Lists the children of <replaceable>SCHEMA</replaceable>.
|
|||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>list-recursively</option></term>
|
<term><option>list-recursively</option></term>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
Lists keys and values, recursively.
|
Lists keys and values, recursively. If no <replaceable>SCHEMA</replaceable>
|
||||||
|
is given, list keys in all schemas.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@ -240,29 +240,44 @@ gsettings_list_recursively (GSettings *settings,
|
|||||||
const gchar *key,
|
const gchar *key,
|
||||||
const gchar *value)
|
const gchar *value)
|
||||||
{
|
{
|
||||||
gchar **children;
|
if (settings)
|
||||||
gint i;
|
|
||||||
|
|
||||||
enumerate (settings);
|
|
||||||
|
|
||||||
children = g_settings_list_children (settings);
|
|
||||||
|
|
||||||
for (i = 0; children[i]; i++)
|
|
||||||
{
|
{
|
||||||
GSettings *child;
|
gchar **children;
|
||||||
gchar *schema;
|
gint i;
|
||||||
|
|
||||||
child = g_settings_get_child (settings, children[i]);
|
enumerate (settings);
|
||||||
g_object_get (child, "schema", &schema, NULL);
|
children = g_settings_list_children (settings);
|
||||||
|
for (i = 0; children[i]; i++)
|
||||||
|
{
|
||||||
|
GSettings *child;
|
||||||
|
gchar *schema;
|
||||||
|
|
||||||
if (is_schema (schema))
|
child = g_settings_get_child (settings, children[i]);
|
||||||
enumerate (child);
|
g_object_get (child, "schema", &schema, NULL);
|
||||||
|
|
||||||
g_object_unref (child);
|
if (is_schema (schema))
|
||||||
g_free (schema);
|
enumerate (child);
|
||||||
|
|
||||||
|
g_object_unref (child);
|
||||||
|
g_free (schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_strfreev (children);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const gchar * const *schemas;
|
||||||
|
gint i;
|
||||||
|
|
||||||
g_strfreev (children);
|
schemas = g_settings_list_schemas ();
|
||||||
|
|
||||||
|
for (i = 0; schemas[i]; i++)
|
||||||
|
{
|
||||||
|
settings = g_settings_new (schemas[i]);
|
||||||
|
enumerate (settings);
|
||||||
|
g_object_unref (settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -485,8 +500,9 @@ gsettings_help (gboolean requested,
|
|||||||
|
|
||||||
else if (strcmp (command, "list-recursively") == 0)
|
else if (strcmp (command, "list-recursively") == 0)
|
||||||
{
|
{
|
||||||
description = _("List keys and values, recursively");
|
description = _("List keys and values, recursively\n"
|
||||||
synopsis = N_("SCHEMA[:PATH]");
|
"If no SCHEMA is given, list all keys\n");
|
||||||
|
synopsis = N_("[SCHEMA[:PATH]]");
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strcmp (command, "get") == 0)
|
else if (strcmp (command, "get") == 0)
|
||||||
@ -640,7 +656,7 @@ main (int argc, char **argv)
|
|||||||
else if (argc == 3 && strcmp (argv[1], "list-children") == 0)
|
else if (argc == 3 && strcmp (argv[1], "list-children") == 0)
|
||||||
function = gsettings_list_children;
|
function = gsettings_list_children;
|
||||||
|
|
||||||
else if (argc == 3 && strcmp (argv[1], "list-recursively") == 0)
|
else if ((argc == 2 || argc == 3) && strcmp (argv[1], "list-recursively") == 0)
|
||||||
function = gsettings_list_recursively;
|
function = gsettings_list_recursively;
|
||||||
|
|
||||||
else if (argc == 4 && strcmp (argv[1], "range") == 0)
|
else if (argc == 4 && strcmp (argv[1], "range") == 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user