[telepathy-doc/master] Initial work to track the Connection

Danielle Madeley danielle.madeley at collabora.co.uk
Wed Sep 23 06:26:15 PDT 2009


---
 docs/examples/gtk_presence_app/presence-widget.c |   27 ++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/docs/examples/gtk_presence_app/presence-widget.c b/docs/examples/gtk_presence_app/presence-widget.c
index 15bc8fa..9b6d4ef 100644
--- a/docs/examples/gtk_presence_app/presence-widget.c
+++ b/docs/examples/gtk_presence_app/presence-widget.c
@@ -154,6 +154,27 @@ _notify_status_message (PresenceWidget *self,
 }
 
 static void
+_status_changed (PresenceWidget *self,
+                 guint           old_status,
+                 guint           new_status,
+                 guint           reason,
+                 TpAccount      *account)
+{
+  TpConnection *conn = tp_account_get_connection (account);
+
+  g_print ("conn = %p\n", conn);
+
+  if (conn == NULL) return;
+  else if (new_status == TP_CONNECTION_STATUS_CONNECTED ||
+           new_status == TP_CONNECTION_STATUS_DISCONNECTED)
+    {
+      g_print ("requesting Statuses\n");
+    }
+
+  g_print ("end\n");
+}
+
+static void
 _account_removed (PresenceWidget *self,
                   TpAccount      *account)
 {
@@ -175,6 +196,8 @@ presence_widget_constructed (GObject *self)
   g_signal_connect_swapped (priv->account, "notify::status-message",
       G_CALLBACK (_notify_status_message), self);
 
+  g_signal_connect_swapped (priv->account, "status-changed",
+      G_CALLBACK (_status_changed), self);
   g_signal_connect_swapped (priv->account, "removed",
       G_CALLBACK (_account_removed), self);
 
@@ -182,6 +205,10 @@ presence_widget_constructed (GObject *self)
   _notify_display_name (PRESENCE_WIDGET (self), NULL, priv->account);
   _notify_presence (PRESENCE_WIDGET (self), NULL, priv->account);
   _notify_status_message (PRESENCE_WIDGET (self), NULL, priv->account);
+
+  _status_changed (PRESENCE_WIDGET (self), 0,
+      tp_account_get_connection_status (priv->account),
+      0, priv->account);
 }
 
 static void
-- 
1.5.6.5




More information about the telepathy-commits mailing list