device: refactor nm_device_get_applied_setting()
This commit is contained in:
@@ -1130,7 +1130,11 @@ nm_device_get_settings_connection (NMDevice *self)
|
|||||||
NMConnection *
|
NMConnection *
|
||||||
nm_device_get_applied_connection (NMDevice *self)
|
nm_device_get_applied_connection (NMDevice *self)
|
||||||
{
|
{
|
||||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
NMDevicePrivate *priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (NM_IS_DEVICE (self), NULL);
|
||||||
|
|
||||||
|
priv = NM_DEVICE_GET_PRIVATE (self);
|
||||||
|
|
||||||
return priv->act_request ? nm_act_request_get_applied_connection (priv->act_request) : NULL;
|
return priv->act_request ? nm_act_request_get_applied_connection (priv->act_request) : NULL;
|
||||||
}
|
}
|
||||||
@@ -1147,23 +1151,12 @@ nm_device_has_unmodified_applied_connection (NMDevice *self, NMSettingCompareFla
|
|||||||
}
|
}
|
||||||
|
|
||||||
NMSetting *
|
NMSetting *
|
||||||
nm_device_get_applied_setting (NMDevice *device, GType setting_type)
|
nm_device_get_applied_setting (NMDevice *self, GType setting_type)
|
||||||
{
|
{
|
||||||
NMActRequest *req;
|
NMConnection *connection;
|
||||||
NMSetting *setting = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE (device), NULL);
|
connection = nm_device_get_applied_connection (self);
|
||||||
|
return connection ? nm_connection_get_setting (connection, setting_type) : NULL;
|
||||||
req = nm_device_get_act_request (device);
|
|
||||||
if (req) {
|
|
||||||
NMConnection *connection;
|
|
||||||
|
|
||||||
connection = nm_act_request_get_applied_connection (req);
|
|
||||||
if (connection)
|
|
||||||
setting = nm_connection_get_setting (connection, setting_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return setting;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RfKillType
|
RfKillType
|
||||||
|
Reference in New Issue
Block a user