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.
This commit is contained in:
Thomas Haller 2019-10-28 17:18:39 +01:00
parent 9c01d6ca67
commit 83d7599acc
2 changed files with 9 additions and 0 deletions

View file

@ -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)

View file

@ -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);