Configuration API

Thomas Leonard tal00r at ecs.soton.ac.uk
Fri Apr 30 13:54:16 EEST 2004


On Thu, Apr 29, 2004 at 01:06:23PM -0400, Sean Middleditch wrote:
[...]
> This is a good place for specification (which has no need to be codified
> in the API) to step in.  I.e., we provide this API and programming
> interface for backends.  We also provide a document of "freedesktop.org
> approved formats" for storing common data types.  I.e., this
> specification might say that "All colors must be stored as hex-encoded
> <string>s as specified in the following W3C standard..."  We can then
> provide names for these formats.

That sounds ideal. It should actually make it easier to specify new types,
since we just have to add them to the list ("Colours should be #rrggbb")
and front ends can add support when they need to, while all backends
continue to work fine without changes.

[ schemas ]
> These schemas can even be used in app-specific preferences windows.  For
> example, say we have a web browser and it has a key (an integer) which
> maps to an enumeration controlling some behaviour (load all images, load
> images from same server, do not load images).  The schema could specify
> the format as an enum with values 1, 2, 3 and labels "All Images",
> "Images from Server", and "No Images".  (The labels could even include
> translations.)  This will make gconf-editor look a little cleaner for
> this specific setting.  But the browser preferences window could also
> use this information.

This is basically what we do in ROX. The configuration is stored as plain
strings, and the application uses a separate XML file to create the
interface. This file may indicate, for example, that a particular value is
an integer between 1 and 10 and should be displayed as a slider. Since ROX
apps don't share settings, the XML file is kept inside the application.
For shared settings, it could be placed in a shared directory.

Coming up with a decent schema language is hard. In the XML world, they
made a schema language (XML DTD) part of the core spec, and we then got
XML Schema, Schematron, DSD, RELAX NG, etc, because the core one wasn't
good enough. Worse, anyone writing an XML parser (or editor) now has to
write a load of code to handle the near-useless built-in DTD language.

> Best of all, both schemas and format types could be optional. 

Yep. I think people should be able to buy into a shared config system
without having to accept our schema language. We should propose a shared
one separately (the Config4GNU team will have a lot of ideas here, I'm
sure), but it should stand on its own merits.


-- 
Thomas Leonard			http://rox.sourceforge.net
tal00r at ecs.soton.ac.uk	tal197 at users.sourceforge.net
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1




More information about the xdg mailing list