Mercurial > pidgin.yaz
annotate pidgin/gtkmedia.c @ 32413:022a82d394c2
Fix build-breakage introduced by 9000557e8a6b7649547a10cfc0fe85dbb8ce661d.
(pidgin: 9000557e: Hide PurpleValue)
author | andrew.victor@mxit.com |
---|---|
date | Thu, 25 Aug 2011 07:36:54 +0000 |
parents | 6f503dcd843e |
children | f21518a8f3b8 fed510b05c32 |
rev | line source |
---|---|
25550 | 1 /** |
2 * @file media.c Account API | |
3 * @ingroup core | |
4 * | |
5 * Pidgin | |
6 * | |
7 * Pidgin 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 | |
28397
8c991e09efcb
Update various header copyrights thanks to licensecheck.
Paul Aurich <paul@darkrain42.org>
parents:
28349
diff
changeset
|
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
25550 | 24 */ |
25 | |
29028
f1437342cc0e
Include 'internal.h' before all other headers to make some non-gcc compilers happy.
Paul Aurich <paul@darkrain42.org>
parents:
28772
diff
changeset
|
26 #include "internal.h" |
25678
1fb16d784ccb
Listen to the media pipeline and display errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25674
diff
changeset
|
27 #include "debug.h" |
25550 | 28 #include "connection.h" |
29 #include "media.h" | |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
30 #include "mediamanager.h" |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
31 #include "pidgin.h" |
26149
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
32 #include "request.h" |
25550 | 33 |
34 #include "gtkmedia.h" | |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
35 #include "gtkutils.h" |
28472
092659955afb
Set the icon of media corresponding to the media type
Marcus Lundblad <ml@update.uu.se>
parents:
28454
diff
changeset
|
36 #include "pidginstock.h" |
25550 | 37 |
25654
cbe97caec684
Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25651
diff
changeset
|
38 #ifdef USE_VV |
26506
beb22a90bf5d
Gstreamer shouldn't be a requirement if USE_VV isn't defined.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
26497
diff
changeset
|
39 #include "media-gst.h" |
25550 | 40 |
28043
6e3c83e1057c
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <stu@nosnilmot.com>
parents:
26606
diff
changeset
|
41 #ifdef _WIN32 |
6e3c83e1057c
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <stu@nosnilmot.com>
parents:
26606
diff
changeset
|
42 #include <gdk/gdkwin32.h> |
6e3c83e1057c
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <stu@nosnilmot.com>
parents:
26606
diff
changeset
|
43 #endif |
6e3c83e1057c
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <stu@nosnilmot.com>
parents:
26606
diff
changeset
|
44 |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
45 #include <gst/interfaces/xoverlay.h> |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
46 |
26455
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
47 #define PIDGIN_TYPE_MEDIA (pidgin_media_get_type()) |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
48 #define PIDGIN_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PIDGIN_TYPE_MEDIA, PidginMedia)) |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
49 #define PIDGIN_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PIDGIN_TYPE_MEDIA, PidginMediaClass)) |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
50 #define PIDGIN_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PIDGIN_TYPE_MEDIA)) |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
51 #define PIDGIN_IS_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PIDGIN_TYPE_MEDIA)) |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
52 #define PIDGIN_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PIDGIN_TYPE_MEDIA, PidginMediaClass)) |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
53 |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
54 typedef struct _PidginMedia PidginMedia; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
55 typedef struct _PidginMediaClass PidginMediaClass; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
56 typedef struct _PidginMediaPrivate PidginMediaPrivate; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
57 |
25643
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
58 typedef enum |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
59 { |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
60 /* Waiting for response */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
61 PIDGIN_MEDIA_WAITING = 1, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
62 /* Got request */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
63 PIDGIN_MEDIA_REQUESTED, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
64 /* Accepted call */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
65 PIDGIN_MEDIA_ACCEPTED, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
66 /* Rejected call */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
67 PIDGIN_MEDIA_REJECTED, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
68 } PidginMediaState; |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
69 |
26455
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
70 struct _PidginMediaClass |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
71 { |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
72 GtkWindowClass parent_class; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
73 }; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
74 |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
75 struct _PidginMedia |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
76 { |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
77 GtkWindow parent; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
78 PidginMediaPrivate *priv; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
79 }; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
80 |
25550 | 81 struct _PidginMediaPrivate |
82 { | |
83 PurpleMedia *media; | |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
84 gchar *screenname; |
28191
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
85 gulong level_handler_id; |
25550 | 86 |
30725
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
87 GtkUIManager *ui; |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
88 GtkWidget *menubar; |
26161
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
89 GtkWidget *statusbar; |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
90 |
28772 | 91 GtkWidget *hold; |
25713
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
92 GtkWidget *mute; |
28199
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
93 GtkWidget *pause; |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
94 |
25550 | 95 GtkWidget *send_progress; |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
96 GHashTable *recv_progressbars; |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
97 |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
98 PidginMediaState state; |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
99 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
100 GtkWidget *display; |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
101 GtkWidget *send_widget; |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
102 GtkWidget *recv_widget; |
28199
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
103 GtkWidget *button_widget; |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
104 GtkWidget *local_video; |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
105 GHashTable *remote_videos; |
26464
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
106 |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
107 guint timeout_id; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
108 PurpleMediaSessionType request_type; |
25550 | 109 }; |
110 | |
111 #define PIDGIN_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PIDGIN_TYPE_MEDIA, PidginMediaPrivate)) | |
112 | |
113 static void pidgin_media_class_init (PidginMediaClass *klass); | |
114 static void pidgin_media_init (PidginMedia *media); | |
26087
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
115 static void pidgin_media_dispose (GObject *object); |
25550 | 116 static void pidgin_media_finalize (GObject *object); |
117 static void pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); | |
118 static void pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); | |
25643
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
119 static void pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state); |
25550 | 120 |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
121 static GtkWindowClass *parent_class = NULL; |
25550 | 122 |
123 | |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
124 #if 0 |
25550 | 125 enum { |
126 LAST_SIGNAL | |
127 }; | |
128 static guint pidgin_media_signals[LAST_SIGNAL] = {0}; | |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
129 #endif |
25550 | 130 |
131 enum { | |
132 PROP_0, | |
133 PROP_MEDIA, | |
28192
47a356df8b5a
Remove send_level and recv_level from PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28191
diff
changeset
|
134 PROP_SCREENNAME |
25550 | 135 }; |
136 | |
26456 | 137 static GType |
25634
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
138 pidgin_media_get_type(void) |
25550 | 139 { |
140 static GType type = 0; | |
141 | |
142 if (type == 0) { | |
143 static const GTypeInfo info = { | |
144 sizeof(PidginMediaClass), | |
145 NULL, | |
146 NULL, | |
147 (GClassInitFunc) pidgin_media_class_init, | |
148 NULL, | |
149 NULL, | |
150 sizeof(PidginMedia), | |
151 0, | |
25561
1ec6a26cfefc
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25550
diff
changeset
|
152 (GInstanceInitFunc) pidgin_media_init, |
1ec6a26cfefc
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25550
diff
changeset
|
153 NULL |
25550 | 154 }; |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
155 type = g_type_register_static(GTK_TYPE_WINDOW, "PidginMedia", &info, 0); |
25550 | 156 } |
157 return type; | |
158 } | |
159 | |
160 | |
161 static void | |
162 pidgin_media_class_init (PidginMediaClass *klass) | |
163 { | |
164 GObjectClass *gobject_class = (GObjectClass*)klass; | |
25679 | 165 /* GtkContainerClass *container_class = (GtkContainerClass*)klass; */ |
25550 | 166 parent_class = g_type_class_peek_parent(klass); |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
167 |
26087
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
168 gobject_class->dispose = pidgin_media_dispose; |
25550 | 169 gobject_class->finalize = pidgin_media_finalize; |
170 gobject_class->set_property = pidgin_media_set_property; | |
171 gobject_class->get_property = pidgin_media_get_property; | |
172 | |
173 g_object_class_install_property(gobject_class, PROP_MEDIA, | |
174 g_param_spec_object("media", | |
175 "PurpleMedia", | |
176 "The PurpleMedia associated with this media.", | |
177 PURPLE_TYPE_MEDIA, | |
178 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); | |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
179 g_object_class_install_property(gobject_class, PROP_SCREENNAME, |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
180 g_param_spec_string("screenname", |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
181 "Screenname", |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
182 "The screenname of the user this session is with.", |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
183 NULL, |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
184 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); |
25550 | 185 |
186 g_type_class_add_private(klass, sizeof(PidginMediaPrivate)); | |
187 } | |
188 | |
25713
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
189 static void |
28772 | 190 pidgin_media_hold_toggled(GtkToggleButton *toggle, PidginMedia *media) |
191 { | |
192 purple_media_stream_info(media->priv->media, | |
193 gtk_toggle_button_get_active(toggle) ? | |
194 PURPLE_MEDIA_INFO_HOLD : PURPLE_MEDIA_INFO_UNHOLD, | |
195 NULL, NULL, TRUE); | |
196 } | |
197 | |
198 static void | |
25713
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
199 pidgin_media_mute_toggled(GtkToggleButton *toggle, PidginMedia *media) |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
200 { |
26454
d254bc6b4d60
Remove purple_media_mute.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26453
diff
changeset
|
201 purple_media_stream_info(media->priv->media, |
d254bc6b4d60
Remove purple_media_mute.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26453
diff
changeset
|
202 gtk_toggle_button_get_active(toggle) ? |
d254bc6b4d60
Remove purple_media_mute.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26453
diff
changeset
|
203 PURPLE_MEDIA_INFO_MUTE : PURPLE_MEDIA_INFO_UNMUTE, |
d254bc6b4d60
Remove purple_media_mute.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26453
diff
changeset
|
204 NULL, NULL, TRUE); |
25713
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
205 } |
25550 | 206 |
28199
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
207 static void |
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
208 pidgin_media_pause_toggled(GtkToggleButton *toggle, PidginMedia *media) |
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
209 { |
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
210 purple_media_stream_info(media->priv->media, |
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
211 gtk_toggle_button_get_active(toggle) ? |
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
212 PURPLE_MEDIA_INFO_PAUSE : PURPLE_MEDIA_INFO_UNPAUSE, |
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
213 NULL, NULL, TRUE); |
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
214 } |
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
215 |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
216 static gboolean |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
217 pidgin_media_delete_event_cb(GtkWidget *widget, |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
218 GdkEvent *event, PidginMedia *media) |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
219 { |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
220 if (media->priv->media) |
26451
2862fee7acf2
Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26448
diff
changeset
|
221 purple_media_stream_info(media->priv->media, |
2862fee7acf2
Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26448
diff
changeset
|
222 PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
223 return FALSE; |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
224 } |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
225 |
28043
6e3c83e1057c
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <stu@nosnilmot.com>
parents:
26606
diff
changeset
|
226 #ifdef HAVE_X11 |
26159
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
227 static int |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
228 pidgin_x_error_handler(Display *display, XErrorEvent *event) |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
229 { |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
230 const gchar *error_type; |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
231 switch (event->error_code) { |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
232 #define XERRORCASE(type) case type: error_type = #type; break |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
233 XERRORCASE(BadAccess); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
234 XERRORCASE(BadAlloc); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
235 XERRORCASE(BadAtom); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
236 XERRORCASE(BadColor); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
237 XERRORCASE(BadCursor); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
238 XERRORCASE(BadDrawable); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
239 XERRORCASE(BadFont); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
240 XERRORCASE(BadGC); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
241 XERRORCASE(BadIDChoice); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
242 XERRORCASE(BadImplementation); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
243 XERRORCASE(BadLength); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
244 XERRORCASE(BadMatch); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
245 XERRORCASE(BadName); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
246 XERRORCASE(BadPixmap); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
247 XERRORCASE(BadRequest); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
248 XERRORCASE(BadValue); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
249 XERRORCASE(BadWindow); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
250 #undef XERRORCASE |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
251 default: |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
252 error_type = "unknown"; |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
253 break; |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
254 } |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
255 purple_debug_error("media", "A %s Xlib error has occurred. " |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
256 "The program would normally crash now.\n", |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
257 error_type); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
258 return 0; |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
259 } |
28043
6e3c83e1057c
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <stu@nosnilmot.com>
parents:
26606
diff
changeset
|
260 #endif |
26159
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
261 |
25550 | 262 static void |
30725
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
263 menu_hangup(GtkAction *action, gpointer data) |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
264 { |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
265 PidginMedia *gtkmedia = PIDGIN_MEDIA(data); |
26451
2862fee7acf2
Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26448
diff
changeset
|
266 purple_media_stream_info(gtkmedia->priv->media, |
2862fee7acf2
Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26448
diff
changeset
|
267 PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE); |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
268 } |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
269 |
30725
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
270 static const GtkActionEntry menu_entries[] = { |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
271 { "MediaMenu", NULL, N_("_Media"), NULL, NULL, NULL }, |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
272 { "Hangup", NULL, N_("_Hangup"), NULL, NULL, G_CALLBACK(menu_hangup) }, |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
273 }; |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
274 |
30725
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
275 static const char *media_menu = |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
276 "<ui>" |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
277 "<menubar name='Media'>" |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
278 "<menu action='MediaMenu'>" |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
279 "<menuitem action='Hangup'/>" |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
280 "</menu>" |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
281 "</menubar>" |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
282 "</ui>"; |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
283 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
284 static GtkWidget * |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
285 setup_menubar(PidginMedia *window) |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
286 { |
30725
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
287 GtkActionGroup *action_group; |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
288 GError *error; |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
289 GtkAccelGroup *accel_group; |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
290 GtkWidget *menu; |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
291 |
30725
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
292 action_group = gtk_action_group_new("MediaActions"); |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
293 gtk_action_group_add_actions(action_group, |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
294 menu_entries, |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
295 G_N_ELEMENTS(menu_entries), |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
296 GTK_WINDOW(window)); |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
297 #ifdef ENABLE_NLS |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
298 gtk_action_group_set_translation_domain(action_group, |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
299 PACKAGE); |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
300 #endif |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
301 |
30725
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
302 window->priv->ui = gtk_ui_manager_new(); |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
303 gtk_ui_manager_insert_action_group(window->priv->ui, action_group, 0); |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
304 |
30725
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
305 accel_group = gtk_ui_manager_get_accel_group(window->priv->ui); |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
306 gtk_window_add_accel_group(GTK_WINDOW(window), accel_group); |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
307 |
30725
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
308 error = NULL; |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
309 if (!gtk_ui_manager_add_ui_from_string(window->priv->ui, media_menu, -1, &error)) |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
310 { |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
311 g_message("building menus failed: %s", error->message); |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
312 g_error_free(error); |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
313 exit(EXIT_FAILURE); |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
314 } |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
315 |
30725
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
316 menu = gtk_ui_manager_get_widget(window->priv->ui, "/Media"); |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
317 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
318 gtk_widget_show(menu); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
319 return menu; |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
320 } |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
321 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
322 static void |
25550 | 323 pidgin_media_init (PidginMedia *media) |
324 { | |
26492
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
325 GtkWidget *vbox; |
25550 | 326 media->priv = PIDGIN_MEDIA_GET_PRIVATE(media); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
327 |
28043
6e3c83e1057c
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <stu@nosnilmot.com>
parents:
26606
diff
changeset
|
328 #ifdef HAVE_X11 |
26159
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
329 XSetErrorHandler(pidgin_x_error_handler); |
28043
6e3c83e1057c
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <stu@nosnilmot.com>
parents:
26606
diff
changeset
|
330 #endif |
26159
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
331 |
26433
0dfd05966e09
Improve padding in media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
332 vbox = gtk_vbox_new(FALSE, 0); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
333 gtk_container_add(GTK_CONTAINER(media), vbox); |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
334 |
26161
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
335 media->priv->statusbar = gtk_statusbar_new(); |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
336 gtk_box_pack_end(GTK_BOX(vbox), media->priv->statusbar, |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
337 FALSE, FALSE, 0); |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
338 gtk_statusbar_push(GTK_STATUSBAR(media->priv->statusbar), |
26176
08a3749993fe
Remove unnecessary buttons and change statusbar to say "Calling..."
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
339 0, _("Calling...")); |
26161
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
340 gtk_widget_show(media->priv->statusbar); |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
341 |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
342 media->priv->menubar = setup_menubar(media); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
343 gtk_box_pack_start(GTK_BOX(vbox), media->priv->menubar, |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
344 FALSE, TRUE, 0); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
345 |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
346 media->priv->display = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
26433
0dfd05966e09
Improve padding in media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
347 gtk_container_set_border_width(GTK_CONTAINER(media->priv->display), |
0dfd05966e09
Improve padding in media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
348 PIDGIN_HIG_BOX_SPACE); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
349 gtk_box_pack_start(GTK_BOX(vbox), media->priv->display, |
26131
6eeb500ce9a2
Remove unneeded pidgin_media_get_display_widget function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26130
diff
changeset
|
350 TRUE, TRUE, PIDGIN_HIG_BOX_SPACE); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
351 gtk_widget_show(vbox); |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
352 |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
353 g_signal_connect(G_OBJECT(media), "delete-event", |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
354 G_CALLBACK(pidgin_media_delete_event_cb), media); |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
355 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
356 media->priv->recv_progressbars = |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
357 g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
358 media->priv->remote_videos = |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
359 g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
360 } |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
361 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
362 static gchar * |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
363 create_key(const gchar *session_id, const gchar *participant) |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
364 { |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
365 return g_strdup_printf("%s_%s", session_id, participant); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
366 } |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
367 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
368 static void |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
369 pidgin_media_insert_widget(PidginMedia *gtkmedia, GtkWidget *widget, |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
370 const gchar *session_id, const gchar *participant) |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
371 { |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
372 gchar *key = create_key(session_id, participant); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
373 PurpleMediaSessionType type = |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
374 purple_media_get_session_type(gtkmedia->priv->media, session_id); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
375 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
376 if (type & PURPLE_MEDIA_AUDIO) |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
377 g_hash_table_insert(gtkmedia->priv->recv_progressbars, key, widget); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
378 else if (type & PURPLE_MEDIA_VIDEO) |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
379 g_hash_table_insert(gtkmedia->priv->remote_videos, key, widget); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
380 } |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
381 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
382 static GtkWidget * |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
383 pidgin_media_get_widget(PidginMedia *gtkmedia, |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
384 const gchar *session_id, const gchar *participant) |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
385 { |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
386 GtkWidget *widget = NULL; |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
387 gchar *key = create_key(session_id, participant); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
388 PurpleMediaSessionType type = |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
389 purple_media_get_session_type(gtkmedia->priv->media, session_id); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
390 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
391 if (type & PURPLE_MEDIA_AUDIO) |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
392 widget = g_hash_table_lookup(gtkmedia->priv->recv_progressbars, key); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
393 else if (type & PURPLE_MEDIA_VIDEO) |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
394 widget = g_hash_table_lookup(gtkmedia->priv->remote_videos, key); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
395 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
396 g_free(key); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
397 return widget; |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
398 } |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
399 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
400 static void |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
401 pidgin_media_remove_widget(PidginMedia *gtkmedia, |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
402 const gchar *session_id, const gchar *participant) |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
403 { |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
404 GtkWidget *widget = pidgin_media_get_widget(gtkmedia, session_id, participant); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
405 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
406 if (widget) { |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
407 PurpleMediaSessionType type = |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
408 purple_media_get_session_type(gtkmedia->priv->media, session_id); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
409 gchar *key = create_key(session_id, participant); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
410 GtkRequisition req; |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
411 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
412 if (type & PURPLE_MEDIA_AUDIO) { |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
413 g_hash_table_remove(gtkmedia->priv->recv_progressbars, key); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
414 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
415 if (g_hash_table_size(gtkmedia->priv->recv_progressbars) == 0 && |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
416 gtkmedia->priv->send_progress) { |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
417 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
418 gtk_widget_destroy(gtkmedia->priv->send_progress); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
419 gtkmedia->priv->send_progress = NULL; |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
420 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
421 gtk_widget_destroy(gtkmedia->priv->mute); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
422 gtkmedia->priv->mute = NULL; |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
423 } |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
424 } else if (type & PURPLE_MEDIA_VIDEO) { |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
425 g_hash_table_remove(gtkmedia->priv->remote_videos, key); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
426 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
427 if (g_hash_table_size(gtkmedia->priv->remote_videos) == 0 && |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
428 gtkmedia->priv->local_video) { |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
429 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
430 gtk_widget_destroy(gtkmedia->priv->local_video); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
431 gtkmedia->priv->local_video = NULL; |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
432 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
433 gtk_widget_destroy(gtkmedia->priv->pause); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
434 gtkmedia->priv->pause = NULL; |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
435 } |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
436 } |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
437 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
438 g_free(key); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
439 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
440 gtk_widget_destroy(widget); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
441 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
442 gtk_widget_size_request(GTK_WIDGET(gtkmedia), &req); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
443 gtk_window_resize(GTK_WINDOW(gtkmedia), req.width, req.height); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
444 } |
25550 | 445 } |
446 | |
28191
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
447 static void |
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
448 level_message_cb(PurpleMedia *media, gchar *session_id, gchar *participant, |
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
449 double level, PidginMedia *gtkmedia) |
25550 | 450 { |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
451 GtkWidget *progress = NULL; |
28191
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
452 if (participant == NULL) |
26152
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
453 progress = gtkmedia->priv->send_progress; |
28191
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
454 else |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
455 progress = pidgin_media_get_widget(gtkmedia, session_id, participant); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
456 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
457 if (progress) |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
458 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), level * 5); |
25550 | 459 } |
460 | |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
461 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
462 static void |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
463 pidgin_media_disconnect_levels(PurpleMedia *media, PidginMedia *gtkmedia) |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
464 { |
26475
462e5c27dbd7
Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
465 PurpleMediaManager *manager = purple_media_get_manager(media); |
462e5c27dbd7
Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
466 GstElement *element = purple_media_manager_get_pipeline(manager); |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
467 gulong handler_id = g_signal_handler_find(G_OBJECT(gst_pipeline_get_bus(GST_PIPELINE(element))), |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31390
diff
changeset
|
468 G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0, |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
469 NULL, G_CALLBACK(level_message_cb), gtkmedia); |
25651
43b3b9ff6028
Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25647
diff
changeset
|
470 if (handler_id) |
43b3b9ff6028
Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25647
diff
changeset
|
471 g_signal_handler_disconnect(G_OBJECT(gst_pipeline_get_bus(GST_PIPELINE(element))), |
43b3b9ff6028
Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25647
diff
changeset
|
472 handler_id); |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
473 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
474 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
475 static void |
26087
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
476 pidgin_media_dispose(GObject *media) |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
477 { |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
478 PidginMedia *gtkmedia = PIDGIN_MEDIA(media); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
479 purple_debug_info("gtkmedia", "pidgin_media_dispose\n"); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
480 |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
481 if (gtkmedia->priv->media) { |
26177
8b95080061ed
Close the request dialog if the remote user hung up.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26176
diff
changeset
|
482 purple_request_close_with_handle(gtkmedia); |
26157
1aed9a92b657
Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
483 purple_media_remove_output_windows(gtkmedia->priv->media); |
26087
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
484 pidgin_media_disconnect_levels(gtkmedia->priv->media, gtkmedia); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
485 g_object_unref(gtkmedia->priv->media); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
486 gtkmedia->priv->media = NULL; |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
487 } |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
488 |
30725
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
489 if (gtkmedia->priv->ui) { |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
490 g_object_unref(gtkmedia->priv->ui); |
b6c3000eec60
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30678
diff
changeset
|
491 gtkmedia->priv->ui = NULL; |
26175
1830d339f9b9
Properly free item factory. Should fix a crash on close.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
492 } |
1830d339f9b9
Properly free item factory. Should fix a crash on close.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
493 |
31390
11211e6427ae
pidgin: Remove a timeout when destroying this object to avoid a use-after-free
jakub.adam@ktknet.cz
parents:
30725
diff
changeset
|
494 if (gtkmedia->priv->timeout_id != 0) |
11211e6427ae
pidgin: Remove a timeout when destroying this object to avoid a use-after-free
jakub.adam@ktknet.cz
parents:
30725
diff
changeset
|
495 g_source_remove(gtkmedia->priv->timeout_id); |
11211e6427ae
pidgin: Remove a timeout when destroying this object to avoid a use-after-free
jakub.adam@ktknet.cz
parents:
30725
diff
changeset
|
496 |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
497 if (gtkmedia->priv->recv_progressbars) { |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
498 g_hash_table_destroy(gtkmedia->priv->recv_progressbars); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
499 g_hash_table_destroy(gtkmedia->priv->remote_videos); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
500 gtkmedia->priv->recv_progressbars = NULL; |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
501 gtkmedia->priv->remote_videos = NULL; |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
502 } |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
503 |
26087
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
504 G_OBJECT_CLASS(parent_class)->dispose(media); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
505 } |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
506 |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
507 static void |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
508 pidgin_media_finalize(GObject *media) |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
509 { |
26131
6eeb500ce9a2
Remove unneeded pidgin_media_get_display_widget function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26130
diff
changeset
|
510 /* PidginMedia *gtkmedia = PIDGIN_MEDIA(media); */ |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26013
diff
changeset
|
511 purple_debug_info("gtkmedia", "pidgin_media_finalize\n"); |
26087
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
512 |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
513 G_OBJECT_CLASS(parent_class)->finalize(media); |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
514 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
515 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
516 static void |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
517 pidgin_media_emit_message(PidginMedia *gtkmedia, const char *msg) |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
518 { |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
519 PurpleConversation *conv = purple_find_conversation_with_account( |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
520 PURPLE_CONV_TYPE_ANY, gtkmedia->priv->screenname, |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26596
diff
changeset
|
521 purple_media_get_account(gtkmedia->priv->media)); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
522 if (conv != NULL) |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
523 purple_conversation_write(conv, NULL, msg, |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
524 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
525 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
526 |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
527 typedef struct |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
528 { |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
529 PidginMedia *gtkmedia; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
530 gchar *session_id; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
531 gchar *participant; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
532 } PidginMediaRealizeData; |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
533 |
26107
4859b0b82289
Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26089
diff
changeset
|
534 static gboolean |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
535 realize_cb_cb(PidginMediaRealizeData *data) |
26107
4859b0b82289
Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26089
diff
changeset
|
536 { |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
537 PidginMediaPrivate *priv = data->gtkmedia->priv; |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
538 GdkWindow *window = NULL; |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
539 |
28043
6e3c83e1057c
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <stu@nosnilmot.com>
parents:
26606
diff
changeset
|
540 if (data->participant == NULL) |
32197
6f503dcd843e
pidgin: Fix building on GTK+ less than 2.14.
Paul Aurich <paul@darkrain42.org>
parents:
31871
diff
changeset
|
541 #if GTK_CHECK_VERSION(2, 14, 0) |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
542 window = gtk_widget_get_window(priv->local_video); |
32197
6f503dcd843e
pidgin: Fix building on GTK+ less than 2.14.
Paul Aurich <paul@darkrain42.org>
parents:
31871
diff
changeset
|
543 #else |
6f503dcd843e
pidgin: Fix building on GTK+ less than 2.14.
Paul Aurich <paul@darkrain42.org>
parents:
31871
diff
changeset
|
544 window = (priv->local_video)->window; |
6f503dcd843e
pidgin: Fix building on GTK+ less than 2.14.
Paul Aurich <paul@darkrain42.org>
parents:
31871
diff
changeset
|
545 #endif |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
546 else { |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
547 GtkWidget *widget = pidgin_media_get_widget(data->gtkmedia, |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
548 data->session_id, data->participant); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
549 if (widget) |
32197
6f503dcd843e
pidgin: Fix building on GTK+ less than 2.14.
Paul Aurich <paul@darkrain42.org>
parents:
31871
diff
changeset
|
550 #if GTK_CHECK_VERSION(2, 14, 0) |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
551 window = gtk_widget_get_window(widget); |
32197
6f503dcd843e
pidgin: Fix building on GTK+ less than 2.14.
Paul Aurich <paul@darkrain42.org>
parents:
31871
diff
changeset
|
552 #else |
6f503dcd843e
pidgin: Fix building on GTK+ less than 2.14.
Paul Aurich <paul@darkrain42.org>
parents:
31871
diff
changeset
|
553 window = widget->window; |
6f503dcd843e
pidgin: Fix building on GTK+ less than 2.14.
Paul Aurich <paul@darkrain42.org>
parents:
31871
diff
changeset
|
554 #endif |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
555 } |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
556 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
557 if (window) { |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
558 gulong window_id; |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
559 #ifdef _WIN32 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
560 window_id = GDK_WINDOW_HWND(window); |
28043
6e3c83e1057c
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <stu@nosnilmot.com>
parents:
26606
diff
changeset
|
561 #elif defined(HAVE_X11) |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
562 window_id = GDK_WINDOW_XWINDOW(window); |
28043
6e3c83e1057c
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <stu@nosnilmot.com>
parents:
26606
diff
changeset
|
563 #else |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
564 # error "Unsupported windowing system" |
28043
6e3c83e1057c
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <stu@nosnilmot.com>
parents:
26606
diff
changeset
|
565 #endif |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
566 |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
567 purple_media_set_output_window(priv->media, data->session_id, |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
568 data->participant, window_id); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
569 } |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
570 |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
571 g_free(data->session_id); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
572 g_free(data->participant); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
573 g_free(data); |
26107
4859b0b82289
Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26089
diff
changeset
|
574 return FALSE; |
4859b0b82289
Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26089
diff
changeset
|
575 } |
4859b0b82289
Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26089
diff
changeset
|
576 |
25550 | 577 static void |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
578 realize_cb(GtkWidget *widget, PidginMediaRealizeData *data) |
26053
99c3489e06b0
Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26034
diff
changeset
|
579 { |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
580 g_timeout_add(0, (GSourceFunc)realize_cb_cb, data); |
26053
99c3489e06b0
Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26034
diff
changeset
|
581 } |
99c3489e06b0
Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26034
diff
changeset
|
582 |
99c3489e06b0
Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26034
diff
changeset
|
583 static void |
26058
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
584 pidgin_media_error_cb(PidginMedia *media, const char *error, PidginMedia *gtkmedia) |
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
585 { |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
586 PurpleConversation *conv = purple_find_conversation_with_account( |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
587 PURPLE_CONV_TYPE_ANY, gtkmedia->priv->screenname, |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26596
diff
changeset
|
588 purple_media_get_account(gtkmedia->priv->media)); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
589 if (conv != NULL) |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
590 purple_conversation_write(conv, NULL, error, |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
591 PURPLE_MESSAGE_ERROR, time(NULL)); |
26161
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
592 gtk_statusbar_push(GTK_STATUSBAR(gtkmedia->priv->statusbar), |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
593 0, error); |
26058
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
594 } |
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
595 |
26143
f6a98b2b8d92
Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26135
diff
changeset
|
596 static void |
26464
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
597 pidgin_media_accept_cb(PurpleMedia *media, int index) |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
598 { |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
599 purple_media_stream_info(media, PURPLE_MEDIA_INFO_ACCEPT, |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
600 NULL, NULL, TRUE); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
601 } |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
602 |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
603 static void |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
604 pidgin_media_reject_cb(PurpleMedia *media, int index) |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
605 { |
31871
db480fe010d5
Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
jakub.adam@ktknet.cz
parents:
31870
diff
changeset
|
606 GList *iter = purple_media_get_session_ids(media); |
db480fe010d5
Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
jakub.adam@ktknet.cz
parents:
31870
diff
changeset
|
607 for (; iter; iter = g_list_delete_link(iter, iter)) { |
db480fe010d5
Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
jakub.adam@ktknet.cz
parents:
31870
diff
changeset
|
608 const gchar *sessionid = iter->data; |
db480fe010d5
Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
jakub.adam@ktknet.cz
parents:
31870
diff
changeset
|
609 if (!purple_media_accepted(media, sessionid, NULL)) |
db480fe010d5
Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
jakub.adam@ktknet.cz
parents:
31870
diff
changeset
|
610 purple_media_stream_info(media, PURPLE_MEDIA_INFO_REJECT, |
db480fe010d5
Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
jakub.adam@ktknet.cz
parents:
31870
diff
changeset
|
611 sessionid, NULL, TRUE); |
db480fe010d5
Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
jakub.adam@ktknet.cz
parents:
31870
diff
changeset
|
612 } |
26464
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
613 } |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
614 |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
615 static gboolean |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
616 pidgin_request_timeout_cb(PidginMedia *gtkmedia) |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
617 { |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26596
diff
changeset
|
618 PurpleAccount *account; |
26464
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
619 PurpleBuddy *buddy; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
620 const gchar *alias; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
621 PurpleMediaSessionType type; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
622 gchar *message = NULL; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
623 |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26596
diff
changeset
|
624 account = purple_media_get_account(gtkmedia->priv->media); |
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26596
diff
changeset
|
625 buddy = purple_find_buddy(account, gtkmedia->priv->screenname); |
26464
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
626 alias = buddy ? purple_buddy_get_contact_alias(buddy) : |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
627 gtkmedia->priv->screenname; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
628 type = gtkmedia->priv->request_type; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
629 gtkmedia->priv->timeout_id = 0; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
630 |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
631 if (type & PURPLE_MEDIA_AUDIO && type & PURPLE_MEDIA_VIDEO) { |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
632 message = g_strdup_printf(_("%s wishes to start an audio/video session with you."), |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
633 alias); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
634 } else if (type & PURPLE_MEDIA_AUDIO) { |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
635 message = g_strdup_printf(_("%s wishes to start an audio session with you."), |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
636 alias); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
637 } else if (type & PURPLE_MEDIA_VIDEO) { |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
638 message = g_strdup_printf(_("%s wishes to start a video session with you."), |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
639 alias); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
640 } |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
641 |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
642 gtkmedia->priv->request_type = PURPLE_MEDIA_NONE; |
28454
7a66b8d66456
There's no reason to ask for acceptance if the stream has been accepted. Also,
maiku@pidgin.im
parents:
28397
diff
changeset
|
643 if (!purple_media_accepted(gtkmedia->priv->media, NULL, NULL)) { |
7a66b8d66456
There's no reason to ask for acceptance if the stream has been accepted. Also,
maiku@pidgin.im
parents:
28397
diff
changeset
|
644 purple_request_accept_cancel(gtkmedia, _("Incoming Call"), |
7a66b8d66456
There's no reason to ask for acceptance if the stream has been accepted. Also,
maiku@pidgin.im
parents:
28397
diff
changeset
|
645 message, NULL, PURPLE_DEFAULT_ACTION_NONE, |
7a66b8d66456
There's no reason to ask for acceptance if the stream has been accepted. Also,
maiku@pidgin.im
parents:
28397
diff
changeset
|
646 (void*)account, gtkmedia->priv->screenname, |
7a66b8d66456
There's no reason to ask for acceptance if the stream has been accepted. Also,
maiku@pidgin.im
parents:
28397
diff
changeset
|
647 NULL, gtkmedia->priv->media, |
7a66b8d66456
There's no reason to ask for acceptance if the stream has been accepted. Also,
maiku@pidgin.im
parents:
28397
diff
changeset
|
648 pidgin_media_accept_cb, |
7a66b8d66456
There's no reason to ask for acceptance if the stream has been accepted. Also,
maiku@pidgin.im
parents:
28397
diff
changeset
|
649 pidgin_media_reject_cb); |
7a66b8d66456
There's no reason to ask for acceptance if the stream has been accepted. Also,
maiku@pidgin.im
parents:
28397
diff
changeset
|
650 } |
26464
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
651 pidgin_media_emit_message(gtkmedia, message); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
652 g_free(message); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
653 return FALSE; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
654 } |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
655 |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
656 static void |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
657 #if GTK_CHECK_VERSION(2,12,0) |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
658 pidgin_media_input_volume_changed(GtkScaleButton *range, double value, |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
659 PurpleMedia *media) |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
660 { |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
661 double val = (double)value * 100.0; |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
662 #else |
26490
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
663 pidgin_media_input_volume_changed(GtkRange *range, PurpleMedia *media) |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
664 { |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
665 double val = (double)gtk_range_get_value(GTK_RANGE(range)); |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
666 #endif |
28191
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
667 purple_media_set_input_volume(media, NULL, val); |
26490
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
668 } |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
669 |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
670 static void |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
671 #if GTK_CHECK_VERSION(2,12,0) |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
672 pidgin_media_output_volume_changed(GtkScaleButton *range, double value, |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
673 PurpleMedia *media) |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
674 { |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
675 double val = (double)value * 100.0; |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
676 #else |
26490
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
677 pidgin_media_output_volume_changed(GtkRange *range, PurpleMedia *media) |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
678 { |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
679 double val = (double)gtk_range_get_value(GTK_RANGE(range)); |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
680 #endif |
28191
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
681 purple_media_set_output_volume(media, NULL, NULL, val); |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
682 } |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
683 |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
684 static void |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
685 destroy_parent_widget_cb(GtkWidget *widget, GtkWidget *parent) |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
686 { |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
687 g_return_if_fail(GTK_IS_WIDGET(parent)); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
688 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
689 gtk_widget_destroy(parent); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
690 } |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
691 |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
692 static GtkWidget * |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
693 pidgin_media_add_audio_widget(PidginMedia *gtkmedia, |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
694 PurpleMediaSessionType type, const gchar *sid) |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
695 { |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
696 GtkWidget *volume_widget, *progress_parent, *volume, *progress; |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
697 double value; |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
698 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
699 if (type & PURPLE_MEDIA_SEND_AUDIO) { |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
700 value = purple_prefs_get_int( |
28191
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
701 "/purple/media/audio/volume/input"); |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
702 } else if (type & PURPLE_MEDIA_RECV_AUDIO) { |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
703 value = purple_prefs_get_int( |
28191
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
704 "/purple/media/audio/volume/output"); |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
705 } else |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
706 g_return_val_if_reached(NULL); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
707 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
708 #if GTK_CHECK_VERSION(2,12,0) |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
709 /* Setup widget structure */ |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
710 volume_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
711 progress_parent = gtk_vbox_new(FALSE, 0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
712 gtk_box_pack_start(GTK_BOX(volume_widget), |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
713 progress_parent, TRUE, TRUE, 0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
714 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
715 /* Volume button */ |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
716 volume = gtk_volume_button_new(); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
717 gtk_scale_button_set_value(GTK_SCALE_BUTTON(volume), value/100.0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
718 gtk_box_pack_end(GTK_BOX(volume_widget), |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
719 volume, FALSE, FALSE, 0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
720 #else |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
721 /* Setup widget structure */ |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
722 volume_widget = gtk_vbox_new(FALSE, 0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
723 progress_parent = volume_widget; |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
724 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
725 /* Volume slider */ |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
726 volume = gtk_hscale_new_with_range(0.0, 100.0, 5.0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
727 gtk_range_set_increments(GTK_RANGE(volume), 5.0, 25.0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
728 gtk_range_set_value(GTK_RANGE(volume), value); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
729 gtk_scale_set_draw_value(GTK_SCALE(volume), FALSE); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
730 gtk_box_pack_end(GTK_BOX(volume_widget), |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
731 volume, TRUE, FALSE, 0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
732 #endif |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
733 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
734 /* Volume level indicator */ |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
735 progress = gtk_progress_bar_new(); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
736 gtk_widget_set_size_request(progress, 250, 10); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
737 gtk_box_pack_end(GTK_BOX(progress_parent), progress, TRUE, FALSE, 0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
738 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
739 if (type & PURPLE_MEDIA_SEND_AUDIO) { |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
740 g_signal_connect (G_OBJECT(volume), "value-changed", |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
741 G_CALLBACK(pidgin_media_input_volume_changed), |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
742 gtkmedia->priv->media); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
743 gtkmedia->priv->send_progress = progress; |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
744 } else if (type & PURPLE_MEDIA_RECV_AUDIO) { |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
745 g_signal_connect (G_OBJECT(volume), "value-changed", |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
746 G_CALLBACK(pidgin_media_output_volume_changed), |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
747 gtkmedia->priv->media); |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
748 |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
749 pidgin_media_insert_widget(gtkmedia, progress, sid, gtkmedia->priv->screenname); |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
750 } |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
751 |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
752 g_signal_connect(G_OBJECT(progress), "destroy", |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
753 G_CALLBACK(destroy_parent_widget_cb), |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
754 volume_widget); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
755 |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
756 gtk_widget_show_all(volume_widget); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
757 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
758 return volume_widget; |
26490
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
759 } |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
760 |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
761 static void |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
762 pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia, const gchar *sid) |
25550 | 763 { |
28199
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
764 GtkWidget *send_widget = NULL, *recv_widget = NULL, *button_widget = NULL; |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
765 PurpleMediaSessionType type = |
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
766 purple_media_get_session_type(media, sid); |
28472
092659955afb
Set the icon of media corresponding to the media type
Marcus Lundblad <ml@update.uu.se>
parents:
28454
diff
changeset
|
767 GdkPixbuf *icon = NULL; |
25671
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
768 |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
769 if (gtkmedia->priv->recv_widget == NULL |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
770 && type & (PURPLE_MEDIA_RECV_VIDEO | |
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
771 PURPLE_MEDIA_RECV_AUDIO)) { |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31390
diff
changeset
|
772 recv_widget = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
773 gtk_box_pack_start(GTK_BOX(gtkmedia->priv->display), |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
774 recv_widget, TRUE, TRUE, 0); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
775 gtk_widget_show(recv_widget); |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
776 } else { |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
777 recv_widget = gtkmedia->priv->recv_widget; |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
778 } |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
779 if (gtkmedia->priv->send_widget == NULL |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
780 && type & (PURPLE_MEDIA_SEND_VIDEO | |
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
781 PURPLE_MEDIA_SEND_AUDIO)) { |
26147
09386489e6d1
Change the media window items' orientations to look better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26146
diff
changeset
|
782 send_widget = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
783 gtk_box_pack_start(GTK_BOX(gtkmedia->priv->display), |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
784 send_widget, FALSE, TRUE, 0); |
28199
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
785 button_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
786 gtk_box_pack_end(GTK_BOX(recv_widget), button_widget, |
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
787 FALSE, TRUE, 0); |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
788 gtk_widget_show(send_widget); |
28772 | 789 |
790 /* Hold button */ | |
791 gtkmedia->priv->hold = | |
792 gtk_toggle_button_new_with_mnemonic("_Hold"); | |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
793 gtk_box_pack_end(GTK_BOX(button_widget), gtkmedia->priv->hold, |
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
794 FALSE, FALSE, 0); |
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
795 gtk_widget_show(gtkmedia->priv->hold); |
28772 | 796 g_signal_connect(gtkmedia->priv->hold, "toggled", |
797 G_CALLBACK(pidgin_media_hold_toggled), | |
798 gtkmedia); | |
28199
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
799 } else { |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
800 send_widget = gtkmedia->priv->send_widget; |
28199
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
801 button_widget = gtkmedia->priv->button_widget; |
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
802 } |
25688
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
803 |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
804 if (type & PURPLE_MEDIA_RECV_VIDEO) { |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
805 PidginMediaRealizeData *data; |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
806 GtkWidget *aspect; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
807 GtkWidget *remote_video; |
26158
bb8d4ff8276a
Make the backgrounds of the drawing areas black so it doesn't look as
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26157
diff
changeset
|
808 GdkColor color = {0, 0, 0, 0}; |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
809 |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
810 aspect = gtk_aspect_frame_new(NULL, 0, 0, 4.0/3.0, FALSE); |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
811 gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN); |
25693
b8e0a56cd6cf
Fix the order of the send/recv audio/video display widgets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25692
diff
changeset
|
812 gtk_box_pack_start(GTK_BOX(recv_widget), aspect, TRUE, TRUE, 0); |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
813 |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
814 data = g_new0(PidginMediaRealizeData, 1); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
815 data->gtkmedia = gtkmedia; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
816 data->session_id = g_strdup(sid); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
817 data->participant = g_strdup(gtkmedia->priv->screenname); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
818 |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
819 remote_video = gtk_drawing_area_new(); |
26158
bb8d4ff8276a
Make the backgrounds of the drawing areas black so it doesn't look as
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26157
diff
changeset
|
820 gtk_widget_modify_bg(remote_video, GTK_STATE_NORMAL, &color); |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
821 g_signal_connect(G_OBJECT(remote_video), "realize", |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
822 G_CALLBACK(realize_cb), data); |
26516
30c870ee4ec9
Remove old GtkPlug and GtkSocket code.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26506
diff
changeset
|
823 gtk_container_add(GTK_CONTAINER(aspect), remote_video); |
26160
27b553a07800
Make the sinks better default sizes and display them immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26159
diff
changeset
|
824 gtk_widget_set_size_request (GTK_WIDGET(remote_video), 320, 240); |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
825 g_signal_connect(G_OBJECT(remote_video), "destroy", |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
826 G_CALLBACK(destroy_parent_widget_cb), aspect); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
827 |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
828 gtk_widget_show(remote_video); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
829 gtk_widget_show(aspect); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
830 |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
831 pidgin_media_insert_widget(gtkmedia, remote_video, |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
832 data->session_id, data->participant); |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
833 } |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
834 |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
835 if (type & PURPLE_MEDIA_SEND_VIDEO && !gtkmedia->priv->local_video) { |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
836 PidginMediaRealizeData *data; |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
837 GtkWidget *aspect; |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
838 GtkWidget *local_video; |
26158
bb8d4ff8276a
Make the backgrounds of the drawing areas black so it doesn't look as
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26157
diff
changeset
|
839 GdkColor color = {0, 0, 0, 0}; |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
840 |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
841 aspect = gtk_aspect_frame_new(NULL, 0, 0, 4.0/3.0, TRUE); |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
842 gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN); |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
843 gtk_box_pack_start(GTK_BOX(send_widget), aspect, FALSE, TRUE, 0); |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
844 |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
845 data = g_new0(PidginMediaRealizeData, 1); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
846 data->gtkmedia = gtkmedia; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
847 data->session_id = g_strdup(sid); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
848 data->participant = NULL; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
849 |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
850 local_video = gtk_drawing_area_new(); |
26158
bb8d4ff8276a
Make the backgrounds of the drawing areas black so it doesn't look as
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26157
diff
changeset
|
851 gtk_widget_modify_bg(local_video, GTK_STATE_NORMAL, &color); |
26053
99c3489e06b0
Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26034
diff
changeset
|
852 g_signal_connect(G_OBJECT(local_video), "realize", |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
853 G_CALLBACK(realize_cb), data); |
26516
30c870ee4ec9
Remove old GtkPlug and GtkSocket code.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26506
diff
changeset
|
854 gtk_container_add(GTK_CONTAINER(aspect), local_video); |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
855 gtk_widget_set_size_request (GTK_WIDGET(local_video), 80, 60); |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
856 g_signal_connect(G_OBJECT(local_video), "destroy", |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
857 G_CALLBACK(destroy_parent_widget_cb), aspect); |
26053
99c3489e06b0
Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26034
diff
changeset
|
858 |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
859 gtk_widget_show(local_video); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
860 gtk_widget_show(aspect); |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
861 |
28199
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
862 gtkmedia->priv->pause = |
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
863 gtk_toggle_button_new_with_mnemonic(_("_Pause")); |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
864 gtk_box_pack_end(GTK_BOX(button_widget), gtkmedia->priv->pause, |
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
865 FALSE, FALSE, 0); |
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
866 gtk_widget_show(gtkmedia->priv->pause); |
28199
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
867 g_signal_connect(gtkmedia->priv->pause, "toggled", |
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
868 G_CALLBACK(pidgin_media_pause_toggled), |
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
869 gtkmedia); |
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
870 |
25686
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
871 gtkmedia->priv->local_video = local_video; |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
872 } |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
873 if (type & PURPLE_MEDIA_RECV_AUDIO) { |
26490
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
874 gtk_box_pack_end(GTK_BOX(recv_widget), |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
875 pidgin_media_add_audio_widget(gtkmedia, |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
876 PURPLE_MEDIA_RECV_AUDIO, sid), FALSE, FALSE, 0); |
25688
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
877 } |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
878 |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
879 if (type & PURPLE_MEDIA_SEND_AUDIO) { |
26492
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
880 gtkmedia->priv->mute = |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
881 gtk_toggle_button_new_with_mnemonic("_Mute"); |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
882 gtk_box_pack_end(GTK_BOX(button_widget), gtkmedia->priv->mute, |
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
883 FALSE, FALSE, 0); |
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
884 gtk_widget_show(gtkmedia->priv->mute); |
26492
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
885 g_signal_connect(gtkmedia->priv->mute, "toggled", |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
886 G_CALLBACK(pidgin_media_mute_toggled), |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
887 gtkmedia); |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
888 |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
889 gtk_box_pack_end(GTK_BOX(recv_widget), |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
890 pidgin_media_add_audio_widget(gtkmedia, |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
891 PURPLE_MEDIA_SEND_AUDIO, NULL), FALSE, FALSE, 0); |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
892 } |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
893 |
28191
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
894 if (type & PURPLE_MEDIA_AUDIO && |
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
895 gtkmedia->priv->level_handler_id == 0) { |
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
896 gtkmedia->priv->level_handler_id = g_signal_connect( |
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
897 media, "level", G_CALLBACK(level_message_cb), |
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
898 gtkmedia); |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
899 } |
26027
94224a5563db
Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
900 |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
901 if (send_widget != NULL) |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
902 gtkmedia->priv->send_widget = send_widget; |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
903 if (recv_widget != NULL) |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
904 gtkmedia->priv->recv_widget = recv_widget; |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
905 if (button_widget != NULL) { |
28199
c1687897825f
Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28192
diff
changeset
|
906 gtkmedia->priv->button_widget = button_widget; |
30678
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
907 gtk_widget_show(GTK_WIDGET(button_widget)); |
5ec2d3617538
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <ml@update.uu.se>
parents:
29028
diff
changeset
|
908 } |
26027
94224a5563db
Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
909 |
26466
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26464
diff
changeset
|
910 if (purple_media_is_initiator(media, sid, NULL) == FALSE) { |
26464
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
911 if (gtkmedia->priv->timeout_id != 0) |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
912 g_source_remove(gtkmedia->priv->timeout_id); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
913 gtkmedia->priv->request_type |= type; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
914 gtkmedia->priv->timeout_id = g_timeout_add(500, |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
915 (GSourceFunc)pidgin_request_timeout_cb, |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
916 gtkmedia); |
25687
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
917 } |
26160
27b553a07800
Make the sinks better default sizes and display them immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26159
diff
changeset
|
918 |
28472
092659955afb
Set the icon of media corresponding to the media type
Marcus Lundblad <ml@update.uu.se>
parents:
28454
diff
changeset
|
919 /* set the window icon according to the type */ |
092659955afb
Set the icon of media corresponding to the media type
Marcus Lundblad <ml@update.uu.se>
parents:
28454
diff
changeset
|
920 if (type & PURPLE_MEDIA_VIDEO) { |
28491 | 921 icon = gtk_widget_render_icon(GTK_WIDGET(gtkmedia), |
922 PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, | |
28472
092659955afb
Set the icon of media corresponding to the media type
Marcus Lundblad <ml@update.uu.se>
parents:
28454
diff
changeset
|
923 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_LARGE), NULL); |
092659955afb
Set the icon of media corresponding to the media type
Marcus Lundblad <ml@update.uu.se>
parents:
28454
diff
changeset
|
924 } else if (type & PURPLE_MEDIA_AUDIO) { |
28491 | 925 icon = gtk_widget_render_icon(GTK_WIDGET(gtkmedia), |
926 PIDGIN_STOCK_TOOLBAR_AUDIO_CALL, | |
28472
092659955afb
Set the icon of media corresponding to the media type
Marcus Lundblad <ml@update.uu.se>
parents:
28454
diff
changeset
|
927 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_LARGE), NULL); |
092659955afb
Set the icon of media corresponding to the media type
Marcus Lundblad <ml@update.uu.se>
parents:
28454
diff
changeset
|
928 } |
092659955afb
Set the icon of media corresponding to the media type
Marcus Lundblad <ml@update.uu.se>
parents:
28454
diff
changeset
|
929 |
092659955afb
Set the icon of media corresponding to the media type
Marcus Lundblad <ml@update.uu.se>
parents:
28454
diff
changeset
|
930 if (icon) { |
092659955afb
Set the icon of media corresponding to the media type
Marcus Lundblad <ml@update.uu.se>
parents:
28454
diff
changeset
|
931 gtk_window_set_icon(GTK_WINDOW(gtkmedia), icon); |
092659955afb
Set the icon of media corresponding to the media type
Marcus Lundblad <ml@update.uu.se>
parents:
28454
diff
changeset
|
932 g_object_unref(icon); |
092659955afb
Set the icon of media corresponding to the media type
Marcus Lundblad <ml@update.uu.se>
parents:
28454
diff
changeset
|
933 } |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31390
diff
changeset
|
934 |
26160
27b553a07800
Make the sinks better default sizes and display them immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26159
diff
changeset
|
935 gtk_widget_show(gtkmedia->priv->display); |
25687
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
936 } |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
937 |
ddbea813862e
Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25686
diff
changeset
|
938 static void |
26411
86bc2d34f689
Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
939 pidgin_media_state_changed_cb(PurpleMedia *media, PurpleMediaState state, |
26114
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
940 gchar *sid, gchar *name, PidginMedia *gtkmedia) |
25634
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
941 { |
26411
86bc2d34f689
Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
942 purple_debug_info("gtkmedia", "state: %d sid: %s name: %s\n", |
28045
813f2eb3fdc8
Fixes for some potential printf("%s", NULL) type of problems from Maiku
Stu Tomlinson <stu@nosnilmot.com>
parents:
28043
diff
changeset
|
943 state, sid ? sid : "(null)", name ? name : "(null)"); |
31870
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
944 if (state == PURPLE_MEDIA_STATE_END) { |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
945 if (sid != NULL && name != NULL) { |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
946 pidgin_media_remove_widget(gtkmedia, sid, name); |
9f8da7c21afd
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
jakub.adam@ktknet.cz
parents:
31805
diff
changeset
|
947 } else if (sid == NULL && name == NULL) { |
26114
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
948 pidgin_media_emit_message(gtkmedia, |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
949 _("The call has been terminated.")); |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
950 gtk_widget_destroy(GTK_WIDGET(gtkmedia)); |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
951 } |
26411
86bc2d34f689
Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
952 } else if (state == PURPLE_MEDIA_STATE_NEW && |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
953 sid != NULL && name != NULL) { |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
954 pidgin_media_ready_cb(media, gtkmedia, sid); |
26114
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
955 } |
25550 | 956 } |
957 | |
958 static void | |
26406
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
959 pidgin_media_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, |
26448
4e1286e76f1f
Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26446
diff
changeset
|
960 gchar *sid, gchar *name, gboolean local, |
4e1286e76f1f
Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26446
diff
changeset
|
961 PidginMedia *gtkmedia) |
26406
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
962 { |
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
963 if (type == PURPLE_MEDIA_INFO_REJECT) { |
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
964 pidgin_media_emit_message(gtkmedia, |
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
965 _("You have rejected the call.")); |
28176
584fa66dfb31
Remove the "accepted" signal from PurpleMedia as it was redundant.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28045
diff
changeset
|
966 } else if (type == PURPLE_MEDIA_INFO_ACCEPT) { |
28454
7a66b8d66456
There's no reason to ask for acceptance if the stream has been accepted. Also,
maiku@pidgin.im
parents:
28397
diff
changeset
|
967 if (local == TRUE) |
7a66b8d66456
There's no reason to ask for acceptance if the stream has been accepted. Also,
maiku@pidgin.im
parents:
28397
diff
changeset
|
968 purple_request_close_with_handle(gtkmedia); |
28176
584fa66dfb31
Remove the "accepted" signal from PurpleMedia as it was redundant.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28045
diff
changeset
|
969 pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED); |
584fa66dfb31
Remove the "accepted" signal from PurpleMedia as it was redundant.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28045
diff
changeset
|
970 pidgin_media_emit_message(gtkmedia, _("Call in progress.")); |
584fa66dfb31
Remove the "accepted" signal from PurpleMedia as it was redundant.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28045
diff
changeset
|
971 gtk_statusbar_push(GTK_STATUSBAR(gtkmedia->priv->statusbar), |
584fa66dfb31
Remove the "accepted" signal from PurpleMedia as it was redundant.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28045
diff
changeset
|
972 0, _("Call in progress.")); |
584fa66dfb31
Remove the "accepted" signal from PurpleMedia as it was redundant.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28045
diff
changeset
|
973 gtk_widget_show(GTK_WIDGET(gtkmedia)); |
26406
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
974 } |
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
975 } |
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
976 |
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
977 static void |
25550 | 978 pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
979 { | |
980 PidginMedia *media; | |
981 g_return_if_fail(PIDGIN_IS_MEDIA(object)); | |
25634
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
982 |
25550 | 983 media = PIDGIN_MEDIA(object); |
984 switch (prop_id) { | |
985 case PROP_MEDIA: | |
26115
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
986 { |
25550 | 987 if (media->priv->media) |
988 g_object_unref(media->priv->media); | |
989 media->priv->media = g_value_get_object(value); | |
990 g_object_ref(media->priv->media); | |
26115
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
991 |
26466
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26464
diff
changeset
|
992 if (purple_media_is_initiator(media->priv->media, |
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26464
diff
changeset
|
993 NULL, NULL) == TRUE) |
26115
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
994 pidgin_media_set_state(media, PIDGIN_MEDIA_WAITING); |
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
995 else |
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
996 pidgin_media_set_state(media, PIDGIN_MEDIA_REQUESTED); |
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
997 |
26058
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
998 g_signal_connect(G_OBJECT(media->priv->media), "error", |
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
999 G_CALLBACK(pidgin_media_error_cb), media); |
26114
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
1000 g_signal_connect(G_OBJECT(media->priv->media), "state-changed", |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
1001 G_CALLBACK(pidgin_media_state_changed_cb), media); |
26406
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
1002 g_signal_connect(G_OBJECT(media->priv->media), "stream-info", |
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
1003 G_CALLBACK(pidgin_media_stream_info_cb), media); |
25550 | 1004 break; |
26115
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
1005 } |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
1006 case PROP_SCREENNAME: |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
1007 if (media->priv->screenname) |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
1008 g_free(media->priv->screenname); |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
1009 media->priv->screenname = g_value_dup_string(value); |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
1010 break; |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
1011 default: |
25550 | 1012 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
1013 break; | |
1014 } | |
1015 } | |
1016 | |
1017 static void | |
1018 pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) | |
1019 { | |
1020 PidginMedia *media; | |
1021 g_return_if_fail(PIDGIN_IS_MEDIA(object)); | |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
1022 |
25550 | 1023 media = PIDGIN_MEDIA(object); |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
1024 |
25550 | 1025 switch (prop_id) { |
1026 case PROP_MEDIA: | |
1027 g_value_set_object(value, media->priv->media); | |
1028 break; | |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
1029 case PROP_SCREENNAME: |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
1030 g_value_set_string(value, media->priv->screenname); |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
1031 break; |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
1032 default: |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
1033 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
25550 | 1034 break; |
1035 } | |
1036 } | |
1037 | |
26446
e114ed3c8cfe
No reason for this to be public API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26440
diff
changeset
|
1038 static GtkWidget * |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
1039 pidgin_media_new(PurpleMedia *media, const gchar *screenname) |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
1040 { |
25671
12a16471f94e
Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
1041 PidginMedia *gtkmedia = g_object_new(pidgin_media_get_type(), |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
1042 "media", media, |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
1043 "screenname", screenname, NULL); |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
1044 return GTK_WIDGET(gtkmedia); |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
1045 } |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
1046 |
25643
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
1047 static void |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
1048 pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state) |
25550 | 1049 { |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
1050 gtkmedia->priv->state = state; |
25550 | 1051 } |
1052 | |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1053 static gboolean |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1054 pidgin_media_new_cb(PurpleMediaManager *manager, PurpleMedia *media, |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26596
diff
changeset
|
1055 PurpleAccount *account, gchar *screenname, gpointer nul) |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1056 { |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1057 PidginMedia *gtkmedia = PIDGIN_MEDIA( |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1058 pidgin_media_new(media, screenname)); |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26596
diff
changeset
|
1059 PurpleBuddy *buddy = purple_find_buddy(account, screenname); |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31390
diff
changeset
|
1060 const gchar *alias = buddy ? |
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31390
diff
changeset
|
1061 purple_buddy_get_contact_alias(buddy) : screenname; |
26151
e6d548856fcd
Use aliases for the media window title and the request window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26149
diff
changeset
|
1062 gtk_window_set_title(GTK_WINDOW(gtkmedia), alias); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1063 |
26466
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26464
diff
changeset
|
1064 if (purple_media_is_initiator(media, NULL, NULL) == TRUE) |
26149
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
1065 gtk_widget_show(GTK_WIDGET(gtkmedia)); |
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
1066 |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1067 return TRUE; |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1068 } |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1069 |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1070 static GstElement * |
26474
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
1071 create_default_video_src(PurpleMedia *media, |
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
1072 const gchar *session_id, const gchar *participant) |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1073 { |
31551
4ce69a55f2c6
Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents:
31534
diff
changeset
|
1074 GstElement *sendbin, *src; |
26424
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
1075 GstPad *pad; |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
1076 GstPad *ghost; |
26495
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1077 |
28231 | 1078 #ifdef _WIN32 |
1079 /* autovideosrc doesn't pick ksvideosrc for some reason */ | |
1080 src = gst_element_factory_make("ksvideosrc", NULL); | |
1081 if (src == NULL) | |
1082 src = gst_element_factory_make("dshowvideosrc", NULL); | |
1083 if (src == NULL) | |
1084 src = gst_element_factory_make("autovideosrc", NULL); | |
1085 #else | |
26495
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1086 src = gst_element_factory_make("gconfvideosrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1087 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1088 src = gst_element_factory_make("autovideosrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1089 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1090 src = gst_element_factory_make("v4l2src", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1091 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1092 src = gst_element_factory_make("v4lsrc", NULL); |
28231 | 1093 #endif |
26495
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1094 if (src == NULL) { |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1095 purple_debug_error("gtkmedia", "Unable to find a suitable " |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1096 "element for the default video source.\n"); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1097 return NULL; |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1098 } |
26424
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
1099 |
26459
452be048bded
Unique elements ought to be named the same as their id.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26457
diff
changeset
|
1100 sendbin = gst_bin_new("pidgindefaultvideosrc"); |
26424
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
1101 |
31551
4ce69a55f2c6
Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents:
31534
diff
changeset
|
1102 gst_bin_add(GST_BIN(sendbin), src); |
26424
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
1103 |
31551
4ce69a55f2c6
Add a GstCapsFilter between every video source and the rest of the pipeline.
jakub.adam@ktknet.cz
parents:
31534
diff
changeset
|
1104 pad = gst_element_get_static_pad(src, "src"); |
26424
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
1105 ghost = gst_ghost_pad_new("ghostsrc", pad); |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
1106 gst_object_unref(pad); |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
1107 gst_element_add_pad(sendbin, ghost); |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
1108 |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
1109 return sendbin; |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1110 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1111 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1112 static GstElement * |
26474
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
1113 create_default_video_sink(PurpleMedia *media, |
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
1114 const gchar *session_id, const gchar *participant) |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1115 { |
26495
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1116 GstElement *sink = gst_element_factory_make("gconfvideosink", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1117 if (sink == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1118 sink = gst_element_factory_make("autovideosink", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1119 if (sink == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1120 purple_debug_error("gtkmedia", "Unable to find a suitable " |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1121 "element for the default video sink.\n"); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1122 return sink; |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1123 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1124 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1125 static GstElement * |
26474
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
1126 create_default_audio_src(PurpleMedia *media, |
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
1127 const gchar *session_id, const gchar *participant) |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1128 { |
28191
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
1129 GstElement *src; |
26495
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1130 src = gst_element_factory_make("gconfaudiosrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1131 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1132 src = gst_element_factory_make("autoaudiosrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1133 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1134 src = gst_element_factory_make("alsasrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1135 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1136 src = gst_element_factory_make("osssrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1137 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1138 src = gst_element_factory_make("dshowaudiosrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1139 if (src == NULL) { |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1140 purple_debug_error("gtkmedia", "Unable to find a suitable " |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1141 "element for the default audio source.\n"); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1142 return NULL; |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1143 } |
28191
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
1144 gst_element_set_name(src, "pidgindefaultaudiosrc"); |
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
1145 return src; |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1146 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1147 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1148 static GstElement * |
26474
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
1149 create_default_audio_sink(PurpleMedia *media, |
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
1150 const gchar *session_id, const gchar *participant) |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1151 { |
28191
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
1152 GstElement *sink; |
26495
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1153 sink = gst_element_factory_make("gconfaudiosink", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1154 if (sink == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1155 sink = gst_element_factory_make("autoaudiosink",NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1156 if (sink == NULL) { |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1157 purple_debug_error("gtkmedia", "Unable to find a suitable " |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1158 "element for the default audio sink.\n"); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1159 return NULL; |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1160 } |
28191
c8ff0a9cf8cc
Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28176
diff
changeset
|
1161 return sink; |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1162 } |
26457
0ee10b3e8ee6
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26455
diff
changeset
|
1163 #endif /* USE_VV */ |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
1164 |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1165 void |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1166 pidgin_medias_init(void) |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1167 { |
26457
0ee10b3e8ee6
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26455
diff
changeset
|
1168 #ifdef USE_VV |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
1169 PurpleMediaManager *manager = purple_media_manager_get(); |
26484
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1170 PurpleMediaElementInfo *default_video_src = |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1171 g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1172 "id", "pidgindefaultvideosrc", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1173 "name", "Pidgin Default Video Source", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1174 "type", PURPLE_MEDIA_ELEMENT_VIDEO |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1175 | PURPLE_MEDIA_ELEMENT_SRC |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1176 | PURPLE_MEDIA_ELEMENT_ONE_SRC |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1177 | PURPLE_MEDIA_ELEMENT_UNIQUE, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1178 "create-cb", create_default_video_src, NULL); |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1179 PurpleMediaElementInfo *default_video_sink = |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1180 g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1181 "id", "pidgindefaultvideosink", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1182 "name", "Pidgin Default Video Sink", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1183 "type", PURPLE_MEDIA_ELEMENT_VIDEO |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1184 | PURPLE_MEDIA_ELEMENT_SINK |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1185 | PURPLE_MEDIA_ELEMENT_ONE_SINK, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1186 "create-cb", create_default_video_sink, NULL); |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1187 PurpleMediaElementInfo *default_audio_src = |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1188 g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1189 "id", "pidgindefaultaudiosrc", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1190 "name", "Pidgin Default Audio Source", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1191 "type", PURPLE_MEDIA_ELEMENT_AUDIO |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1192 | PURPLE_MEDIA_ELEMENT_SRC |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1193 | PURPLE_MEDIA_ELEMENT_ONE_SRC |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1194 | PURPLE_MEDIA_ELEMENT_UNIQUE, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1195 "create-cb", create_default_audio_src, NULL); |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1196 PurpleMediaElementInfo *default_audio_sink = |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1197 g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1198 "id", "pidgindefaultaudiosink", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1199 "name", "Pidgin Default Audio Sink", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1200 "type", PURPLE_MEDIA_ELEMENT_AUDIO |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1201 | PURPLE_MEDIA_ELEMENT_SINK |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1202 | PURPLE_MEDIA_ELEMENT_ONE_SINK, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1203 "create-cb", create_default_audio_sink, NULL); |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1204 |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
1205 g_signal_connect(G_OBJECT(manager), "init-media", |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1206 G_CALLBACK(pidgin_media_new_cb), NULL); |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
1207 |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31390
diff
changeset
|
1208 purple_media_manager_set_ui_caps(manager, |
26473
24feaf9cfbf1
Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26466
diff
changeset
|
1209 PURPLE_MEDIA_CAPS_AUDIO | |
24feaf9cfbf1
Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26466
diff
changeset
|
1210 PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION | |
24feaf9cfbf1
Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26466
diff
changeset
|
1211 PURPLE_MEDIA_CAPS_VIDEO | |
24feaf9cfbf1
Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26466
diff
changeset
|
1212 PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION | |
24feaf9cfbf1
Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26466
diff
changeset
|
1213 PURPLE_MEDIA_CAPS_AUDIO_VIDEO); |
24feaf9cfbf1
Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26466
diff
changeset
|
1214 |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
1215 purple_debug_info("gtkmedia", "Registering media element types\n"); |
26484
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1216 purple_media_manager_set_active_element(manager, default_video_src); |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1217 purple_media_manager_set_active_element(manager, default_video_sink); |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1218 purple_media_manager_set_active_element(manager, default_audio_src); |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1219 purple_media_manager_set_active_element(manager, default_audio_sink); |
26457
0ee10b3e8ee6
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26455
diff
changeset
|
1220 #endif |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1221 } |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1222 |