[PATCH 5/5] base-call: port call_delete to use GTask
Aleksander Morgado
aleksander at aleksander.es
Thu Jul 6 09:13:37 UTC 2017
On 06/07/17 00:12, Ben Chan wrote:
> ---
> src/mm-base-call.c | 27 ++++++---------------------
> 1 file changed, 6 insertions(+), 21 deletions(-)
>
Pushed to git master, thanks.
Also please note that I pushed a follow up commit removing the unneeded g_task_set_task_data() call.
> diff --git a/src/mm-base-call.c b/src/mm-base-call.c
> index 7aeaa5e9..0896259b 100644
> --- a/src/mm-base-call.c
> +++ b/src/mm-base-call.c
> @@ -856,33 +856,18 @@ call_send_dtmf (MMBaseCall *self,
> }
>
> /*****************************************************************************/
> -typedef struct {
> - MMBaseCall *self;
> - MMBaseModem *modem;
> - GSimpleAsyncResult *result;
> -} CallDeleteContext;
>
> static void
> call_delete (MMBaseCall *self,
> GAsyncReadyCallback callback,
> gpointer user_data)
> {
> - CallDeleteContext *ctx;
> -
> - ctx = g_new0 (CallDeleteContext, 1);
> - ctx->result = g_simple_async_result_new (G_OBJECT (self),
> - callback,
> - user_data,
> - call_delete);
> - ctx->self = g_object_ref (self);
> - ctx->modem = g_object_ref (self->priv->modem);
> + GTask *task;
>
> - g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
> - g_simple_async_result_complete_in_idle (ctx->result);
> - g_object_unref (ctx->result);
> - g_object_unref (ctx->modem);
> - g_object_unref (ctx->self);
> - g_free (ctx);
> + task = g_task_new (self, NULL, callback, user_data);
> + g_task_set_task_data (task, g_object_ref (self->priv->modem), g_object_unref);
> + g_task_return_boolean (task, TRUE);
> + g_object_unref (task);
> }
>
> static gboolean
> @@ -890,7 +875,7 @@ call_delete_finish (MMBaseCall *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);
> }
>
> /*****************************************************************************/
>
--
Aleksander
https://aleksander.es
More information about the ModemManager-devel
mailing list