Add-ons Sync Prefs: A Restartless Add-on for SeaMonkey 2.8
On January 31st, SeaMonkey 2.7 will be released (well, that's the plan). A few days later, the first beta of SeaMonkey 2.8 will follow. People like me who are on the beta channel will upgrade directly from 2.7b5 (ETA today) to 2.8b1. This is when my main working environment will be ready for Add-ons Sync.
Now I was wondering what the SeaMonkey developers could do to allow users of SeaMonkey 2.8 (on aurora, beta or release) to enable/disable the Add-ons Sync engine through preferences UI. Well, the answer is simple: Provide an add-on that adds the corresponding option!
I decided early on to give it a try myself and create that add-on. I also felt that users were probably more likely to install such an add-on if it didn't interrupt their work flow (i.e. not require a restart of the application, which in the case of SeaMonkey is often used for both browsing and mail) and took care to not break anything if it was installed on an incompatible version of SeaMonkey (say, 2.7 or 2.9). The first requirement could be solved through writing a restartless add-on, the latter by adding explicit checks to the code.
I guess for someone new to Mozilla-specific code, starting from scratch like this could be hard. During the development I faced several issues that you would probably not have seen with a classic XUL overlay approach. The Add-ons SDK might have been a better alternative if I had intended to write an add-on for Firefox, but since this one is SeaMonkey-only and given the requirements, there was not much of a choice.
Anyway, I was finally able to finish the add-on (with friendly help from Neil Rashbrook), upload it to AMO, and get it fully reviewed. :-) Here it is.
Now of course none of this would have been possible without…
- the Toolkit add-ons back-end developers
- the MDN authors (in addition to the above linked pages, I valued most: Using nsIXULAppInfo, nsIVersionComparator, Services.jsm, nsIPrefBranch, window and window, prefpane)
- Mark Finkle (his blog post was very helpful for getting started!)
- MXR (development is just no fun without it!)
Note: If you look at the source code you might see that the prefs handling (user vs. default prefs) is not perfect yet. This is something that both Neil and Kris Maglione (AMO reviewer) pointed out, but which I deliberately disregarded for the first version of the add-on.