From 56436fb8b147c55afb0557f211b4e71b42e570b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 22 Jan 2021 15:51:00 +0100 Subject: [PATCH] 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. --- src/device.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/src/device.c b/src/device.c index 564657f..9c315e5 100644 --- a/src/device.c +++ b/src/device.c @@ -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; }