[gnome-utils/gsettings-tutorial: 3/22] [gsettings-tutorial] Create and install GSettings schemas



commit 8f4e9f6846aa577db128c8e37ea6d5c08f077196
Author: Vincent Untz <vuntz gnome org>
Date:   Fri Apr 16 15:03:16 2010 -0400

    [gsettings-tutorial] Create and install GSettings schemas
    
    We use the gsettings-schema-convert tool to convert the gconf schema to
    a gsetting schema.
    
    A few notes:
    
      + The --schema-id argument is used to specify the schema ID that will
        be used in the schema. The best practice is to name your file like
        in this example (org.gnome.baobab.gschema) and, in this case, use
        org.gnome.baobab as schema ID.
    
      + In complex cases, the generated schema will contain FIXME, so make
        sure to check this.
    
      + After installing the gsettings schema, gschema-compile has to be
        called.

 baobab/data/Makefile.am |    9 ++++++++-
 configure.ac            |    5 +++++
 2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/baobab/data/Makefile.am b/baobab/data/Makefile.am
index c7dc71f..54e2bf1 100644
--- a/baobab/data/Makefile.am
+++ b/baobab/data/Makefile.am
@@ -16,6 +16,12 @@ schemas_in_files = baobab.schemas.in
 schemas_DATA 	 = $(schemas_in_files:.schemas.in=.schemas)
 @INTLTOOL_SCHEMAS_RULE@
 
+gsettingsschema_DATA = org.gnome.baobab.gschema
+org.gnome.baobab.gschema: baobab.schemas
+	gsettings-schema-convert --force --gconf --xml --schema-id $(@:.gschema=) $< -o $@
+install-data-hook:
+	$(gsettingsupdateschemacache) $(gsettingsschemadir)
+
 man_MANS = baobab.1
 
 if GCONF_SCHEMAS_INSTALL
@@ -36,4 +42,5 @@ EXTRA_DIST = 				\
 CLEANFILES =	 			\
 	$(baobabapp_in_files)		\
 	$(baobabapp_DATA)		\
-	$(schemas_DATA)
+	$(schemas_DATA)			\
+	$(gsettingsschema_DATA)
diff --git a/configure.ac b/configure.ac
index 76c6fad..7fdfdda 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,6 +142,11 @@ AS_IF([test "x$GCONFTOOL" = "xno"],
 
 AM_GCONF_SOURCE_2
 
+AC_SUBST(gsettingsschemadir,
+         `pkg-config --variable gsettingsschemadir gio-2.0`)
+AC_SUBST(gsettingsupdateschemacache,
+         `pkg-config --variable gsettingsupdateschemacache gio-2.0`)
+
 AC_ARG_ENABLE([gdict-applet],
                [AC_HELP_STRING([--enable-gdict-applet=@<:@yes/no@:>@],
                                [Whether to build the Dictionary gnome-panel applet])],



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]