diff options
author | Ben Chan <benchan@chromium.org> | 2017-08-01 11:41:18 -0700 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-09-08 17:45:29 +0200 |
commit | 9c32a96578c43f245d83ba9af6faf6831651edcd (patch) | |
tree | 58218339787c7cc07c4c097328b2378b98f44086 | |
parent | 39484765f1140487dd24fc9255f8087439fc738d (diff) |
huawei: port setup_registration_checks to use GTask
-rw-r--r-- | plugins/huawei/mm-broadband-modem-huawei.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/plugins/huawei/mm-broadband-modem-huawei.c b/plugins/huawei/mm-broadband-modem-huawei.c index a360ca51..f0f9bf7a 100644 --- a/plugins/huawei/mm-broadband-modem-huawei.c +++ b/plugins/huawei/mm-broadband-modem-huawei.c @@ -2677,35 +2677,39 @@ setup_registration_checks_finish (MMIfaceModemCdma *self, { SetupRegistrationChecksResults *results; - if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) + results = g_task_propagate_pointer (G_TASK (res), error); + if (!results) return FALSE; - results = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)); *skip_qcdm_call_manager_step = results->skip_qcdm_call_manager_step; *skip_qcdm_hdr_step = results->skip_qcdm_hdr_step; *skip_at_cdma_service_status_step = results->skip_at_cdma_service_status_step; *skip_at_cdma1x_serving_system_step = results->skip_at_cdma1x_serving_system_step; *skip_detailed_registration_state = results->skip_detailed_registration_state; + g_free (results); return TRUE; } static void parent_setup_registration_checks_ready (MMIfaceModemCdma *self, GAsyncResult *res, - GSimpleAsyncResult *simple) + GTask *task) { + SetupRegistrationChecksResults *results; GError *error = NULL; - SetupRegistrationChecksResults results = { 0 }; + + results = g_new0 (SetupRegistrationChecksResults, 1); if (!iface_modem_cdma_parent->setup_registration_checks_finish (self, res, - &results.skip_qcdm_call_manager_step, - &results.skip_qcdm_hdr_step, - &results.skip_at_cdma_service_status_step, - &results.skip_at_cdma1x_serving_system_step, - &results.skip_detailed_registration_state, + &results->skip_qcdm_call_manager_step, + &results->skip_qcdm_hdr_step, + &results->skip_at_cdma_service_status_step, + &results->skip_at_cdma1x_serving_system_step, + &results->skip_detailed_registration_state, &error)) { - g_simple_async_result_take_error (simple, error); + g_free (results); + g_task_return_error (task, error); } else { gboolean evdo_supported = FALSE; @@ -2718,18 +2722,16 @@ parent_setup_registration_checks_ready (MMIfaceModemCdma *self, * AT+CSS won't necessarily report EVDO registration status, only 1X. */ if (evdo_supported) - results.skip_at_cdma1x_serving_system_step = TRUE; + results->skip_at_cdma1x_serving_system_step = TRUE; /* Force to always use the detailed registration checks, as we have * ^SYSINFO for that */ - results.skip_detailed_registration_state = FALSE; + results->skip_detailed_registration_state = FALSE; - g_simple_async_result_set_op_res_gpointer (simple, &results, NULL); + g_task_return_pointer (task, results, g_free); } - /* All done. NOTE: complete NOT in idle! */ - g_simple_async_result_complete (simple); - g_object_unref (simple); + g_object_unref (task); } static void @@ -2737,17 +2739,14 @@ setup_registration_checks (MMIfaceModemCdma *self, GAsyncReadyCallback callback, gpointer user_data) { - GSimpleAsyncResult *result; + GTask *task; - result = g_simple_async_result_new (G_OBJECT (self), - callback, - user_data, - setup_registration_checks); + task = g_task_new (self, NULL, callback, user_data); /* Run parent's checks first */ iface_modem_cdma_parent->setup_registration_checks (self, (GAsyncReadyCallback)parent_setup_registration_checks_ready, - result); + task); } /*****************************************************************************/ |