Add compatibility code for older Gtk versions