From 83d7599acce1016c005acaec5af021fc4474c427 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 28 Oct 2019 17:18:39 +0100 Subject: [PATCH] libnm: deprecate nm_device_set_managed() and nm_device_set_autoconnect() API These setters not only invoke a synchronous D-Bus call (ignoring the return value). They also modify the content of the cache client-side, bypassing the information that we receive via notifications from the server. Also, they don't emit property changed signals, but in any case they are broken beyond repair. Fully mark them as deprecated. Note that they were already marked as _NM_DEPRECATED_SYNC_METHOD. However, that does not actually mark the API as deprecated, because fully deprecating all synchronous methods is premature at this point. --- libnm/nm-device.c | 7 +++++++ libnm/nm-device.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/libnm/nm-device.c b/libnm/nm-device.c index 96698967b9..8344f2a037 100644 --- a/libnm/nm-device.c +++ b/libnm/nm-device.c @@ -1066,6 +1066,10 @@ nm_device_get_managed (NMDevice *device) * Since: 1.2 * * Deprecated: 1.22, use nm_device_set_managed_async() or GDBusConnection + * + * This function is deprecated because it calls a synchronous D-Bus method + * and modifies the content of the NMClient cache client side. Also, it does + * not emit a property changed signal. **/ void nm_device_set_managed (NMDevice *device, gboolean managed) @@ -1108,6 +1112,9 @@ nm_device_get_autoconnect (NMDevice *device) * Enables or disables automatic activation of the #NMDevice. * * Deprecated: 1.22, use nm_device_set_autoconnect_async() or GDBusConnection + * + * This function is deprecated because it calls a synchronous D-Bus method + * and modifies the content of the NMClient cache client side. **/ void nm_device_set_autoconnect (NMDevice *device, gboolean autoconnect) diff --git a/libnm/nm-device.h b/libnm/nm-device.h index ede606d8e9..bc8aad63df 100644 --- a/libnm/nm-device.h +++ b/libnm/nm-device.h @@ -77,11 +77,13 @@ NMDeviceCapabilities nm_device_get_capabilities (NMDevice *device); gboolean nm_device_get_managed (NMDevice *device); NM_AVAILABLE_IN_1_2 +NM_DEPRECATED_IN_1_22 _NM_DEPRECATED_SYNC_METHOD void nm_device_set_managed (NMDevice *device, gboolean managed); gboolean nm_device_get_autoconnect (NMDevice *device); +NM_DEPRECATED_IN_1_22 _NM_DEPRECATED_SYNC_METHOD void nm_device_set_autoconnect (NMDevice *device, gboolean autoconnect);