aboutsummaryrefslogtreecommitdiff
path: root/libmm-glib
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-02-09 14:23:03 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:15:02 +0100
commitcee94ef536fa759b5fbd6fcbd20860ba1a32f3ce (patch)
tree08aee9a84ff435f2266cc87d275626d07683b3a6 /libmm-glib
parent556efdd37874f726b7ad6b6a3cf32fffad7972d2 (diff)
libmm-glib: new method to store SMS messages
Diffstat (limited to 'libmm-glib')
-rw-r--r--libmm-glib/mm-sms.c73
-rw-r--r--libmm-glib/mm-sms.h11
2 files changed, 84 insertions, 0 deletions
diff --git a/libmm-glib/mm-sms.c b/libmm-glib/mm-sms.c
index 24774f70..4340b1e6 100644
--- a/libmm-glib/mm-sms.c
+++ b/libmm-glib/mm-sms.c
@@ -328,6 +328,79 @@ mm_sms_send_sync (MMSms *self,
error);
}
+/**
+ * mm_sms_store:
+ * @self: A #MMSms.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
+ * @user_data: User data to pass to @callback.
+ *
+ * TODO
+ *
+ * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
+ * You can then call mm_sms_store_finish() to get the result of the operation.
+ *
+ * See mm_sms_store_sync() for the synchronous, blocking version of this method.
+ */
+void
+mm_sms_store (MMSms *self,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_return_if_fail (MM_GDBUS_IS_SMS (self));
+
+ mm_gdbus_sms_call_store (self,
+ cancellable,
+ callback,
+ user_data);
+}
+
+/**
+ * mm_sms_store_finish:
+ * @self: A #MMSms.
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_sms_store().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes an operation started with mm_sms_store().
+ *
+ * Returns: (skip): %TRUE if the operation succeded, %FALSE if @error is set.
+ */
+gboolean
+mm_sms_store_finish (MMSms *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SMS (self), FALSE);
+
+ return mm_gdbus_sms_call_store_finish (self, res, error);
+}
+
+/**
+ * mm_sms_store_sync:
+ * @self: A #MMSms.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * TODO
+ *
+ * The calling thread is blocked until a reply is received.
+ * See mm_sms_store() for the asynchronous version of this method.
+ *
+ * Returns: (skip): %TRUE if the operation succeded, %FALSE if @error is set.
+ */
+gboolean
+mm_sms_store_sync (MMSms *self,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_return_val_if_fail (MM_GDBUS_IS_SMS (self), FALSE);
+
+ return mm_gdbus_sms_call_store_sync (self,
+ cancellable,
+ error);
+}
+
void
mm_sms_new (GDBusConnection *connection,
const gchar *path,
diff --git a/libmm-glib/mm-sms.h b/libmm-glib/mm-sms.h
index 1060f58a..b919fec1 100644
--- a/libmm-glib/mm-sms.h
+++ b/libmm-glib/mm-sms.h
@@ -62,6 +62,17 @@ gboolean mm_sms_send_sync (MMSms *self,
GCancellable *cancellable,
GError **error);
+void mm_sms_store (MMSms *self,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean mm_sms_store_finish (MMSms *self,
+ GAsyncResult *res,
+ GError **error);
+gboolean mm_sms_store_sync (MMSms *self,
+ GCancellable *cancellable,
+ GError **error);
+
const gchar *mm_sms_get_text (MMSms *self);
gchar *mm_sms_dup_text (MMSms *self);
const gchar *mm_sms_get_number (MMSms *self);