+ else if (strcmp (command, "monitor") == 0)
+ {
+ description = _("Monitor KEY for changes.\n"
+ "If no KEY is specified, monitor all keys in SCHEMA.\n"
+ "Use ^C to stop monitoring.\n");
+ synopsis = N_("SCHEMA[:PATH] [KEY]");
+ }
+ else
+ {
+ g_string_printf (string, _("Unknown command %s\n\n"), command);
+ requested = FALSE;
+ command = NULL;
+ }
+
+ if (command == NULL)
+ {
+ g_string_append (string,
+ _("Usage:\n"
+ " gsettings --version\n"
+ " gsettings [--schemadir SCHEMADIR] COMMAND [ARGS...]\n"
+ "\n"
+ "Commands:\n"
+ " help Show this information\n"
+ " list-schemas List installed schemas\n"
+ " list-relocatable-schemas List relocatable schemas\n"
+ " list-keys List keys in a schema\n"
+ " list-children List children of a schema\n"
+ " list-recursively List keys and values, recursively\n"
+ " range Queries the range of a key\n"
+ " get Get the value of a key\n"
+ " set Set the value of a key\n"
+ " reset Reset the value of a key\n"
+ " reset-recursively Reset all values in a given schema\n"
+ " writable Check if a key is writable\n"
+ " monitor Watch for changes\n"
+ "\n"
+ "Use 'gsettings help COMMAND' to get detailed help.\n\n"));
+ }
+ else
+ {
+ g_string_append_printf (string, _("Usage:\n gsettings [--schemadir SCHEMADIR] %s %s\n\n%s\n\n"),
+ command, synopsis[0] ? _(synopsis) : "", description);
+
+ g_string_append (string, _("Arguments:\n"));
+
+ g_string_append (string,
+ _(" SCHEMADIR A directory to search for additional schemas\n"));
+
+ if (strstr (synopsis, "[COMMAND]"))
+ g_string_append (string,
+ _(" COMMAND The (optional) command to explain\n"));
+
+ else if (strstr (synopsis, "SCHEMA"))
+ g_string_append (string,
+ _(" SCHEMA The name of the schema\n"
+ " PATH The path, for relocatable schemas\n"));
+
+ if (strstr (synopsis, "[KEY]"))
+ g_string_append (string,
+ _(" KEY The (optional) key within the schema\n"));
+
+ else if (strstr (synopsis, "KEY"))
+ g_string_append (string,
+ _(" KEY The key within the schema\n"));
+
+ if (strstr (synopsis, "VALUE"))
+ g_string_append (string,
+ _(" VALUE The value to set\n"));
+
+ g_string_append (string, "\n");
+ }
+
+ if (requested)
+ g_print ("%s", string->str);
+ else
+ g_printerr ("%s\n", string->str);
+
+ g_string_free (string, TRUE);
+
+ return requested ? 0 : 1;
+}
+
+
+int
+main (int argc, char **argv)
+{
+ void (* function) (void);
+
+#ifdef G_OS_WIN32
+ gchar *tmp;
+#endif
+
+ setlocale (LC_ALL, "");
+ textdomain (GETTEXT_PACKAGE);
+
+#ifdef G_OS_WIN32
+ tmp = _glib_get_locale_dir ();
+ bindtextdomain (GETTEXT_PACKAGE, tmp);
+ g_free (tmp);
+#else
+ bindtextdomain (GETTEXT_PACKAGE, GLIB_LOCALE_DIR);
+#endif
+
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
+
+ if (argc < 2)
+ return gsettings_help (FALSE, NULL);
+
+ global_schema_source = g_settings_schema_source_ref (g_settings_schema_source_get_default ());
+
+ if (argc > 3 && g_str_equal (argv[1], "--schemadir"))
+ {
+ GSettingsSchemaSource *parent = global_schema_source;
+ GError *error = NULL;
+
+ global_schema_source = g_settings_schema_source_new_from_directory (argv[2], parent, FALSE, &error);
+ g_settings_schema_source_unref (parent);
+
+ if (global_schema_source == NULL)