broadband-modem-qmi: port modem_load_supported_ip_modes to use GTask

This commit is contained in:
Ben Chan
2017-07-11 16:05:55 -07:00
committed by Aleksander Morgado
parent bba2386238
commit 0b942a6759

View File

@@ -2503,7 +2503,7 @@ modem_load_supported_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
return 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 static void
@@ -2512,22 +2512,18 @@ modem_load_supported_modes (MMIfaceModem *_self,
gpointer user_data) gpointer user_data)
{ {
MMBroadbandModemQmi *self = MM_BROADBAND_MODEM_QMI (_self); MMBroadbandModemQmi *self = MM_BROADBAND_MODEM_QMI (_self);
GSimpleAsyncResult *result; GTask *task;
GArray *combinations; GArray *combinations;
MMModemModeCombination mode; MMModemModeCombination mode;
result = g_simple_async_result_new (G_OBJECT (self), task = g_task_new (self, NULL, callback, user_data);
callback,
user_data,
modem_load_supported_modes);
if (!self->priv->supported_radio_interfaces) { if (!self->priv->supported_radio_interfaces) {
g_simple_async_result_set_error (result, g_task_return_new_error (task,
MM_CORE_ERROR, MM_CORE_ERROR,
MM_CORE_ERROR_FAILED, MM_CORE_ERROR_FAILED,
"Cannot load supported modes, no radio interface list"); "Cannot load supported modes, no radio interface list");
g_simple_async_result_complete_in_idle (result); g_object_unref (task);
g_object_unref (result);
return; return;
} }
@@ -2628,9 +2624,8 @@ modem_load_supported_modes (MMIfaceModem *_self,
combinations = filtered; combinations = filtered;
} }
g_simple_async_result_set_op_res_gpointer (result, combinations, (GDestroyNotify) g_array_unref); g_task_return_pointer (task, combinations, (GDestroyNotify) g_array_unref);
g_simple_async_result_complete_in_idle (result); g_object_unref (task);
g_object_unref (result);
} }
/*****************************************************************************/ /*****************************************************************************/