diff options
author | Ben Chan <benchan@chromium.org> | 2017-07-19 11:03:37 -0700 |
---|---|---|
committer | Ben Chan <benchan@chromium.org> | 2017-07-19 11:03:37 -0700 |
commit | c609c2bc46f07d1bb14993ef3c0268f5541114d6 (patch) | |
tree | f20fa0aec33f85643ca227e21a3de9686bd1d0f2 | |
parent | 03d96197598c08bb3c8faf7b4b795865c80315fb (diff) |
zte: port load_unlock_retries to use GTask
-rw-r--r-- | plugins/zte/mm-broadband-modem-zte.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/plugins/zte/mm-broadband-modem-zte.c b/plugins/zte/mm-broadband-modem-zte.c index 961783d4..aeb18a41 100644 --- a/plugins/zte/mm-broadband-modem-zte.c +++ b/plugins/zte/mm-broadband-modem-zte.c @@ -56,15 +56,13 @@ load_unlock_retries_finish (MMIfaceModem *self, GAsyncResult *res, GError **error) { - if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) - return NULL; - return (MMUnlockRetries *) g_object_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res))); + return g_task_propagate_pointer (G_TASK (res), error); } static void load_unlock_retries_ready (MMBaseModem *self, GAsyncResult *res, - GSimpleAsyncResult *operation_result) + GTask *task) { const gchar *response; GError *error = NULL; @@ -73,9 +71,8 @@ load_unlock_retries_ready (MMBaseModem *self, response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error); if (!response) { mm_dbg ("Couldn't query unlock retries: '%s'", error->message); - g_simple_async_result_take_error (operation_result, error); - g_simple_async_result_complete (operation_result); - g_object_unref (operation_result); + g_task_return_error (task, error); + g_object_unref (task); return; } @@ -86,18 +83,15 @@ load_unlock_retries_ready (MMBaseModem *self, retries = mm_unlock_retries_new (); mm_unlock_retries_set (retries, MM_MODEM_LOCK_SIM_PIN, pin1); mm_unlock_retries_set (retries, MM_MODEM_LOCK_SIM_PUK, puk1); - g_simple_async_result_set_op_res_gpointer (operation_result, - retries, - g_object_unref); + g_task_return_pointer (task, retries, g_object_unref); } else { - g_simple_async_result_set_error (operation_result, - MM_CORE_ERROR, - MM_CORE_ERROR_FAILED, - "Invalid unlock retries response: '%s'", - response); + g_task_return_new_error (task, + MM_CORE_ERROR, + MM_CORE_ERROR_FAILED, + "Invalid unlock retries response: '%s'", + response); } - g_simple_async_result_complete (operation_result); - g_object_unref (operation_result); + g_object_unref (task); } static void @@ -111,10 +105,7 @@ load_unlock_retries (MMIfaceModem *self, 3, FALSE, (GAsyncReadyCallback)load_unlock_retries_ready, - g_simple_async_result_new (G_OBJECT (self), - callback, - user_data, - load_unlock_retries)); + g_task_new (self, NULL, callback, user_data)); } /*****************************************************************************/ |