[PATCH 03/10] iface-modem: port mm_iface_modem_disable to use GTask

Ben Chan benchan at chromium.org
Fri Jun 30 09:23:40 UTC 2017


---
 src/mm-iface-modem.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index d718e914..28f3bf01 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -3474,10 +3474,10 @@ mm_iface_modem_set_power_state (MMIfaceModem *self,
 
 gboolean
 mm_iface_modem_disable_finish (MMIfaceModem *self,
-                              GAsyncResult *res,
-                              GError **error)
+                               GAsyncResult *res,
+                               GError **error)
 {
-    return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
+    return g_task_propagate_boolean (G_TASK (res), error);
 }
 
 void
@@ -3485,16 +3485,12 @@ mm_iface_modem_disable (MMIfaceModem *self,
                         GAsyncReadyCallback callback,
                         gpointer user_data)
 {
-    GSimpleAsyncResult *result;
+    GTask *task;
 
     /* Just complete, nothing to do */
-    result = g_simple_async_result_new (G_OBJECT (self),
-                                        callback,
-                                        user_data,
-                                        mm_iface_modem_disable);
-    g_simple_async_result_set_op_res_gboolean (result, TRUE);
-    g_simple_async_result_complete_in_idle (result);
-    g_object_unref (result);
+    task = g_task_new (self, NULL, callback, user_data);
+    g_task_return_boolean (task, TRUE);
+    g_object_unref (task);
 }
 
 /*****************************************************************************/
-- 
2.13.2



More information about the ModemManager-devel mailing list