aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mm-broadband-modem-qmi.c52
1 files changed, 21 insertions, 31 deletions
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c
index c0a1c09a..f077a4a7 100644
--- a/src/mm-broadband-modem-qmi.c
+++ b/src/mm-broadband-modem-qmi.c
@@ -2063,24 +2063,23 @@ modem_load_supported_bands_finish (MMIfaceModem *_self,
GError **error)
{
MMBroadbandModemQmi *self = MM_BROADBAND_MODEM_QMI (_self);
+ GArray *supported_bands;
+
+ supported_bands = g_task_propagate_pointer (G_TASK (res), error);
+ if (supported_bands) {
+ if (self->priv->supported_bands)
+ g_array_unref (self->priv->supported_bands);
- if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
- return NULL;
-
- if (self->priv->supported_bands)
- g_array_unref (self->priv->supported_bands);
-
- /* Cache the supported bands value */
- self->priv->supported_bands = g_array_ref (g_simple_async_result_get_op_res_gpointer (
- G_SIMPLE_ASYNC_RESULT (res)));
-
- return g_array_ref (self->priv->supported_bands);
+ /* Cache the supported bands value */
+ self->priv->supported_bands = g_array_ref (supported_bands);
+ }
+ return supported_bands;
}
static void
dms_get_band_capabilities_ready (QmiClientDms *client,
GAsyncResult *res,
- GSimpleAsyncResult *simple)
+ GTask *task)
{
QmiMessageDmsGetBandCapabilitiesOutput *output;
GError *error = NULL;
@@ -2088,10 +2087,10 @@ dms_get_band_capabilities_ready (QmiClientDms *client,
output = qmi_client_dms_get_band_capabilities_finish (client, res, &error);
if (!output) {
g_prefix_error (&error, "QMI operation failed: ");
- g_simple_async_result_take_error (simple, error);
+ g_task_return_error (task, error);
} else if (!qmi_message_dms_get_band_capabilities_output_get_result (output, &error)) {
g_prefix_error (&error, "Couldn't get band capabilities: ");
- g_simple_async_result_take_error (simple, error);
+ g_task_return_error (task, error);
} else {
GArray *mm_bands;
QmiDmsBandCapability qmi_bands = 0;
@@ -2110,22 +2109,19 @@ dms_get_band_capabilities_ready (QmiClientDms *client,
if (mm_bands->len == 0) {
g_array_unref (mm_bands);
- g_simple_async_result_set_error (simple,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "Couldn't parse the list of supported bands");
+ g_task_return_new_error (task,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_FAILED,
+ "Couldn't parse the list of supported bands");
} else {
- g_simple_async_result_set_op_res_gpointer (simple,
- mm_bands,
- (GDestroyNotify)g_array_unref);
+ g_task_return_pointer (task, mm_bands, (GDestroyNotify)g_array_unref);
}
}
if (output)
qmi_message_dms_get_band_capabilities_output_unref (output);
- g_simple_async_result_complete (simple);
- g_object_unref (simple);
+ g_object_unref (task);
}
static void
@@ -2133,26 +2129,20 @@ modem_load_supported_bands (MMIfaceModem *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- GSimpleAsyncResult *result;
QmiClient *client = NULL;
- if (!ensure_qmi_client (MM_BROADBAND_MODEM_QMI (self),
+ if (!assure_qmi_client (MM_BROADBAND_MODEM_QMI (self),
QMI_SERVICE_DMS, &client,
callback, user_data))
return;
- result = g_simple_async_result_new (G_OBJECT (self),
- callback,
- user_data,
- modem_load_supported_bands);
-
mm_dbg ("loading band capabilities...");
qmi_client_dms_get_band_capabilities (QMI_CLIENT_DMS (client),
NULL,
5,
NULL,
(GAsyncReadyCallback)dms_get_band_capabilities_ready,
- result);
+ g_task_new (self, NULL, callback, user_data));
}
/*****************************************************************************/