Run the command:
sudo apt-get install gconf-editor -y && gconf-editor
Then navigate to
Apps → Metacity → General
or using Gnome shell:
desktop → gnome → shell → windows
under button_layout change:
And I have just tried this in 12.04 Unity and it works in all the programs I tried, including Chromium and Thunderbird.
The colon separates what buttons go on which side, and you can change the order to suit what you want, for example:
would put close on the left and minimize and maximize on the right in that order, while:
Would give the Gnome shell style of just a close button on the right.