In the change to $CFG->pixpath to $OUTPUT->old_icon_url I had to do a nasty hack for file icons.
There is now a couple of dozen instances of code like
str_replace(array('.gif', '.png'), '', mimeinfo_from_type('icon', $mimetype));
I think what we need is:
1. a new method $OUTPUT->file_icon_url($mimetype); the does the same as $OUTPUT->old_icon_url(... above search and replace ...);
2. a new method $OUTPUT->link_to_file($file); that does the half-a-dozen lines of code we have duplicated around the place that is a link to a file, with the appropriate icon next to it. (For example, look at where it outputs forum attachements, or uploaded files in assignment.)