Respond to permission requests. Closes #71

Also abstracted custom button dialog wrapper to make it easy to create
custom buttons.