simtech: port 3gpp_{setup|cleanup}_unsolicited_messages to GTask
This commit is contained in:
@@ -116,30 +116,28 @@ set_unsolicited_events_handlers (MMBroadbandModemSimtech *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
modem_3gpp_setup_cleanup_unsolicited_events_finish (MMIfaceModem3gpp *self,
|
modem_3gpp_setup_cleanup_unsolicited_events_finish (MMIfaceModem3gpp *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **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
|
static void
|
||||||
parent_setup_unsolicited_events_ready (MMIfaceModem3gpp *self,
|
parent_setup_unsolicited_events_ready (MMIfaceModem3gpp *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GSimpleAsyncResult *simple)
|
GTask *task)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
if (!iface_modem_3gpp_parent->setup_unsolicited_events_finish (self, res, &error))
|
if (!iface_modem_3gpp_parent->setup_unsolicited_events_finish (self, res, &error))
|
||||||
g_simple_async_result_take_error (simple, error);
|
g_task_return_error (task, error);
|
||||||
else {
|
else {
|
||||||
/* Our own setup now */
|
/* Our own setup now */
|
||||||
set_unsolicited_events_handlers (MM_BROADBAND_MODEM_SIMTECH (self), TRUE);
|
set_unsolicited_events_handlers (MM_BROADBAND_MODEM_SIMTECH (self), TRUE);
|
||||||
g_simple_async_result_set_op_res_gboolean (simple, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
}
|
}
|
||||||
|
g_object_unref (task);
|
||||||
g_simple_async_result_complete (simple);
|
|
||||||
g_object_unref (simple);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -147,47 +145,32 @@ modem_3gpp_setup_unsolicited_events (MMIfaceModem3gpp *self,
|
|||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *result;
|
|
||||||
|
|
||||||
result = g_simple_async_result_new (G_OBJECT (self),
|
|
||||||
callback,
|
|
||||||
user_data,
|
|
||||||
modem_3gpp_setup_unsolicited_events);
|
|
||||||
|
|
||||||
/* Chain up parent's setup */
|
/* Chain up parent's setup */
|
||||||
iface_modem_3gpp_parent->setup_unsolicited_events (
|
iface_modem_3gpp_parent->setup_unsolicited_events (
|
||||||
self,
|
self,
|
||||||
(GAsyncReadyCallback)parent_setup_unsolicited_events_ready,
|
(GAsyncReadyCallback)parent_setup_unsolicited_events_ready,
|
||||||
result);
|
g_task_new (self, NULL, callback, user_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parent_cleanup_unsolicited_events_ready (MMIfaceModem3gpp *self,
|
parent_cleanup_unsolicited_events_ready (MMIfaceModem3gpp *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GSimpleAsyncResult *simple)
|
GTask *task)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
if (!iface_modem_3gpp_parent->cleanup_unsolicited_events_finish (self, res, &error))
|
if (!iface_modem_3gpp_parent->cleanup_unsolicited_events_finish (self, res, &error))
|
||||||
g_simple_async_result_take_error (simple, error);
|
g_task_return_error (task, error);
|
||||||
else
|
else
|
||||||
g_simple_async_result_set_op_res_gboolean (simple, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
g_simple_async_result_complete (simple);
|
g_object_unref (task);
|
||||||
g_object_unref (simple);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
modem_3gpp_cleanup_unsolicited_events (MMIfaceModem3gpp *self,
|
modem_3gpp_cleanup_unsolicited_events (MMIfaceModem3gpp *self,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *result;
|
|
||||||
|
|
||||||
result = g_simple_async_result_new (G_OBJECT (self),
|
|
||||||
callback,
|
|
||||||
user_data,
|
|
||||||
modem_3gpp_cleanup_unsolicited_events);
|
|
||||||
|
|
||||||
/* Our own cleanup first */
|
/* Our own cleanup first */
|
||||||
set_unsolicited_events_handlers (MM_BROADBAND_MODEM_SIMTECH (self), FALSE);
|
set_unsolicited_events_handlers (MM_BROADBAND_MODEM_SIMTECH (self), FALSE);
|
||||||
|
|
||||||
@@ -195,7 +178,7 @@ modem_3gpp_cleanup_unsolicited_events (MMIfaceModem3gpp *self,
|
|||||||
iface_modem_3gpp_parent->cleanup_unsolicited_events (
|
iface_modem_3gpp_parent->cleanup_unsolicited_events (
|
||||||
self,
|
self,
|
||||||
(GAsyncReadyCallback)parent_cleanup_unsolicited_events_ready,
|
(GAsyncReadyCallback)parent_cleanup_unsolicited_events_ready,
|
||||||
result);
|
g_task_new (self, NULL, callback, user_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
Reference in New Issue
Block a user