Working version for gedit 3.8+