Refactor menu handling and prepare for adding view-specific actions.

Signed-off-by: Kristian Duske <kristian.duske@gmail.com>