broadband-modem-qmi: port messaging_check_support to use GTask

This commit is contained in:
Ben Chan
2017-07-11 14:13:14 -07:00
committed by Aleksander Morgado
parent 30dfe3055e
commit bf9e5cdfeb

View File

@@ -7309,22 +7309,20 @@ messaging_check_support_finish (MMIfaceModemMessaging *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
/* no error expected here */ return g_task_propagate_boolean (G_TASK (res), error);
return g_simple_async_result_get_op_res_gboolean (G_SIMPLE_ASYNC_RESULT (res));
} }
static void static void
parent_messaging_check_support_ready (MMIfaceModemMessaging *_self, parent_messaging_check_support_ready (MMIfaceModemMessaging *_self,
GAsyncResult *res, GAsyncResult *res,
GSimpleAsyncResult *simple) GTask *task)
{ {
MMBroadbandModemQmi *self = MM_BROADBAND_MODEM_QMI (_self); MMBroadbandModemQmi *self = MM_BROADBAND_MODEM_QMI (_self);
self->priv->messaging_fallback_at = iface_modem_messaging_parent->check_support_finish (_self, res, NULL); self->priv->messaging_fallback_at = iface_modem_messaging_parent->check_support_finish (_self, res, NULL);
g_simple_async_result_set_op_res_gboolean (simple, self->priv->messaging_fallback_at); g_task_return_boolean (task, self->priv->messaging_fallback_at);
g_simple_async_result_complete (simple); g_object_unref (task);
g_object_unref (simple);
} }
static void static void
@@ -7332,13 +7330,10 @@ messaging_check_support (MMIfaceModemMessaging *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *result; GTask *task;
MMPortQmi *port; MMPortQmi *port;
result = g_simple_async_result_new (G_OBJECT (self), task = g_task_new (self, NULL, callback, user_data);
callback,
user_data,
messaging_check_support);
port = mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self)); port = mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self));
/* If we have support for the WMS client, messaging is supported */ /* If we have support for the WMS client, messaging is supported */
@@ -7347,14 +7342,13 @@ messaging_check_support (MMIfaceModemMessaging *self,
iface_modem_messaging_parent->check_support ( iface_modem_messaging_parent->check_support (
self, self,
(GAsyncReadyCallback)parent_messaging_check_support_ready, (GAsyncReadyCallback)parent_messaging_check_support_ready,
result); task);
return; return;
} }
mm_dbg ("Messaging capabilities supported"); mm_dbg ("Messaging capabilities supported");
g_simple_async_result_set_op_res_gboolean (result, TRUE); g_task_return_boolean (task, TRUE);
g_simple_async_result_complete_in_idle (result); g_object_unref (task);
g_object_unref (result);
} }
/*****************************************************************************/ /*****************************************************************************/