Introduction to GConf

Motivation
Terms and Concepts
Namespace
GConf Data Types
Configuration Sources
Schemas

This chapter introduces GConf, including the basic terms and concepts. After reading it, if you're a GNOME programmer looking to dive in quickly, you might skip to the section called “A Complete Example”. If you want to have comprehensive knowledge of GConf, you might want to read the whole manual.

Motivation

GConf is intended to store key-value pairs, where keys are located in an infinite tree-structured namespace (similar to the UNIX filesystem). It offers several useful features:

  • Users can select a variety of data storage backends, such as XML text files, ACAP, or databases (LDAP, DB, etc.). This makes it easy to adapt GConf to local needs. It also avoids the age-old "text files vs. binary registry" debate. (Note: the current GConf only has an XML backend implemented, other backends are easy to write though.)

  • GConf offers a notification service, so applications can ask to be notified when the value of a key changes. This allows settings to be applied to groups of applications, without restarting them and without ugly hacks. It also allows a clean model-view architecture for applications.

  • Each user has a "GConf search path" which is a list of configuration sources to scan for each value. For example, the configuration engine might look for values first in the local machine's database and then in a network-wide database.

  • GConf is implemented as a per-user daemon, which makes locking a non-issue and allows aggressive caching.

  • The client API is simple and very abstract, which allows us to change its implementation at a later time without a big headache. Because a good implementation is a complex problem, this is important.

GConf was inspired by Wichert Akkerman's configuration system specification, originally developed for the Debian project. Other sources of ideas include the Windows registry, the ACAP specification, and Emacs customize mode (try typing M-x customize-browse in Emacs). Windows XP's registry has some features such as documentation that GConf has as well - maybe they copied GConf - hey, it's possible. ;-)