Move enums/flags registration to Rust, for thread safety
Our glib-mkenums template doesn't use GOnce, so registering those types from another thread may break. In the subclass branch this is done properly in Rust. The commits can't be cherry-picked since the code goes in a new source file; that code has to be added by hand in the 2.44 branch.