core: add parameter to ignore error in add/remove pending action

Add a parameter to nm_device_add_pending_action() to silently
accept adding duplicate actions.

Same for nm_device_remove_pending_action(), to silently ignore
removing non-pending actions.

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller
2014-04-28 11:18:05 +02:00
parent 50bafeaf2e
commit a16faa3985
6 changed files with 74 additions and 43 deletions

View File

@@ -152,7 +152,7 @@ nm_active_connection_set_state (NMActiveConnection *self,
&& new_state >= NM_ACTIVE_CONNECTION_STATE_ACTIVATED &&
priv->pending_activation_id)
{
nm_device_remove_pending_action (priv->device, priv->pending_activation_id);
nm_device_remove_pending_action (priv->device, priv->pending_activation_id, TRUE);
g_clear_pointer (&priv->pending_activation_id, g_free);
}
}
@@ -399,7 +399,7 @@ nm_active_connection_set_device (NMActiveConnection *self, NMDevice *device)
if (!priv->assumed) {
priv->pending_activation_id = g_strdup_printf ("activation::%p", (void *)self);
nm_device_add_pending_action (device, priv->pending_activation_id);
nm_device_add_pending_action (device, priv->pending_activation_id, TRUE);
}
}
return TRUE;
@@ -540,7 +540,7 @@ nm_active_connection_set_assumed (NMActiveConnection *self, gboolean assumed)
priv->assumed = assumed;
if (priv->pending_activation_id) {
nm_device_remove_pending_action (priv->device, priv->pending_activation_id);
nm_device_remove_pending_action (priv->device, priv->pending_activation_id, TRUE);
g_clear_pointer (&priv->pending_activation_id, g_free);
}
}
@@ -795,7 +795,7 @@ _device_cleanup (NMActiveConnection *self)
}
if (priv->pending_activation_id) {
nm_device_remove_pending_action (priv->device, priv->pending_activation_id);
nm_device_remove_pending_action (priv->device, priv->pending_activation_id, TRUE);
g_clear_pointer (&priv->pending_activation_id, g_free);
}