hso: port location_load_capabilities to use GTask
This commit is contained in:

committed by
Aleksander Morgado

parent
616cfa9959
commit
227eae3f31
@@ -340,26 +340,29 @@ location_load_capabilities_finish (MMIfaceModemLocation *self,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
GError *inner_error = NULL;
|
||||||
return MM_MODEM_LOCATION_SOURCE_NONE;
|
gssize value;
|
||||||
|
|
||||||
return (MMModemLocationSource) GPOINTER_TO_UINT (g_simple_async_result_get_op_res_gpointer (
|
value = g_task_propagate_int (G_TASK (res), &inner_error);
|
||||||
G_SIMPLE_ASYNC_RESULT (res)));
|
if (inner_error) {
|
||||||
|
g_propagate_error (error, inner_error);
|
||||||
|
return MM_MODEM_LOCATION_SOURCE_NONE;
|
||||||
|
}
|
||||||
|
return (MMModemLocationSource)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parent_load_capabilities_ready (MMIfaceModemLocation *self,
|
parent_load_capabilities_ready (MMIfaceModemLocation *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GSimpleAsyncResult *simple)
|
GTask *task)
|
||||||
{
|
{
|
||||||
MMModemLocationSource sources;
|
MMModemLocationSource sources;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
sources = iface_modem_location_parent->load_capabilities_finish (self, res, &error);
|
sources = iface_modem_location_parent->load_capabilities_finish (self, res, &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,11 +386,8 @@ parent_load_capabilities_ready (MMIfaceModemLocation *self,
|
|||||||
MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED);
|
MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED);
|
||||||
|
|
||||||
/* So we're done, complete */
|
/* So we're done, complete */
|
||||||
g_simple_async_result_set_op_res_gpointer (simple,
|
g_task_return_int (task, sources);
|
||||||
GUINT_TO_POINTER (sources),
|
g_object_unref (task);
|
||||||
NULL);
|
|
||||||
g_simple_async_result_complete (simple);
|
|
||||||
g_object_unref (simple);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -395,18 +395,11 @@ location_load_capabilities (MMIfaceModemLocation *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,
|
|
||||||
location_load_capabilities);
|
|
||||||
|
|
||||||
/* Chain up parent's setup */
|
/* Chain up parent's setup */
|
||||||
iface_modem_location_parent->load_capabilities (
|
iface_modem_location_parent->load_capabilities (
|
||||||
self,
|
self,
|
||||||
(GAsyncReadyCallback)parent_load_capabilities_ready,
|
(GAsyncReadyCallback)parent_load_capabilities_ready,
|
||||||
result);
|
g_task_new (self, NULL, callback, user_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
Reference in New Issue
Block a user