gnome-games r7380 - in trunk/glchess: . src/lib
- From: rancell svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r7380 - in trunk/glchess: . src/lib
- Date: Sat, 16 Feb 2008 03:26:54 +0000 (GMT)
Author: rancell
Date: Sat Feb 16 03:26:54 2008
New Revision: 7380
URL: http://svn.gnome.org/viewvc/gnome-games?rev=7380&view=rev
Log:
Catch GError exceptions from GConf (Bug #489878)
Modified:
trunk/glchess/ChangeLog
trunk/glchess/src/lib/config.py
Modified: trunk/glchess/src/lib/config.py
==============================================================================
--- trunk/glchess/src/lib/config.py (original)
+++ trunk/glchess/src/lib/config.py Sat Feb 16 03:26:54 2008
@@ -2,6 +2,7 @@
try:
import gconf
+ import gobject
except ImportError:
haveGConfSupport = False
_notifiers = {}
@@ -51,7 +52,10 @@
haveGConfSupport = True
_GCONF_DIR = '/apps/glchess/'
_config = gconf.client_get_default()
- _config.add_dir(_GCONF_DIR[:-1], gconf.CLIENT_PRELOAD_NONE)
+ try:
+ _config.add_dir(_GCONF_DIR[:-1], gconf.CLIENT_PRELOAD_NONE)
+ except gobject.GError:
+ pass
_gconfGetFunction = {gconf.VALUE_BOOL: gconf.Value.get_bool,
gconf.VALUE_FLOAT: gconf.Value.get_float,
@@ -97,7 +101,11 @@
Raises an Error exception if the value does not exist.
"""
if haveGConfSupport:
- entry = _config.get(_GCONF_DIR + name)
+ try:
+ entry = _config.get(_GCONF_DIR + name)
+ except gobject.GError:
+ entry = None
+
if entry is None:
try:
return _defaults[name]
@@ -131,8 +139,10 @@
function = _gconfSetFunction[type(value)]
except KeyError:
raise TypeError('Only config values of type: int, str, float, bool supported')
-
- function(_GCONF_DIR + name, value)
+ except gobject.GError:
+ pass
+ else:
+ function(_GCONF_DIR + name, value)
else:
# Debounce
@@ -168,7 +178,10 @@
"""
"""
if haveGConfSupport:
- _config.notify_add(_GCONF_DIR + name, _watch, (function, name))
+ try:
+ _config.notify_add(_GCONF_DIR + name, _watch, (function, name))
+ except gobject.GError:
+ pass
else:
try:
watchers = _notifiers[name]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]