1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-24 19:55:26 +03:00
aports/community/gnome-control-center/0001-network-reapply-connection-on-device.patch
Dylan Van Assche 8729e4403b community/gnome-control-center: add reapply patch
GNOME Control Center did not reapply connection settings through
NetworkManager when the user changed it. Only when the user toggled the
network device OFF/ON, the settings were applied. It was missing a
reapply call to NetworkManager which was added in MR 1642 [1].
This patch is merged for GNOME 44 but backporting the patch to fix this
bug already.

Only the functional patch is backported, the clean up patches in the MR
are not backported to keep the patch small until GNOME 44 is released.

[1] https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1642
2023-02-12 16:23:35 +01:00

104 lines
4.2 KiB
Diff

Patch-Source: https://gitlab.gnome.org/GNOME/gnome-control-center/-/commit/3c4939bdbd7ba91bca4a2b3539c9ae82b8714f95
From 3c4939bdbd7ba91bca4a2b3539c9ae82b8714f95 Mon Sep 17 00:00:00 2001
From: Dylan Van Assche <me@dylanvanassche.be>
Date: Mon, 23 Jan 2023 14:46:31 +0100
Subject: [PATCH] network: reapply connection on device
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
---
.../connection-editor/net-connection-editor.c | 35 ++++++++++++++-----
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/panels/network/connection-editor/net-connection-editor.c b/panels/network/connection-editor/net-connection-editor.c
index 03d9fcac0..04f48bce9 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -201,12 +201,29 @@ update_complete (NetConnectionEditor *self,
g_signal_emit (self, signals[DONE], 0, success);
}
+static void
+device_reapply_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ NetConnectionEditor *self = user_data;
+ g_autoptr(GError) error = NULL;
+ gboolean success = TRUE;
+
+ if (!nm_device_reapply_finish (NM_DEVICE (source_object), res, &error)) {
+ g_warning ("Failed to reapply changes on device: %s", error->message);
+ success = FALSE;
+ }
+
+ update_complete (self, success);
+}
+
static void
updated_connection_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- NetConnectionEditor *self;
+ NetConnectionEditor *self = user_data;
g_autoptr(GError) error = NULL;
gboolean success = TRUE;
@@ -214,13 +231,14 @@ updated_connection_cb (GObject *source_object,
res, &error)) {
g_warning ("Failed to commit changes: %s", error->message);
success = FALSE;
- //return; FIXME return if cancelled
+ update_complete (self, success);
+ return;
}
nm_connection_clear_secrets (NM_CONNECTION (source_object));
- self = user_data;
- update_complete (self, success);
+ nm_device_reapply_async (self->device, NM_CONNECTION (self->orig_connection),
+ 0, 0, NULL, device_reapply_cb, self);
}
static void
@@ -228,7 +246,7 @@ added_connection_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- NetConnectionEditor *self;
+ NetConnectionEditor *self = user_data;
g_autoptr(GError) error = NULL;
gboolean success = TRUE;
@@ -236,11 +254,12 @@ added_connection_cb (GObject *source_object,
g_warning ("Failed to add connection: %s", error->message);
success = FALSE;
/* Leave the editor open */
- // return; FIXME return if cancelled
+ update_complete (self, success);
+ return;
}
- self = user_data;
- update_complete (self, success);
+ nm_device_reapply_async (self->device, NM_CONNECTION (self->orig_connection),
+ 0, 0, NULL, device_reapply_cb, self);
}
static void
--
GitLab