Some refactoring for our work on showing/hiding actions based on the selected view (#150).