diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2015-04-14 14:16:04 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2015-04-20 10:00:28 +0200 |
commit | fc6373bea918f359ebece75e500773c50f5375c7 (patch) | |
tree | f0324004470c7d1d3244d9ce2cbfdd95b91c2cc6 | |
parent | 823df334eda48a8e2cec897d6123f7b2158c12ff (diff) | |
download | NetworkManager-fc6373bea918f359ebece75e500773c50f5375c7.tar.gz |
device: add nm-plugin-missing property indicating NM device plugin not available
It is useful for indicating that the device type is supported but the required
plugin is not installed.
-rw-r--r-- | introspection/nm-device.xml | 6 | ||||
-rw-r--r-- | src/devices/nm-device.c | 35 | ||||
-rw-r--r-- | src/devices/nm-device.h | 4 |
3 files changed, 45 insertions, 0 deletions
diff --git a/introspection/nm-device.xml b/introspection/nm-device.xml index 9e78856cf5..7aef2f35b1 100644 --- a/introspection/nm-device.xml +++ b/introspection/nm-device.xml @@ -116,6 +116,12 @@ its operation. </tp:docstring> </property> + <property name="NmPluginMissing" type="b" access="read"> + <tp:docstring> + If TRUE, indicates the NetworkManager plugin for the device is likely + missing or misconfigured. + </tp:docstring> + </property> <property name="DeviceType" type="u" access="read" tp:type="NM_DEVICE_TYPE"> <tp:docstring> The general type of the network device; ie Ethernet, WiFi, etc. diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 85050154d3..05392392c1 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -120,6 +120,7 @@ enum { PROP_MANAGED, PROP_AUTOCONNECT, PROP_FIRMWARE_MISSING, + PROP_NM_PLUGIN_MISSING, PROP_TYPE_DESC, PROP_RFKILL_TYPE, PROP_IFINDEX, @@ -197,6 +198,7 @@ typedef struct { char * firmware_version; RfKillType rfkill_type; gboolean firmware_missing; + gboolean nm_plugin_missing; GHashTable * available_connections; char * hw_addr; guint hw_addr_len; @@ -6691,6 +6693,26 @@ nm_device_get_firmware_missing (NMDevice *self) return NM_DEVICE_GET_PRIVATE (self)->firmware_missing; } +void +nm_device_set_nm_plugin_missing (NMDevice *self, gboolean new_missing) +{ + NMDevicePrivate *priv; + + g_return_if_fail (NM_IS_DEVICE (self)); + + priv = NM_DEVICE_GET_PRIVATE (self); + if (priv->nm_plugin_missing != new_missing) { + priv->nm_plugin_missing = new_missing; + g_object_notify (G_OBJECT (self), NM_DEVICE_NM_PLUGIN_MISSING); + } +} + +gboolean +nm_device_get_nm_plugin_missing (NMDevice *self) +{ + return NM_DEVICE_GET_PRIVATE (self)->nm_plugin_missing; +} + static NMIP4Config * find_ip4_lease_config (NMDevice *self, NMConnection *connection, @@ -8690,6 +8712,9 @@ set_property (GObject *object, guint prop_id, case PROP_FIRMWARE_MISSING: priv->firmware_missing = g_value_get_boolean (value); break; + case PROP_NM_PLUGIN_MISSING: + priv->nm_plugin_missing = g_value_get_boolean (value); + break; case PROP_DEVICE_TYPE: g_return_if_fail (priv->type == NM_DEVICE_TYPE_UNKNOWN); priv->type = g_value_get_uint (value); @@ -8835,6 +8860,9 @@ get_property (GObject *object, guint prop_id, case PROP_FIRMWARE_MISSING: g_value_set_boolean (value, priv->firmware_missing); break; + case PROP_NM_PLUGIN_MISSING: + g_value_set_boolean (value, priv->nm_plugin_missing); + break; case PROP_TYPE_DESC: g_value_set_string (value, priv->type_desc); break; @@ -9061,6 +9089,13 @@ nm_device_class_init (NMDeviceClass *klass) G_PARAM_STATIC_STRINGS)); g_object_class_install_property + (object_class, PROP_NM_PLUGIN_MISSING, + g_param_spec_boolean (NM_DEVICE_NM_PLUGIN_MISSING, "", "", + FALSE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (object_class, PROP_TYPE_DESC, g_param_spec_string (NM_DEVICE_TYPE_DESC, "", "", NULL, diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index fb46c80dc0..ad6de877ff 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -54,6 +54,7 @@ #define NM_DEVICE_MANAGED "managed" #define NM_DEVICE_AUTOCONNECT "autoconnect" #define NM_DEVICE_FIRMWARE_MISSING "firmware-missing" +#define NM_DEVICE_NM_PLUGIN_MISSING "nm-plugin-missing" #define NM_DEVICE_AVAILABLE_CONNECTIONS "available-connections" #define NM_DEVICE_PHYSICAL_PORT_ID "physical-port-id" #define NM_DEVICE_MTU "mtu" @@ -389,6 +390,9 @@ void nm_device_queue_state (NMDevice *self, NMDeviceStateReason reason); gboolean nm_device_get_firmware_missing (NMDevice *self); +gboolean nm_device_get_nm_plugin_missing (NMDevice *self); +void nm_device_set_nm_plugin_missing (NMDevice *self, + gboolean missing); void nm_device_steal_connection (NMDevice *device, NMConnection *connection); |