Better gio platform mapping: Backport fixes to support GLib 2.86.0 typelibs#131
Merged
mtwebster merged 9 commits intolinuxmint:masterfrom Sep 15, 2025
Merged
Conversation
GLib will not expose anymore platform specific functions in Gio namespace as it used to do when GI Repository 1.0 was used, in order to keep retro-compatibility in gjs applications, generate wrappers for Gio platform-specific definitions that we used to provide inside the main Gio object, but warn the users of these APIs that they should migrate to GioUnix or GioWin32 instead.
Expose it in the print module Co-Authored-By: <marco.trevisan@canonical.com>
Re-use the C definition to warn when using a deprecated namespace instead of doing the same in pure JS.
When using warnDeprecatedOncePerCallsite() from JS we need to use a larger stack to track the call site, otherwise we may end up considering the same call site for different actual callers. In fact when using this in Gio.js override the call site is always the same, but we care about where that function is being invoked from.
In previous versions of GLib, platform-specific symbols such as GUnixMountMonitor were mapped in the Gio namespace as Gio.UnixMountMonitor, while since commit 0565682 we create wrappers such as Gio.MountMonitor. This is not correct, and does not serve the initial purpose of providing a backward compatible wrapper. So, use the same logic that we had before: if the GType of a symbol starts with G{Unix,Win32} we use the platform specific name as prefix of the wrapper type, so that it will be Gio.{Unix,Win32}TypeName
JS functions have a name properties by default, but we did not implement it for our function wrappers. Given that there's no a defined specification for it and that it can be used for debugging purposes, use it to store the original C function name.
In case a platform-only function is being mapped inside the Gio namespace and that has a platform-specific prefix, then we should use it inside the more generic Gio namespace. This is preserving the pre-girepository-2.0 behavior
GObject.type_default_interface_ref() is no longer introspectable for some reason, but as it is deprecated in favor of GObject.type_default_interface_get() anyway, use that instead.
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

GLib typelibs have changed in 2.86.0, see:
So, backporting the gjs changes that landed as part of:
I don't plan to update this MR much unfortunately, so this is a best effort to get the
GioandIntorspectiontests to pass,