[PATCH] novatel: port load_supported_modes to use GTask
Aleksander Morgado
aleksander at aleksander.es
Sun Oct 22 06:14:15 UTC 2017
On 20/10/17 23:43, Ben Chan wrote:
> ---
> plugins/novatel/mm-broadband-modem-novatel.c | 22 +++++++---------------
> 1 file changed, 7 insertions(+), 15 deletions(-)
>
Pushed to git master, thanks!
> diff --git a/plugins/novatel/mm-broadband-modem-novatel.c b/plugins/novatel/mm-broadband-modem-novatel.c
> index 6fd0c478..fdb4ba52 100644
> --- a/plugins/novatel/mm-broadband-modem-novatel.c
> +++ b/plugins/novatel/mm-broadband-modem-novatel.c
> @@ -58,16 +58,13 @@ load_supported_modes_finish (MMIfaceModem *self,
> GAsyncResult *res,
> GError **error)
> {
> - if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
> - return NULL;
> -
> - 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
> parent_load_supported_modes_ready (MMIfaceModem *self,
> GAsyncResult *res,
> - GSimpleAsyncResult *simple)
> + GTask *task)
> {
> GError *error = NULL;
> GArray *all;
> @@ -77,9 +74,8 @@ parent_load_supported_modes_ready (MMIfaceModem *self,
>
> all = iface_modem_parent->load_supported_modes_finish (self, res, &error);
> if (!all) {
> - g_simple_async_result_take_error (simple, error);
> - g_simple_async_result_complete (simple);
> - g_object_unref (simple);
> + g_task_return_error (task, error);
> + g_object_unref (task);
> return;
> }
>
> @@ -112,9 +108,8 @@ parent_load_supported_modes_ready (MMIfaceModem *self,
> g_array_unref (all);
> g_array_unref (combinations);
>
> - g_simple_async_result_set_op_res_gpointer (simple, filtered, (GDestroyNotify) g_array_unref);
> - g_simple_async_result_complete (simple);
> - g_object_unref (simple);
> + g_task_return_pointer (task, filtered, (GDestroyNotify) g_array_unref);
> + g_object_unref (task);
> }
>
> static void
> @@ -126,10 +121,7 @@ load_supported_modes (MMIfaceModem *self,
> iface_modem_parent->load_supported_modes (
> MM_IFACE_MODEM (self),
> (GAsyncReadyCallback)parent_load_supported_modes_ready,
> - g_simple_async_result_new (G_OBJECT (self),
> - callback,
> - user_data,
> - load_supported_modes));
> + g_task_new (self, NULL, callback, user_data));
> }
>
> /*****************************************************************************/
>
--
Aleksander
https://aleksander.es
More information about the ModemManager-devel
mailing list