Commits

elbaschid committed a72176e

fixed loading gconf default values from schema

  • Participants
  • Parent commits 9282705

Comments (0)

Files changed (1)

File revelation_indicator

     def __init__(self, basedir):
         super(Config, self).__init__(basedir)
 
-
     def get(self, key):
         value = self.client.get(self.__resolve_keypath(key))
 
         if value is None:
-            raise ConfigError
 
-        if value.type == gconf.VALUE_SCHEMA:
-            logger.debug('found schema for %s. will use default value', key)
-            value = value.get_schema().get_default_value()
+            schema_value = self.client.get(
+                self.__resolve_keypath('/schemas/%s' % key)
+            )
+
+            if schema_value.type == gconf.VALUE_SCHEMA:
+                value = schema_value.get_schema().get_default_value()
+                self.client.set_value(key, value)
+            else:
+                raise config.ConfigError
 
         if value.type == gconf.VALUE_STRING:
             return str(value.get_string())
             sys.exit(1)
 
     def __init_config(self, filename=''):
-        self.config = Config("/schemas/apps/revelation-indicator/prefs")
+        self.config = Config("/apps/revelation-indicator/prefs")
         
         ##FIXME: use a better way to set the filename
         if filename: