diff --git a/docs/reference/gio/gsettings.xml b/docs/reference/gio/gsettings.xml
index 9528b9dd7..d7dc65db6 100644
--- a/docs/reference/gio/gsettings.xml
+++ b/docs/reference/gio/gsettings.xml
@@ -75,6 +75,7 @@
gsettings
list-schemas
+ --print-paths
gsettings
@@ -198,7 +199,8 @@ Reset all keys under the given SCHEMA.
Lists the installed, non-relocatable schemas.
See if you are interested in
-relocatable schemas.
+relocatable schemas. If
+is given, the path where each schema is mapped is also printed.
diff --git a/gio/completion/gsettings b/gio/completion/gsettings
index 22b2ac379..d509758e9 100644
--- a/gio/completion/gsettings
+++ b/gio/completion/gsettings
@@ -37,6 +37,10 @@ __gsettings() {
list-keys|list-children|list-recursively|reset-recursively)
choices="$(gsettings $schemadir list-schemas 2> /dev/null)"$'\n'"$(gsettings $schemadir list-relocatable-schemas 2> /dev/null | sed -e 's.$.:/.')"
;;
+ list-schemas)
+ COMPREPLY=($(compgen -W "--print-paths" -- ${COMP_WORDS[${COMP_CWORD}]}))
+ return 0
+ ;;
get|range|set|reset|writable|monitor|describe)
choices="$(gsettings $schemadir list-schemas 2> /dev/null | sed -e 's.$. .')"$'\n'"$(gsettings $schemadir list-relocatable-schemas 2> /dev/null | sed -e 's.$.:/.')"
diff --git a/gio/gsettings-tool.c b/gio/gsettings-tool.c
index d74b6dd9e..57eb838a1 100644
--- a/gio/gsettings-tool.c
+++ b/gio/gsettings-tool.c
@@ -140,6 +140,35 @@ gsettings_list_schemas (void)
g_strfreev (schemas);
}
+static void
+gsettings_list_schemas_with_paths (void)
+{
+ gchar **schemas;
+ gsize i;
+
+ g_settings_schema_source_list_schemas (global_schema_source, TRUE, &schemas, NULL);
+
+ for (i = 0; schemas[i] != NULL; i++)
+ {
+ GSettingsSchema *schema;
+ gchar *schema_name;
+ const gchar *schema_path;
+
+ schema_name = g_steal_pointer (&schemas[i]);
+
+ schema = g_settings_schema_source_lookup (global_schema_source, schema_name, TRUE);
+ schema_path = g_settings_schema_get_path (schema);
+
+ schemas[i] = g_strconcat (schema_name, " ", schema_path, NULL);
+
+ g_settings_schema_unref (schema);
+ g_free (schema_name);
+ }
+
+ output_list (schemas);
+ g_strfreev (schemas);
+}
+
static void
gsettings_list_relocatable_schemas (void)
{
@@ -532,7 +561,7 @@ gsettings_help (gboolean requested,
else if (strcmp (command, "list-schemas") == 0)
{
description = _("List the installed (non-relocatable) schemas");
- synopsis = "";
+ synopsis = "[--print-paths]";
}
else if (strcmp (command, "list-relocatable-schemas") == 0)
@@ -690,7 +719,7 @@ int
main (int argc, char **argv)
{
void (* function) (void);
- gboolean need_settings;
+ gboolean need_settings, skip_third_arg_test;
#ifdef G_OS_WIN32
gchar *tmp;
@@ -744,6 +773,7 @@ main (int argc, char **argv)
g_settings_schema_source_ref (global_schema_source);
need_settings = TRUE;
+ skip_third_arg_test = FALSE;
if (strcmp (argv[1], "help") == 0)
return gsettings_help (TRUE, argv[2]);
@@ -754,6 +784,13 @@ main (int argc, char **argv)
else if (argc == 2 && strcmp (argv[1], "list-schemas") == 0)
function = gsettings_list_schemas;
+ else if (argc == 3 && strcmp (argv[1], "list-schemas") == 0
+ && strcmp (argv[2], "--print-paths") == 0)
+ {
+ skip_third_arg_test = TRUE;
+ function = gsettings_list_schemas_with_paths;
+ }
+
else if (argc == 2 && strcmp (argv[1], "list-relocatable-schemas") == 0)
function = gsettings_list_relocatable_schemas;
@@ -802,7 +839,7 @@ main (int argc, char **argv)
else
return gsettings_help (FALSE, argv[1]);
- if (argc > 2)
+ if (argc > 2 && !skip_third_arg_test)
{
gchar **parts;