diff options
Diffstat (limited to 'libmm-glib/mm-modem-messaging.c')
-rw-r--r-- | libmm-glib/mm-modem-messaging.c | 56 |
1 files changed, 17 insertions, 39 deletions
diff --git a/libmm-glib/mm-modem-messaging.c b/libmm-glib/mm-modem-messaging.c index 50c525c..fdf1497 100644 --- a/libmm-glib/mm-modem-messaging.c +++ b/libmm-glib/mm-modem-messaging.c @@ -236,7 +236,7 @@ sms_object_list_free (GList *list) static void list_sms_context_complete_and_free (ListSmsContext *ctx) { - g_simple_async_result_complete (ctx->result); + g_simple_async_result_complete_in_idle (ctx->result); g_strfreev (ctx->sms_paths); sms_object_list_free (ctx->sms_objects); @@ -255,7 +255,7 @@ list_sms_context_complete_and_free (ListSmsContext *ctx) * * Finishes an operation started with mm_modem_messaging_list(). * - * Returns: (element-type MM.Sms) (transfer full): A list of #MMSms objects, or #NULL if either not found or @error is set. The returned value should be freed with g_list_free_full() using g_object_unref() as #GDestroyNotify function. + * Returns: (element-type ModemManager.Sms) (transfer full): A list of #MMSms objects, or #NULL if either not found or @error is set. The returned value should be freed with g_list_free_full() using g_object_unref() as #GDestroyNotify function. */ GList * mm_modem_messaging_list_finish (MMModemMessaging *self, @@ -331,32 +331,6 @@ create_next_sms (ListSmsContext *ctx) NULL); } -static void -list_ready (MMModemMessaging *self, - GAsyncResult *res, - ListSmsContext *ctx) -{ - GError *error = NULL; - - mm_gdbus_modem_messaging_call_list_finish (MM_GDBUS_MODEM_MESSAGING (self), &ctx->sms_paths, res, &error); - if (error) { - g_simple_async_result_take_error (ctx->result, error); - list_sms_context_complete_and_free (ctx); - return; - } - - /* If no SMS, just end here. */ - if (!ctx->sms_paths || !ctx->sms_paths[0]) { - g_simple_async_result_set_op_res_gpointer (ctx->result, NULL, NULL); - list_sms_context_complete_and_free (ctx); - return; - } - - /* Got list of paths. If at least one found, start creating objects for each */ - ctx->i = 0; - create_next_sms (ctx); -} - /** * mm_modem_messaging_list: * @self: A #MMModemMessaging. @@ -390,10 +364,18 @@ mm_modem_messaging_list (MMModemMessaging *self, if (cancellable) ctx->cancellable = g_object_ref (cancellable); - mm_gdbus_modem_messaging_call_list (MM_GDBUS_MODEM_MESSAGING (self), - cancellable, - (GAsyncReadyCallback)list_ready, - ctx); + ctx->sms_paths = mm_gdbus_modem_messaging_dup_messages (MM_GDBUS_MODEM_MESSAGING (self)); + + /* If no SMS, just end here. */ + if (!ctx->sms_paths || !ctx->sms_paths[0]) { + g_simple_async_result_set_op_res_gpointer (ctx->result, NULL, NULL); + list_sms_context_complete_and_free (ctx); + return; + } + + /* Got list of paths. If at least one found, start creating objects for each */ + ctx->i = 0; + create_next_sms (ctx); } /** @@ -407,7 +389,7 @@ mm_modem_messaging_list (MMModemMessaging *self, * The calling thread is blocked until a reply is received. See mm_modem_messaging_list() * for the asynchronous version of this method. * - * Returns: (element-type MM.Sms) (transfer full): A list of #MMSms objects, or #NULL if either not found or @error is set. The returned value should be freed with g_list_free_full() using g_object_unref() as #GDestroyNotify function. + * Returns: (element-type MMSms) (transfer full): A list of #MMSms objects, or #NULL if either not found or @error is set. The returned value should be freed with g_list_free_full() using g_object_unref() as #GDestroyNotify function. */ GList * mm_modem_messaging_list_sync (MMModemMessaging *self, @@ -420,11 +402,7 @@ mm_modem_messaging_list_sync (MMModemMessaging *self, g_return_val_if_fail (MM_IS_MODEM_MESSAGING (self), NULL); - if (!mm_gdbus_modem_messaging_call_list_sync (MM_GDBUS_MODEM_MESSAGING (self), - &sms_paths, - cancellable, - error)) - return NULL; + sms_paths = mm_gdbus_modem_messaging_dup_messages (MM_GDBUS_MODEM_MESSAGING (self)); /* Only non-empty lists are returned */ if (!sms_paths) @@ -598,7 +576,7 @@ mm_modem_messaging_create (MMModemMessaging *self, } /** - * mm_modem_create_sms_sync: + * mm_modem_messaging_create_sync: * @self: A #MMModemMessaging. * @properties: A ##MMSmsProperties object with the properties to use. * @cancellable: (allow-none): A #GCancellable or %NULL. |