wavecom: port load_supported_bands to use GTask
This commit is contained in:
@@ -551,27 +551,22 @@ set_current_modes (MMIfaceModem *self,
|
|||||||
/* Load supported bands (Modem interface) */
|
/* Load supported bands (Modem interface) */
|
||||||
|
|
||||||
static GArray *
|
static GArray *
|
||||||
load_supported_bands_finish (MMIfaceModem *self,
|
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
|
||||||
load_supported_bands (MMIfaceModem *self,
|
load_supported_bands (MMIfaceModem *self,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *result;
|
GTask *task;
|
||||||
GArray *bands;
|
GArray *bands;
|
||||||
|
|
||||||
result = g_simple_async_result_new (G_OBJECT (self),
|
task = g_task_new (self, NULL, callback, user_data);
|
||||||
callback,
|
|
||||||
user_data,
|
|
||||||
load_supported_bands);
|
|
||||||
|
|
||||||
/* We do assume that we already know if the modem is 2G-only, 3G-only or
|
/* We do assume that we already know if the modem is 2G-only, 3G-only or
|
||||||
* 2G+3G. This is checked quite before trying to load supported bands. */
|
* 2G+3G. This is checked quite before trying to load supported bands. */
|
||||||
@@ -603,11 +598,8 @@ load_supported_bands (MMIfaceModem *self,
|
|||||||
_g_array_insert_enum (bands, 3, MMModemBand, MM_MODEM_BAND_G850);
|
_g_array_insert_enum (bands, 3, MMModemBand, MM_MODEM_BAND_G850);
|
||||||
}
|
}
|
||||||
|
|
||||||
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