Preferences on the Network

by havoc

For a long time people have talked about an LDAP or other
network-located backend for GConf. Unfortunately
writing GConf backends is painful and in some ways not really
possible, for example the backend interface does not support change
notifications originating from the backend. Presumably Ryan’s dconf will address some of
this.

In the meantime, we wanted to sync certain settings to a network
server as part of the online desktop effort
to optimize GNOME for the Internet. I took a simple approach,
first in a hacky Python
prototype
and now in more
productized form
.

The approach: an online-prefs-sync-daemon looks
for a service on the session bus called OnlinePrefsManager. This
service implements a Preferences interface (get and set key-value
pairs, pretty much). If an OnlinePrefsManager is found, then
online-prefs-sync-daemon keeps GConf in sync with it. Otherwise,
online-prefs-sync-daemon doesn’t do anything.

The data
model service
implements OnlinePrefsManager in a way that stores
settings on an Internet server. However, it would be simple to also
implement an LDAP or enterprise version. Or a WebDAV version if you
can figure out how to do change notification that way.

Owen says it is overengineered to make OnlinePrefsManager pluggable
instead of talking to the data model directly, and he’s probably right
as usual, but maybe someone will write the Enterprise Edition.

online-prefs-sync-daemon uses a simple directory full of files that
whitelist GConf keys to be stored online. Here
is an example of a .synclist file
. The idea is that apps could
install these, though for now I’m just shipping one with the sync
daemon. In the sync list file, a GConf key can be marked to be synced
among all systems, per-machine (which means the sync is for backup
purposes only), or not at all.

If you have three computers on your desk like I do, it’s sort of
fun to change your desktop background on all three at once (the
change notification means all three update live and
instantly). Something like your preferred web browser or gnome-terminal
profiles might be more useful to change for all your
systems at once, though…

On the downside, some of the most useful items to sync – such as
browser bookmarks – aren’t stored in GConf. So those will have to be
dealt with separately.

(This post was originally found at http://log.ometer.com/2007-10.html#17)

My Twitter account is @havocp.
Interested in becoming a better software developer? Sign up for my email list and I'll let you know when I write something new.
Name
Email *