broadband-modem-qmi: port messaging_set_default_storage to use GTask
This commit is contained in:

committed by
Aleksander Morgado

parent
216fb6bbe8
commit
3cd9ae6321
@@ -7169,13 +7169,13 @@ messaging_set_default_storage_finish (MMIfaceModemMessaging *_self,
|
||||
return iface_modem_messaging_parent->set_default_storage_finish (_self, res, 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
|
||||
wms_set_routes_ready (QmiClientWms *client,
|
||||
GAsyncResult *res,
|
||||
GSimpleAsyncResult *simple)
|
||||
GTask *task)
|
||||
{
|
||||
QmiMessageWmsSetRoutesOutput *output = NULL;
|
||||
GError *error = NULL;
|
||||
@@ -7183,19 +7183,17 @@ wms_set_routes_ready (QmiClientWms *client,
|
||||
output = qmi_client_wms_set_routes_finish (client, res, &error);
|
||||
if (!output) {
|
||||
g_prefix_error (&error, "QMI operation failed: ");
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
g_task_return_error (task, error);
|
||||
} else if (!qmi_message_wms_set_routes_output_get_result (output, &error)) {
|
||||
g_prefix_error (&error, "Couldn't set routes: ");
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
} else {
|
||||
g_simple_async_result_set_op_res_gboolean (simple, TRUE);
|
||||
}
|
||||
g_task_return_error (task, error);
|
||||
} else
|
||||
g_task_return_boolean (task, TRUE);
|
||||
|
||||
g_object_unref (task);
|
||||
|
||||
if (output)
|
||||
qmi_message_wms_set_routes_output_unref (output);
|
||||
|
||||
g_simple_async_result_complete (simple);
|
||||
g_object_unref (simple);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -7205,7 +7203,6 @@ messaging_set_default_storage (MMIfaceModemMessaging *_self,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMBroadbandModemQmi *self = MM_BROADBAND_MODEM_QMI (_self);
|
||||
GSimpleAsyncResult *result;
|
||||
QmiClient *client = NULL;
|
||||
QmiMessageWmsSetRoutesInput *input;
|
||||
GArray *routes_array;
|
||||
@@ -7217,16 +7214,11 @@ messaging_set_default_storage (MMIfaceModemMessaging *_self,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ensure_qmi_client (MM_BROADBAND_MODEM_QMI (self),
|
||||
if (!assure_qmi_client (MM_BROADBAND_MODEM_QMI (self),
|
||||
QMI_SERVICE_WMS, &client,
|
||||
callback, user_data))
|
||||
return;
|
||||
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
messaging_set_default_storage);
|
||||
|
||||
/* Build routes array and add it as input
|
||||
* Just worry about Class 0 and Class 1 messages for now */
|
||||
input = qmi_message_wms_set_routes_input_new ();
|
||||
@@ -7246,7 +7238,7 @@ messaging_set_default_storage (MMIfaceModemMessaging *_self,
|
||||
5,
|
||||
NULL,
|
||||
(GAsyncReadyCallback)wms_set_routes_ready,
|
||||
result);
|
||||
g_task_new (self, NULL, callback, user_data));
|
||||
|
||||
qmi_message_wms_set_routes_input_unref (input);
|
||||
g_array_unref (routes_array);
|
||||
|
Reference in New Issue
Block a user