2
* call-content.c - a content in a call.
4
* Copyright © 2007-2009 Collabora Ltd. <http://www.collabora.co.uk/>
5
* Copyright © 2007-2009 Nokia Corporation
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
#include "call-content.h"
24
#include <telepathy-glib/base-connection.h>
25
#include <telepathy-glib/telepathy-glib.h>
26
#include <telepathy-glib/svc-call.h>
28
G_DEFINE_TYPE (ExampleCallContent,
30
TP_TYPE_BASE_MEDIA_CALL_CONTENT)
32
struct _ExampleCallContentPrivate
34
ExampleCallStream *stream;
38
example_call_content_init (ExampleCallContent *self)
40
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
41
EXAMPLE_TYPE_CALL_CONTENT,
42
ExampleCallContentPrivate);
46
dispose (GObject *object)
48
ExampleCallContent *self = EXAMPLE_CALL_CONTENT (object);
50
g_clear_object (&self->priv->stream);
52
((GObjectClass *) example_call_content_parent_class)->dispose (object);
56
example_call_content_class_init (ExampleCallContentClass *klass)
58
GObjectClass *object_class = (GObjectClass *) klass;
60
g_type_class_add_private (klass,
61
sizeof (ExampleCallContentPrivate));
63
object_class->dispose = dispose;
67
example_call_content_get_stream (ExampleCallContent *self)
69
g_return_val_if_fail (EXAMPLE_IS_CALL_CONTENT (self), NULL);
71
return self->priv->stream;
75
example_call_content_add_stream (ExampleCallContent *self,
76
ExampleCallStream *stream)
78
g_return_if_fail (EXAMPLE_IS_CALL_CONTENT (self));
79
g_return_if_fail (EXAMPLE_IS_CALL_STREAM (stream));
80
g_return_if_fail (self->priv->stream == NULL);
82
self->priv->stream = g_object_ref (stream);
84
tp_base_call_content_add_stream ((TpBaseCallContent *) self,
85
(TpBaseCallStream *) stream);
89
example_call_content_remove_stream (ExampleCallContent *self)
91
TpBaseCallStream *stream;
93
g_return_if_fail (EXAMPLE_IS_CALL_CONTENT (self));
94
g_return_if_fail (self->priv->stream != NULL);
96
stream = (TpBaseCallStream *) self->priv->stream;
97
self->priv->stream = NULL;
99
tp_base_call_content_remove_stream ((TpBaseCallContent *) self, stream,
100
0, TP_CALL_STATE_CHANGE_REASON_UNKNOWN, "", "");
102
g_object_unref (stream);