Abstract saving and restoring enabled state of actions (ie. menu items).

Because there are more places where I'm doing that now.
Merge branch 'master' into mousepan
Save & restore action enabled states around mouse panning.

Also, disable (ie. consume) all keyboard events when either panning or
mouse selecting.