Thu, 19 Dec 2019 05:00:44 -0500
Convert PidginRoomlistDialog to Glade.
| 35454 | 1 | /* pidgin |
| 19886 | 2 | * |
| 3 | * Pidgin is the legal property of its developers, whose names are too numerous | |
| 4 | * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 5 | * source distribution. | |
| 6 | * | |
| 7 | * This program is free software; you can redistribute it and/or modify | |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * along with this program; if not, write to the Free Software | |
|
28321
c8d617c408ab
Update various header copyrights thanks to licensecheck.
Paul Aurich <darkrain42@pidgin.im>
parents:
28278
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 19886 | 20 | */ |
| 21 | ||
|
28981
4e3922ab4844
Include 'internal.h' before all other headers to make some non-gcc compilers happy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28709
diff
changeset
|
22 | #include "internal.h" |
|
23728
77a48a216424
Listen to the media pipeline and display errors.
Michael Ruprecht <maiku@pidgin.im>
parents:
23724
diff
changeset
|
23 | #include "debug.h" |
| 19886 | 24 | #include "connection.h" |
| 25 | #include "media.h" | |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
26 | #include "mediamanager.h" |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
27 | #include "pidgin.h" |
|
26273
34eb5919488a
Use request API for a media invitation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26272
diff
changeset
|
28 | #include "request.h" |
| 19886 | 29 | |
| 30 | #include "gtkmedia.h" | |
|
26298
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
31 | #include "gtkutils.h" |
|
28398
acc1ddff586b
Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents:
28385
diff
changeset
|
32 | #include "pidginstock.h" |
| 19886 | 33 | |
|
23704
9b88c9b23aed
Use USE_VV instead of USE_FARSIGHT.
Michael Ruprecht <maiku@pidgin.im>
parents:
23701
diff
changeset
|
34 | #ifdef USE_VV |
|
26639
a56751b4291d
Gstreamer shouldn't be a requirement if USE_VV isn't defined.
Daniel Atallah <datallah@pidgin.im>
parents:
26629
diff
changeset
|
35 | #include "media-gst.h" |
| 19886 | 36 | |
|
33520
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
37 | #ifdef GDK_WINDOWING_WIN32 |
|
27972
54d25d73c6c8
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
26746
diff
changeset
|
38 | #include <gdk/gdkwin32.h> |
|
54d25d73c6c8
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
26746
diff
changeset
|
39 | #endif |
|
33520
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
40 | #ifdef GDK_WINDOWING_X11 |
|
33478
e6e3ac31f0b4
Move gdkx.h include to the file that really needs it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33277
diff
changeset
|
41 | #include <gdk/gdkx.h> |
|
33520
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
42 | #endif |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
43 | #ifdef GDK_WINDOWING_QUARTZ |
|
32752
8163ce6c42a6
Allow compile of V/V on OSX without X11. Patch by Eion Robb.
Eion Robb <eion@robbmob.com>
parents:
32751
diff
changeset
|
44 | #include <gdk/gdkquartz.h> |
|
27972
54d25d73c6c8
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
26746
diff
changeset
|
45 | #endif |
|
36312
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
46 | #include <gdk/gdkkeysyms.h> |
|
27972
54d25d73c6c8
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
26746
diff
changeset
|
47 | |
|
26503
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
48 | #define PIDGIN_TYPE_MEDIA (pidgin_media_get_type()) |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
49 | #define PIDGIN_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PIDGIN_TYPE_MEDIA, PidginMedia)) |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
50 | #define PIDGIN_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PIDGIN_TYPE_MEDIA, PidginMediaClass)) |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
51 | #define PIDGIN_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PIDGIN_TYPE_MEDIA)) |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
52 | #define PIDGIN_IS_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PIDGIN_TYPE_MEDIA)) |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
53 | #define PIDGIN_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PIDGIN_TYPE_MEDIA, PidginMediaClass)) |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
54 | |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
55 | typedef struct _PidginMedia PidginMedia; |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
56 | typedef struct _PidginMediaClass PidginMediaClass; |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
57 | typedef struct _PidginMediaPrivate PidginMediaPrivate; |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
58 | |
|
22682
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
59 | typedef enum |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
60 | { |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
61 | /* Waiting for response */ |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
62 | PIDGIN_MEDIA_WAITING = 1, |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
63 | /* Got request */ |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
64 | PIDGIN_MEDIA_REQUESTED, |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
65 | /* Accepted call */ |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
66 | PIDGIN_MEDIA_ACCEPTED, |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
67 | /* Rejected call */ |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
68 | PIDGIN_MEDIA_REJECTED, |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
69 | } PidginMediaState; |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
70 | |
|
26503
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
71 | struct _PidginMediaClass |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
72 | { |
|
38587
7a36a36f66b7
gtkmedia: Use GtkApplicationWindow as base class
Mike Ruprecht <cmaiku@gmail.com>
parents:
38027
diff
changeset
|
73 | GtkApplicationWindowClass parent_class; |
|
26503
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
74 | }; |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
75 | |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
76 | struct _PidginMedia |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
77 | { |
|
38587
7a36a36f66b7
gtkmedia: Use GtkApplicationWindow as base class
Mike Ruprecht <cmaiku@gmail.com>
parents:
38027
diff
changeset
|
78 | GtkApplicationWindow parent; |
|
26503
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
79 | PidginMediaPrivate *priv; |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
80 | }; |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
81 | |
| 19886 | 82 | struct _PidginMediaPrivate |
| 83 | { | |
| 84 | PurpleMedia *media; | |
|
26184
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
85 | gchar *screenname; |
|
28125
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28111
diff
changeset
|
86 | gulong level_handler_id; |
| 19886 | 87 | |
|
38588
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
88 | GtkBuilder *ui; |
|
26298
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
89 | GtkWidget *menubar; |
|
26285
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
90 | GtkWidget *statusbar; |
|
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
91 | |
|
28709
47bd5eac3afd
Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
28421
diff
changeset
|
92 | GtkWidget *hold; |
|
26103
1cdefa229226
Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents:
26096
diff
changeset
|
93 | GtkWidget *mute; |
|
28133
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
94 | GtkWidget *pause; |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
95 | |
| 19886 | 96 | GtkWidget *send_progress; |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
97 | GHashTable *recv_progressbars; |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
98 | |
|
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
99 | PidginMediaState state; |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
100 | |
|
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
101 | GtkWidget *display; |
|
26242
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
102 | GtkWidget *send_widget; |
|
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
103 | GtkWidget *recv_widget; |
|
28133
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
104 | GtkWidget *button_widget; |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
105 | GtkWidget *local_video; |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
106 | GHashTable *remote_videos; |
|
26512
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
107 | |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
108 | guint timeout_id; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
109 | PurpleMediaSessionType request_type; |
| 19886 | 110 | }; |
| 111 | ||
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39129
diff
changeset
|
112 | static GType pidgin_media_get_type(void); |
| 19886 | 113 | |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39129
diff
changeset
|
114 | G_DEFINE_TYPE_WITH_PRIVATE(PidginMedia, pidgin_media, |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39129
diff
changeset
|
115 | GTK_TYPE_APPLICATION_WINDOW); |
|
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39129
diff
changeset
|
116 | |
|
26210
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
117 | static void pidgin_media_dispose (GObject *object); |
| 19886 | 118 | static void pidgin_media_finalize (GObject *object); |
| 119 | static void pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); | |
| 120 | static void pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); | |
|
22682
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
121 | static void pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state); |
| 19886 | 122 | |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
123 | #if 0 |
| 19886 | 124 | enum { |
| 125 | LAST_SIGNAL | |
| 126 | }; | |
| 127 | static guint pidgin_media_signals[LAST_SIGNAL] = {0}; | |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
128 | #endif |
| 19886 | 129 | |
| 130 | enum { | |
| 131 | PROP_0, | |
| 132 | PROP_MEDIA, | |
|
28126
6b4a7ccec66f
Remove send_level and recv_level from PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
28125
diff
changeset
|
133 | PROP_SCREENNAME |
| 19886 | 134 | }; |
| 135 | ||
| 136 | ||
| 137 | static void | |
| 138 | pidgin_media_class_init (PidginMediaClass *klass) | |
| 139 | { | |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39129
diff
changeset
|
140 | GObjectClass *gobject_class = G_OBJECT_CLASS(klass); |
| 23729 | 141 | /* GtkContainerClass *container_class = (GtkContainerClass*)klass; */ |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
142 | |
|
26210
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
143 | gobject_class->dispose = pidgin_media_dispose; |
| 19886 | 144 | gobject_class->finalize = pidgin_media_finalize; |
| 145 | gobject_class->set_property = pidgin_media_set_property; | |
| 146 | gobject_class->get_property = pidgin_media_get_property; | |
| 147 | ||
| 148 | g_object_class_install_property(gobject_class, PROP_MEDIA, | |
| 149 | g_param_spec_object("media", | |
| 150 | "PurpleMedia", | |
| 151 | "The PurpleMedia associated with this media.", | |
| 152 | PURPLE_TYPE_MEDIA, | |
|
35060
195dbb3b6432
pidgin: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
153 | G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
|
26184
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
154 | g_object_class_install_property(gobject_class, PROP_SCREENNAME, |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
155 | g_param_spec_string("screenname", |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
156 | "Screenname", |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
157 | "The screenname of the user this session is with.", |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
158 | NULL, |
|
35060
195dbb3b6432
pidgin: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
159 | G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 19886 | 160 | } |
| 161 | ||
|
26103
1cdefa229226
Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents:
26096
diff
changeset
|
162 | static void |
|
38588
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
163 | pidgin_media_hangup_activate_cb(GSimpleAction *action, GVariant *parameter, |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
164 | gpointer user_data) |
|
28709
47bd5eac3afd
Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
28421
diff
changeset
|
165 | { |
|
38588
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
166 | PidginMedia *media = PIDGIN_MEDIA(user_data); |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
167 | |
|
28709
47bd5eac3afd
Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
28421
diff
changeset
|
168 | purple_media_stream_info(media->priv->media, |
|
38588
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
169 | PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE); |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
170 | } |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
171 | |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
172 | static void |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
173 | pidgin_media_hold_change_state_cb(GSimpleAction *action, GVariant *value, |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
174 | gpointer user_data) |
|
28709
47bd5eac3afd
Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
28421
diff
changeset
|
175 | { |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
176 | PidginMedia *media = PIDGIN_MEDIA(user_data); |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
177 | |
|
28709
47bd5eac3afd
Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
28421
diff
changeset
|
178 | purple_media_stream_info(media->priv->media, |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
179 | g_variant_get_boolean(value) ? |
|
28709
47bd5eac3afd
Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
28421
diff
changeset
|
180 | PURPLE_MEDIA_INFO_HOLD : PURPLE_MEDIA_INFO_UNHOLD, |
|
47bd5eac3afd
Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
28421
diff
changeset
|
181 | NULL, NULL, TRUE); |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
182 | |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
183 | g_simple_action_set_state(action, value); |
|
28709
47bd5eac3afd
Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
28421
diff
changeset
|
184 | } |
|
47bd5eac3afd
Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
28421
diff
changeset
|
185 | |
|
47bd5eac3afd
Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
28421
diff
changeset
|
186 | static void |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
187 | pidgin_media_mute_change_state_cb(GSimpleAction *action, GVariant *value, |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
188 | gpointer user_data) |
|
26103
1cdefa229226
Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents:
26096
diff
changeset
|
189 | { |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
190 | PidginMedia *media = PIDGIN_MEDIA(user_data); |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
191 | |
|
26502
f0c8338ca7da
Remove purple_media_mute.
Michael Ruprecht <maiku@pidgin.im>
parents:
26501
diff
changeset
|
192 | purple_media_stream_info(media->priv->media, |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
193 | g_variant_get_boolean(value) ? |
|
26502
f0c8338ca7da
Remove purple_media_mute.
Michael Ruprecht <maiku@pidgin.im>
parents:
26501
diff
changeset
|
194 | PURPLE_MEDIA_INFO_MUTE : PURPLE_MEDIA_INFO_UNMUTE, |
|
f0c8338ca7da
Remove purple_media_mute.
Michael Ruprecht <maiku@pidgin.im>
parents:
26501
diff
changeset
|
195 | NULL, NULL, TRUE); |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
196 | |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
197 | g_simple_action_set_state(action, value); |
|
26103
1cdefa229226
Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents:
26096
diff
changeset
|
198 | } |
| 19886 | 199 | |
|
28133
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
200 | static void |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
201 | pidgin_media_pause_change_state_cb(GSimpleAction *action, GVariant *value, |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
202 | gpointer user_data) |
|
28133
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
203 | { |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
204 | PidginMedia *media = PIDGIN_MEDIA(user_data); |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
205 | |
|
28133
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
206 | purple_media_stream_info(media->priv->media, |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
207 | g_variant_get_boolean(value) ? |
|
28133
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
208 | PURPLE_MEDIA_INFO_PAUSE : PURPLE_MEDIA_INFO_UNPAUSE, |
|
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
209 | NULL, NULL, TRUE); |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
210 | |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
211 | g_simple_action_set_state(action, value); |
|
28133
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
212 | } |
|
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
213 | |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
214 | static gboolean |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
215 | pidgin_media_delete_event_cb(GtkWidget *widget, |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
216 | GdkEvent *event, PidginMedia *media) |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
217 | { |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
218 | if (media->priv->media) |
|
38589
94c055910a4b
gtkmedia: Use "Hangup" action in window's "delete-event"
Mike Ruprecht <cmaiku@gmail.com>
parents:
38588
diff
changeset
|
219 | g_action_group_activate_action(G_ACTION_GROUP(media), |
|
94c055910a4b
gtkmedia: Use "Hangup" action in window's "delete-event"
Mike Ruprecht <cmaiku@gmail.com>
parents:
38588
diff
changeset
|
220 | "Hangup", NULL); |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
221 | return FALSE; |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
222 | } |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
223 | |
|
27972
54d25d73c6c8
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
26746
diff
changeset
|
224 | #ifdef HAVE_X11 |
|
26283
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
225 | static int |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
226 | pidgin_x_error_handler(Display *display, XErrorEvent *event) |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
227 | { |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
228 | const gchar *error_type; |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
229 | switch (event->error_code) { |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
230 | #define XERRORCASE(type) case type: error_type = #type; break |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
231 | XERRORCASE(BadAccess); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
232 | XERRORCASE(BadAlloc); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
233 | XERRORCASE(BadAtom); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
234 | XERRORCASE(BadColor); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
235 | XERRORCASE(BadCursor); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
236 | XERRORCASE(BadDrawable); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
237 | XERRORCASE(BadFont); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
238 | XERRORCASE(BadGC); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
239 | XERRORCASE(BadIDChoice); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
240 | XERRORCASE(BadImplementation); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
241 | XERRORCASE(BadLength); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
242 | XERRORCASE(BadMatch); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
243 | XERRORCASE(BadName); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
244 | XERRORCASE(BadPixmap); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
245 | XERRORCASE(BadRequest); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
246 | XERRORCASE(BadValue); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
247 | XERRORCASE(BadWindow); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
248 | #undef XERRORCASE |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
249 | default: |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
250 | error_type = "unknown"; |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
251 | break; |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
252 | } |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
253 | purple_debug_error("media", "A %s Xlib error has occurred. " |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
254 | "The program would normally crash now.\n", |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
255 | error_type); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
256 | return 0; |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
257 | } |
|
27972
54d25d73c6c8
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
26746
diff
changeset
|
258 | #endif |
|
26283
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
259 | |
|
38588
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
260 | static const GActionEntry media_action_entries[] = { |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
261 | { "Hangup", pidgin_media_hangup_activate_cb }, |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
262 | { "Hold", NULL, NULL, "false", pidgin_media_hold_change_state_cb }, |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
263 | { "Mute", NULL, NULL, "false", pidgin_media_mute_change_state_cb }, |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
264 | { "Pause", NULL, NULL, "false", pidgin_media_pause_change_state_cb }, |
|
26298
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
265 | }; |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
266 | |
|
38588
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
267 | static const gchar *media_menu = |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
268 | "<interface>" |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
269 | "<menu id='MediaMenu'>" |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
270 | "<submenu>" |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
271 | "<attribute name='label' translatable='yes'>_Media</attribute>" |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
272 | "<section>" |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
273 | "<item>" |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
274 | "<attribute name='label' translatable='yes'>_Hangup</attribute>" |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
275 | "<attribute name='action'>win.Hangup</attribute>" |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
276 | "</item>" |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
277 | "</section>" |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
278 | "</submenu>" |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
279 | "</menu>" |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
280 | "</interface>"; |
|
26298
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
281 | |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
282 | static GtkWidget * |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
283 | setup_menubar(PidginMedia *window) |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
284 | { |
|
30554
c429e21a08b9
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30481
diff
changeset
|
285 | GError *error; |
|
26298
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
286 | GtkWidget *menu; |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
287 | |
|
38588
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
288 | window->priv->ui = gtk_builder_new(); |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
289 | gtk_builder_set_translation_domain(window->priv->ui, PACKAGE); |
|
26298
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
290 | |
|
30554
c429e21a08b9
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30481
diff
changeset
|
291 | error = NULL; |
|
38588
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
292 | if (!gtk_builder_add_from_string(window->priv->ui, media_menu, -1, |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
293 | &error)) |
|
30554
c429e21a08b9
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30481
diff
changeset
|
294 | { |
|
c429e21a08b9
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30481
diff
changeset
|
295 | g_message("building menus failed: %s", error->message); |
|
c429e21a08b9
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30481
diff
changeset
|
296 | g_error_free(error); |
|
c429e21a08b9
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30481
diff
changeset
|
297 | exit(EXIT_FAILURE); |
|
c429e21a08b9
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30481
diff
changeset
|
298 | } |
|
26298
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
299 | |
|
38588
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
300 | menu = gtk_menu_bar_new_from_model(G_MENU_MODEL( |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
301 | gtk_builder_get_object(window->priv->ui, |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
302 | "MediaMenu"))); |
|
26298
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
303 | |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
304 | gtk_widget_show(menu); |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
305 | return menu; |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
306 | } |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
307 | |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
308 | static void |
| 19886 | 309 | pidgin_media_init (PidginMedia *media) |
| 310 | { | |
|
26624
d8be4ebac4f0
Improve the padding around the mute button.
Michael Ruprecht <maiku@pidgin.im>
parents:
26623
diff
changeset
|
311 | GtkWidget *vbox; |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39129
diff
changeset
|
312 | media->priv = pidgin_media_get_instance_private(media); |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
313 | |
|
27972
54d25d73c6c8
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
26746
diff
changeset
|
314 | #ifdef HAVE_X11 |
|
26283
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
315 | XSetErrorHandler(pidgin_x_error_handler); |
|
27972
54d25d73c6c8
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
26746
diff
changeset
|
316 | #endif |
|
26283
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
317 | |
|
38588
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
318 | g_action_map_add_action_entries(G_ACTION_MAP(media), |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
319 | media_action_entries, |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
320 | G_N_ELEMENTS(media_action_entries), media); |
|
258e213d1325
gtkmedia: Replace GtkUIManager usage with GtkBuilder
Mike Ruprecht <cmaiku@gmail.com>
parents:
38587
diff
changeset
|
321 | |
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35510
diff
changeset
|
322 | vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
323 | gtk_container_add(GTK_CONTAINER(media), vbox); |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
324 | |
|
26285
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
325 | media->priv->statusbar = gtk_statusbar_new(); |
|
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
326 | gtk_box_pack_end(GTK_BOX(vbox), media->priv->statusbar, |
|
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
327 | FALSE, FALSE, 0); |
|
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
328 | gtk_statusbar_push(GTK_STATUSBAR(media->priv->statusbar), |
|
26299
e7a85461e2a7
Remove unnecessary buttons and change statusbar to say "Calling..."
Michael Ruprecht <maiku@pidgin.im>
parents:
26298
diff
changeset
|
329 | 0, _("Calling...")); |
|
26285
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
330 | gtk_widget_show(media->priv->statusbar); |
|
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
331 | |
|
26298
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
332 | media->priv->menubar = setup_menubar(media); |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
333 | gtk_box_pack_start(GTK_BOX(vbox), media->priv->menubar, |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
334 | FALSE, TRUE, 0); |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
335 | |
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35510
diff
changeset
|
336 | media->priv->display = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PIDGIN_HIG_BOX_SPACE); |
|
26481
c5813c3ae985
Improve padding in media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
337 | gtk_container_set_border_width(GTK_CONTAINER(media->priv->display), |
|
c5813c3ae985
Improve padding in media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
338 | PIDGIN_HIG_BOX_SPACE); |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
339 | gtk_box_pack_start(GTK_BOX(vbox), media->priv->display, |
|
26255
3b0da2f49570
Remove unneeded pidgin_media_get_display_widget function.
Michael Ruprecht <maiku@pidgin.im>
parents:
26254
diff
changeset
|
340 | TRUE, TRUE, PIDGIN_HIG_BOX_SPACE); |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
341 | gtk_widget_show(vbox); |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
342 | |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
343 | g_signal_connect(G_OBJECT(media), "delete-event", |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
344 | G_CALLBACK(pidgin_media_delete_event_cb), media); |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
345 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
346 | media->priv->recv_progressbars = |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
347 | g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
348 | media->priv->remote_videos = |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
349 | g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
350 | } |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
351 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
352 | static gchar * |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
353 | create_key(const gchar *session_id, const gchar *participant) |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
354 | { |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
355 | return g_strdup_printf("%s_%s", session_id, participant); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
356 | } |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
357 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
358 | static void |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
359 | pidgin_media_insert_widget(PidginMedia *gtkmedia, GtkWidget *widget, |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
360 | const gchar *session_id, const gchar *participant) |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
361 | { |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
362 | gchar *key = create_key(session_id, participant); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
363 | PurpleMediaSessionType type = |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
364 | purple_media_get_session_type(gtkmedia->priv->media, session_id); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
365 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
366 | if (type & PURPLE_MEDIA_AUDIO) |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
367 | g_hash_table_insert(gtkmedia->priv->recv_progressbars, key, widget); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
368 | else if (type & PURPLE_MEDIA_VIDEO) |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
369 | g_hash_table_insert(gtkmedia->priv->remote_videos, key, widget); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
370 | } |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
371 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
372 | static GtkWidget * |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
373 | pidgin_media_get_widget(PidginMedia *gtkmedia, |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
374 | const gchar *session_id, const gchar *participant) |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
375 | { |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
376 | GtkWidget *widget = NULL; |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
377 | gchar *key = create_key(session_id, participant); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
378 | PurpleMediaSessionType type = |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
379 | purple_media_get_session_type(gtkmedia->priv->media, session_id); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
380 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
381 | if (type & PURPLE_MEDIA_AUDIO) |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
382 | widget = g_hash_table_lookup(gtkmedia->priv->recv_progressbars, key); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
383 | else if (type & PURPLE_MEDIA_VIDEO) |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
384 | widget = g_hash_table_lookup(gtkmedia->priv->remote_videos, key); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
385 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
386 | g_free(key); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
387 | return widget; |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
388 | } |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
389 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
390 | static void |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
391 | pidgin_media_remove_widget(PidginMedia *gtkmedia, |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
392 | const gchar *session_id, const gchar *participant) |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
393 | { |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
394 | GtkWidget *widget = pidgin_media_get_widget(gtkmedia, session_id, participant); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
395 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
396 | if (widget) { |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
397 | PurpleMediaSessionType type = |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
398 | purple_media_get_session_type(gtkmedia->priv->media, session_id); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
399 | gchar *key = create_key(session_id, participant); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
400 | GtkRequisition req; |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
401 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
402 | if (type & PURPLE_MEDIA_AUDIO) { |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
403 | g_hash_table_remove(gtkmedia->priv->recv_progressbars, key); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
404 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
405 | if (g_hash_table_size(gtkmedia->priv->recv_progressbars) == 0 && |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
406 | gtkmedia->priv->send_progress) { |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
407 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
408 | gtk_widget_destroy(gtkmedia->priv->send_progress); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
409 | gtkmedia->priv->send_progress = NULL; |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
410 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
411 | gtk_widget_destroy(gtkmedia->priv->mute); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
412 | gtkmedia->priv->mute = NULL; |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
413 | } |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
414 | } else if (type & PURPLE_MEDIA_VIDEO) { |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
415 | g_hash_table_remove(gtkmedia->priv->remote_videos, key); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
416 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
417 | if (g_hash_table_size(gtkmedia->priv->remote_videos) == 0 && |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
418 | gtkmedia->priv->local_video) { |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
419 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
420 | gtk_widget_destroy(gtkmedia->priv->local_video); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
421 | gtkmedia->priv->local_video = NULL; |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
422 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
423 | gtk_widget_destroy(gtkmedia->priv->pause); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
424 | gtkmedia->priv->pause = NULL; |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
425 | } |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
426 | } |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
427 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
428 | g_free(key); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
429 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
430 | gtk_widget_destroy(widget); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
431 | |
|
33277
d6229108ce71
Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
432 | gtk_widget_get_preferred_size(GTK_WIDGET(gtkmedia), NULL, &req); |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
433 | gtk_window_resize(GTK_WINDOW(gtkmedia), req.width, req.height); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
434 | } |
| 19886 | 435 | } |
| 436 | ||
|
28125
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28111
diff
changeset
|
437 | static void |
|
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28111
diff
changeset
|
438 | level_message_cb(PurpleMedia *media, gchar *session_id, gchar *participant, |
|
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28111
diff
changeset
|
439 | double level, PidginMedia *gtkmedia) |
| 19886 | 440 | { |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
441 | GtkWidget *progress = NULL; |
|
28125
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28111
diff
changeset
|
442 | if (participant == NULL) |
|
26276
b9d3887b8318
Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents:
26275
diff
changeset
|
443 | progress = gtkmedia->priv->send_progress; |
|
28125
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28111
diff
changeset
|
444 | else |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
445 | progress = pidgin_media_get_widget(gtkmedia, session_id, participant); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
446 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
447 | if (progress) |
|
32751
24798e6f3c3a
The function gst_msg_db_to_percent already retyrns a number between
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32711
diff
changeset
|
448 | gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), level); |
| 19886 | 449 | } |
| 450 | ||
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
451 | |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
452 | static void |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
453 | pidgin_media_disconnect_levels(PurpleMedia *media, PidginMedia *gtkmedia) |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
454 | { |
|
26523
4544b079e3dd
Use purple_media_manager_get_pipeline instead.
Michael Ruprecht <maiku@pidgin.im>
parents:
26522
diff
changeset
|
455 | PurpleMediaManager *manager = purple_media_get_manager(media); |
|
4544b079e3dd
Use purple_media_manager_get_pipeline instead.
Michael Ruprecht <maiku@pidgin.im>
parents:
26522
diff
changeset
|
456 | GstElement *element = purple_media_manager_get_pipeline(manager); |
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
457 | gulong handler_id = g_signal_handler_find(G_OBJECT(gst_pipeline_get_bus(GST_PIPELINE(element))), |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31151
diff
changeset
|
458 | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0, |
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
459 | NULL, G_CALLBACK(level_message_cb), gtkmedia); |
|
23701
ecbd92b724df
Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents:
23697
diff
changeset
|
460 | if (handler_id) |
|
ecbd92b724df
Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents:
23697
diff
changeset
|
461 | g_signal_handler_disconnect(G_OBJECT(gst_pipeline_get_bus(GST_PIPELINE(element))), |
|
ecbd92b724df
Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents:
23697
diff
changeset
|
462 | handler_id); |
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
463 | } |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
464 | |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
465 | static void |
|
26210
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
466 | pidgin_media_dispose(GObject *media) |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
467 | { |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
468 | PidginMedia *gtkmedia = PIDGIN_MEDIA(media); |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
469 | purple_debug_info("gtkmedia", "pidgin_media_dispose\n"); |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
470 | |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
471 | if (gtkmedia->priv->media) { |
|
26300
02de47d1a94c
Close the request dialog if the remote user hung up.
Michael Ruprecht <maiku@pidgin.im>
parents:
26299
diff
changeset
|
472 | purple_request_close_with_handle(gtkmedia); |
|
26281
111754ffd39b
Implement *_remove_output_window and *_remove_output_windows.
Michael Ruprecht <maiku@pidgin.im>
parents:
26276
diff
changeset
|
473 | purple_media_remove_output_windows(gtkmedia->priv->media); |
|
26210
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
474 | pidgin_media_disconnect_levels(gtkmedia->priv->media, gtkmedia); |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
475 | g_object_unref(gtkmedia->priv->media); |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
476 | gtkmedia->priv->media = NULL; |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
477 | } |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
478 | |
|
30554
c429e21a08b9
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30481
diff
changeset
|
479 | if (gtkmedia->priv->ui) { |
|
c429e21a08b9
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30481
diff
changeset
|
480 | g_object_unref(gtkmedia->priv->ui); |
|
c429e21a08b9
Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30481
diff
changeset
|
481 | gtkmedia->priv->ui = NULL; |
|
26305
04b0dd0fd8cb
Properly free item factory. Should fix a crash on close.
Michael Ruprecht <maiku@pidgin.im>
parents:
26298
diff
changeset
|
482 | } |
|
04b0dd0fd8cb
Properly free item factory. Should fix a crash on close.
Michael Ruprecht <maiku@pidgin.im>
parents:
26298
diff
changeset
|
483 | |
|
31151
f352f10d5755
pidgin: Remove a timeout when destroying this object to avoid a use-after-free
Jakub Adam <jakub.adam@ktknet.cz>
parents:
30554
diff
changeset
|
484 | if (gtkmedia->priv->timeout_id != 0) |
|
f352f10d5755
pidgin: Remove a timeout when destroying this object to avoid a use-after-free
Jakub Adam <jakub.adam@ktknet.cz>
parents:
30554
diff
changeset
|
485 | g_source_remove(gtkmedia->priv->timeout_id); |
|
f352f10d5755
pidgin: Remove a timeout when destroying this object to avoid a use-after-free
Jakub Adam <jakub.adam@ktknet.cz>
parents:
30554
diff
changeset
|
486 | |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
487 | if (gtkmedia->priv->recv_progressbars) { |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
488 | g_hash_table_destroy(gtkmedia->priv->recv_progressbars); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
489 | g_hash_table_destroy(gtkmedia->priv->remote_videos); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
490 | gtkmedia->priv->recv_progressbars = NULL; |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
491 | gtkmedia->priv->remote_videos = NULL; |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
492 | } |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
493 | |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39129
diff
changeset
|
494 | G_OBJECT_CLASS(pidgin_media_parent_class)->dispose(media); |
|
26210
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
495 | } |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
496 | |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
497 | static void |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
498 | pidgin_media_finalize(GObject *media) |
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
499 | { |
|
26255
3b0da2f49570
Remove unneeded pidgin_media_get_display_widget function.
Michael Ruprecht <maiku@pidgin.im>
parents:
26254
diff
changeset
|
500 | /* PidginMedia *gtkmedia = PIDGIN_MEDIA(media); */ |
|
26143
673b6665624d
Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
26137
diff
changeset
|
501 | purple_debug_info("gtkmedia", "pidgin_media_finalize\n"); |
|
26210
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
502 | |
|
39238
53cfb9400de8
Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39129
diff
changeset
|
503 | G_OBJECT_CLASS(pidgin_media_parent_class)->finalize(media); |
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
504 | } |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
505 | |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
506 | static void |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
507 | pidgin_media_emit_message(PidginMedia *gtkmedia, const char *msg) |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
508 | { |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
33958
diff
changeset
|
509 | PurpleConversation *conv = purple_conversations_find_with_account( |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
510 | gtkmedia->priv->screenname, |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26728
diff
changeset
|
511 | purple_media_get_account(gtkmedia->priv->media)); |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
512 | if (conv != NULL) |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
513 | purple_conversation_write_system_message(conv, msg, 0); |
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
514 | } |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
515 | |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
516 | typedef struct |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
517 | { |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
518 | PidginMedia *gtkmedia; |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
519 | gchar *session_id; |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
520 | gchar *participant; |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
521 | } PidginMediaRealizeData; |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
522 | |
|
26233
236de657aae4
Hopefully stop the last of the BadWindow errors.
Michael Ruprecht <maiku@pidgin.im>
parents:
26212
diff
changeset
|
523 | static gboolean |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
524 | realize_cb_cb(PidginMediaRealizeData *data) |
|
26233
236de657aae4
Hopefully stop the last of the BadWindow errors.
Michael Ruprecht <maiku@pidgin.im>
parents:
26212
diff
changeset
|
525 | { |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
526 | PidginMediaPrivate *priv = data->gtkmedia->priv; |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
527 | GdkWindow *window = NULL; |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
528 | |
|
27972
54d25d73c6c8
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
26746
diff
changeset
|
529 | if (data->participant == NULL) |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
530 | window = gtk_widget_get_window(priv->local_video); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
531 | else { |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
532 | GtkWidget *widget = pidgin_media_get_widget(data->gtkmedia, |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
533 | data->session_id, data->participant); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
534 | if (widget) |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
535 | window = gtk_widget_get_window(widget); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
536 | } |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
537 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
538 | if (window) { |
|
33520
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
539 | gulong window_id = 0; |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
540 | #ifdef GDK_WINDOWING_WIN32 |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
541 | if (GDK_IS_WIN32_WINDOW(window)) |
|
33948
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33947
diff
changeset
|
542 | window_id = GPOINTER_TO_UINT(GDK_WINDOW_HWND(window)); |
|
33520
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
543 | else |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
544 | #endif |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
545 | #ifdef GDK_WINDOWING_X11 |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
546 | if (GDK_IS_X11_WINDOW(window)) |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
547 | window_id = gdk_x11_window_get_xid(window); |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
548 | else |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
549 | #endif |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
550 | #ifdef GDK_WINDOWING_QUARTZ |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
551 | if (GDK_IS_QUARTZ_WINDOW(window)) |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
552 | window_id = (gulong)gdk_quartz_window_get_nsview(window); |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
553 | else |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
554 | #endif |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
555 | g_warning("Unsupported GDK backend"); |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
556 | #if !(defined(GDK_WINDOWING_WIN32) \ |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
557 | || defined(GDK_WINDOWING_X11) \ |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
558 | || defined(GDK_WINDOWING_QUARTZ)) |
|
e7741c77c5b2
Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33510
diff
changeset
|
559 | # error "Unsupported GDK windowing system" |
|
27972
54d25d73c6c8
Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
26746
diff
changeset
|
560 | #endif |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
561 | |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
562 | purple_media_set_output_window(priv->media, data->session_id, |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
563 | data->participant, window_id); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
564 | } |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
565 | |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
566 | g_free(data->session_id); |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
567 | g_free(data->participant); |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
568 | g_free(data); |
|
26233
236de657aae4
Hopefully stop the last of the BadWindow errors.
Michael Ruprecht <maiku@pidgin.im>
parents:
26212
diff
changeset
|
569 | return FALSE; |
|
236de657aae4
Hopefully stop the last of the BadWindow errors.
Michael Ruprecht <maiku@pidgin.im>
parents:
26212
diff
changeset
|
570 | } |
|
236de657aae4
Hopefully stop the last of the BadWindow errors.
Michael Ruprecht <maiku@pidgin.im>
parents:
26212
diff
changeset
|
571 | |
| 19886 | 572 | static void |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
573 | realize_cb(GtkWidget *widget, PidginMediaRealizeData *data) |
|
26177
35f25555116f
Wait for local video frame to be realized before starting local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26158
diff
changeset
|
574 | { |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
575 | g_timeout_add(0, (GSourceFunc)realize_cb_cb, data); |
|
26177
35f25555116f
Wait for local video frame to be realized before starting local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26158
diff
changeset
|
576 | } |
|
35f25555116f
Wait for local video frame to be realized before starting local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26158
diff
changeset
|
577 | |
|
35f25555116f
Wait for local video frame to be realized before starting local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26158
diff
changeset
|
578 | static void |
|
26182
728ad1da9cbc
Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents:
26177
diff
changeset
|
579 | pidgin_media_error_cb(PidginMedia *media, const char *error, PidginMedia *gtkmedia) |
|
728ad1da9cbc
Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents:
26177
diff
changeset
|
580 | { |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
33958
diff
changeset
|
581 | PurpleConversation *conv = purple_conversations_find_with_account( |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
582 | gtkmedia->priv->screenname, |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26728
diff
changeset
|
583 | purple_media_get_account(gtkmedia->priv->media)); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
584 | if (conv != NULL) { |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
585 | purple_conversation_write_system_message( |
|
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
586 | conv, error, PURPLE_MESSAGE_ERROR); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
587 | } else { |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
588 | purple_notify_error(NULL, NULL, _("Media error"), error, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
589 | purple_request_cpar_from_conversation(conv)); |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
590 | } |
|
36316
2415067473ba
Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents:
36312
diff
changeset
|
591 | |
|
26285
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
592 | gtk_statusbar_push(GTK_STATUSBAR(gtkmedia->priv->statusbar), |
|
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
593 | 0, error); |
|
26182
728ad1da9cbc
Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents:
26177
diff
changeset
|
594 | } |
|
728ad1da9cbc
Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents:
26177
diff
changeset
|
595 | |
|
26267
3bd0240f0632
Add the accepted signal and make the accept button go away immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26259
diff
changeset
|
596 | static void |
|
26512
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
597 | pidgin_media_accept_cb(PurpleMedia *media, int index) |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
598 | { |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
599 | purple_media_stream_info(media, PURPLE_MEDIA_INFO_ACCEPT, |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
600 | NULL, NULL, TRUE); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
601 | } |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
602 | |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
603 | static void |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
604 | pidgin_media_reject_cb(PurpleMedia *media, int index) |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
605 | { |
|
31620
6058b133ecfd
Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31619
diff
changeset
|
606 | GList *iter = purple_media_get_session_ids(media); |
|
6058b133ecfd
Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31619
diff
changeset
|
607 | for (; iter; iter = g_list_delete_link(iter, iter)) { |
|
6058b133ecfd
Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31619
diff
changeset
|
608 | const gchar *sessionid = iter->data; |
|
6058b133ecfd
Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31619
diff
changeset
|
609 | if (!purple_media_accepted(media, sessionid, NULL)) |
|
6058b133ecfd
Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31619
diff
changeset
|
610 | purple_media_stream_info(media, PURPLE_MEDIA_INFO_REJECT, |
|
6058b133ecfd
Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31619
diff
changeset
|
611 | sessionid, NULL, TRUE); |
|
6058b133ecfd
Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31619
diff
changeset
|
612 | } |
|
26512
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
613 | } |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
614 | |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
615 | static gboolean |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
616 | pidgin_request_timeout_cb(PidginMedia *gtkmedia) |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
617 | { |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26728
diff
changeset
|
618 | PurpleAccount *account; |
|
26512
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
619 | PurpleBuddy *buddy; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
620 | const gchar *alias; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
621 | PurpleMediaSessionType type; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
622 | gchar *message = NULL; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
623 | |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26728
diff
changeset
|
624 | account = purple_media_get_account(gtkmedia->priv->media); |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34662
diff
changeset
|
625 | buddy = purple_blist_find_buddy(account, gtkmedia->priv->screenname); |
|
26512
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
626 | alias = buddy ? purple_buddy_get_contact_alias(buddy) : |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
627 | gtkmedia->priv->screenname; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
628 | type = gtkmedia->priv->request_type; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
629 | gtkmedia->priv->timeout_id = 0; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
630 | |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
631 | if (type & PURPLE_MEDIA_AUDIO && type & PURPLE_MEDIA_VIDEO) { |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
632 | message = g_strdup_printf(_("%s wishes to start an audio/video session with you."), |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
633 | alias); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
634 | } else if (type & PURPLE_MEDIA_AUDIO) { |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
635 | message = g_strdup_printf(_("%s wishes to start an audio session with you."), |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
636 | alias); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
637 | } else if (type & PURPLE_MEDIA_VIDEO) { |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
638 | message = g_strdup_printf(_("%s wishes to start a video session with you."), |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
639 | alias); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
640 | } |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
641 | |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
642 | gtkmedia->priv->request_type = PURPLE_MEDIA_NONE; |
|
28385
871a31df2174
There's no reason to ask for acceptance if the stream has been accepted. Also,
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
643 | if (!purple_media_accepted(gtkmedia->priv->media, NULL, NULL)) { |
|
871a31df2174
There's no reason to ask for acceptance if the stream has been accepted. Also,
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
644 | purple_request_accept_cancel(gtkmedia, _("Incoming Call"), |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33958
diff
changeset
|
645 | message, NULL, PURPLE_DEFAULT_ACTION_NONE, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33958
diff
changeset
|
646 | purple_request_cpar_from_account(account), |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33958
diff
changeset
|
647 | gtkmedia->priv->media, pidgin_media_accept_cb, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33958
diff
changeset
|
648 | pidgin_media_reject_cb); |
|
28385
871a31df2174
There's no reason to ask for acceptance if the stream has been accepted. Also,
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
649 | } |
|
26512
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
650 | pidgin_media_emit_message(gtkmedia, message); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
651 | g_free(message); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
652 | return FALSE; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
653 | } |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
654 | |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
655 | static void |
|
26728
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
656 | pidgin_media_input_volume_changed(GtkScaleButton *range, double value, |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
657 | PurpleMedia *media) |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
658 | { |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
659 | double val = (double)value * 100.0; |
|
28125
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28111
diff
changeset
|
660 | purple_media_set_input_volume(media, NULL, val); |
|
26622
b3cd53038449
Move volume levels for media to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26619
diff
changeset
|
661 | } |
|
b3cd53038449
Move volume levels for media to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26619
diff
changeset
|
662 | |
|
b3cd53038449
Move volume levels for media to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26619
diff
changeset
|
663 | static void |
|
26728
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
664 | pidgin_media_output_volume_changed(GtkScaleButton *range, double value, |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
665 | PurpleMedia *media) |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
666 | { |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
667 | double val = (double)value * 100.0; |
|
28125
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28111
diff
changeset
|
668 | purple_media_set_output_volume(media, NULL, NULL, val); |
|
26728
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
669 | } |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
670 | |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
671 | static void |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
672 | destroy_parent_widget_cb(GtkWidget *widget, GtkWidget *parent) |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
673 | { |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
674 | g_return_if_fail(GTK_IS_WIDGET(parent)); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
675 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
676 | gtk_widget_destroy(parent); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
677 | } |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
678 | |
|
26728
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
679 | static GtkWidget * |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
680 | pidgin_media_add_audio_widget(PidginMedia *gtkmedia, |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
681 | PurpleMediaSessionType type, const gchar *sid) |
|
26728
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
682 | { |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
683 | GtkWidget *volume_widget, *progress_parent, *volume, *progress; |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
684 | double value; |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
685 | |
|
37918
41c93b7fecce
gtkmedia: fix -Wdiscarded-qualifiers
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37911
diff
changeset
|
686 | static const gchar * input_volume_icons[] = { |
|
37652
7b1c2a7c0c1d
gtkmedia: use distinct icon for input volume
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37648
diff
changeset
|
687 | "microphone-sensitivity-muted-symbolic", |
|
7b1c2a7c0c1d
gtkmedia: use distinct icon for input volume
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37648
diff
changeset
|
688 | "microphone-sensitivity-high-symbolic", |
|
7b1c2a7c0c1d
gtkmedia: use distinct icon for input volume
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37648
diff
changeset
|
689 | "microphone-sensitivity-low-symbolic", |
|
7b1c2a7c0c1d
gtkmedia: use distinct icon for input volume
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37648
diff
changeset
|
690 | "microphone-sensitivity-medium-symbolic", |
|
7b1c2a7c0c1d
gtkmedia: use distinct icon for input volume
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37648
diff
changeset
|
691 | NULL |
|
7b1c2a7c0c1d
gtkmedia: use distinct icon for input volume
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37648
diff
changeset
|
692 | }; |
|
7b1c2a7c0c1d
gtkmedia: use distinct icon for input volume
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37648
diff
changeset
|
693 | |
|
26728
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
694 | if (type & PURPLE_MEDIA_SEND_AUDIO) { |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
695 | value = purple_prefs_get_int( |
|
28125
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28111
diff
changeset
|
696 | "/purple/media/audio/volume/input"); |
|
26728
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
697 | } else if (type & PURPLE_MEDIA_RECV_AUDIO) { |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
698 | value = purple_prefs_get_int( |
|
28125
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28111
diff
changeset
|
699 | "/purple/media/audio/volume/output"); |
|
26728
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
700 | } else |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
701 | g_return_val_if_reached(NULL); |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
702 | |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
703 | /* Setup widget structure */ |
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35510
diff
changeset
|
704 | volume_widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PIDGIN_HIG_BOX_SPACE); |
|
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35510
diff
changeset
|
705 | progress_parent = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); |
|
26728
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
706 | gtk_box_pack_start(GTK_BOX(volume_widget), |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
707 | progress_parent, TRUE, TRUE, 0); |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
708 | |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
709 | /* Volume button */ |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
710 | volume = gtk_volume_button_new(); |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
711 | gtk_scale_button_set_value(GTK_SCALE_BUTTON(volume), value/100.0); |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
712 | gtk_box_pack_end(GTK_BOX(volume_widget), |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
713 | volume, FALSE, FALSE, 0); |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
714 | |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
715 | /* Volume level indicator */ |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
716 | progress = gtk_progress_bar_new(); |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
717 | gtk_widget_set_size_request(progress, 250, 10); |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
718 | gtk_box_pack_end(GTK_BOX(progress_parent), progress, TRUE, FALSE, 0); |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
719 | |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
720 | if (type & PURPLE_MEDIA_SEND_AUDIO) { |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
721 | g_signal_connect (G_OBJECT(volume), "value-changed", |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
722 | G_CALLBACK(pidgin_media_input_volume_changed), |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
723 | gtkmedia->priv->media); |
|
37652
7b1c2a7c0c1d
gtkmedia: use distinct icon for input volume
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37648
diff
changeset
|
724 | gtk_scale_button_set_icons(GTK_SCALE_BUTTON(volume), |
|
7b1c2a7c0c1d
gtkmedia: use distinct icon for input volume
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37648
diff
changeset
|
725 | input_volume_icons); |
|
7b1c2a7c0c1d
gtkmedia: use distinct icon for input volume
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37648
diff
changeset
|
726 | |
|
26728
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
727 | gtkmedia->priv->send_progress = progress; |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
728 | } else if (type & PURPLE_MEDIA_RECV_AUDIO) { |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
729 | g_signal_connect (G_OBJECT(volume), "value-changed", |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
730 | G_CALLBACK(pidgin_media_output_volume_changed), |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
731 | gtkmedia->priv->media); |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
732 | |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
733 | pidgin_media_insert_widget(gtkmedia, progress, sid, gtkmedia->priv->screenname); |
|
26728
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
734 | } |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
735 | |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
736 | g_signal_connect(G_OBJECT(progress), "destroy", |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
737 | G_CALLBACK(destroy_parent_widget_cb), |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
738 | volume_widget); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
739 | |
|
26728
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
740 | gtk_widget_show_all(volume_widget); |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
741 | |
|
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
742 | return volume_widget; |
|
26622
b3cd53038449
Move volume levels for media to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26619
diff
changeset
|
743 | } |
|
b3cd53038449
Move volume levels for media to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26619
diff
changeset
|
744 | |
|
b3cd53038449
Move volume levels for media to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26619
diff
changeset
|
745 | static void |
|
36312
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
746 | phone_dtmf_pressed_cb(GtkButton *button, gpointer user_data) |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
747 | { |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
748 | PidginMedia *gtkmedia = user_data; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
749 | gint num; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
750 | gchar *sid; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
751 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
752 | num = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "dtmf-digit")); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
753 | sid = g_object_get_data(G_OBJECT(button), "session-id"); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
754 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
755 | purple_media_send_dtmf(gtkmedia->priv->media, sid, num, 25, 50); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
756 | } |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
757 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
758 | static inline GtkWidget * |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
759 | phone_create_button(const gchar *text_hi, const gchar *text_lo) |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
760 | { |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
761 | GtkWidget *button; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
762 | GtkWidget *label_hi; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
763 | GtkWidget *label_lo; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
764 | GtkWidget *grid; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
765 | const gchar *text_hi_local; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
766 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
767 | if (text_hi) |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
768 | text_hi_local = _(text_hi); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
769 | else |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
770 | text_hi_local = ""; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
771 | |
|
37994
11829debec7a
Replace Gtk[HV]Box with GtkBox.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
772 | grid = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); |
|
11829debec7a
Replace Gtk[HV]Box with GtkBox.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
773 | gtk_box_set_homogeneous(GTK_BOX(grid), TRUE); |
|
36312
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
774 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
775 | button = gtk_button_new(); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
776 | label_hi = gtk_label_new(text_hi_local); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
777 | gtk_box_pack_end(GTK_BOX(grid), label_hi, FALSE, TRUE, 0); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
778 | label_lo = gtk_label_new(text_lo); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
779 | gtk_label_set_use_markup(GTK_LABEL(label_lo), TRUE); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
780 | gtk_box_pack_end(GTK_BOX(grid), label_lo, FALSE, TRUE, 0); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
781 | gtk_container_add(GTK_CONTAINER(button), grid); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
782 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
783 | return button; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
784 | } |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
785 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
786 | static struct phone_label { |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
787 | gchar *subtext; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
788 | gchar *text; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
789 | gchar chr; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
790 | } phone_labels[] = { |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
791 | {"<b>1</b>", NULL, '1'}, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
792 | /* Translators note: These are the letters on the keys of a numeric |
|
36339
69efd0ff9b9a
Update the link for ETSI ES 202 130
Richard Laager <rlaager@pidgin.im>
parents:
36316
diff
changeset
|
793 | keypad; translate according to the tables in §7 of ETSI ES 202 130: |
|
69efd0ff9b9a
Update the link for ETSI ES 202 130
Richard Laager <rlaager@pidgin.im>
parents:
36316
diff
changeset
|
794 | http://webapp.etsi.org/WorkProgram/Report_WorkItem.asp?WKI_ID=11730 |
|
69efd0ff9b9a
Update the link for ETSI ES 202 130
Richard Laager <rlaager@pidgin.im>
parents:
36316
diff
changeset
|
795 | */ |
|
36312
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
796 | /* Letters on the '2' key of a numeric keypad */ |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
797 | {"<b>2</b>", N_("ABC"), '2'}, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
798 | /* Letters on the '3' key of a numeric keypad */ |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
799 | {"<b>3</b>", N_("DEF"), '3'}, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
800 | /* Letters on the '4' key of a numeric keypad */ |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
801 | {"<b>4</b>", N_("GHI"), '4'}, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
802 | /* Letters on the '5' key of a numeric keypad */ |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
803 | {"<b>5</b>", N_("JKL"), '5'}, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
804 | /* Letters on the '6' key of a numeric keypad */ |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
805 | {"<b>6</b>", N_("MNO"), '6'}, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
806 | /* Letters on the '7' key of a numeric keypad */ |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
807 | {"<b>7</b>", N_("PQRS"), '7'}, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
808 | /* Letters on the '8' key of a numeric keypad */ |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
809 | {"<b>8</b>", N_("TUV"), '8'}, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
810 | /* Letters on the '9' key of a numeric keypad */ |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
811 | {"<b>9</b>", N_("WXYZ"), '9'}, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
812 | {"<b>*</b>", NULL, '*'}, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
813 | {"<b>0</b>", NULL, '0'}, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
814 | {"<b>#</b>", NULL, '#'}, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
815 | {NULL, NULL, 0} |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
816 | }; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
817 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
818 | static gboolean |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
819 | pidgin_media_dtmf_key_press_event_cb(GtkWidget *widget, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
820 | GdkEvent *event, gpointer user_data) |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
821 | { |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
822 | PidginMedia *gtkmedia = user_data; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
823 | GdkEventKey *key = (GdkEventKey *) event; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
824 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
825 | if (event->type != GDK_KEY_PRESS) { |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
826 | return FALSE; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
827 | } |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
828 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
829 | if ((key->keyval >= GDK_KEY_0 && key->keyval <= GDK_KEY_9) || |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
830 | key->keyval == GDK_KEY_asterisk || |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
831 | key->keyval == GDK_KEY_numbersign) { |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
832 | gchar *sid = g_object_get_data(G_OBJECT(widget), "session-id"); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
833 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
834 | purple_media_send_dtmf(gtkmedia->priv->media, sid, key->keyval, 25, 50); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
835 | } |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
836 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
837 | return FALSE; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
838 | } |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
839 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
840 | static GtkWidget * |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
841 | pidgin_media_add_dtmf_widget(PidginMedia *gtkmedia, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
842 | PurpleMediaSessionType type, const gchar *_sid) |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
843 | { |
|
37995
d5ab4262ea77
Replace GtkTable with GtkGrid.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
844 | GtkWidget *grid = gtk_grid_new(); |
|
36312
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
845 | GtkWidget *button; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
846 | gint index = 0; |
|
38587
7a36a36f66b7
gtkmedia: Use GtkApplicationWindow as base class
Mike Ruprecht <cmaiku@gmail.com>
parents:
38027
diff
changeset
|
847 | GtkApplicationWindow *win = >kmedia->parent; |
|
36312
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
848 | |
|
37995
d5ab4262ea77
Replace GtkTable with GtkGrid.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
849 | gtk_grid_set_row_homogeneous(GTK_GRID(grid), TRUE); |
|
d5ab4262ea77
Replace GtkTable with GtkGrid.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
850 | gtk_grid_set_column_homogeneous(GTK_GRID(grid), TRUE); |
|
36312
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
851 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
852 | /* Add buttons */ |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
853 | for (index = 0; phone_labels[index].subtext != NULL; index++) { |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
854 | button = phone_create_button(phone_labels[index].text, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
855 | phone_labels[index].subtext); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
856 | g_signal_connect(button, "pressed", |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
857 | G_CALLBACK(phone_dtmf_pressed_cb), gtkmedia); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
858 | g_object_set_data(G_OBJECT(button), "dtmf-digit", |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
859 | GINT_TO_POINTER(phone_labels[index].chr)); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
860 | g_object_set_data_full(G_OBJECT(button), "session-id", |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
861 | g_strdup(_sid), g_free); |
|
37995
d5ab4262ea77
Replace GtkTable with GtkGrid.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
862 | gtk_grid_attach(GTK_GRID(grid), button, |
|
d5ab4262ea77
Replace GtkTable with GtkGrid.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
863 | index % 3, index / 3, 1, 1); |
|
d5ab4262ea77
Replace GtkTable with GtkGrid.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
864 | g_object_set(button, "expand", TRUE, "margin", 2, NULL); |
|
36312
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
865 | } |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
866 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
867 | g_signal_connect(G_OBJECT(win), "key-press-event", |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
868 | G_CALLBACK(pidgin_media_dtmf_key_press_event_cb), gtkmedia); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
869 | g_object_set_data_full(G_OBJECT(win), "session-id", |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
870 | g_strdup(_sid), g_free); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
871 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
872 | gtk_widget_show_all(grid); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
873 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
874 | return grid; |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
875 | } |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
876 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
877 | static void |
|
26242
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
878 | pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia, const gchar *sid) |
| 19886 | 879 | { |
|
28133
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
880 | GtkWidget *send_widget = NULL, *recv_widget = NULL, *button_widget = NULL; |
|
26270
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
881 | PurpleMediaSessionType type = |
|
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
882 | purple_media_get_session_type(media, sid); |
|
23721
15285d082f6c
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.
Michael Ruprecht <maiku@pidgin.im>
parents:
23704
diff
changeset
|
883 | |
|
26242
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
884 | if (gtkmedia->priv->recv_widget == NULL |
|
26270
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
885 | && type & (PURPLE_MEDIA_RECV_VIDEO | |
|
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
886 | PURPLE_MEDIA_RECV_AUDIO)) { |
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35510
diff
changeset
|
887 | recv_widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, PIDGIN_HIG_BOX_SPACE); |
|
26113
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
888 | gtk_box_pack_start(GTK_BOX(gtkmedia->priv->display), |
|
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
889 | recv_widget, TRUE, TRUE, 0); |
|
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
890 | gtk_widget_show(recv_widget); |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
891 | } else { |
|
26242
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
892 | recv_widget = gtkmedia->priv->recv_widget; |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
893 | } |
|
26242
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
894 | if (gtkmedia->priv->send_widget == NULL |
|
26270
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
895 | && type & (PURPLE_MEDIA_SEND_VIDEO | |
|
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
896 | PURPLE_MEDIA_SEND_AUDIO)) { |
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35510
diff
changeset
|
897 | send_widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, PIDGIN_HIG_BOX_SPACE); |
|
26113
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
898 | gtk_box_pack_start(GTK_BOX(gtkmedia->priv->display), |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
899 | send_widget, FALSE, TRUE, 0); |
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35510
diff
changeset
|
900 | button_widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PIDGIN_HIG_BOX_SPACE); |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
901 | gtk_box_pack_end(GTK_BOX(recv_widget), button_widget, |
|
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
902 | FALSE, TRUE, 0); |
|
26113
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
903 | gtk_widget_show(send_widget); |
|
28709
47bd5eac3afd
Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
28421
diff
changeset
|
904 | |
|
47bd5eac3afd
Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
28421
diff
changeset
|
905 | /* Hold button */ |
|
47bd5eac3afd
Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
28421
diff
changeset
|
906 | gtkmedia->priv->hold = |
|
32056
5ecbc7cf4ee1
Mark the "hold" and "mute" menu items for translation in the media dialog.
Mark Doliner <markdoliner@pidgin.im>
parents:
32055
diff
changeset
|
907 | gtk_toggle_button_new_with_mnemonic(_("_Hold")); |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
908 | gtk_box_pack_end(GTK_BOX(button_widget), gtkmedia->priv->hold, |
|
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
909 | FALSE, FALSE, 0); |
|
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
910 | gtk_widget_show(gtkmedia->priv->hold); |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
911 | gtk_actionable_set_action_name( |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
912 | GTK_ACTIONABLE(gtkmedia->priv->hold), |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
913 | "win.Hold"); |
|
28133
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
914 | } else { |
|
26242
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
915 | send_widget = gtkmedia->priv->send_widget; |
|
28133
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
916 | button_widget = gtkmedia->priv->button_widget; |
|
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
917 | } |
|
23738
2188a1d89a3a
Move the audio progress bar widgets to be beside the video displays.
Michael Ruprecht <maiku@pidgin.im>
parents:
23737
diff
changeset
|
918 | |
|
26270
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
919 | if (type & PURPLE_MEDIA_RECV_VIDEO) { |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
920 | PidginMediaRealizeData *data; |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
921 | GtkWidget *aspect; |
|
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
922 | GtkWidget *remote_video; |
|
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
923 | |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
924 | aspect = gtk_aspect_frame_new(NULL, 0, 0, 4.0/3.0, FALSE); |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
925 | gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN); |
|
23743
bc49c5e2ab2b
Fix the order of the send/recv audio/video display widgets.
Michael Ruprecht <maiku@pidgin.im>
parents:
23742
diff
changeset
|
926 | gtk_box_pack_start(GTK_BOX(recv_widget), aspect, TRUE, TRUE, 0); |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
927 | |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
928 | data = g_new0(PidginMediaRealizeData, 1); |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
929 | data->gtkmedia = gtkmedia; |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
930 | data->session_id = g_strdup(sid); |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
931 | data->participant = g_strdup(gtkmedia->priv->screenname); |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
932 | |
|
37589
e498a88e7c00
Factor out video widget creation into pidgin_create_video_widget()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37424
diff
changeset
|
933 | remote_video = pidgin_create_video_widget(); |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
934 | g_signal_connect(G_OBJECT(remote_video), "realize", |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
935 | G_CALLBACK(realize_cb), data); |
|
26676
8cd0a1fc0f14
Remove old GtkPlug and GtkSocket code.
Michael Ruprecht <maiku@pidgin.im>
parents:
26639
diff
changeset
|
936 | gtk_container_add(GTK_CONTAINER(aspect), remote_video); |
|
26284
5d36c99b8f2d
Make the sinks better default sizes and display them immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26283
diff
changeset
|
937 | gtk_widget_set_size_request (GTK_WIDGET(remote_video), 320, 240); |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
938 | g_signal_connect(G_OBJECT(remote_video), "destroy", |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
939 | G_CALLBACK(destroy_parent_widget_cb), aspect); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
940 | |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
941 | gtk_widget_show(remote_video); |
|
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
942 | gtk_widget_show(aspect); |
|
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
943 | |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
944 | pidgin_media_insert_widget(gtkmedia, remote_video, |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
945 | data->session_id, data->participant); |
|
26113
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
946 | } |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
947 | |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
948 | if (type & PURPLE_MEDIA_SEND_VIDEO && !gtkmedia->priv->local_video) { |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
949 | PidginMediaRealizeData *data; |
|
26113
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
950 | GtkWidget *aspect; |
|
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
951 | GtkWidget *local_video; |
|
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
952 | |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
953 | aspect = gtk_aspect_frame_new(NULL, 0, 0, 4.0/3.0, TRUE); |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
954 | gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN); |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
955 | gtk_box_pack_start(GTK_BOX(send_widget), aspect, FALSE, TRUE, 0); |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
956 | |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
957 | data = g_new0(PidginMediaRealizeData, 1); |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
958 | data->gtkmedia = gtkmedia; |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
959 | data->session_id = g_strdup(sid); |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
960 | data->participant = NULL; |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
961 | |
|
37589
e498a88e7c00
Factor out video widget creation into pidgin_create_video_widget()
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37424
diff
changeset
|
962 | local_video = pidgin_create_video_widget(); |
|
26177
35f25555116f
Wait for local video frame to be realized before starting local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26158
diff
changeset
|
963 | g_signal_connect(G_OBJECT(local_video), "realize", |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
964 | G_CALLBACK(realize_cb), data); |
|
26676
8cd0a1fc0f14
Remove old GtkPlug and GtkSocket code.
Michael Ruprecht <maiku@pidgin.im>
parents:
26639
diff
changeset
|
965 | gtk_container_add(GTK_CONTAINER(aspect), local_video); |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
966 | gtk_widget_set_size_request (GTK_WIDGET(local_video), 80, 60); |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
967 | g_signal_connect(G_OBJECT(local_video), "destroy", |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
968 | G_CALLBACK(destroy_parent_widget_cb), aspect); |
|
26177
35f25555116f
Wait for local video frame to be realized before starting local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26158
diff
changeset
|
969 | |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
970 | gtk_widget_show(local_video); |
|
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
971 | gtk_widget_show(aspect); |
|
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
972 | |
|
28133
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
973 | gtkmedia->priv->pause = |
|
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
974 | gtk_toggle_button_new_with_mnemonic(_("_Pause")); |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
975 | gtk_box_pack_end(GTK_BOX(button_widget), gtkmedia->priv->pause, |
|
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
976 | FALSE, FALSE, 0); |
|
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
977 | gtk_widget_show(gtkmedia->priv->pause); |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
978 | gtk_actionable_set_action_name( |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
979 | GTK_ACTIONABLE(gtkmedia->priv->pause), |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
980 | "win.Pause"); |
|
28133
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
981 | |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
982 | gtkmedia->priv->local_video = local_video; |
|
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
983 | } |
|
26270
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
984 | if (type & PURPLE_MEDIA_RECV_AUDIO) { |
|
26622
b3cd53038449
Move volume levels for media to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26619
diff
changeset
|
985 | gtk_box_pack_end(GTK_BOX(recv_widget), |
|
26728
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
986 | pidgin_media_add_audio_widget(gtkmedia, |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
987 | PURPLE_MEDIA_RECV_AUDIO, sid), FALSE, FALSE, 0); |
|
23738
2188a1d89a3a
Move the audio progress bar widgets to be beside the video displays.
Michael Ruprecht <maiku@pidgin.im>
parents:
23737
diff
changeset
|
988 | } |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
989 | |
|
26270
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
990 | if (type & PURPLE_MEDIA_SEND_AUDIO) { |
|
26624
d8be4ebac4f0
Improve the padding around the mute button.
Michael Ruprecht <maiku@pidgin.im>
parents:
26623
diff
changeset
|
991 | gtkmedia->priv->mute = |
|
32056
5ecbc7cf4ee1
Mark the "hold" and "mute" menu items for translation in the media dialog.
Mark Doliner <markdoliner@pidgin.im>
parents:
32055
diff
changeset
|
992 | gtk_toggle_button_new_with_mnemonic(_("_Mute")); |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
993 | gtk_box_pack_end(GTK_BOX(button_widget), gtkmedia->priv->mute, |
|
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
994 | FALSE, FALSE, 0); |
|
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
995 | gtk_widget_show(gtkmedia->priv->mute); |
|
38590
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
996 | gtk_actionable_set_action_name( |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
997 | GTK_ACTIONABLE(gtkmedia->priv->mute), |
|
2a46ccba53cb
gtkmedia: Port Hold, Mute, & Pause buttons to use GActions
Mike Ruprecht <cmaiku@gmail.com>
parents:
38589
diff
changeset
|
998 | "win.Mute"); |
|
26624
d8be4ebac4f0
Improve the padding around the mute button.
Michael Ruprecht <maiku@pidgin.im>
parents:
26623
diff
changeset
|
999 | |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
1000 | gtk_box_pack_end(GTK_BOX(recv_widget), |
|
26728
e6d5b2333b1d
Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents:
26676
diff
changeset
|
1001 | pidgin_media_add_audio_widget(gtkmedia, |
|
36312
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
1002 | PURPLE_MEDIA_SEND_AUDIO, sid), FALSE, FALSE, 0); |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
1003 | |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
1004 | gtk_box_pack_end(GTK_BOX(recv_widget), |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
1005 | pidgin_media_add_dtmf_widget(gtkmedia, |
|
6b4576edf2a6
Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents:
32056
diff
changeset
|
1006 | PURPLE_MEDIA_SEND_AUDIO, sid), FALSE, FALSE, 0); |
|
26113
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
1007 | } |
|
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
1008 | |
|
28125
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28111
diff
changeset
|
1009 | if (type & PURPLE_MEDIA_AUDIO && |
|
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28111
diff
changeset
|
1010 | gtkmedia->priv->level_handler_id == 0) { |
|
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28111
diff
changeset
|
1011 | gtkmedia->priv->level_handler_id = g_signal_connect( |
|
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28111
diff
changeset
|
1012 | media, "level", G_CALLBACK(level_message_cb), |
|
2e47531fc140
Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
28111
diff
changeset
|
1013 | gtkmedia); |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
1014 | } |
|
26151
218a4f61cf0d
Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Michael Ruprecht <maiku@pidgin.im>
parents:
26143
diff
changeset
|
1015 | |
|
26242
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
1016 | if (send_widget != NULL) |
|
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
1017 | gtkmedia->priv->send_widget = send_widget; |
|
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
1018 | if (recv_widget != NULL) |
|
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
1019 | gtkmedia->priv->recv_widget = recv_widget; |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
1020 | if (button_widget != NULL) { |
|
28133
4b84b16a01af
Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
28126
diff
changeset
|
1021 | gtkmedia->priv->button_widget = button_widget; |
|
30481
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
1022 | gtk_widget_show(GTK_WIDGET(button_widget)); |
|
97ccb2147ce3
pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents:
28981
diff
changeset
|
1023 | } |
|
26151
218a4f61cf0d
Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Michael Ruprecht <maiku@pidgin.im>
parents:
26143
diff
changeset
|
1024 | |
|
26514
058053cffc0e
Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents:
26512
diff
changeset
|
1025 | if (purple_media_is_initiator(media, sid, NULL) == FALSE) { |
|
26512
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
1026 | if (gtkmedia->priv->timeout_id != 0) |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
1027 | g_source_remove(gtkmedia->priv->timeout_id); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
1028 | gtkmedia->priv->request_type |= type; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
1029 | gtkmedia->priv->timeout_id = g_timeout_add(500, |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
1030 | (GSourceFunc)pidgin_request_timeout_cb, |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
1031 | gtkmedia); |
|
23737
91165a8fcbd9
Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents:
23736
diff
changeset
|
1032 | } |
|
26284
5d36c99b8f2d
Make the sinks better default sizes and display them immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26283
diff
changeset
|
1033 | |
|
28398
acc1ddff586b
Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents:
28385
diff
changeset
|
1034 | /* set the window icon according to the type */ |
|
acc1ddff586b
Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents:
28385
diff
changeset
|
1035 | if (type & PURPLE_MEDIA_VIDEO) { |
|
39129
70843401e6e7
gtkmedia: Replace usage of deprecated gtk_widget_render_icon()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38929
diff
changeset
|
1036 | gtk_window_set_icon_name(GTK_WINDOW(gtkmedia), "video-call"); |
|
28398
acc1ddff586b
Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents:
28385
diff
changeset
|
1037 | } else if (type & PURPLE_MEDIA_AUDIO) { |
|
39129
70843401e6e7
gtkmedia: Replace usage of deprecated gtk_widget_render_icon()
Mike Ruprecht <cmaiku@gmail.com>
parents:
38929
diff
changeset
|
1038 | gtk_window_set_icon_name(GTK_WINDOW(gtkmedia), "audio-call"); |
|
28398
acc1ddff586b
Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents:
28385
diff
changeset
|
1039 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31151
diff
changeset
|
1040 | |
|
26284
5d36c99b8f2d
Make the sinks better default sizes and display them immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26283
diff
changeset
|
1041 | gtk_widget_show(gtkmedia->priv->display); |
|
23737
91165a8fcbd9
Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents:
23736
diff
changeset
|
1042 | } |
|
91165a8fcbd9
Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents:
23736
diff
changeset
|
1043 | |
|
91165a8fcbd9
Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents:
23736
diff
changeset
|
1044 | static void |
|
26449
9e381dc6ed24
Rename state-changed enum and values.
Michael Ruprecht <maiku@pidgin.im>
parents:
26444
diff
changeset
|
1045 | pidgin_media_state_changed_cb(PurpleMedia *media, PurpleMediaState state, |
|
26240
3bc5338843aa
Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26234
diff
changeset
|
1046 | gchar *sid, gchar *name, PidginMedia *gtkmedia) |
|
22400
3762d64b1f58
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22072
diff
changeset
|
1047 | { |
|
26449
9e381dc6ed24
Rename state-changed enum and values.
Michael Ruprecht <maiku@pidgin.im>
parents:
26444
diff
changeset
|
1048 | purple_debug_info("gtkmedia", "state: %d sid: %s name: %s\n", |
|
27974
2021706e911d
Fixes for some potential printf("%s", NULL) type of problems from Maiku
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27972
diff
changeset
|
1049 | state, sid ? sid : "(null)", name ? name : "(null)"); |
|
31619
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
1050 | if (state == PURPLE_MEDIA_STATE_END) { |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
1051 | if (sid != NULL && name != NULL) { |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
1052 | pidgin_media_remove_widget(gtkmedia, sid, name); |
|
8eeb5fc86dcf
Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents:
31557
diff
changeset
|
1053 | } else if (sid == NULL && name == NULL) { |
|
26240
3bc5338843aa
Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26234
diff
changeset
|
1054 | pidgin_media_emit_message(gtkmedia, |
|
3bc5338843aa
Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26234
diff
changeset
|
1055 | _("The call has been terminated.")); |
|
3bc5338843aa
Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26234
diff
changeset
|
1056 | gtk_widget_destroy(GTK_WIDGET(gtkmedia)); |
|
3bc5338843aa
Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26234
diff
changeset
|
1057 | } |
|
26449
9e381dc6ed24
Rename state-changed enum and values.
Michael Ruprecht <maiku@pidgin.im>
parents:
26444
diff
changeset
|
1058 | } else if (state == PURPLE_MEDIA_STATE_NEW && |
|
26242
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
1059 | sid != NULL && name != NULL) { |
|
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
1060 | pidgin_media_ready_cb(media, gtkmedia, sid); |
|
26240
3bc5338843aa
Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26234
diff
changeset
|
1061 | } |
| 19886 | 1062 | } |
| 1063 | ||
| 1064 | static void | |
|
26444
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
1065 | pidgin_media_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, |
|
26496
11e1e5221460
Create purple_media_stream_info. Add local parameter to stream-info signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26494
diff
changeset
|
1066 | gchar *sid, gchar *name, gboolean local, |
|
11e1e5221460
Create purple_media_stream_info. Add local parameter to stream-info signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26494
diff
changeset
|
1067 | PidginMedia *gtkmedia) |
|
26444
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
1068 | { |
|
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
1069 | if (type == PURPLE_MEDIA_INFO_REJECT) { |
|
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
1070 | pidgin_media_emit_message(gtkmedia, |
|
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
1071 | _("You have rejected the call.")); |
|
28111
61de2e173be9
Remove the "accepted" signal from PurpleMedia as it was redundant.
Michael Ruprecht <maiku@pidgin.im>
parents:
27974
diff
changeset
|
1072 | } else if (type == PURPLE_MEDIA_INFO_ACCEPT) { |
|
28385
871a31df2174
There's no reason to ask for acceptance if the stream has been accepted. Also,
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
1073 | if (local == TRUE) |
|
871a31df2174
There's no reason to ask for acceptance if the stream has been accepted. Also,
Michael Ruprecht <maiku@pidgin.im>
parents:
28321
diff
changeset
|
1074 | purple_request_close_with_handle(gtkmedia); |
|
28111
61de2e173be9
Remove the "accepted" signal from PurpleMedia as it was redundant.
Michael Ruprecht <maiku@pidgin.im>
parents:
27974
diff
changeset
|
1075 | pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED); |
|
61de2e173be9
Remove the "accepted" signal from PurpleMedia as it was redundant.
Michael Ruprecht <maiku@pidgin.im>
parents:
27974
diff
changeset
|
1076 | pidgin_media_emit_message(gtkmedia, _("Call in progress.")); |
|
61de2e173be9
Remove the "accepted" signal from PurpleMedia as it was redundant.
Michael Ruprecht <maiku@pidgin.im>
parents:
27974
diff
changeset
|
1077 | gtk_statusbar_push(GTK_STATUSBAR(gtkmedia->priv->statusbar), |
|
32695
f86582a6bc5b
Remove a period from a phrase that appears in the status bar of active calls
Mark Doliner <markdoliner@pidgin.im>
parents:
31966
diff
changeset
|
1078 | 0, _("Call in progress")); |
|
28111
61de2e173be9
Remove the "accepted" signal from PurpleMedia as it was redundant.
Michael Ruprecht <maiku@pidgin.im>
parents:
27974
diff
changeset
|
1079 | gtk_widget_show(GTK_WIDGET(gtkmedia)); |
|
38818
87ae8821ef63
Pidgin: Indicate mute/unmute status when changed remotely.
David Woodhouse <dwmw@amazon.co.uk>
parents:
37650
diff
changeset
|
1080 | } else if (type == PURPLE_MEDIA_INFO_MUTE && !local) { |
|
87ae8821ef63
Pidgin: Indicate mute/unmute status when changed remotely.
David Woodhouse <dwmw@amazon.co.uk>
parents:
37650
diff
changeset
|
1081 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkmedia->priv->mute), TRUE); |
|
87ae8821ef63
Pidgin: Indicate mute/unmute status when changed remotely.
David Woodhouse <dwmw@amazon.co.uk>
parents:
37650
diff
changeset
|
1082 | } else if (type == PURPLE_MEDIA_INFO_UNMUTE && !local) { |
|
87ae8821ef63
Pidgin: Indicate mute/unmute status when changed remotely.
David Woodhouse <dwmw@amazon.co.uk>
parents:
37650
diff
changeset
|
1083 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkmedia->priv->mute), FALSE); |
|
26444
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
1084 | } |
|
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
1085 | } |
|
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
1086 | |
|
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
1087 | static void |
| 19886 | 1088 | pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
| 1089 | { | |
| 1090 | PidginMedia *media; | |
| 1091 | g_return_if_fail(PIDGIN_IS_MEDIA(object)); | |
|
22400
3762d64b1f58
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22072
diff
changeset
|
1092 | |
| 19886 | 1093 | media = PIDGIN_MEDIA(object); |
| 1094 | switch (prop_id) { | |
| 1095 | case PROP_MEDIA: | |
|
26241
d4be7f79d6bc
Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents:
26240
diff
changeset
|
1096 | { |
| 19886 | 1097 | if (media->priv->media) |
| 1098 | g_object_unref(media->priv->media); | |
|
39424
793f7d43e2f0
Use g_value_dup_object where needed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39374
diff
changeset
|
1099 | media->priv->media = g_value_dup_object(value); |
|
26241
d4be7f79d6bc
Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents:
26240
diff
changeset
|
1100 | |
|
26514
058053cffc0e
Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents:
26512
diff
changeset
|
1101 | if (purple_media_is_initiator(media->priv->media, |
|
058053cffc0e
Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents:
26512
diff
changeset
|
1102 | NULL, NULL) == TRUE) |
|
26241
d4be7f79d6bc
Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents:
26240
diff
changeset
|
1103 | pidgin_media_set_state(media, PIDGIN_MEDIA_WAITING); |
|
d4be7f79d6bc
Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents:
26240
diff
changeset
|
1104 | else |
|
d4be7f79d6bc
Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents:
26240
diff
changeset
|
1105 | pidgin_media_set_state(media, PIDGIN_MEDIA_REQUESTED); |
|
d4be7f79d6bc
Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents:
26240
diff
changeset
|
1106 | |
|
26182
728ad1da9cbc
Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents:
26177
diff
changeset
|
1107 | g_signal_connect(G_OBJECT(media->priv->media), "error", |
|
728ad1da9cbc
Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents:
26177
diff
changeset
|
1108 | G_CALLBACK(pidgin_media_error_cb), media); |
|
26240
3bc5338843aa
Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26234
diff
changeset
|
1109 | g_signal_connect(G_OBJECT(media->priv->media), "state-changed", |
|
3bc5338843aa
Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26234
diff
changeset
|
1110 | G_CALLBACK(pidgin_media_state_changed_cb), media); |
|
26444
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
1111 | g_signal_connect(G_OBJECT(media->priv->media), "stream-info", |
|
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
1112 | G_CALLBACK(pidgin_media_stream_info_cb), media); |
| 19886 | 1113 | break; |
|
26241
d4be7f79d6bc
Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents:
26240
diff
changeset
|
1114 | } |
|
26184
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
1115 | case PROP_SCREENNAME: |
|
37424
04cf8cbe44d8
Remove more NULL-checks before free().
Michael McConville <mmcco@mykolab.com>
parents:
37422
diff
changeset
|
1116 | g_free(media->priv->screenname); |
|
26184
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
1117 | media->priv->screenname = g_value_dup_string(value); |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
1118 | break; |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
1119 | default: |
| 19886 | 1120 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
| 1121 | break; | |
| 1122 | } | |
| 1123 | } | |
| 1124 | ||
| 1125 | static void | |
| 1126 | pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) | |
| 1127 | { | |
| 1128 | PidginMedia *media; | |
| 1129 | g_return_if_fail(PIDGIN_IS_MEDIA(object)); | |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
1130 | |
| 19886 | 1131 | media = PIDGIN_MEDIA(object); |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
1132 | |
| 19886 | 1133 | switch (prop_id) { |
| 1134 | case PROP_MEDIA: | |
| 1135 | g_value_set_object(value, media->priv->media); | |
| 1136 | break; | |
|
26184
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
1137 | case PROP_SCREENNAME: |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
1138 | g_value_set_string(value, media->priv->screenname); |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
1139 | break; |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
1140 | default: |
|
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
1141 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
| 19886 | 1142 | break; |
| 1143 | } | |
| 1144 | } | |
| 1145 | ||
|
26494
829997fe9c23
No reason for this to be public API.
Michael Ruprecht <maiku@pidgin.im>
parents:
26488
diff
changeset
|
1146 | static GtkWidget * |
|
26184
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
1147 | pidgin_media_new(PurpleMedia *media, const gchar *screenname) |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
1148 | { |
|
23721
15285d082f6c
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.
Michael Ruprecht <maiku@pidgin.im>
parents:
23704
diff
changeset
|
1149 | PidginMedia *gtkmedia = g_object_new(pidgin_media_get_type(), |
|
26184
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
1150 | "media", media, |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
1151 | "screenname", screenname, NULL); |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
1152 | return GTK_WIDGET(gtkmedia); |
|
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
1153 | } |
|
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
1154 | |
|
22682
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
1155 | static void |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
1156 | pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state) |
| 19886 | 1157 | { |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
1158 | gtkmedia->priv->state = state; |
| 19886 | 1159 | } |
| 1160 | ||
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1161 | static gboolean |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1162 | pidgin_media_new_cb(PurpleMediaManager *manager, PurpleMedia *media, |
|
26746
2a2d45ac9774
Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents:
26728
diff
changeset
|
1163 | PurpleAccount *account, gchar *screenname, gpointer nul) |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1164 | { |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1165 | PidginMedia *gtkmedia = PIDGIN_MEDIA( |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1166 | pidgin_media_new(media, screenname)); |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34662
diff
changeset
|
1167 | PurpleBuddy *buddy = purple_blist_find_buddy(account, screenname); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31151
diff
changeset
|
1168 | const gchar *alias = buddy ? |
|
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31151
diff
changeset
|
1169 | purple_buddy_get_contact_alias(buddy) : screenname; |
|
26275
69951c5ca44f
Use aliases for the media window title and the request window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26273
diff
changeset
|
1170 | gtk_window_set_title(GTK_WINDOW(gtkmedia), alias); |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1171 | |
|
26514
058053cffc0e
Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents:
26512
diff
changeset
|
1172 | if (purple_media_is_initiator(media, NULL, NULL) == TRUE) |
|
26273
34eb5919488a
Use request API for a media invitation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26272
diff
changeset
|
1173 | gtk_widget_show(GTK_WIDGET(gtkmedia)); |
|
34eb5919488a
Use request API for a media invitation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26272
diff
changeset
|
1174 | |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1175 | return TRUE; |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1176 | } |
|
26504
55082249a5f9
Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents:
26503
diff
changeset
|
1177 | #endif /* USE_VV */ |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1178 | |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1179 | void |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1180 | pidgin_medias_init(void) |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1181 | { |
|
26504
55082249a5f9
Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents:
26503
diff
changeset
|
1182 | #ifdef USE_VV |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1183 | PurpleMediaManager *manager = purple_media_manager_get(); |
|
38027
bd088b2700cd
Fix crash if VV config device prefs are unset.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38007
diff
changeset
|
1184 | PurpleMediaElementInfo *video_src = NULL; |
|
bd088b2700cd
Fix crash if VV config device prefs are unset.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38007
diff
changeset
|
1185 | PurpleMediaElementInfo *video_sink = NULL; |
|
bd088b2700cd
Fix crash if VV config device prefs are unset.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38007
diff
changeset
|
1186 | PurpleMediaElementInfo *audio_src = NULL; |
|
bd088b2700cd
Fix crash if VV config device prefs are unset.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38007
diff
changeset
|
1187 | PurpleMediaElementInfo *audio_sink = NULL; |
|
37885
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1188 | const char *pref; |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1189 | |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1190 | pref = purple_prefs_get_string( |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1191 | PIDGIN_PREFS_ROOT "/vvconfig/video/src/device"); |
|
38027
bd088b2700cd
Fix crash if VV config device prefs are unset.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38007
diff
changeset
|
1192 | if (pref) |
|
bd088b2700cd
Fix crash if VV config device prefs are unset.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38007
diff
changeset
|
1193 | video_src = purple_media_manager_get_element_info(manager, pref); |
|
37885
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1194 | if (!video_src) { |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1195 | pref = "autovideosrc"; |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1196 | purple_prefs_set_string( |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1197 | PIDGIN_PREFS_ROOT "/vvconfig/video/src/device", pref); |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1198 | video_src = purple_media_manager_get_element_info(manager, |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1199 | pref); |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1200 | } |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1201 | |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1202 | pref = purple_prefs_get_string( |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1203 | PIDGIN_PREFS_ROOT "/vvconfig/video/sink/device"); |
|
38027
bd088b2700cd
Fix crash if VV config device prefs are unset.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38007
diff
changeset
|
1204 | if (pref) |
|
bd088b2700cd
Fix crash if VV config device prefs are unset.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38007
diff
changeset
|
1205 | video_sink = purple_media_manager_get_element_info(manager, pref); |
|
37885
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1206 | if (!video_sink) { |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1207 | pref = "autovideosink"; |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1208 | purple_prefs_set_string( |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1209 | PIDGIN_PREFS_ROOT "/vvconfig/video/sink/device", pref); |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1210 | video_sink = purple_media_manager_get_element_info(manager, |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1211 | pref); |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1212 | } |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1213 | |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1214 | pref = purple_prefs_get_string( |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1215 | PIDGIN_PREFS_ROOT "/vvconfig/audio/src/device"); |
|
38027
bd088b2700cd
Fix crash if VV config device prefs are unset.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38007
diff
changeset
|
1216 | if (pref) |
|
bd088b2700cd
Fix crash if VV config device prefs are unset.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38007
diff
changeset
|
1217 | audio_src = purple_media_manager_get_element_info(manager, pref); |
|
37885
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1218 | if (!audio_src) { |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1219 | pref = "autoaudiosrc"; |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1220 | purple_prefs_set_string( |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1221 | PIDGIN_PREFS_ROOT "/vvconfig/audio/src/device", pref); |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1222 | audio_src = purple_media_manager_get_element_info(manager, |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1223 | pref); |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1224 | } |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1225 | |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1226 | pref = purple_prefs_get_string( |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1227 | PIDGIN_PREFS_ROOT "/vvconfig/audio/sink/device"); |
|
38027
bd088b2700cd
Fix crash if VV config device prefs are unset.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38007
diff
changeset
|
1228 | if (pref) |
|
bd088b2700cd
Fix crash if VV config device prefs are unset.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38007
diff
changeset
|
1229 | audio_sink = purple_media_manager_get_element_info(manager, pref); |
|
37885
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1230 | if (!audio_sink) { |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1231 | pref = "autoaudiosink"; |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1232 | purple_prefs_set_string( |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1233 | PIDGIN_PREFS_ROOT "/vvconfig/audio/sink/device", pref); |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1234 | audio_sink = purple_media_manager_get_element_info(manager, |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1235 | pref); |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1236 | } |
|
26616
4f58db29d346
Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26523
diff
changeset
|
1237 | |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1238 | g_signal_connect(G_OBJECT(manager), "init-media", |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1239 | G_CALLBACK(pidgin_media_new_cb), NULL); |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1240 | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
31151
diff
changeset
|
1241 | purple_media_manager_set_ui_caps(manager, |
|
26521
f7f083e8cd31
Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents:
26514
diff
changeset
|
1242 | PURPLE_MEDIA_CAPS_AUDIO | |
|
f7f083e8cd31
Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents:
26514
diff
changeset
|
1243 | PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION | |
|
f7f083e8cd31
Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents:
26514
diff
changeset
|
1244 | PURPLE_MEDIA_CAPS_VIDEO | |
|
f7f083e8cd31
Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents:
26514
diff
changeset
|
1245 | PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION | |
|
f7f083e8cd31
Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents:
26514
diff
changeset
|
1246 | PURPLE_MEDIA_CAPS_AUDIO_VIDEO); |
|
f7f083e8cd31
Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents:
26514
diff
changeset
|
1247 | |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1248 | purple_debug_info("gtkmedia", "Registering media element types\n"); |
|
37885
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1249 | purple_media_manager_set_active_element(manager, video_src); |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1250 | purple_media_manager_set_active_element(manager, video_sink); |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1251 | purple_media_manager_set_active_element(manager, audio_src); |
|
f12d4064eeae
pidgin/finch: use GStreamer-provided VV elements
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37880
diff
changeset
|
1252 | purple_media_manager_set_active_element(manager, audio_sink); |
|
26504
55082249a5f9
Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents:
26503
diff
changeset
|
1253 | #endif |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1254 | } |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1255 |