icera: port modem_load_current_bands to use GTask
This commit is contained in:

committed by
Aleksander Morgado

parent
f168ffd032
commit
aa2cd2288a
@@ -1376,17 +1376,13 @@ modem_load_current_bands_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
||||
return NULL;
|
||||
|
||||
return (GArray *) g_array_ref (g_simple_async_result_get_op_res_gpointer (
|
||||
G_SIMPLE_ASYNC_RESULT (res)));
|
||||
return g_task_propagate_pointer (G_TASK (res), error);
|
||||
}
|
||||
|
||||
static void
|
||||
load_current_bands_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GSimpleAsyncResult *operation_result)
|
||||
GTask *task)
|
||||
{
|
||||
GArray *bands;
|
||||
const gchar *response;
|
||||
@@ -1397,9 +1393,7 @@ load_current_bands_ready (MMIfaceModem *self,
|
||||
response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
|
||||
if (!response) {
|
||||
mm_dbg ("Couldn't query current bands: '%s'", error->message);
|
||||
g_simple_async_result_take_error (operation_result, error);
|
||||
g_simple_async_result_complete (operation_result);
|
||||
g_object_unref (operation_result);
|
||||
g_task_return_error (task, error);
|
||||
} else {
|
||||
/* Parse bands from Icera response into MM band numbers */
|
||||
parsed = parse_bands (response, &len);
|
||||
@@ -1412,12 +1406,9 @@ load_current_bands_ready (MMIfaceModem *self,
|
||||
}
|
||||
g_slist_free_full (parsed, (GDestroyNotify) band_free);
|
||||
|
||||
g_simple_async_result_set_op_res_gpointer (operation_result,
|
||||
bands,
|
||||
(GDestroyNotify)g_array_unref);
|
||||
g_simple_async_result_complete (operation_result);
|
||||
g_object_unref (operation_result);
|
||||
g_task_return_pointer (task, bands, (GDestroyNotify)g_array_unref);
|
||||
}
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1431,10 +1422,7 @@ modem_load_current_bands (MMIfaceModem *self,
|
||||
3,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback)load_current_bands_ready,
|
||||
g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
modem_load_current_bands));
|
||||
g_task_new (self, NULL, callback, user_data));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
Reference in New Issue
Block a user