summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-09-26 13:26:15 +0200
committerThomas Haller <thaller@redhat.com>2016-09-26 13:27:00 +0200
commit5b8c092d6be5251695fb59ff0821ab0161438966 (patch)
tree658143b31c6c9d5dcb8886e6525f1e66ce1aed04
parent5db62eb51d0664cc815e146dc49b82bbddae3ae1 (diff)
downloadNetworkManager-5b8c092d6be5251695fb59ff0821ab0161438966.tar.gz
device: initialize nm_plugin_missing via constructor property
No need for the setter/getter of this property. Immutable properties are so much nicer. Remove the setter and ensure that the nm_plugin_missing property is only set during object construction.
-rw-r--r--src/devices/nm-device-generic.c3
-rw-r--r--src/devices/nm-device-generic.h3
-rw-r--r--src/devices/nm-device.c29
-rw-r--r--src/devices/nm-device.h3
-rw-r--r--src/nm-manager.c7
5 files changed, 12 insertions, 33 deletions
diff --git a/src/devices/nm-device-generic.c b/src/devices/nm-device-generic.c
index d90840d272..a0ce8a0494 100644
--- a/src/devices/nm-device-generic.c
+++ b/src/devices/nm-device-generic.c
@@ -111,7 +111,7 @@ update_connection (NMDevice *device, NMConnection *connection)
/**************************************************************/
NMDevice *
-nm_device_generic_new (const NMPlatformLink *plink)
+nm_device_generic_new (const NMPlatformLink *plink, gboolean nm_plugin_missing)
{
g_return_val_if_fail (plink != NULL, NULL);
@@ -119,6 +119,7 @@ nm_device_generic_new (const NMPlatformLink *plink)
NM_DEVICE_IFACE, plink->name,
NM_DEVICE_TYPE_DESC, "Generic",
NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_GENERIC,
+ NM_DEVICE_NM_PLUGIN_MISSING, nm_plugin_missing,
NULL);
}
diff --git a/src/devices/nm-device-generic.h b/src/devices/nm-device-generic.h
index 9a5ff09122..d988a5e2a1 100644
--- a/src/devices/nm-device-generic.h
+++ b/src/devices/nm-device-generic.h
@@ -43,6 +43,7 @@ typedef struct {
GType nm_device_generic_get_type (void);
-NMDevice *nm_device_generic_new (const NMPlatformLink *plink);
+NMDevice *nm_device_generic_new (const NMPlatformLink *plink,
+ gboolean nm_plugin_missing);
#endif /* __NETWORKMANAGER_DEVICE_GENERIC_H__ */
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 387856fbea..c7fc22e529 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -9278,26 +9278,6 @@ 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;
- _notify (self, PROP_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,
@@ -12397,7 +12377,7 @@ set_property (GObject *object, guint prop_id,
}
break;
case PROP_IFACE:
- /* construct only */
+ /* construct-only */
g_return_if_fail (!priv->iface);
priv->iface = g_value_dup_string (value);
break;
@@ -12441,10 +12421,11 @@ set_property (GObject *object, guint prop_id,
nm_device_set_autoconnect (self, g_value_get_boolean (value));
break;
case PROP_FIRMWARE_MISSING:
- /* construct only */
+ /* construct-only */
priv->firmware_missing = g_value_get_boolean (value);
break;
case PROP_NM_PLUGIN_MISSING:
+ /* construct-only */
priv->nm_plugin_missing = g_value_get_boolean (value);
break;
case PROP_DEVICE_TYPE:
@@ -12452,7 +12433,7 @@ set_property (GObject *object, guint prop_id,
priv->type = g_value_get_uint (value);
break;
case PROP_LINK_TYPE:
- /* construct only */
+ /* construct-only */
g_return_if_fail (priv->link_type == NM_LINK_TYPE_NONE);
priv->link_type = g_value_get_uint (value);
break;
@@ -12467,7 +12448,7 @@ set_property (GObject *object, guint prop_id,
priv->is_master = g_value_get_boolean (value);
break;
case PROP_PERM_HW_ADDRESS:
- /* construct only */
+ /* construct-only */
priv->hw_addr_perm = g_value_dup_string (value);
break;
case PROP_REFRESH_RATE_MS:
diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h
index 4e4d24e1f6..812a8608a1 100644
--- a/src/devices/nm-device.h
+++ b/src/devices/nm-device.h
@@ -540,9 +540,6 @@ 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, NMSettingsConnection *connection);
diff --git a/src/nm-manager.c b/src/nm-manager.c
index efc21c9459..dfbe10c049 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -2088,7 +2088,6 @@ platform_link_added (NMManager *self,
{
NMDeviceFactory *factory;
NMDevice *device = NULL;
- gboolean nm_plugin_missing = FALSE;
GSList *iter;
g_return_if_fail (ifindex > 0);
@@ -2142,6 +2141,8 @@ platform_link_added (NMManager *self,
}
if (device == NULL) {
+ gboolean nm_plugin_missing = FALSE;
+
switch (plink->type) {
case NM_LINK_TYPE_WWAN_NET:
case NM_LINK_TYPE_BNEP:
@@ -2153,7 +2154,7 @@ platform_link_added (NMManager *self,
nm_plugin_missing = TRUE;
/* fall through */
default:
- device = nm_device_generic_new (plink);
+ device = nm_device_generic_new (plink, nm_plugin_missing);
break;
}
}
@@ -2161,8 +2162,6 @@ platform_link_added (NMManager *self,
if (device) {
gs_free_error GError *error = NULL;
- if (nm_plugin_missing)
- nm_device_set_nm_plugin_missing (device, TRUE);
if (nm_device_realize_start (device, plink, NULL, &error)) {
add_device (self, device, NULL);
_device_realize_finish (self, device, plink);