This works in Gnome 2.16.1, which is the default version used in Ubuntu Edgy.

I spent several hours looking for a way to so this, but everything I found on google was for old versions of gnome and didn't seem to work anymore.

It turns out that it's very simple to do this so here's the guide step-by-step:

How to change the icon for a specific file type in Gnome

1) Go to the folder where your icon theme is installed. Mine is in ~/.icons/Vista-Inspirate_1.0

2) Look for a subfolder called "mimetypes". In the case of Vista Inpirate (the icon theme I use), there is no such folder so I had to create one. I created mine in "48x48/mimetypes" so the full path of the folder is ~/.icons/Vista-Inspirate_1.0/48x48/mimetypes

3) Inside this folder, copy the icon/image you want to use for a specific file type. In my case, I wanted to create an icon for Mathematica notebooks which have extension "*.nb" so I renamed my png picture to the following: gnome-mime-application-mathematica.png. The name depends on the mime type you are trying to change so look for the mime type of your file and name it accordingly.

4) Log out and log back in so that your icons are refreshed. Now all the files with the specific extension you changed (*.nb in my case) have the correct icon.

That's it!

Enjoy your new icons...