[glib] Add documentation and translation for gsettings-tool
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Add documentation and translation for gsettings-tool
- Date: Wed, 21 Apr 2010 02:57:22 +0000 (UTC)
commit bedf4c3259756caec97d5aa4cd32d501de2be82e
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Apr 20 22:41:12 2010 -0400
Add documentation and translation for gsettings-tool
docs/reference/gio/Makefile.am | 3 +
docs/reference/gio/gio-docs.xml | 1 +
docs/reference/gio/gsettings-tool.xml | 93 +++++++++++++++++++++++++++++++++
gio/gschema-compile.c | 27 ++++++----
gio/gsettings-tool.c | 33 ++++++------
po/POTFILES.in | 4 ++
6 files changed, 135 insertions(+), 26 deletions(-)
---
diff --git a/docs/reference/gio/Makefile.am b/docs/reference/gio/Makefile.am
index 83f5676..1e10931 100644
--- a/docs/reference/gio/Makefile.am
+++ b/docs/reference/gio/Makefile.am
@@ -117,6 +117,7 @@ content_files = \
migrating.xml \
gio-querymodules.xml \
gschema-compile.xml \
+ gsettings-tool.xml \
gsettings-schema-convert.xml
expand_content_files = \
@@ -124,6 +125,7 @@ expand_content_files = \
migrating.xml \
gio-querymodules.xml \
gschema-compile.xml \
+ gsettings-tool.xml \
gsettings-schema-convert.xml
extra_files = \
@@ -140,6 +142,7 @@ if ENABLE_MAN
man_MANS = \
gio-querymodules.1 \
gschema-compile.1 \
+ gsettings-tool.1 \
gsettings-schema-convert.1
$(man_MANS) : sgml-build.stamp
diff --git a/docs/reference/gio/gio-docs.xml b/docs/reference/gio/gio-docs.xml
index 8394cf1..c6652fc 100644
--- a/docs/reference/gio/gio-docs.xml
+++ b/docs/reference/gio/gio-docs.xml
@@ -142,6 +142,7 @@
<chapter id="tools">
<title>GIO Tools</title>
<xi:include href="xml/gio-querymodules.xml"/>
+ <xi:include href="xml/gsettings-tool.xml"/>
<xi:include href="xml/gschema-compile.xml"/>
<xi:include href="xml/gsettings-schema-convert.xml"/>
</chapter>
diff --git a/docs/reference/gio/gsettings-tool.xml b/docs/reference/gio/gsettings-tool.xml
new file mode 100644
index 0000000..c997495
--- /dev/null
+++ b/docs/reference/gio/gsettings-tool.xml
@@ -0,0 +1,93 @@
+<refentry id="gsettings-tool" lang="en">
+
+<refmeta>
+ <refentrytitle>gsettings-tool</refentrytitle>
+ <manvolnum>1</manvolnum>
+ <refmiscinfo class="manual">User Commands</refmiscinfo>
+</refmeta>
+
+<refnamediv>
+ <refname>gsettings-tool</refname>
+ <refpurpose>GSettings configuration tool</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+ <cmdsynopsis>
+ <command>gsettings-tool</command>
+ <arg choice="opt" rep="repeat">option</arg>
+ <arg choice="req"><replaceable>schema</replaceable></arg>
+ <arg choice="req"><replaceable>key</replaceable></arg>
+ <arg choice="opt"><replaceable>value</replaceable></arg>
+ </cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para><command>gsettings-tool</command> offers a simple commandline
+interface to #GSettings. It lets you get, set or monitor an individual
+key for changes.
+</para>
+<para>
+The <replaceable>schema</replaceable> and <replaceable>key</replaceable>
+arguments are required to specify the schema id and the name of the key
+to operate on.
+</para>
+<para>
+When setting a key, you also need specify a <replaceable>value</replaceable>
+The format for the value is that of a serialized #GVariant, so e.g. a string
+must include explicit quotes: "'foo'". This format is also used when printing
+out values.
+</para>
+
+<refsect2><title>Options</title>
+<variablelist>
+
+<varlistentry>
+<term><option>-h</option>, <option>--help</option></term>
+<listitem><para>
+Print help and exit
+</para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term><option>-g</option>, <option>--get</option></term>
+<listitem><para>
+Get the value of <replaceable>key</replaceable>
+</para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term><option>-s</option>, <option>--set</option></term>
+<listitem><para>
+Set the value of <replaceable>key</replaceable>
+</para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term><option>-w</option>, <option>--writable</option></term>
+<listitem><para>
+Find out whether <replaceable>key</replaceable> is writable
+</para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term><option>-m</option>, <option>--monitor</option></term>
+<listitem><para>
+Monitor <replaceable>key</replaceable> for changes and print the
+changed values. Monitoring will continue until the process is
+terminated.
+</para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term><option>-p</option>, <option>--path=<replaceable>path</replaceable></option></term>
+<listitem><para>
+The path for the schema. This option is only needed if the schema
+does not have a fixed path.
+</para></listitem>
+</varlistentry>
+
+</variablelist>
+</refsect2>
+</refsect1>
+</refentry>
+
diff --git a/gio/gschema-compile.c b/gio/gschema-compile.c
index 7516e6e..51c4307 100644
--- a/gio/gschema-compile.c
+++ b/gio/gschema-compile.c
@@ -19,10 +19,15 @@
* Author: Ryan Lortie <desrt desrt ca>
*/
+#include "config.h"
+
+#include <locale.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
+#include <gi18n.h>
+
#include "gvdb/gvdb-builder.h"
typedef struct
@@ -479,7 +484,7 @@ int
main (int argc, char **argv)
{
gboolean byteswap = G_BYTE_ORDER != G_LITTLE_ENDIAN;
- GError *error = NULL;
+ GError *error;
GHashTable *table;
GDir *dir;
const gchar *file;
@@ -489,19 +494,21 @@ main (int argc, char **argv)
gchar *target;
GOptionContext *context;
GOptionEntry entries[] = {
- { "targetdir", 0, 0, G_OPTION_ARG_FILENAME, &targetdir, "where to store the gschemas.compiled file", "DIRECTORY" },
+ { "targetdir", 0, 0, G_OPTION_ARG_FILENAME, &targetdir, N_("where to store the gschemas.compiled file"), N_("DIRECTORY") },
{ NULL }
};
- context = g_option_context_new ("DIRECTORY");
+ setlocale (LC_ALL, "");
+ context = g_option_context_new (N_("DIRECTORY"));
+ g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
g_option_context_set_summary (context,
- "Compile all GSettings schema files into a schema cache.\n"
- "Schema files are required to have the extension .gschema.xml,\n"
- "and the cache file is called gschemas.compiled.");
-
- g_option_context_add_main_entries (context, entries, NULL);
+ N_("Compile all GSettings schema files into a schema cache.\n"
+ "Schema files are required to have the extension .gschema.xml,\n"
+ "and the cache file is called gschemas.compiled."));
+ g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+ error = NULL;
if (!g_option_context_parse (context, &argc, &argv, &error))
{
fprintf (stderr, "%s", error->message);
@@ -510,7 +517,7 @@ main (int argc, char **argv)
if (argc != 2)
{
- fprintf (stderr, "you should give exactly one directory name\n");
+ fprintf (stderr, _("You should give exactly one directory name\n"));
return 1;
}
@@ -539,7 +546,7 @@ main (int argc, char **argv)
if (files->len == 0)
{
- fprintf (stderr, "no schema files found\n");
+ fprintf (stderr, _("No schema files found\n"));
return 1;
}
diff --git a/gio/gsettings-tool.c b/gio/gsettings-tool.c
index 9784891..3771a17 100644
--- a/gio/gsettings-tool.c
+++ b/gio/gsettings-tool.c
@@ -20,6 +20,8 @@
*/
#include <config.h>
+#include <locale.h>
+#include <gi18n.h>
#include <gio.h>
static void
@@ -54,22 +56,23 @@ main (int argc, char *argv[])
GOptionContext *context;
GOptionEntry entries[] = {
- { "get", 'g', 0, G_OPTION_ARG_NONE, &do_get, "get a key", NULL },
- { "set", 's', 0, G_OPTION_ARG_NONE, &do_set, "set a key", NULL },
- { "writable", 'w', 0, G_OPTION_ARG_NONE, &do_writable, "check if key is writable", NULL },
- { "monitor", 'm', 0, G_OPTION_ARG_NONE, &do_monitor, "monitor key for changes", NULL },
- { "path", 'p', 0, G_OPTION_ARG_STRING, &path, "path for the schema" },
+ { "get", 'g', 0, G_OPTION_ARG_NONE, &do_get, N_("Get the value of KEY"), NULL },
+ { "set", 's', 0, G_OPTION_ARG_NONE, &do_set, N_("Set the value of KEY"), NULL },
+ { "writable", 'w', 0, G_OPTION_ARG_NONE, &do_writable, N_("Check if KEY is writable"), NULL },
+ { "monitor", 'm', 0, G_OPTION_ARG_NONE, &do_monitor, N_("Monitor KEY for changes"), NULL },
+ { "path", 'p', 0, G_OPTION_ARG_STRING, &path, N_("Specify the path for the schema"), N_("PATH") },
{ NULL }
};
GError *error;
- g_type_init ();
-
- context = g_option_context_new ("SCHEMA KEY [VALUE]");
+ setlocale (LC_ALL, "");
- g_option_context_set_summary (context, "Manipulate GSettings configuration");
+ g_type_init ();
- g_option_context_add_main_entries (context, entries, NULL);
+ context = g_option_context_new (N_("SCHEMA KEY [VALUE]"));
+ g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+ g_option_context_set_summary (context, N_("Manipulate GSettings configuration"));
+ g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
error = NULL;
if (!g_option_context_parse (context, &argc, &argv, &error))
@@ -80,7 +83,7 @@ main (int argc, char *argv[])
if (do_get + do_set + do_writable + do_monitor != 1)
{
- g_printerr ("You must specify exactly one of --get, --set, --writable or --monitor\n");
+ g_printerr (_("You must specify exactly one of --get, --set, --writable or --monitor\n"));
return 1;
}
@@ -88,7 +91,7 @@ main (int argc, char *argv[])
{
if (argc != 3)
{
- g_printerr ("You must specify a schema and a key\n");
+ g_printerr (_("You must specify a schema and a key\n"));
return 1;
}
@@ -99,7 +102,7 @@ main (int argc, char *argv[])
{
if (argc != 4)
{
- g_printerr ("You must specify a schema, a key and a value\n");
+ g_printerr (_("You must specify a schema, a key and a value\n"));
return 1;
}
@@ -120,8 +123,6 @@ main (int argc, char *argv[])
}
else if (do_writable)
{
- gboolean writable;
-
if (g_settings_is_writable (settings, key))
g_print ("true\n");
else
@@ -148,7 +149,7 @@ main (int argc, char *argv[])
if (!g_settings_set_value (settings, key, v))
{
- g_printerr ("Key %s is not writable\n", key);
+ g_printerr (_("Key %s is not writable\n"), key);
return 1;
}
}
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e7ae51b..8c1712e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -74,7 +74,11 @@ gio/gnetworkservice.c
gio/goutputstream.c
gio/gpollfilemonitor.c
gio/gresolver.c
+gio/gschema-compile.c
gio/gseekable.c
+gio/gsettingsbackend.c
+gio/gsettings.c
+gio/gsettings-tool.c
gio/gsimpleasyncresult.c
gio/gsocket.c
gio/gsocketaddress.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]