diff options
-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 06fe4854..e2cd96a5 100644 --- a/plugins/altair/mm-broadband-modem-altair-lte.c +++ b/plugins/altair/mm-broadband-modem-altair-lte.c @@ -317,11 +317,7 @@ load_current_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 CFGBANDS_TAG "Bands: " @@ -329,7 +325,7 @@ load_current_bands_finish (MMIfaceModem *self, static void load_current_bands_done (MMIfaceModem *self, GAsyncResult *res, - GSimpleAsyncResult *operation_result) + GTask *task) { GArray *bands; const gchar *response; @@ -338,9 +334,8 @@ load_current_bands_done (MMIfaceModem *self, response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error); if (!response) { mm_dbg ("Couldn't query current 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; } @@ -352,21 +347,17 @@ load_current_bands_done (MMIfaceModem *self, bands = mm_altair_parse_bands_response (response); if (!bands) { mm_dbg ("Failed to parse current 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 current 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 @@ -374,12 +365,9 @@ load_current_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_current_bands); + task = g_task_new (self, NULL, callback, user_data); mm_base_modem_at_command ( MM_BASE_MODEM (self), @@ -387,7 +375,7 @@ load_current_bands (MMIfaceModem *self, 3, FALSE, (GAsyncReadyCallback)load_current_bands_done, - result); + task); } /*****************************************************************************/ |