`gtk_builder_add_from_resource` and `gtk_builder_add_from_file` failing in GTK 4 (breaks VPN connection editing in gnome-control-center)
We have a downstream bug reporting that editing VPN connections in gnome-control-center in Fedora 36 (GNOME 42.beta) does not work. This is trivially reproducible with an OpenVPN or openconnect profile installed: run Control Center, go to the Network pane, click the cog next to a VPN profile, and go to the Identity tab. An editor should be loaded into this tab, but instead you see "Error: unable to load VPN connection editor".
On the console, we get slightly more useful errors. For openvpn we see "file properties/nm-openvpn-editor.c: line 2671 (openvpn_editor_new): should not be reached". For openconnect we see "Couldn't load builder file: (unknown)".
I dug through the codepaths a bit and found out they're failing in similar code. openvpn:
if (!gtk_builder_add_from_resource (priv->builder, "/org/freedesktop/network-manager-openvpn/nm-openvpn-dialog.ui", error))
g_return_val_if_reached (NULL);
if (!gtk_builder_add_from_file (priv->builder, ui_file, error)) {
g_warning ("Couldn't load builder file: %s",
error && *error ? (*error)->message : "(unknown)");
The ui_file
there looks like it ought to be /usr/share/gnome-vpn-properties/openconnect/nm-openconnect-dialog.ui
, which is in the NetworkManager-openconnect-gnome package so it should be present (I don't have an openconnect profile to test with locally).
A reporter on the downstream bug says it works with gnome-control-center-41.4-1.fc37.x86_64 , which was built with GTK3. None of the control-center or networkmanager code changed recently, AFAICS, so I think the most likely thing is this was broken by changes to the builder code between GTK3 and GTK4.
@matthiasc suggested using GDB to print error->message
, but as you can see above the openconnect code is actually trying to log that if it exists. But we get "Couldn't load builder file: (unknown)" instead, which is the other side of the ternary, so it looks like we're not getting error
, which seems odd.