[Telepathy-commits] [telepathy-glib/master] ExampleCallableMediaChannel: react to streams being removed or having direction changes
Simon McVittie
simon.mcvittie at collabora.co.uk
Thu Mar 12 10:16:04 PDT 2009
---
examples/cm/callable/media-channel.c | 37 ++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/examples/cm/callable/media-channel.c b/examples/cm/callable/media-channel.c
index 1fdd964..f3e9a32 100644
--- a/examples/cm/callable/media-channel.c
+++ b/examples/cm/callable/media-channel.c
@@ -746,6 +746,38 @@ error:
}
static void
+stream_removed_cb (ExampleCallableMediaStream *stream,
+ ExampleCallableMediaChannel *self)
+{
+ guint id;
+
+ g_object_get (stream,
+ "id", &id,
+ NULL);
+
+ g_signal_handlers_disconnect_matched (stream, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, self);
+ g_hash_table_remove (self->priv->streams, GUINT_TO_POINTER (id));
+ tp_svc_channel_type_streamed_media_emit_stream_removed (self, id);
+}
+
+static void
+stream_direction_changed_cb (ExampleCallableMediaStream *stream,
+ ExampleCallableMediaChannel *self)
+{
+ guint id, direction, pending;
+
+ g_object_get (stream,
+ "id", &id,
+ "direction", &direction,
+ "pending-send", &pending,
+ NULL);
+
+ tp_svc_channel_type_streamed_media_emit_stream_direction_changed (self, id,
+ direction, pending);
+}
+
+static void
media_request_streams (TpSvcChannelTypeStreamedMedia *iface,
guint contact_handle,
const GArray *media_types,
@@ -797,6 +829,11 @@ media_request_streams (TpSvcChannelTypeStreamedMedia *iface,
g_hash_table_insert (self->priv->streams, GUINT_TO_POINTER (id), stream);
+ g_signal_connect (stream, "removed", G_CALLBACK (stream_removed_cb),
+ self);
+ g_signal_connect (stream, "direction-changed",
+ G_CALLBACK (stream_direction_changed_cb), self);
+
g_object_get (stream,
"stream-info", &info,
NULL);
--
1.5.6.5
More information about the telepathy-commits
mailing list