device: Always use stoppable_action_completed to terminate actions

Avoid having repeated code for doing the same, nothing changes as before
we were doing the same only in case we had not a cancellable set.
This commit is contained in:
Marco Trevisan (Treviño) 2021-01-22 15:51:00 +01:00
parent dbf01399ad
commit 56436fb8b1

View file

@ -1425,7 +1425,6 @@ static gboolean
fprint_device_verify_stop (FprintDBusDevice *dbus_dev,
GDBusMethodInvocation *invocation)
{
g_autoptr(SessionData) session = NULL;
FprintDevice *rdev = FPRINT_DEVICE (dbus_dev);
FprintDevicePrivate *priv = fprint_device_get_instance_private (rdev);
@ -1458,20 +1457,12 @@ fprint_device_verify_stop (FprintDBusDevice *dbus_dev,
return TRUE;
}
priv->current_cancel_invocation = invocation;
if (priv->current_cancellable)
{
/* We return only when the action was cancelled */
g_cancellable_cancel (priv->current_cancellable);
priv->current_cancel_invocation = invocation;
}
/* We return only when the action was cancelled */
g_cancellable_cancel (priv->current_cancellable);
else
{
fprint_dbus_device_complete_verify_stop (dbus_dev, invocation);
priv->current_action = ACTION_NONE;
session = session_data_get (priv);
session->verify_status_reported = FALSE;
}
stoppable_action_completed (rdev);
return TRUE;
}
@ -1783,17 +1774,12 @@ fprint_device_enroll_stop (FprintDBusDevice *dbus_dev,
return TRUE;
}
priv->current_cancel_invocation = invocation;
if (priv->current_cancellable)
{
/* We return only when the action was cancelled */
g_cancellable_cancel (priv->current_cancellable);
priv->current_cancel_invocation = invocation;
}
/* We return only when the action was cancelled */
g_cancellable_cancel (priv->current_cancellable);
else
{
fprint_dbus_device_complete_enroll_stop (dbus_dev, invocation);
priv->current_action = ACTION_NONE;
}
stoppable_action_completed (rdev);
return TRUE;
}