Previously, when editing a connection that doesn't have native editor
support, nm-connection-editor is spawned to do the work. But after
closing nm-connection-editor, an empty editor dialog still exists.
Fix that in this commit.
For example, fix adding new VPN connections.
In 60b4956c05 I correctly observed that we
need to not run code that requires a device when there is no device.
NetConnectionEditor is a multipurpose dialog and self->device is
optional when creating the dialog. E.g. when modifying VPN
configuration, we update just the configuration, not an NMDevice.
However, I added this check too soon, before updating the connection
configuration. We need to update the configuration first, then only bail
before proceeding to update the device, not sooner.
Fix#2668
If the NMDevice is not active (i.e. if we are editing a connection that
is not active) then don't warn when failing to reapply changes to the
device. That's expected and not something we should warn about.
We could perhaps not even try, but the device could become inactive
between the time of our check and this error, so better ignore the error
regardless.
All of the following code assumes that self->device is valid, so we need
to skip over it. It's confusing, but this is a multipurpose dialog and
self->device is optional when creating the dialog. E.g. when modifying
VPN configuration, we update just the configuration, not an NMDevice.
If the operation is cancelled (because the dialog was closed, because
the Apply button was pressed), then trying to make further use of the
source_object is a use after free, which is bad. At first I tried to fix
this by simply avoiding the use after free when the operation is
canceled, but then I realized it is ridiculous to always try committing
connection changes when closing the dialog, then immediately cancel the
operation by destroying the dialog.
So instead I've decided to not pass the cancellable along to these
operations, and instead ref the dialog to keep it alive until the
operations complete. Instead, let's just hide the window.
This commit also removes an inaccurate comment /* Leave the editor open
*/ placed right before the call to the function that hides the editor.
There's no need to leave the editor open when updating the device fails.
The connection properties at least are still saved.
Fixes#2618
It required two changes:
* Setting the stack page only after all pages are initialized
* And removing the VPN choices list from its bin only after that
When NetworkManager doesn't give us any secrets for a connection, the
connection editor still needs to be opened. This change ensures that
initialization of the editor completes even when there's an error when
fetching secrets.
Fixes#2329
Changing an active connection applies the changes onto the
NetworkManager connection, but not on the device. This is because
NetworkManager clones the connection when it is applied on a device.
This behavior is expected and documented in the NetworkManager
documentation [1]. To effectively apply the connection changes onto a
device, a reapply operation must be performed. This will make NetworkManager
apply the new connection onto the active device without having to
disable and re-enable the device.
Perform this reapply operation when the Apply button is pressed in the
Connection Editor so the changes effectively propagate to the network
device.
[1] https://networkmanager.dev/docs/api/1.32.10/gdbus-org.freedesktop.NetworkManager.Device.html#gdbus-method-org-freedesktop-NetworkManager-Device.Reapply
panels/network/wireless-security is essentially an old fork of the part
of nm-connection-editor that is now part of libnma.
The UI elements provided by libnma adhere to the same look as the rest
of gnome-control-center for quite some time now. The functinality they
implement the same functionality and more. In particular, libnma uses
Gcr to provide Smart Card access for keys and certificates.
https://bugzilla.redhat.com/show_bug.cgi?id=1992836
If an user opens an connection editor and then closes it, repeat this
multiple times causes lots of unused hidden editor windows.
Fix that by destroying the connection editor instead of hiding them
when closing.
Boy this was hard.
To ease the pain of porting wireless-security to GTK4, add
a new WsFileChooserButton class that mimics the behavior of
a button that triggers a filechooser, as per the migration
guide suggests.
There were lots of GtkGrids, so the diff is particularly
horrendous. Sorry.
This needs serious testing before landing.