Sat, 29 Dec 2007 16:54:15 +0000
Fix the prplinfo structs and get rid of some compile warnings.
| 19883 | 1 | /** |
| 19889 | 2 | * @file mediamanager.c Media Manager API |
| 19883 | 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 | ||
| 19889 | 26 | #include "internal.h" |
| 27 | ||
| 19883 | 28 | #include "connection.h" |
| 29 | #include "mediamanager.h" | |
| 30 | #include "media.h" | |
| 31 | ||
| 32 | #ifdef USE_FARSIGHT | |
| 33 | ||
| 34 | #include <farsight/farsight.h> | |
| 35 | ||
| 36 | struct _PurpleMediaManagerPrivate | |
| 37 | { | |
| 38 | GList *medias; | |
| 39 | }; | |
| 40 | ||
| 41 | #define PURPLE_MEDIA_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManagerPrivate)) | |
| 42 | ||
| 43 | static void purple_media_manager_class_init (PurpleMediaManagerClass *klass); | |
| 44 | static void purple_media_manager_init (PurpleMediaManager *media); | |
| 45 | static void purple_media_manager_finalize (GObject *object); | |
| 46 | ||
| 47 | static GObjectClass *parent_class = NULL; | |
| 48 | ||
| 49 | ||
| 50 | ||
| 51 | enum { | |
|
19885
593613a22e57
You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents:
19884
diff
changeset
|
52 | INIT_MEDIA, |
| 19883 | 53 | LAST_SIGNAL |
| 54 | }; | |
| 55 | static guint purple_media_manager_signals[LAST_SIGNAL] = {0}; | |
| 56 | ||
| 57 | enum { | |
| 58 | PROP_0, | |
| 59 | PROP_FARSIGHT_SESSION, | |
| 60 | PROP_NAME, | |
| 61 | PROP_CONNECTION, | |
| 62 | PROP_MIC_ELEMENT, | |
| 63 | PROP_SPEAKER_ELEMENT, | |
| 64 | }; | |
| 65 | ||
| 66 | GType | |
| 67 | purple_media_manager_get_type() | |
| 68 | { | |
| 69 | static GType type = 0; | |
| 70 | ||
| 71 | if (type == 0) { | |
| 72 | static const GTypeInfo info = { | |
| 73 | sizeof(PurpleMediaManagerClass), | |
| 74 | NULL, | |
| 75 | NULL, | |
| 76 | (GClassInitFunc) purple_media_manager_class_init, | |
| 77 | NULL, | |
| 78 | NULL, | |
| 79 | sizeof(PurpleMediaManager), | |
| 80 | 0, | |
|
22071
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19889
diff
changeset
|
81 | (GInstanceInitFunc) purple_media_manager_init, |
|
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19889
diff
changeset
|
82 | NULL |
| 19883 | 83 | }; |
| 84 | type = g_type_register_static(G_TYPE_OBJECT, "PurpleMediaManager", &info, 0); | |
| 85 | } | |
| 86 | return type; | |
| 87 | } | |
| 88 | ||
| 89 | ||
| 90 | static void | |
| 91 | purple_media_manager_class_init (PurpleMediaManagerClass *klass) | |
| 92 | { | |
| 93 | GObjectClass *gobject_class = (GObjectClass*)klass; | |
| 94 | parent_class = g_type_class_peek_parent(klass); | |
| 95 | ||
| 96 | gobject_class->finalize = purple_media_manager_finalize; | |
| 97 | ||
|
19885
593613a22e57
You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents:
19884
diff
changeset
|
98 | purple_media_manager_signals[INIT_MEDIA] = g_signal_new ("init-media", |
| 19883 | 99 | G_TYPE_FROM_CLASS (klass), |
| 100 | G_SIGNAL_RUN_LAST, | |
| 101 | 0, NULL, NULL, | |
| 102 | g_cclosure_marshal_VOID__OBJECT, | |
| 103 | G_TYPE_NONE, 1, PURPLE_TYPE_MEDIA); | |
| 19884 | 104 | g_type_class_add_private(klass, sizeof(PurpleMediaManagerPrivate)); |
| 19883 | 105 | } |
| 106 | ||
| 107 | static void | |
| 108 | purple_media_manager_init (PurpleMediaManager *media) | |
| 109 | { | |
| 110 | media->priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media); | |
| 19884 | 111 | media->priv->medias = NULL; |
| 19883 | 112 | } |
| 113 | ||
| 114 | static void | |
| 115 | purple_media_manager_finalize (GObject *media) | |
| 116 | { | |
| 117 | parent_class->finalize(media); | |
| 118 | } | |
| 119 | ||
| 120 | PurpleMediaManager * | |
| 121 | purple_media_manager_get() | |
| 122 | { | |
| 123 | static PurpleMediaManager *manager = NULL; | |
| 124 | ||
| 125 | if (manager == NULL) | |
| 126 | manager = PURPLE_MEDIA_MANAGER(g_object_new(purple_media_manager_get_type(), NULL)); | |
| 127 | return manager; | |
| 128 | } | |
| 129 | ||
| 130 | PurpleMedia* | |
| 131 | purple_media_manager_create_media(PurpleMediaManager *manager, | |
| 132 | PurpleConnection *gc, | |
|
19885
593613a22e57
You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents:
19884
diff
changeset
|
133 | const char *screenname, |
|
593613a22e57
You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents:
19884
diff
changeset
|
134 | FarsightStream *audio_stream, |
|
593613a22e57
You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents:
19884
diff
changeset
|
135 | FarsightStream *video_stream) |
| 19883 | 136 | { |
| 137 | PurpleMedia *media = PURPLE_MEDIA(g_object_new(purple_media_get_type(), | |
| 19884 | 138 | "screenname", screenname, |
|
19885
593613a22e57
You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents:
19884
diff
changeset
|
139 | "connection", gc, |
|
593613a22e57
You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents:
19884
diff
changeset
|
140 | "audio-stream", audio_stream, |
|
593613a22e57
You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents:
19884
diff
changeset
|
141 | "video-stream", video_stream, NULL)); |
| 19883 | 142 | manager->priv->medias = g_list_append(manager->priv->medias, media); |
|
19885
593613a22e57
You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@pidgin.im>
parents:
19884
diff
changeset
|
143 | g_signal_emit(manager, purple_media_manager_signals[INIT_MEDIA], 0, media); |
| 19883 | 144 | return media; |
| 145 | } | |
| 146 | ||
| 147 | #endif /* USE_FARSIGHT */ |