mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-04 09:28:00 +02:00
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.
This commit is contained in:
parent
5db62eb51d
commit
5b8c092d6b
5 changed files with 12 additions and 33 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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__ */
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue