aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Chan <benchan@chromium.org>2017-09-12 03:51:35 -0700
committerAleksander Morgado <aleksander@aleksander.es>2017-09-13 16:36:49 +0200
commitaa2cd2288ac45a64393c461ea9b1362e85e99cc9 (patch)
treec8fd8022be04975ae8d14d49cdf6bc087893eabe
parentf168ffd032747ba6900feeafe9c898ae513ef79f (diff)
icera: port modem_load_current_bands to use GTask
-rw-r--r--plugins/icera/mm-broadband-modem-icera.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/plugins/icera/mm-broadband-modem-icera.c b/plugins/icera/mm-broadband-modem-icera.c
index 1c135b6f..45d6e27f 100644
--- a/plugins/icera/mm-broadband-modem-icera.c
+++ b/plugins/icera/mm-broadband-modem-icera.c
@@ -1376,17 +1376,13 @@ modem_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);
}
static void
load_current_bands_ready (MMIfaceModem *self,
GAsyncResult *res,
- GSimpleAsyncResult *operation_result)
+ GTask *task)
{
GArray *bands;
const gchar *response;
@@ -1397,9 +1393,7 @@ load_current_bands_ready (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 (operation_result);
- g_object_unref (operation_result);
+ g_task_return_error (task, error);
} else {
/* Parse bands from Icera response into MM band numbers */
parsed = parse_bands (response, &len);
@@ -1412,12 +1406,9 @@ load_current_bands_ready (MMIfaceModem *self,
}
g_slist_free_full (parsed, (GDestroyNotify) band_free);
- g_simple_async_result_set_op_res_gpointer (operation_result,
- bands,
- (GDestroyNotify)g_array_unref);
- g_simple_async_result_complete (operation_result);
- g_object_unref (operation_result);
+ g_task_return_pointer (task, bands, (GDestroyNotify)g_array_unref);
}
+ g_object_unref (task);
}
static void
@@ -1431,10 +1422,7 @@ modem_load_current_bands (MMIfaceModem *self,
3,
FALSE,
(GAsyncReadyCallback)load_current_bands_ready,
- g_simple_async_result_new (G_OBJECT (self),
- callback,
- user_data,
- modem_load_current_bands));
+ g_task_new (self, NULL, callback, user_data));
}
/*****************************************************************************/