Added support for MIME-type guessing, through libmagic.

This should make it easy to add different icons for various MIME type categories.