def _set_pref(key, setter_name, value): gconf_lock.acquire() try: client = gconf.client_get_default() fullkey = gconf_key(key) setter = getattr(client, setter_name) setter(fullkey, value) finally: gconf_lock.release()
def _get_pref(key, getter_name): gconf_lock.acquire() try: client = gconf.client_get_default() fullkey = gconf_key(key) value = client.get(fullkey) if value is not None: getter = getattr(value, getter_name) return getter() else: return None finally: gconf_lock.release()