Add a StartupWMClass string into your .desktop file. Use xprop
command to get this class. For example :
$ xprop|grep WM_CLASS
WM_CLASS(STRING) = "sun-awt-X11-XFramePeer", "java-lang-Thread"
$ cat /usr/share/applications/PHPStorm.desktop | grep StartupWM
StartupWMClass=sun-awt-X11-XFramePeer
More deatils in this thread (this about AWN, but works for Unity too)
You can use udev rules to match with your devices and then assign an icon.
NOTE: In this example I will change the icons for 3 devices, usb pendrive, partition with Opensuse and a partition (Raid) with Linux Mint.

For Ubuntu 12.10 and Newer.
1) I have 3 icons in my Desktop for each device (2 png and 1 svg images), copy the 3 icons to the /usr/share/pixmaps
folder and give them perms.

cd ~/Desktop
sudo cp linuxmint.svg pendrive.png opensuse.png /usr/share/pixmaps/
cd /usr/share/pixmaps/
sudo chmod 644 linuxmint.svg pendrive.png opensuse.png
2) List the usb pendrive to know the "idVendor" and "idProduct", in a Terminal type:

Write down the numbers after "ID".
In my example:
Bus 002 Device 003: ID 0930:6545 Toshiba Corp. Kingston DataTraveler
102 Flash Drive / HEMA Flash Drive 2 GB / PNY Attache 4GB Stick
The "idVendor" is 0930 and the "idProduct" is 6545
I'm going to match that info with the "ATTRS{idVendor}" and "ATTRS{idProduct}" keys for my usb Pendrive.
3) Make sure your partitions are mounted, then list your partitions and find the attributes.
In my example:
/dev/sdc3 289G 6.3G 282G 3%
/media/hermes/OpenSuse
/dev/mapper/pdc_cjjfccgf3 296G 68G 213G 25%
/media/hermes/Linux-Mint-Raid
4) List the attributes of the OpenSuse partition with "udevadm info -a -n device name"
udevadm info -a -n /dev/sdc3
You can use this info to match the partition.

In this example I'm going to match with the "KERNEL" and "SUBSYSTEM" keys for the OpenSuse.
KERNEL=="sdc3", SUBSYSTEM=="block"
Write down this info.
5) In case of the Linux-Mint-Raid partition, I'm goin to match the rules with the "SUBSYSTEM", "ATTR{size}" and the "ID_FS_LABEL" ENV variable.
List the attributes and variables of the Linux-Mint-Raid partition with "udevadm info -a -n device name" and "udevadm info -q all -n device name".
udevadm info -a -n /dev/mapper/pdc_cjjfccgf3
udevadm info -q all -n /dev/mapper/pdc_cjjfccgf3


Creating the udev rule.
6) Go to the /etc/udev/rules.d folder and create a file with your favorite editor.
eg: 99-devices-icons.rules
cd /etc/udev/rules.d/
sudo nano 99-devices-icons.rules
Write down the info to match each device and then with the ENV{UDISKS_ICON_NAME} you will assign an icon.
In my example:
ATTRS{idVendor}=="0930", ATTRS{idProduct}=="6545",
ENV{UDISKS_ICON_NAME}="pendrive" KERNEL=="sdc3", SUBSYSTEM=="block",
ENV{UDISKS_ICON_NAME}="opensuse" SUBSYSTEM=="block",
ATTR{size}=="629145600", ENV{ID_FS_LABEL}=="Linux-Mint-Raid",
ENV{UDISKS_ICON_NAME}="linuxmint"
In nano you can save the changes with:
- Ctrl +O,Enter then Ctrl +X
7) To refresh the udev rules and see the changes, type in a Terminal window:

For Ubuntu 12.04.
The same but you should assign the icon with ENV{UDISKS_PRESENTATION_ICON_NAME} instead ENV{UDISKS_ICON_NAME}
ATTRS{idVendor}=="0930", ATTRS{idProduct}=="6545",
ENV{UDISKS_PRESENTATION_ICON_NAME}="pendrive"
KERNEL=="sdc3",
SUBSYSTEM=="block", ENV{UDISKS_PRESENTATION_ICON_NAME}="opensuse"
SUBSYSTEM=="block", ATTR{size}=="629145600",
ENV{ID_FS_LABEL}=="Linux-Mint-Raid",
ENV{UDISKS_PRESENTATION_ICON_NAME}="linuxmint"
Hope this helps.
Best Answer
I have a GoFlex which I changed the display Icon by adding two things to the hard drive.
1) Create an Image Icon or import an icon of your choice that represents your hard drive. I recommend no larger than (128 x 128 pixels) and a transparent background.
Mine is like this:
2) Name it "whatever.ico" and save it to the hard drive's "/" partition
3) Create a text file with the name "autorun.inf" and in the the file place 2 lines of text like this:
[autorun] icon=\whatever.ico
4) save the text file to the same "/" partition.
Now this is how mine is displayed and when I take to my win7 computer it is the same there too:
Shows on the panel also.