broadband-modem-qmi: port common_setup_cleanup_oma_unsolicited_events to use GTask

This commit is contained in:
Ben Chan
2018-04-28 15:58:55 -07:00
committed by Aleksander Morgado
parent 456a09c655
commit fe46d2c7db

View File

@@ -9530,7 +9530,7 @@ common_oma_setup_cleanup_unsolicited_events_finish (MMIfaceModemOma *_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
@@ -9539,25 +9539,21 @@ common_setup_cleanup_oma_unsolicited_events (MMBroadbandModemQmi *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
GSimpleAsyncResult *result;
GTask *task;
QmiClient *client = NULL;
if (!ensure_qmi_client (MM_BROADBAND_MODEM_QMI (self),
if (!assure_qmi_client (MM_BROADBAND_MODEM_QMI (self),
QMI_SERVICE_OMA, &client,
callback, user_data))
return;
result = g_simple_async_result_new (G_OBJECT (self),
callback,
user_data,
common_setup_cleanup_oma_unsolicited_events);
task = g_task_new (self, NULL, callback, user_data);
if (enable == self->priv->oma_unsolicited_events_setup) {
mm_dbg ("OMA unsolicited events already %s; skipping",
enable ? "setup" : "cleanup");
g_simple_async_result_set_op_res_gboolean (result, TRUE);
g_simple_async_result_complete_in_idle (result);
g_object_unref (result);
g_task_return_boolean (task, TRUE);
g_object_unref (task);
return;
}
@@ -9578,9 +9574,8 @@ common_setup_cleanup_oma_unsolicited_events (MMBroadbandModemQmi *self,
self->priv->oma_event_report_indication_id = 0;
}
g_simple_async_result_set_op_res_gboolean (result, TRUE);
g_simple_async_result_complete_in_idle (result);
g_object_unref (result);
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
static void