The Case for Gconf

There has been a lot of commentary recently about Gnome, and a common source of confusion seems to be Gconf – what is it, how does it work, and so on. Some people even seem to confuse Gconf with the registry database in Windows. I will attempt to clear some of this confusion and give an overview of Gconf, and why it looks the way it does.Dot files

Most applications in Unix or Unix-like systems use “dot files” as the way to set and save configuration information. These files are saved in the user’s home directory (and can be a whole subdirectory of files if the app is complex). In addition, many apps support the idea of system-wide defaults, with a separate configuration file that sets defaults when the user has not set any preferences themselves.

This system would be simple and straightforward, but it has some limitations.

First, every app has its own file format. Many apps have a variant of “keyword = value”; others use tab-separated (or comma separated, or colon-separated…) values. Applications that are programmable (including bash, Emacs and Vim) favor having config-files that are scripts, executable by the application. As a user, I need to keep track of dozens of different formats (and a few small programming languages) if I want to do any serious reconfiguration. And creating a front end to all of this would be very, very difficult.

Second, these files are all in my home directory, intermingled with my other stuff. Individual apps are becoming pretty good at organizing themselves (more than half of my one-hundred or so dot files are actually directories), but it would be nice if the config stuff could all be collected in a subdirectory of its own. If nothing else, you would know that anything there is a configuration file, not image caches, logs or whatever.

Third, system-wide defaults are spread out all over. Some apps put them in /etc, some in /usr/X11R6/lib/X11 somewhere, others are in their /usr/share directories. Some do not even support the idea of system defaults. Again, it would be preferable to have them collected under one directory somewhere.

So, what we would like, really, is to have text-based config-files, in a common format, and organized in a directory hierarchy. Also, the system-wide defaults would have the same structure, and reside in one place. Add an API for easy application development, and user tools to handle these without having to edit stuff by hand.

Enter Gconf

Gconf really is three things: structured storage of settings; an application API for changing settings and getting notified about changes; and user tools to edit their settings in a more convenient manner than editing dot files by hand. These three components are largely independent of one another. One could have a different storage mechanism (as tables in a company-wide database server for distributed access, for example); different API:s for other desktops; and different or complementary user tools (see Gnome-Extra-Setup for one example).

Current Gconf storage is exactly as described in the previous section: dot files in a common text format (XML), in a structured hierarchy of subdirectories (under ~/.gconf for each users settings, and /etc/gconf for system-wide defaults). An application using Gconf will use the system default unless the user has set it differently locally, just as for most dot files. The user’s Gconf directory will in fact only have those keys that have been changed from the system defaults.

In addition, there are “schema files”, which is just installation defaults for all the settings, and are copied over to be the initial setting when the application is installed.

Again, all of Gconf is editable by hand. If you want to, you can treat it as just another variant of a dot file, with the benefit that a lot of apps share the same file format and organization.

Gconf Tools

Of course, with a reliable organization and a rich back end format, we can do more than just treat them as uncorrelated dot-files. We can have settings that apply for more than one application – or for the whole desktop – and be confident all affected applications can read them.

We can have an easy API for applications to set and read settings – no need for every app to use an XML parser (or any dot file parser for that matter). We can also let applications tell what settings they are interested in, whether their own or system-level settings that may affect them. That way the app can find out directly when a setting changes and act accordingly.

To do so, we have a daemon (gconfd) waiting for changes to settings. When it occurs, this daemon checks what apps (if any) wants to know about this, and tells them about it.

We also have some user and administration tools. gconftool is a command-line tool, mainly meant for use by installation scripts and other automated tasks. For interactive use, we have gconf-editor (usually called “configuration editor” or something similar in the menu) as a clean way to present all available settings for the user to edit, and not jsut those chosen to be exposed by the author.

Since the storage format is rich, gconf-editor can present the options in a manner very much like a dedicated settings window; it knows what data type an option wants, and it can show help texts for the individual options. And since we use Unicode, we can have these texts translated as well. Since Gconf is the way for apps to store all their configuration data, it means we get a nice, organized way to edit even the most obtuse options.

A separate question is of course what options should be available directly in the application’s own config dialog, and which should be accessible only through the configuration editor. Some options are obviously needed in the main config dialog; others are just as clearly not. For the remaining, ambiguous ones, the decision of course ultimately comes down to the maintainer of the individual application. No matter what his or her decision may be, though, the configuration editor allows anyone to edit it in a painless way.

To recap, Gconf really is three different, but related things. It is an organized way to store configuration files; it is an application API to handle settings in a transparent manner; and it is user tools to examine and change any setting an application may have, with instant feedback and help.

About the Author:
Jan Morén is a translator for the Swedish Gnome translation project, and currently resides in Japan.

86 Comments

  1. 2004-06-15 8:54 am
  2. 2004-06-15 8:55 am
  3. 2004-06-15 8:58 am
  4. 2004-06-15 9:00 am
  5. 2004-06-15 9:19 am
  6. 2004-06-15 9:24 am
  7. 2004-06-15 9:31 am
  8. 2004-06-15 9:33 am
  9. 2004-06-15 9:34 am
  10. 2004-06-15 9:41 am
  11. 2004-06-15 9:43 am
  12. 2004-06-15 9:44 am
  13. 2004-06-15 9:53 am
  14. 2004-06-15 10:00 am
  15. 2004-06-15 10:00 am
  16. 2004-06-15 10:01 am
  17. 2004-06-15 10:04 am
  18. 2004-06-15 10:07 am
  19. 2004-06-15 10:09 am
  20. 2004-06-15 10:16 am
  21. 2004-06-15 10:17 am
  22. 2004-06-15 10:24 am
  23. 2004-06-15 10:25 am
  24. 2004-06-15 10:33 am
  25. 2004-06-15 10:44 am
  26. 2004-06-15 10:47 am
  27. 2004-06-15 10:49 am
  28. 2004-06-15 10:52 am
  29. 2004-06-15 10:56 am
  30. 2004-06-15 11:05 am
  31. 2004-06-15 11:05 am
  32. 2004-06-15 11:10 am
  33. 2004-06-15 11:12 am
  34. 2004-06-15 11:17 am
  35. 2004-06-15 11:54 am
  36. 2004-06-15 12:06 pm
  37. 2004-06-15 12:12 pm
  38. 2004-06-15 12:30 pm
  39. 2004-06-15 12:32 pm
  40. 2004-06-15 12:48 pm
  41. 2004-06-15 12:50 pm
  42. 2004-06-15 12:52 pm
  43. 2004-06-15 1:01 pm
  44. 2004-06-15 1:22 pm
  45. 2004-06-15 1:53 pm
  46. 2004-06-15 1:54 pm
  47. 2004-06-15 2:35 pm
  48. 2004-06-15 3:01 pm
  49. 2004-06-15 3:05 pm
  50. 2004-06-15 3:47 pm
  51. 2004-06-15 3:59 pm
  52. 2004-06-15 4:06 pm
  53. 2004-06-15 4:15 pm
  54. 2004-06-15 4:16 pm
  55. 2004-06-15 4:23 pm
  56. 2004-06-15 4:26 pm
  57. 2004-06-15 4:38 pm
  58. 2004-06-15 4:39 pm
  59. 2004-06-15 4:52 pm
  60. 2004-06-15 5:00 pm
  61. 2004-06-15 5:03 pm
  62. 2004-06-15 5:10 pm
  63. 2004-06-15 5:35 pm
  64. 2004-06-15 5:45 pm
  65. 2004-06-15 5:50 pm
  66. 2004-06-15 5:59 pm
  67. 2004-06-15 6:05 pm
  68. 2004-06-15 6:12 pm
  69. 2004-06-15 6:23 pm
  70. 2004-06-15 7:24 pm
  71. 2004-06-15 9:14 pm
  72. 2004-06-15 9:29 pm
  73. 2004-06-15 9:31 pm
  74. 2004-06-15 10:42 pm
  75. 2004-06-15 10:49 pm
  76. 2004-06-15 10:53 pm
  77. 2004-06-15 11:03 pm
  78. 2004-06-15 11:20 pm
  79. 2004-06-16 12:33 am
  80. 2004-06-16 5:57 am
  81. 2004-06-16 6:33 am
  82. 2004-06-16 10:57 am
  83. 2004-06-16 12:53 pm
  84. 2004-06-16 2:13 pm
  85. 2004-06-17 5:13 am
  86. 2004-06-17 9:26 pm