Put this in a separate file and substantially refactor it. Move handling of submenu creation into gtkmodelmenuitem where it belongs. Improve our handling of when to show separators or not.