diff options
author | Ben Chan <benchan@chromium.org> | 2017-07-18 22:33:23 -0700 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-07-19 17:26:40 +0200 |
commit | 2d82c505e465064a0f990c28188ab8b8aa14fc0c (patch) | |
tree | bd3a58ff36e9fb3b2645a58d8ec29b2ff57a21cd | |
parent | 4ea38c26e068644a364b307b3951ac71f4618321 (diff) |
altair-lte: port load_supported_bands to use GTask
-rw-r--r-- | plugins/altair/mm-broadband-modem-altair-lte.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/plugins/altair/mm-broadband-modem-altair-lte.c b/plugins/altair/mm-broadband-modem-altair-lte.c index 7dd168dc..06fe4854 100644 --- a/plugins/altair/mm-broadband-modem-altair-lte.c +++ b/plugins/altair/mm-broadband-modem-altair-lte.c @@ -248,11 +248,7 @@ load_supported_bands_finish (MMIfaceModem *self, GAsyncResult *res, GError **error) { - if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) - return NULL; - - return (GArray *) g_array_ref (g_simple_async_result_get_op_res_gpointer ( - G_SIMPLE_ASYNC_RESULT (res))); + return g_task_propagate_pointer (G_TASK (res), error); } #define BANDCAP_TAG "%BANDCAP: " @@ -260,7 +256,7 @@ load_supported_bands_finish (MMIfaceModem *self, static void load_supported_bands_done (MMIfaceModem *self, GAsyncResult *res, - GSimpleAsyncResult *operation_result) + GTask *task) { GArray *bands; const gchar *response; @@ -269,9 +265,8 @@ load_supported_bands_done (MMIfaceModem *self, response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error); if (!response) { mm_dbg ("Couldn't query supported bands: '%s'", error->message); - g_simple_async_result_take_error (operation_result, error); - g_simple_async_result_complete_in_idle (operation_result); - g_object_unref (operation_result); + g_task_return_error (task, error); + g_object_unref (task); return; } @@ -283,21 +278,17 @@ load_supported_bands_done (MMIfaceModem *self, bands = mm_altair_parse_bands_response (response); if (!bands) { mm_dbg ("Failed to parse supported bands response"); - g_simple_async_result_set_error ( - operation_result, + g_task_return_new_error ( + task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, "Failed to parse supported bands response"); - g_simple_async_result_complete_in_idle (operation_result); - g_object_unref (operation_result); + g_object_unref (task); return; } - g_simple_async_result_set_op_res_gpointer (operation_result, - bands, - (GDestroyNotify)g_array_unref); - g_simple_async_result_complete_in_idle (operation_result); - g_object_unref (operation_result); + g_task_return_pointer (task, bands, (GDestroyNotify)g_array_unref); + g_object_unref (task); } static void @@ -305,12 +296,9 @@ load_supported_bands (MMIfaceModem *self, GAsyncReadyCallback callback, gpointer user_data) { - GSimpleAsyncResult *result; + GTask *task; - result = g_simple_async_result_new (G_OBJECT (self), - callback, - user_data, - load_supported_bands); + task = g_task_new (self, NULL, callback, user_data); mm_base_modem_at_command ( MM_BASE_MODEM (self), @@ -318,7 +306,7 @@ load_supported_bands (MMIfaceModem *self, 3, FALSE, (GAsyncReadyCallback)load_supported_bands_done, - result); + task); } /*****************************************************************************/ |