comparison libpurple/media.c @ 25546:5150d8b576be

Missed files
author Sean Egan <seanegan@gmail.com>
date Wed, 05 Sep 2007 00:48:34 +0000
parents
children 70cdff43ec76
comparison
equal deleted inserted replaced
25545:315151da0dc6 25546:5150d8b576be
1 /**
2 * @file media.c Account API
3 * @ingroup core
4 *
5 * purple
6 *
7 * Purple is the legal property of its developers, whose names are too numerous
8 * to list here. Please refer to the COPYRIGHT file distributed with this
9 * source distribution.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26 #include "connection.h"
27 #include "media.h"
28
29 #ifdef USE_FARSIGHT
30
31 #include <farsight/farsight.h>
32
33 struct _PurpleMediaPrivate
34 {
35 FarsightSession *farsight_session;
36
37 char *name;
38 PurpleConnection *connection;
39 };
40
41 #define PURPLE_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA, PurpleMediaPrivate))
42
43 static void purple_media_class_init (PurpleMediaClass *klass);
44 static void purple_media_init (PurpleMedia *media);
45 static void purple_media_finalize (GObject *object);
46 static void purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
47 static void purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
48
49 static GObjectClass *parent_class = NULL;
50
51
52
53 enum {
54 STATE_CHANGE,
55 LAST_SIGNAL
56 };
57 static guint purple_media_signals[LAST_SIGNAL] = {0};
58
59 enum {
60 PROP_0,
61 PROP_FARSIGHT_SESSION,
62 PROP_NAME,
63 PROP_CONNECTION,
64 PROP_MIC_ELEMENT,
65 PROP_SPEAKER_ELEMENT,
66 };
67
68 GType
69 purple_media_get_type()
70 {
71 static GType type = 0;
72
73 if (type == 0) {
74 static const GTypeInfo info = {
75 sizeof(PurpleMediaClass),
76 NULL,
77 NULL,
78 (GClassInitFunc) purple_media_class_init,
79 NULL,
80 NULL,
81 sizeof(PurpleMedia),
82 0,
83 (GInstanceInitFunc) purple_media_init
84 };
85 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMedia", &info, 0);
86 }
87 return type;
88 }
89
90
91 static void
92 purple_media_class_init (PurpleMediaClass *klass)
93 {
94 GObjectClass *gobject_class = (GObjectClass*)klass;
95 parent_class = g_type_class_peek_parent(klass);
96
97 gobject_class->finalize = purple_media_finalize;
98 gobject_class->set_property = purple_media_set_property;
99 gobject_class->get_property = purple_media_get_property;
100
101 g_object_class_install_property(gobject_class, PROP_FARSIGHT_SESSION,
102 g_param_spec_object("farsight-session",
103 "Farsight session",
104 "The FarsightSession associated with this media.",
105 FARSIGHT_TYPE_SESSION,
106 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READABLE));
107
108 g_object_class_install_property(gobject_class, PROP_NAME,
109 g_param_spec_string("screenname",
110 "Screenname",
111 "The screenname of the remote user",
112 NULL,
113 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READABLE));
114
115 g_object_class_install_property(gobject_class, PROP_CONNECTION,
116 g_param_spec_pointer("connection",
117 "Connection",
118 "The PurpleConnection associated with this session",
119 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READABLE));
120 }
121
122 static void
123 purple_media_init (PurpleMedia *media)
124 {
125 media->priv = PURPLE_MEDIA_GET_PRIVATE(media);
126 }
127
128 static void
129 purple_media_finalize (GObject *media)
130 {
131 parent_class->finalize(media);
132 }
133
134 static void
135 purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
136 {
137 PurpleMedia *media;
138 g_return_if_fail(PURPLE_IS_MEDIA(object));
139
140 media = PURPLE_MEDIA(object);
141
142 switch (prop_id) {
143 case PROP_FARSIGHT_SESSION:
144 media->priv->farsight_session = g_value_get_object(value);
145 break;
146 case PROP_NAME:
147 media->priv->name = g_value_get_string(value);
148 break;
149 case PROP_CONNECTION:
150 media->priv->connection = g_value_get_pointer(value);
151 break;
152 default:
153 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
154 break;
155 }
156 }
157
158 static void
159 purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
160 {
161 PurpleMedia *media;
162 g_return_if_fail(PURPLE_IS_MEDIA(object));
163
164 media = PURPLE_MEDIA(object);
165
166 switch (prop_id) {
167 case PROP_FARSIGHT_SESSION:
168 g_value_set_object(value, media->priv->farsight_session);
169 break;
170 case PROP_NAME:
171 g_value_set_string(value, media->priv->name);
172 break;
173 case PROP_CONNECTION:
174 g_value_set_pointer(value, media->priv->connection);
175 break;
176 default:
177 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
178 break;
179 }
180
181 }
182
183 #endif /* USE_FARSIGHT */