Refactoring patch from Ben Hutchings: move all the Gtk resize code into one