disobedience/control.c: Handle state-change toggles better.
If you click a toggle icon, say the `pause' button, then: Gtk
immediately toggles the state of the icon, but doesn't change the
corresponding menu item. Instead, a state change is reported through
the log connection which causes us to update the menu (and the icon,
though that's already in the right state so you don't notice). (Of
course, this just works the other way around if you use the menu item or
keyboard accelerator instead.)
There are a couple of problems with this, with more or less the same
fix.
* If the connection to the server is very slow, then there's a lag
between clicking the icon, or pressing the accelerator, and the rest
of the UI updating. This is unfortunate.
* If something goes wrong, then the icon is left in the wrong state,
and nothing will correct it.
The fix is as follows:
* When toggling the state of something, we immediately (a) adjust our
internal idea of what the state /ought/ to be, and (b) force an
update of the icon (and associated menu item). This solves the
problem of the associated UI element lagging.
* On a server error, we immediately change the state back again and
force another icon update.
* That leaves the RTP connection option (which was my original
motivation for all of this). There's no server feedback for this
control. Instead, we periodically check whether the RTP player
process is listening for connections. An event is signalled if this
state /changes/, and this event is used to set the icon and
menu-item state. So, again, if we force our internal idea of the
RTP process state to match the icon, but the player doesn't start up
properly, then the next time we check, we find that the player isn't
responding, signal the event, and then we fix the icon state.