I'm afraid I've got another gnome.config question. Whilst playing around
with it I've noticed that for keys that don't exist the get_bool() and
get_string() methods behave differently. The file ~/.gnome/foo doesn't
exist in this example:

>>> import gnome.config
>>> print gnome.config.get_bool("foo/bar/baz")
0
>>> print gnome.config.get_int("foo/bar/baz")
0
>>> print gnome.config.get_string("foo/bar/baz")
None

This is only a problem for me because I'm trying to handle a default
boolean value, which I'd like to be set to true. If the key doesn't exist
then get_bool() always returns 0, which (as far as I can tell) is
indistinguishable from gtk.FALSE.

Consequently, this code fails to work for a non-existant path:

    value = gnome.config.get_bool(path)
    if value is not None:
        return value
    else:
        return gtk.TRUE  # default

Am I doing it wrong? I'm using gnome-python 1.4.2 with Python 2.1.

Thanks....

-- 
Graham Ashton <[EMAIL PROTECTED]>
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to