Fix finding the default keyboard for Mint 17/Cinnamon

This fixes https://jira.sil.org/browse/WS-285 "Crash while trying
to switch keyboards in Wasta".  Also did a bit of code cleanup in
related keyboarding code.