[Telepathy-commits] [telepathy-glib/master] Add a getter for TpConnection's status and status-reason

Xavier Claessens xclaesse at gmail.com
Thu Aug 14 00:51:12 PDT 2008


---
 telepathy-glib/connection.c |   24 ++++++++++++++++++++++++
 telepathy-glib/connection.h |    4 ++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c
index 7d1a1e0..1341906 100644
--- a/telepathy-glib/connection.c
+++ b/telepathy-glib/connection.c
@@ -555,6 +555,30 @@ finally:
 }
 
 /**
+ * tp_connection_get_status:
+ * @self: a connection
+ * @reason: a TpConnectionStatusReason, or %NULL
+ *
+ * If @reason is not %NULL it is set to the reason why "status" changed to its
+ * current value, or %TP_CONNECTION_STATUS_REASON_NONE_SPECIFIED if unknown.
+ *
+ * Returns: This connection's status, or %TP_UNKNOWN_CONNECTION_STATUS if we
+ * don't know yet.
+ *
+ * Since: 0.7.UNRELEASED
+ */
+TpConnectionStatus
+tp_connection_get_status (TpConnection *self, TpConnectionStatusReason *reason)
+{
+  g_return_val_if_fail (TP_IS_CONNECTION (self), TP_UNKNOWN_CONNECTION_STATUS);
+
+  if (reason != NULL)
+      *reason = self->priv->status_reason;
+
+  return self->priv->status;
+}
+
+/**
  * tp_connection_run_until_ready:
  * @self: a connection
  * @connect: if %TRUE, call Connect() if it appears to be necessary;
diff --git a/telepathy-glib/connection.h b/telepathy-glib/connection.h
index eeefe09..c133523 100644
--- a/telepathy-glib/connection.h
+++ b/telepathy-glib/connection.h
@@ -22,6 +22,7 @@
 #ifndef __TP_CONNECTION_H__
 #define __TP_CONNECTION_H__
 
+#include <telepathy-glib/enums.h>
 #include <telepathy-glib/proxy.h>
 
 G_BEGIN_DECLS
@@ -71,6 +72,9 @@ GQuark tp_errors_disconnected_quark (void);
 TpConnection *tp_connection_new (TpDBusDaemon *dbus, const gchar *bus_name,
     const gchar *object_path, GError **error);
 
+TpConnectionStatus tp_connection_get_status (TpConnection *self,
+    TpConnectionStatusReason *reason);
+
 gboolean tp_connection_run_until_ready (TpConnection *self,
     gboolean connect, GError **error,
     GMainLoop **loop);
-- 
1.5.6.3




More information about the Telepathy-commits mailing list