Closed titoBouzout closed 12 years ago
Oh interesting. Nice catch. I guess the settings API actually makes more sense this way. I didn't really think about this until I saw your Pref = Pref() line, but can you think of a reason why Pref.load() couldn't just be a classmethod? (or why load_prefs couldn't just be a classless function?)
To make clear that everything coming from "Pref.something" is a global. Also, makes more easy the reload of the two different prefs files. If not you need to write two functions?
Also if Pref.load is a method of wordhighlitgh (damn spell checker ) it will reload every-time.
Not sure about more reasons, but I've written many plug-ins with this convention, and easily fixed this error on 5 of them, almost doing the same because of this "Pref" thing.
I don't think the API makes more sense this way. Because there is no way to listen just 1 preference. We will reload when unrelated preferences are changed, which is non efficient.
I was thinking was this way because of my work with Firefox Extensions.
ping
Whoops! Sorry. I must have thought I'd already merged it.
Fix a misinterpretation of "add_on_change" listener.
Receives a key which will listen all the preferences instead of receiving a preference name.