Each preference in the GConf
repository is
expressed as a key-value pair. A GConf preference key
is an element in the repository that corresponds to an application preference.
For example, the /apps/gnome-session/options/show_splash_screen
preference key corresponds to the Show splash screen on login
option in the Sessions
preference tool. The GNOME
Desktop user interface does not contain all of the preference keys in the GConf
repository. For example, the Sessions
preference tool does not contain an option that corresponds to the /apps/gnome-session/options/splash_screen_text key.
The repository is structured like a simple hierarchical file system. The repository contains the following:
Directories that correspond to applications that use the GConf
repository. For example, the file system contains the
directory /apps/metacity.
Subdirectories that correspond to categories of preferences. For example, the file system contains the directory /apps/metacity/general.
Special files that list the preference keys in the directory, and contain information about the keys. For example, a file that contains information about the keys that relate to the HTTP proxy preferences is in the directory /system/http_proxy.
A /schemas directory that contains files that describe all of the preference keys.
Preference keys typically have simple values such as strings, integers, or lists of strings and integers. The format of the preference key in the repository depends on the backend module that is used to read the repository. The following is an example of the /desktop/gnome/interface/font_name preference key when an Extensible Markup Language (XML) backend module is used to read the repository:
<entry name="font_name" mtime="1038323555" muser="user123" type="string"> <stringvalue>avantgarde 10</stringvalue></entry>
When this guide refers to a preference key, the path to the key is added to the name of the key. For example, the font_name preference key in the /desktop/gnome/interface subdirectory is referred to as /desktop/gnome/interface/font_name.
The GConf
repository contains
a series of storage locations that are called configuration sources. The configuration sources are listed in the GConf
path file. The location of the GConf
path file is /etc/gconf/version-number/path. Each user has a path file. Each line in the path file specifies
the following information:
The backend module to use to read the repository.
The permissions on the repository.
The location of the repository.
By default, the contents of the GConf
path
file are as follows:
xml:readonly:/etc/gconf/gconf.xml.mandatory include "$(HOME)/.gconf.path" xml:readwrite:$(HOME)/.gconf xml:readonly:/etc/gconf/gconf.xml.defaults
When GConf
searches for a preference value, GConf
reads the configuration sources in the order specified
in the path file. The following table describes the configuration sources
in the path file:
Configuration Source |
Description |
---|---|
Mandatory |
The permissions on this configuration source are set to read only. Users cannot overwrite the values in this source, so the preferences in the source are mandatory. |
User |
This configuration source is stored in the .gconf directory in the home directory of the user. When the user sets a preference, the new preference information is added to this location. |
Default |
This configuration source contains the default preference settings. |
The sequence of the configuration sources in the path file ensures that
mandatory preference settings override user preference settings. The sequence
also ensures that user preference settings override default preference settings.
That is, GConf
applies preferences in the following
order of priority:
Mandatory preferences
User-specified preferences
Default preferences
The include instruction in the GConf
path file enables users to use another configuration source.
To use another configuration source, the user must specify the location of
the configuration source. The user specifies the location of the configuration
source in the home directory, in a file that is called .gconf.path.
A GConf schema is a collective term for a GConf schema key and a GConf schema object. The following table describes schema keys and schema objects and the relationship of these items to preference keys:
The following table gives examples of a preference key, a schema key, and a schema object:
Item |
Example |
---|---|
Preference key |
/desktop/gnome/interface/font_name |
Schema key |
/schemas/desktop/gnome/interface/font_name |
Schema object |
<schema> <applyto>/desktop/gnome/interface/font_name</applyto> <key>/schemas/desktop/gnome/interface/font_name</key> <owner>gnome</owner> <type>string</type> <default>Sans 10</default> <locale name="C"> <short>Default font</short> <long>Name of the default font used by gtk+.</long> </locale> </schema> |
You can associate a schema key with a preference key. For example, the following /desktop/gnome/interface/font_name key includes a schema key:
<entry name="font_name" mtime="1034873859" schema="/schemas/desktop/gnome/interface/font_name"/>
When you associate a schema key with a preference key, the preference uses the suggested value that is specified in the schema object of the schema key. The suggested value is contained in the <default> element in the schema object. By default, all the preference keys in the default configuration source are associated with schema keys.
Typically, schemas are stored in the default configuration source.
Schemas are generated from schema definition files. A schema definition file defines the characteristics of all of the keys in a particular application. Schema definition files have a .schemas extension.
The schema definition files are included in the /etc/gconf/schemas directory. You can use the schema definition files to create a new configuration source.
Some schema definition files correspond closely to a part of the GNOME
Desktop user interface. For example, system_http_proxy.schemas
corresponds to the Network Proxy
preference tool.
Other schema definition files contain preference keys that are not present
in the GNOME Desktop user interface. For example, the /apps/gnome-session/options/splash_screen_text key is not present in the user interface.
Some parts of the GNOME Desktop user interface contain preferences that
represent preference keys from more than one schema definition file. For example,
the Keyboard Shortcuts
preference tool contains
preferences that represent keys from the panel-global-config.schemas and metacity.schemas files.