From 1064097504c180ad5ed8fd8ce80500da0aca9266 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 19 Apr 2010 08:54:01 -0400 Subject: [PATCH] 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 file changed, 30 insertions(+), 7 deletions(-) diff --git a/docs/reference/gio/migrating.xml b/docs/reference/gio/migrating.xml index ab4682d26..f73f37ab3 100644 --- a/docs/reference/gio/migrating.xml +++ b/docs/reference/gio/migrating.xml @@ -310,6 +310,36 @@ start_monitoring_trash (void)
Schema conversion + + If you are porting your application from GConf, most likely you already + have a GConf schema. GIO comes with a commandline tool + gsettings-schema-convert + 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. + + + + GSettings schemas are described by XML files that need to get installed + into $datadir/glib-2.0/schemas, and need to be + compiled into a binary form by the gschema-compile + utility. GIO provides variables gsettingsschemadir + and gsettingsupdateschemacache for the location + and the command, which can be used in configure.in + as follows: + +AC_SUBST(gsettingsschemadir, `pkg-config --variable gsettingsschemadir gio-2.0`) +AC_SUBST(gsettingsupdateschemacache, `pkg-config --variable gsettingsupdateschemacache gio-2.0`) + + The corresponding Makefile.am fragment looks like + this: + +gsettingsschema_DATA = my.app.gschema.xml +install-data-hook: + $(gsettingsupdateschemacache) $(gsettingsschemadir) + + + One possible pitfall in doing schema conversion is that the default values in GSettings schemas are parsed by the #GVariant parser. @@ -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. - - GIO comes with a commandline tool - gsettings-schema-convert - 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. -
Data conversion