aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-09-07 19:21:22 +0200
committerAleksander Morgado <aleksander@aleksander.es>2017-09-07 19:28:23 +0200
commite2b3b87674236cf5f4e40eaeb43c766903f00909 (patch)
tree8e0281eea0e8e5f35fecfa53be09e2d53b23947f /plugins
parentbb5a950102d146d8d89c3b3916c21d6471811f5c (diff)
wavecom: port load_supported_bands to use GTask
Diffstat (limited to 'plugins')
-rw-r--r--plugins/wavecom/mm-broadband-modem-wavecom.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/plugins/wavecom/mm-broadband-modem-wavecom.c b/plugins/wavecom/mm-broadband-modem-wavecom.c
index 2e02812a..d029e848 100644
--- a/plugins/wavecom/mm-broadband-modem-wavecom.c
+++ b/plugins/wavecom/mm-broadband-modem-wavecom.c
@@ -551,27 +551,22 @@ set_current_modes (MMIfaceModem *self,
/* Load supported bands (Modem interface) */
static GArray *
-load_supported_bands_finish (MMIfaceModem *self,
- GAsyncResult *res,
- GError **error)
+load_supported_bands_finish (MMIfaceModem *self,
+ GAsyncResult *res,
+ GError **error)
{
- /* Never fails */
- 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_supported_bands (MMIfaceModem *self,
- GAsyncReadyCallback callback,
- gpointer user_data)
+load_supported_bands (MMIfaceModem *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
- GSimpleAsyncResult *result;
+ GTask *task;
GArray *bands;
- result = g_simple_async_result_new (G_OBJECT (self),
- callback,
- user_data,
- load_supported_bands);
+ task = g_task_new (self, NULL, callback, user_data);
/* 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. */
@@ -603,11 +598,8 @@ load_supported_bands (MMIfaceModem *self,
_g_array_insert_enum (bands, 3, MMModemBand, MM_MODEM_BAND_G850);
}
- g_simple_async_result_set_op_res_gpointer (result,
- bands,
- (GDestroyNotify)g_array_unref);
- g_simple_async_result_complete_in_idle (result);
- g_object_unref (result);
+ g_task_return_pointer (task, bands, (GDestroyNotify) g_array_unref);
+ g_object_unref (task);
}
/*****************************************************************************/