make glib_should_use_portal() public
As more libraries add support for portal specific APIs, they end up having to implement utility functions to check whether the app should use portals. These are often modelled after the check in GLib, but sometimes simplify it to leave out things like the environment variable override (which is useful for testing and use with non-Flatpak confinement systems).
As GLib needs this utility function itself and is a dependency of these other libraries/apps, it would make sense to make that utility function part of the public API.
As a quick survey, I was able to find the following instances of this kind of check:
- GTK: https://gitlab.gnome.org/GNOME/gtk/-/blob/master/gdk/gdk.c#L373-391
- libsecret: https://gitlab.gnome.org/GNOME/libsecret/-/blob/master/libsecret/secret-backend.c#L158-160
- Tracker: https://gitlab.gnome.org/GNOME/tracker/-/blob/master/src/libtracker-sparql/bus/tracker-bus.vala#L62-64
- Epiphany: https://gitlab.gnome.org/GNOME/epiphany/-/blob/master/lib/ephy-flatpak-utils.c#L48-66
- IBus: https://github.com/ibus/ibus/blob/dd4cc5b028c35f9bb8fa9d3bdc8f26bcdfc43d40/src/ibusbus.c#L473-L493
- Mozilla: https://hg.mozilla.org/mozilla-central/file/tip/toolkit/system/gnome/nsGIOService.cpp#l28
I wouldn't be surprised if we see more libraries and apps that need this functionality as time goes on.