diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 7e74c16f0..036a9f068 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -240,8 +240,18 @@ class Config: The changed config part as string. """ - # FIXME to be implemented - pass + lines = [] + for secname, section in self.config.items(): + changed_opts = [] + for optname, option in section.items(): + if (option.rawvalue is not None and + option.rawvalue != option.default): + keyval = '{} = {}'.format(optname, option) + changed_opts.append(keyval) + if changed_opts: + lines.append('[{}]'.format(secname)) + lines += changed_opts + return '\n'.join(lines) def optionxform(self, val): """Implemented to be compatible with ConfigParser interpolation.""" diff --git a/qutebrowser/config/conftypes.py b/qutebrowser/config/conftypes.py index 6c45d14f5..e65cc4094 100644 --- a/qutebrowser/config/conftypes.py +++ b/qutebrowser/config/conftypes.py @@ -79,7 +79,7 @@ class SettingValue: """ self.typ = typ() - self._rawvalue = None + self.rawvalue = None self.default = default def __str__(self): @@ -94,12 +94,12 @@ class SettingValue: @property def value(self): """Get the currently valid value.""" - return self._rawvalue if self._rawvalue is not None else self.default + return self.rawvalue if self.rawvalue is not None else self.default @value.setter def value(self, val): """Set the currently valid value.""" - self._rawvalue = val + self.rawvalue = val class BaseType: