2009-08-03

gconftool - preferences setting

As Max seeked to setting Proxy for his Debian VM, he found an interesting configuration tool in GNOME, "gconftool", which is used to manage all kinds of appliation preferences, i.e, proxy server, desktop and so on. He decided to spend sometime to learn it.

The cool thing is that " if someone changes a setting by gconftool, it instantly updates in all the applications that interested in this setting" . Simple but powerful, thousand times better than nasty Windows Registry. Take the example of set proxy server in article "Make Debian work better" Let's see how it work:

  • > gconftool -s /system/http_proxy/use_http_proxy -t bool true
  • > gconftool -s /system/http_proxy/host -t string ${PROXYSERVER}
  • > gconftool -s /system/http_proxy/port -t int ${PORT}
  • > gconftool -s /system/http_proxy/use_same_proxy -t bool true
  • > gconf -s /system/proxy/mode -t string manual

No news is good news! At the time, if you open System->preference->Network Proxy, you would find all the settings have been updated, without logout or restart. More explaination in detials can be found in Victor's blog .

Where are these preference value saved? Here you are:

>cat .gconf/system/http_proxy/%gconf.xml


You see, so-called repository is nothing but a just well-structured xml data. More precisely, the repository is not single xml but a series of xml in different storage locations (Configuration sources). You can search a preference in repository as

> gconftool -g /system/http_proxy/port
81

Or recursively show all preference in the path

> gconftool -R /system/http_proxy

use_http_proxy = true
use_authentication = false
host = ${PROXYSERVER}
authentication_user =
ignore_hosts = [localhost,127.0.0.0/8]
use_same_proxy = true
authentication_password =
port = 81

By default, GConf searches the xml files in the following order:

  • xml:readonly:/etc/gconf/gconf.xml.mandatory (w:root)
  • include "$(HOME)/.gconf.path"
  • xml:readwrite:$(HOME)/.gconf (The above setting is save here)
  • xml:readonly:/etc/gconf/gconf.xml.defaults (w:root)

No comments:

Post a Comment