aboutsummaryrefslogtreecommitdiff
path: root/libmm-glib
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2013-11-15 19:33:04 +0100
committerAleksander Morgado <aleksander@lanedo.com>2013-11-21 11:36:21 +0100
commitf7546ad82456afcd0bb176586d26c8bd7cec60cc (patch)
tree893223d779fd5538284840fc131e94c9043d589d /libmm-glib
parent7f442b777c6fe7fd71f4f9022121752dabad5cdd (diff)
introspection,api: new 'Messages' property in the Messaging interface
https://bugzilla.gnome.org/show_bug.cgi?id=712276
Diffstat (limited to 'libmm-glib')
-rw-r--r--libmm-glib/mm-modem-messaging.c50
1 files changed, 14 insertions, 36 deletions
diff --git a/libmm-glib/mm-modem-messaging.c b/libmm-glib/mm-modem-messaging.c
index e81c6bdb..fdf14978 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);
@@ -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);
}
/**
@@ -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)