Additional icon loading stuff

These were supposed to be included with #1369, but I hadn't pushed them before it was merged. The commits are pretty well commented.