[empathy/gnome-2-34: 5/7] Monitor the call state and close the channel when it ends



commit b159d5e210b2ffd38d6c0d59f5758e58e7054969
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Mon Mar 14 12:14:13 2011 +0000

    Monitor the call state and close the channel when it ends

 src/empathy-call-handler.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/empathy-call-handler.c b/src/empathy-call-handler.c
index eeb13ba..7524057 100644
--- a/src/empathy-call-handler.c
+++ b/src/empathy-call-handler.c
@@ -167,6 +167,18 @@ on_get_contacts_cb (TpConnection *connection,
 }
 
 static void
+on_call_state_changed_cb (TpyCallChannel *call,
+  TpyCallState state,
+  TpyCallFlags flags,
+   const GValueArray *call_state_reason,
+  GHashTable *call_state_details,
+  EmpathyCallHandler *handler)
+{
+  if (state == TPY_CALL_STATE_ENDED)
+    tp_channel_close_async (TP_CHANNEL (call), NULL, NULL);
+}
+
+static void
 on_members_changed_cb (TpyCallChannel *call,
     GHashTable *members,
     EmpathyCallHandler *self)
@@ -233,7 +245,12 @@ empathy_call_handler_set_property (GObject *object,
         priv->members = g_value_get_boxed (value);
         break;
       case PROP_CALL_CHANNEL:
+        g_return_if_fail (priv->call == NULL);
+
         priv->call = g_value_dup_object (value);
+
+        tp_g_signal_connect_object (priv->call, "state-changed",
+          G_CALLBACK (on_call_state_changed_cb), object, 0);
         break;
       case PROP_INITIAL_AUDIO:
         priv->initial_audio = g_value_get_boolean (value);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]