Taken from gedit, commit: 42a6a8d8d87f32572f56b56a9c4e92f7181d339a from: Garrett Regier <alias301@gmail.com>