This is going to get extra complicated, because the file chooser is an API, which means the application around it might decide to set a specific path; or it might not cope very well with the file chooser not returning a path if you try going outside of the bounds you set up. You’ll have to modify GTK and likely the application itself.
Not really, sorry. At the very basic, you’d have to modify gtkfilesystem.c
and gtkfilesystemmodel.c
to reject navigating into locations outside a specific “root”. What happens when the user or the application tries to do that is very complicated, and nobody has really attempted at doing that.