libnm: merge device-type-specific errors into NMDeviceError
As with the settings, each device type was defining its own error type, containing either redundant or non-useful error codes. Drop all of the subtype-specific errors, and reduce things to just NM_DEVICE_ERROR_FAILED, NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION, and NM_DEVICE_ERROR_INVALID_CONNECTION. The device-type-specific errors were only returned from their nm_device_connection_compatible() implementations, so this is also a good opportunity to simplify those, by moving duplicated functionality into the base NMDevice implementation, and then allowing the subclasses to assume that the connection has already been validated in their own code. Most of the implementations now just check that the connection has the correct type for the device (which can't be done at the NMDevice level since some device types (eg, Ethernet) support multiple connection types.) Also, make sure that all of the error messages are localized.
This commit is contained in:
@@ -36,21 +36,6 @@ G_BEGIN_DECLS
|
||||
#define NM_IS_DEVICE_GENERIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_GENERIC))
|
||||
#define NM_DEVICE_GENERIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_GENERIC, NMDeviceGenericClass))
|
||||
|
||||
/**
|
||||
* NMDeviceGenericError:
|
||||
* @NM_DEVICE_GENERIC_ERROR_UNKNOWN: unknown or unclassified error
|
||||
* @NM_DEVICE_GENERIC_ERROR_NOT_GENERIC_CONNECTION: the connection was not of generic type
|
||||
* @NM_DEVICE_GENERIC_ERROR_MISSING_INTERFACE_NAME: the connection did not specify the interface name
|
||||
*/
|
||||
typedef enum {
|
||||
NM_DEVICE_GENERIC_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
||||
NM_DEVICE_GENERIC_ERROR_NOT_GENERIC_CONNECTION, /*< nick=NotGenericConnection >*/
|
||||
NM_DEVICE_GENERIC_ERROR_MISSING_INTERFACE_NAME, /*< nick=MissingInterfaceName >*/
|
||||
} NMDeviceGenericError;
|
||||
|
||||
#define NM_DEVICE_GENERIC_ERROR nm_device_generic_error_quark ()
|
||||
GQuark nm_device_generic_error_quark (void);
|
||||
|
||||
#define NM_DEVICE_GENERIC_HW_ADDRESS "hw-address"
|
||||
#define NM_DEVICE_GENERIC_TYPE_DESCRIPTION "type-description"
|
||||
|
||||
|
Reference in New Issue
Block a user