libnm: Fix reporting of unknown device types

nm_device_get_device_type would report the device type as it was send on
DBus, while fetching the property would mean that only a known device
types is reported.

Make both results consistent by coercing in nm_device_get_device_type
rather than when setting the property.

(cherry picked from commit a6a185ba00)
This commit is contained in:
Benjamin Berg 2019-03-07 21:31:47 +01:00 committed by Thomas Haller
parent 2d547059dc
commit 6b2aaba6df

View file

@ -356,7 +356,7 @@ get_property (GObject *object,
switch (prop_id) {
case PROP_DEVICE_TYPE:
g_value_set_enum (value, coerce_type (nm_device_get_device_type (device)));
g_value_set_enum (value, nm_device_get_device_type (device));
break;
case PROP_UDI:
g_value_set_string (value, nm_device_get_udi (device));
@ -937,7 +937,7 @@ nm_device_get_device_type (NMDevice *self)
{
g_return_val_if_fail (NM_IS_DEVICE (self), NM_DEVICE_TYPE_UNKNOWN);
return NM_DEVICE_GET_PRIVATE (self)->device_type;
return coerce_type (NM_DEVICE_GET_PRIVATE (self)->device_type);
}
/**