[PATCH 4/5] iface-modem-cdma: port mm_iface_modem_cdma_register_in_network to use GTask

Aleksander Morgado aleksander at aleksander.es
Fri Jun 30 09:05:35 UTC 2017


On 29/06/17 13:46, Ben Chan wrote:
> ---
>  src/mm-iface-modem-cdma.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
> 

Pushed to git master, thanks.

> diff --git a/src/mm-iface-modem-cdma.c b/src/mm-iface-modem-cdma.c
> index f35d6aa1..6bf7bb17 100644
> --- a/src/mm-iface-modem-cdma.c
> +++ b/src/mm-iface-modem-cdma.c
> @@ -396,22 +396,21 @@ mm_iface_modem_cdma_register_in_network_finish (MMIfaceModemCdma *self,
>                                                  GAsyncResult *res,
>                                                  GError **error)
>  {
> -    return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
> +    return g_task_propagate_boolean (G_TASK (res), error);
>  }
>  
>  static void
>  register_in_network_ready (MMIfaceModemCdma *self,
>                             GAsyncResult *res,
> -                           GSimpleAsyncResult *simple)
> +                           GTask *task)
>  {
>      GError *error = NULL;
>  
>      if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->register_in_network_finish (self, res, &error))
> -        g_simple_async_result_take_error (simple, error);
> +        g_task_return_error (task, error);
>      else
> -        g_simple_async_result_set_op_res_gboolean (simple, TRUE);
> -    g_simple_async_result_complete (simple);
> -    g_object_unref (simple);
> +        g_task_return_boolean (task, TRUE);
> +    g_object_unref (task);
>  }
>  
>  void
> @@ -420,17 +419,15 @@ mm_iface_modem_cdma_register_in_network (MMIfaceModemCdma *self,
>                                           GAsyncReadyCallback callback,
>                                           gpointer user_data)
>  {
> -    GSimpleAsyncResult *result;
> +    GTask *task;
> +
> +    task = g_task_new (self, NULL, callback, user_data);
>  
> -    result = g_simple_async_result_new (G_OBJECT (self),
> -                                        callback,
> -                                        user_data,
> -                                        mm_iface_modem_cdma_register_in_network);
>      MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->register_in_network (
>          self,
>          max_registration_time,
>          (GAsyncReadyCallback)register_in_network_ready,
> -        result);
> +        task);
>  }
>  
>  /*****************************************************************************/
> 


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list