x22x: port load_supported_modes to use GTask
This commit is contained in:

committed by
Aleksander Morgado

parent
fea6835592
commit
4e3a6b4eb5
@@ -46,16 +46,13 @@ load_supported_modes_finish (MMIfaceModem *self,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
return g_task_propagate_pointer (G_TASK (res), error);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return g_array_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parent_load_supported_modes_ready (MMIfaceModem *self,
|
parent_load_supported_modes_ready (MMIfaceModem *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GSimpleAsyncResult *simple)
|
GTask *task)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GArray *all;
|
GArray *all;
|
||||||
@@ -65,9 +62,8 @@ parent_load_supported_modes_ready (MMIfaceModem *self,
|
|||||||
|
|
||||||
all = iface_modem_parent->load_supported_modes_finish (self, res, &error);
|
all = iface_modem_parent->load_supported_modes_finish (self, res, &error);
|
||||||
if (!all) {
|
if (!all) {
|
||||||
g_simple_async_result_take_error (simple, error);
|
g_task_return_error (task, error);
|
||||||
g_simple_async_result_complete (simple);
|
g_object_unref (task);
|
||||||
g_object_unref (simple);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Build list of combinations for 3GPP devices */
|
/* Build list of combinations for 3GPP devices */
|
||||||
@@ -91,9 +87,8 @@ parent_load_supported_modes_ready (MMIfaceModem *self,
|
|||||||
g_array_unref (all);
|
g_array_unref (all);
|
||||||
g_array_unref (combinations);
|
g_array_unref (combinations);
|
||||||
|
|
||||||
g_simple_async_result_set_op_res_gpointer (simple, filtered, (GDestroyNotify) g_array_unref);
|
g_task_return_pointer (task, filtered, (GDestroyNotify) g_array_unref);
|
||||||
g_simple_async_result_complete (simple);
|
g_object_unref (task);
|
||||||
g_object_unref (simple);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -105,10 +100,7 @@ load_supported_modes (MMIfaceModem *self,
|
|||||||
iface_modem_parent->load_supported_modes (
|
iface_modem_parent->load_supported_modes (
|
||||||
MM_IFACE_MODEM (self),
|
MM_IFACE_MODEM (self),
|
||||||
(GAsyncReadyCallback)parent_load_supported_modes_ready,
|
(GAsyncReadyCallback)parent_load_supported_modes_ready,
|
||||||
g_simple_async_result_new (G_OBJECT (self),
|
g_task_new (self, NULL, callback, user_data));
|
||||||
callback,
|
|
||||||
user_data,
|
|
||||||
load_supported_modes));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
Reference in New Issue
Block a user