#include <string.h>
#include <stdlib.h>
+#ifdef G_OS_WIN32
+#include "glib/glib-private.h"
+#endif
+
static gboolean
contained (const gchar * const *items,
const gchar *item)
}
static void
+gsettings_print_version (GSettings *settings,
+ const gchar *key,
+ const gchar *value)
+{
+ g_print ("%d.%d.%d\n", glib_major_version, glib_minor_version,
+ glib_micro_version);
+}
+
+static void
gsettings_list_schemas (GSettings *settings,
const gchar *key,
const gchar *value)
exit (1);
}
- g_settings_set_value (settings, key, new);
+ if (!g_settings_set_value (settings, key, new))
+ {
+ g_printerr (_("The key is not writable\n"));
+ exit (1);
+ }
g_settings_sync ();
synopsis = "[COMMAND]";
}
+ else if (strcmp (command, "--version") == 0)
+ {
+ description = _("Print version information and exit");
+ synopsis = "";
+ }
+
else if (strcmp (command, "list-schemas") == 0)
{
description = _("List the installed (non-relocatable) schemas");
{
g_string_append (string,
_("Usage:\n"
+ " gsettings --version\n"
" gsettings [--schemadir SCHEMADIR] COMMAND [ARGS...]\n"
"\n"
"Commands:\n"
const gchar *key;
#ifdef G_OS_WIN32
- extern gchar *_glib_get_locale_dir (void);
gchar *tmp;
#endif
if (schema_source == NULL)
{
- g_printerr ("Could not load schemas from %s: %s\n", argv[2], error->message);
+ g_printerr (_("Could not load schemas from %s: %s\n"), argv[2], error->message);
g_clear_error (&error);
return 1;
if (strcmp (argv[1], "help") == 0)
return gsettings_help (TRUE, argv[2]);
+ else if (argc == 2 && strcmp (argv[1], "--version") == 0)
+ function = gsettings_print_version;
+
else if (argc == 2 && strcmp (argv[1], "list-schemas") == 0)
function = gsettings_list_schemas;
else
return gsettings_help (FALSE, argv[1]);
- g_type_init ();
-
if (argc > 2)
{
gchar **parts;