More fixes for the applet

Sorry for bothering you again :)

I have added some minor fixes to the code that change nothing right now, but will:

* Make it work when we want to change applet state via D-Bus or in other programmatical way;
* Make sure others can safely re-use our code without being given a bad example.

Please see the commit messages for details.