libnm-core: don't emit signal when clearing lists already empty

If the property is a list and it is already empty, we should not emit
a signal when it gets cleared.
This commit is contained in:
Beniamino Galvani
2018-05-28 15:31:11 +02:00
parent 347e0d8b5a
commit a2846bd735
4 changed files with 34 additions and 16 deletions

View File

@@ -1589,9 +1589,12 @@ nm_setting_ip_config_clear_dns (NMSettingIPConfig *setting)
g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
if (priv->dns->len != 0) {
g_ptr_array_set_size (priv->dns, 0);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS);
}
}
/**
* nm_setting_ip_config_get_num_dns_searches:
@@ -1727,9 +1730,12 @@ nm_setting_ip_config_clear_dns_searches (NMSettingIPConfig *setting)
g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
if (priv->dns_search->len != 0) {
g_ptr_array_set_size (priv->dns_search, 0);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_DNS_SEARCH);
}
}
/**
* nm_setting_ip_config_get_num_dns_options:
@@ -2107,9 +2113,11 @@ nm_setting_ip_config_clear_addresses (NMSettingIPConfig *setting)
g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
if (priv->addresses->len != 0) {
g_ptr_array_set_size (priv->addresses, 0);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ADDRESSES);
}
}
/**
* nm_setting_ip_config_get_gateway:
@@ -2264,9 +2272,11 @@ nm_setting_ip_config_clear_routes (NMSettingIPConfig *setting)
g_return_if_fail (NM_IS_SETTING_IP_CONFIG (setting));
if (priv->routes->len != 0) {
g_ptr_array_set_size (priv->routes, 0);
g_object_notify (G_OBJECT (setting), NM_SETTING_IP_CONFIG_ROUTES);
}
}
/**
* nm_setting_ip_config_get_route_metric:

View File

@@ -982,9 +982,11 @@ nm_setting_tc_config_clear_qdiscs (NMSettingTCConfig *self)
{
g_return_if_fail (NM_IS_SETTING_TC_CONFIG (self));
if (self->qdiscs->len != 0) {
g_ptr_array_set_size (self->qdiscs, 0);
g_object_notify (G_OBJECT (self), NM_SETTING_TC_CONFIG_QDISCS);
}
}
/*****************************************************************************/
/**
@@ -1116,9 +1118,11 @@ nm_setting_tc_config_clear_tfilters (NMSettingTCConfig *self)
{
g_return_if_fail (NM_IS_SETTING_TC_CONFIG (self));
if (self->tfilters->len != 0) {
g_ptr_array_set_size (self->tfilters, 0);
g_object_notify (G_OBJECT (self), NM_SETTING_TC_CONFIG_TFILTERS);
}
}
/*****************************************************************************/

View File

@@ -322,9 +322,11 @@ nm_setting_team_port_clear_link_watchers (NMSettingTeamPort *setting)
g_return_if_fail (NM_IS_SETTING_TEAM_PORT (setting));
if (priv->link_watchers->len != 0) {
g_ptr_array_set_size (priv->link_watchers, 0);
g_object_notify (G_OBJECT (setting), NM_SETTING_TEAM_PORT_LINK_WATCHERS);
}
}
static GVariant *
team_link_watchers_to_dbus (const GValue *prop_value)

View File

@@ -1120,9 +1120,11 @@ nm_setting_team_clear_link_watchers (NMSettingTeam *setting) {
g_return_if_fail (NM_IS_SETTING_TEAM (setting));
if (priv->link_watchers->len != 0) {
g_ptr_array_set_size (priv->link_watchers, 0);
g_object_notify (G_OBJECT (setting), NM_SETTING_TEAM_LINK_WATCHERS);
}
}
static GVariant *
team_link_watchers_to_dbus (const GValue *prop_value)