Comment 10 for bug 630281

Created attachment 472595
Set the default mail handler to thunderbird if it exists in the users $PATH

This bug was reported in Launchpad: https://launchpad.net/bugs/630281

Currently, when you set Thunderbird to be the default mail client from the Thunderbird UI on GNOME, it sets "/desktop/gnome/url-handlers/mailto/command" to something like $XCurProcD/thunderbird (on Ubuntu, this path is currently /usr/lib/thunderbird-3.1.3/thunderbird).

This has a couple of problems:

1) It breaks upgrades if the path has the version number in it (which is the Ubuntu bug). Ok, I suppose that could also be argued as a distro-problem too.

2) It causes the default mail client in gnome-default-application-properties to be displayed as "Custom" rather than "Thunderbird". This is because the settings dialog expects the setting to just be an executable in the users path. I suppose that could be changed too, but that isn't how other applications work.

3) Setting the default mail client in gnome-default-application-properties to Thunderbird doesn't stop Thunderbird asking to be the default mail client.

The way I think that this should work is:

1) If thunderbird is in the users path and it is a symbolic link to something in $XCurProcD, set the key to "thunderbird %s", else...
2) Fall back to "$XCurProcD/thunderbird %s".

So, most users with a single install of Thunderbird will have the key set to "thunderbird %s". It also allows for users to download, extract and run other instances of Thunderbird if they want to, and still be able to set them as the default mail client too, without installing them properly (it would just use the full path for those in that case).

Attached is a first attempt at a patch to implement this behaviour, which is working ok here.