Based on a patch by Jeremy Bicha <jbicha@ubuntu.com>. https://bugzilla.gnome.org/show_bug.cgi?id=790373