[PATCH 3/6] base-sim: port send_pin and send_puk to use GTask
Ben Chan
benchan at chromium.org
Tue Jul 4 18:40:06 UTC 2017
---
src/mm-base-sim.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/src/mm-base-sim.c b/src/mm-base-sim.c
index 289b6754..37faeb20 100644
--- a/src/mm-base-sim.c
+++ b/src/mm-base-sim.c
@@ -426,23 +426,23 @@ common_send_pin_puk_finish (MMBaseSim *self,
GAsyncResult *res,
GError **error)
{
- return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
+ return g_task_propagate_boolean (G_TASK (res), error);
}
static void
send_pin_puk_ready (MMBaseModem *modem,
GAsyncResult *res,
- GSimpleAsyncResult *simple)
+ GTask *task)
{
GError *error = NULL;
mm_base_modem_at_command_finish (modem, res, &error);
if (error)
- g_simple_async_result_take_error (simple, error);
+ g_task_return_error (task, error);
else
- g_simple_async_result_set_op_res_gboolean (simple, TRUE);
- g_simple_async_result_complete (simple);
- g_object_unref (simple);
+ g_task_return_boolean (task, TRUE);
+
+ g_object_unref (task);
}
static void
@@ -452,13 +452,10 @@ common_send_pin_puk (MMBaseSim *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- GSimpleAsyncResult *result;
+ GTask *task;
gchar *command;
- result = g_simple_async_result_new (G_OBJECT (self),
- callback,
- user_data,
- common_send_pin_puk);
+ task = g_task_new (self, NULL, callback, user_data);
command = (puk ?
g_strdup_printf ("+CPIN=\"%s\",\"%s\"", puk, pin) :
@@ -469,7 +466,7 @@ common_send_pin_puk (MMBaseSim *self,
3,
FALSE,
(GAsyncReadyCallback)send_pin_puk_ready,
- result);
+ task);
g_free (command);
}
--
2.13.2
More information about the ModemManager-devel
mailing list