Add GSettings schema for LUC handler
authorJonathan Maw <jonathan.maw@codethink.co.uk>
Tue, 12 Jun 2012 13:16:59 +0000 (14:16 +0100)
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>
Tue, 12 Jun 2012 15:04:31 +0000 (16:04 +0100)
The Last User Context will be stored/accessed using GSettings. This
requires:
- a schema of the data that will be stored.
- a modification to Makefile.am to validate and install the schema.
- modifications to the code to use GSettings.

This commit adds the schema and changes to Makefile.am. The
org.genivi.LUCHandler1.gschema.xml file is generated from
org.genivi.LUCHandler1.gschema.xml.in when ./configure is executed.
This is to allow the schema ID and base path to include the
BOOT_MANAGER_VERSION_API defined in configure.ac, in case we ever
decide to break the API or GSettings key structure.

The default value for the "last-user-context" key is an empty dictionary
for now.

configure.ac
luc-handler/Makefile.am
luc-handler/org.genivi.LUCHandler1.gschema.xml.in [new file with mode: 0644]

index 74f76df..2ac99cc 100644 (file)
@@ -88,7 +88,13 @@ PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.30.0])
 PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0 >= 2.30.0])
 PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon >= 37])
 
+dnl *********************************************
+dnl *** Include GLib/GSettings specific stuff ***
+dnl *********************************************
+GLIB_GSETTINGS
+
 AC_OUTPUT([
 Makefile
 luc-handler/Makefile
+luc-handler/org.genivi.LUCHandler1.gschema.xml
 ])
index f1424b6..3fca2d5 100644 (file)
@@ -1,5 +1,15 @@
 # vi:set ts=8 sw=8 noet ai nocindent:
 
+luc_handler_gsettingsschema_in_files =                                 \
+       org.genivi.LUCHandler1.gschema.xml.in
+
+luc_handler_gsettings_SCHEMAS =                                                \
+       $(luc_handler_gsettingsschema_in_files:.xml.in=.xml)
+
+.PRECIOUS: $(luc_handler_gsettings_SCHEMAS)
+
+@GSETTINGS_RULES@
+
 luc_handlerdir =                                                       \
        $(libdir)/luc-handler-$(BOOT_MANAGER_VERSION_API)
 
@@ -54,10 +64,12 @@ CLEANFILES =                                                                \
 
 EXTRA_DIST =                                                           \
        $(service_in_files)                                             \
+       $(luc_handler_gsettingsschema_in_files)                         \
        luc-handler-dbus.xml
 
 DISTCLEANFILES =                                                       \
-       $(luc_handler_built_sources)
+       $(luc_handler_built_sources)                                    \
+       $(luc_handler_gsettings_SCHEMAS)
 
 BUILT_SOURCES =                                                                \
        $(luc_handler_built_headers)
diff --git a/luc-handler/org.genivi.LUCHandler1.gschema.xml.in b/luc-handler/org.genivi.LUCHandler1.gschema.xml.in
new file mode 100644 (file)
index 0000000..80c3775
--- /dev/null
@@ -0,0 +1,12 @@
+<schemalist>
+  <schema id="org.genivi.LUCHandler@BOOT_MANAGER_VERSION_API@" path="/org/genivi/LUCHandler@BOOT_MANAGER_VERSION_API@/">
+    <key name="last-user-context" type="a{sas}">
+      <summary>A dictionary of the apps that are considered part of the Last User Context</summary>
+      <description>
+        The current Last User Context, that is, a dictionary that maps LUC types
+        to arrays of one or more applications registered for each of them.
+      </description>
+      <default>{}</default>
+    </key>
+  </schema>
+</schemalist>