novatel-lte: port load_supported_bands to use GTask
This commit is contained in:

committed by
Aleksander Morgado

parent
b56ea69589
commit
eb59cf8617
@@ -311,9 +311,7 @@ load_supported_bands_finish (MMIfaceModem *self,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
/* Never fails */
|
return g_task_propagate_pointer (G_TASK (res), error);
|
||||||
return (GArray *) g_array_ref (g_simple_async_result_get_op_res_gpointer (
|
|
||||||
G_SIMPLE_ASYNC_RESULT (res)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -321,14 +319,11 @@ load_supported_bands (MMIfaceModem *self,
|
|||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *result;
|
GTask *task;
|
||||||
GArray *bands;
|
GArray *bands;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
result = g_simple_async_result_new (G_OBJECT (self),
|
task = g_task_new (self, NULL, callback, user_data);
|
||||||
callback,
|
|
||||||
user_data,
|
|
||||||
load_supported_bands);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The modem doesn't support telling us what bands are supported;
|
* The modem doesn't support telling us what bands are supported;
|
||||||
@@ -340,11 +335,8 @@ load_supported_bands (MMIfaceModem *self,
|
|||||||
g_array_append_val(bands, bandbits[i]);
|
g_array_append_val(bands, bandbits[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_simple_async_result_set_op_res_gpointer (result,
|
g_task_return_pointer (task, bands, (GDestroyNotify)g_array_unref);
|
||||||
bands,
|
g_object_unref (task);
|
||||||
(GDestroyNotify)g_array_unref);
|
|
||||||
g_simple_async_result_complete_in_idle (result);
|
|
||||||
g_object_unref (result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
Reference in New Issue
Block a user