[glib/origin/master] Add a bit about autofoo for schemas
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/origin/master] Add a bit about autofoo for schemas
- Date: Mon, 19 Apr 2010 13:03:27 +0000 (UTC)
commit 1064097504c180ad5ed8fd8ce80500da0aca9266
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Apr 19 08:54:01 2010 -0400
Add a bit about autofoo for schemas
Always a good idea to have copiable snipplets in a porting guide...
docs/reference/gio/migrating.xml | 37 ++++++++++++++++++++++++++++++-------
1 files changed, 30 insertions(+), 7 deletions(-)
---
diff --git a/docs/reference/gio/migrating.xml b/docs/reference/gio/migrating.xml
index ab4682d..f73f37a 100644
--- a/docs/reference/gio/migrating.xml
+++ b/docs/reference/gio/migrating.xml
@@ -311,6 +311,36 @@ start_monitoring_trash (void)
<title>Schema conversion</title>
<para>
+ If you are porting your application from GConf, most likely you already
+ have a GConf schema. GIO comes with a commandline tool
+ <link linkend="gsettings-schema-convert">gsettings-schema-convert</link>
+ that can help with the task of converting a GConf schema into
+ an equivalent GSettings schema. The tool is not perfect and
+ may need assistence in some cases.
+ </para>
+
+ <para>
+ GSettings schemas are described by XML files that need to get installed
+ into <filename>$datadir/glib-2.0/schemas</filename>, and need to be
+ compiled into a binary form by the <link linkend="gschema-compile">gschema-compile</link>
+ utility. GIO provides variables <literal>gsettingsschemadir</literal>
+ and <literal>gsettingsupdateschemacache</literal> for the location
+ and the command, which can be used in <filename>configure.in</filename>
+ as follows:
+<programlisting>
+AC_SUBST(gsettingsschemadir, `pkg-config --variable gsettingsschemadir gio-2.0`)
+AC_SUBST(gsettingsupdateschemacache, `pkg-config --variable gsettingsupdateschemacache gio-2.0`)
+</programlisting>
+ The corresponding <filename>Makefile.am</filename> fragment looks like
+ this:
+<programlisting>
+gsettingsschema_DATA = my.app.gschema.xml
+install-data-hook:
+ $(gsettingsupdateschemacache) $(gsettingsschemadir)
+</programlisting>
+ </para>
+
+ <para>
One possible pitfall in doing schema conversion is that the default
values in GSettings schemas are parsed by the #GVariant parser.
This means that strings need to include quotes in the XML. Also note
@@ -390,13 +420,6 @@ start_monitoring_trash (void)
GSettings. By the time you have finished porting your application
you must ensure that all key names are valid.
</para>
- <para>
- GIO comes with a commandline tool
- <link linkend="gsettings-schema-convert">gsettings-schema-convert</link>
- that can help with the task of converting a GConf schema into
- an equivalent GSettings schema. The tool is not perfect and
- may need assistence in some cases.
- </para>
</section>
<section><title>Data conversion</title>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]