broadband-modem-mbim: port modem_load_supported_modes to use GTask
This commit is contained in:
@@ -386,7 +386,7 @@ modem_load_supported_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
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
|
||||
@@ -397,23 +397,17 @@ modem_load_supported_modes (MMIfaceModem *_self,
|
||||
MMBroadbandModemMbim *self = MM_BROADBAND_MODEM_MBIM (_self);
|
||||
GArray *combinations;
|
||||
MMModemModeCombination mode;
|
||||
GSimpleAsyncResult *result;
|
||||
MMModemMode all;
|
||||
GTask *task;
|
||||
|
||||
/* Just complete */
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
modem_load_supported_modes);
|
||||
|
||||
task = g_task_new (self, NULL, callback, user_data);
|
||||
|
||||
if (self->priv->caps_data_class == 0) {
|
||||
g_simple_async_result_set_error (result,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Data class not given in device capabilities");
|
||||
g_simple_async_result_complete_in_idle (result);
|
||||
g_object_unref (result);
|
||||
g_task_return_new_error (task,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Data class not given in device capabilities");
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -448,9 +442,8 @@ modem_load_supported_modes (MMIfaceModem *_self,
|
||||
mode.preferred = MM_MODEM_MODE_NONE;
|
||||
g_array_append_val (combinations, mode);
|
||||
|
||||
g_simple_async_result_set_op_res_gpointer (result, combinations, (GDestroyNotify) g_array_unref);
|
||||
g_simple_async_result_complete_in_idle (result);
|
||||
g_object_unref (result);
|
||||
g_task_return_pointer (task, combinations, (GDestroyNotify)g_array_unref);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user