Mercurial > pidgin.yaz
comparison libpurple/mediamanager.c @ 25546:5150d8b576be
Missed files
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Wed, 05 Sep 2007 00:48:34 +0000 |
parents | |
children | 2fda71133800 |
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 "mediamanager.h" | |
28 #include "media.h" | |
29 | |
30 #ifdef USE_FARSIGHT | |
31 | |
32 #include <farsight/farsight.h> | |
33 | |
34 struct _PurpleMediaManagerPrivate | |
35 { | |
36 GList *medias; | |
37 }; | |
38 | |
39 #define PURPLE_MEDIA_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManagerPrivate)) | |
40 | |
41 static void purple_media_manager_class_init (PurpleMediaManagerClass *klass); | |
42 static void purple_media_manager_init (PurpleMediaManager *media); | |
43 static void purple_media_manager_finalize (GObject *object); | |
44 | |
45 static GObjectClass *parent_class = NULL; | |
46 | |
47 | |
48 | |
49 enum { | |
50 NEW_MEDIA, | |
51 LAST_SIGNAL | |
52 }; | |
53 static guint purple_media_manager_signals[LAST_SIGNAL] = {0}; | |
54 | |
55 enum { | |
56 PROP_0, | |
57 PROP_FARSIGHT_SESSION, | |
58 PROP_NAME, | |
59 PROP_CONNECTION, | |
60 PROP_MIC_ELEMENT, | |
61 PROP_SPEAKER_ELEMENT, | |
62 }; | |
63 | |
64 GType | |
65 purple_media_manager_get_type() | |
66 { | |
67 static GType type = 0; | |
68 | |
69 if (type == 0) { | |
70 static const GTypeInfo info = { | |
71 sizeof(PurpleMediaManagerClass), | |
72 NULL, | |
73 NULL, | |
74 (GClassInitFunc) purple_media_manager_class_init, | |
75 NULL, | |
76 NULL, | |
77 sizeof(PurpleMediaManager), | |
78 0, | |
79 (GInstanceInitFunc) purple_media_manager_init | |
80 }; | |
81 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMediaManager", &info, 0); | |
82 } | |
83 return type; | |
84 } | |
85 | |
86 | |
87 static void | |
88 purple_media_manager_class_init (PurpleMediaManagerClass *klass) | |
89 { | |
90 GObjectClass *gobject_class = (GObjectClass*)klass; | |
91 parent_class = g_type_class_peek_parent(klass); | |
92 | |
93 gobject_class->finalize = purple_media_manager_finalize; | |
94 | |
95 purple_media_manager_signals[NEW_MEDIA] = g_signal_new ("new-media", | |
96 G_TYPE_FROM_CLASS (klass), | |
97 G_SIGNAL_RUN_LAST, | |
98 0, NULL, NULL, | |
99 g_cclosure_marshal_VOID__OBJECT, | |
100 G_TYPE_NONE, 1, PURPLE_TYPE_MEDIA); | |
101 } | |
102 | |
103 static void | |
104 purple_media_manager_init (PurpleMediaManager *media) | |
105 { | |
106 media->priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media); | |
107 } | |
108 | |
109 static void | |
110 purple_media_manager_finalize (GObject *media) | |
111 { | |
112 parent_class->finalize(media); | |
113 } | |
114 | |
115 PurpleMediaManager * | |
116 purple_media_manager_get() | |
117 { | |
118 static PurpleMediaManager *manager = NULL; | |
119 | |
120 if (manager == NULL) | |
121 manager = PURPLE_MEDIA_MANAGER(g_object_new(purple_media_manager_get_type(), NULL)); | |
122 return manager; | |
123 } | |
124 | |
125 PurpleMedia* | |
126 purple_media_manager_create_media(PurpleMediaManager *manager, | |
127 PurpleConnection *gc, | |
128 const char *screenname) | |
129 { | |
130 PurpleMedia *media = PURPLE_MEDIA(g_object_new(purple_media_get_type(), | |
131 PROP_NAME, screenname, | |
132 PROP_CONNECTION, gc, NULL)); | |
133 manager->priv->medias = g_list_append(manager->priv->medias, media); | |
134 g_signal_emit(manager, purple_media_manager_signals[NEW_MEDIA], 1, media); | |
135 return media; | |
136 } | |
137 | |
138 #endif /* USE_FARSIGHT */ |