Back-port to GTK+ 2 partially based on a previous back-port found at https://bugs.launchpad.net/midori/+bug/1026441