[PATCH 1/6] base-sim: port change_pin to use GTask
Ben Chan
benchan at chromium.org
Tue Jul 4 18:40:04 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 fdd9ee14..51e4e6a7 100644
--- a/src/mm-base-sim.c
+++ b/src/mm-base-sim.c
@@ -88,23 +88,23 @@ change_pin_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
change_pin_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
@@ -114,13 +114,10 @@ change_pin (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,
- change_pin);
+ task = g_task_new (self, NULL, callback, user_data);
command = g_strdup_printf ("+CPWD=\"SC\",\"%s\",\"%s\"",
old_pin,
@@ -130,7 +127,7 @@ change_pin (MMBaseSim *self,
3,
FALSE,
(GAsyncReadyCallback)change_pin_ready,
- result);
+ task);
g_free (command);
}
--
2.13.2
More information about the ModemManager-devel
mailing list