Thu, 19 Dec 2019 05:00:44 -0500
Convert PidginRoomlistDialog to Glade.
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
1 | /* pidgin |
| 5684 | 2 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15923
diff
changeset
|
3 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 8046 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
| 5684 | 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19849
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5684 | 20 | * |
| 21 | */ | |
| 9791 | 22 | #include "internal.h" |
| 15577 | 23 | #include "pidgin.h" |
| 5684 | 24 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
25 | #ifdef _WIN32 |
| 5684 | 26 | #include <windows.h> |
| 27 | #include <mmsystem.h> | |
| 28 | #endif | |
| 29 | ||
| 13720 | 30 | #ifdef USE_GSTREAMER |
| 31 | # include <gst/gst.h> | |
| 32 | #endif /* USE_GSTREAMER */ | |
| 5684 | 33 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
34 | #include "debug.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
35 | #include "notify.h" |
| 5684 | 36 | #include "prefs.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
37 | #include "sound.h" |
|
23649
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
38 | #include "sound-theme.h" |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
39 | #include "theme-manager.h" |
|
7465
17e1e9e996ad
[gaim-migrate @ 8078]
Mark Doliner <markdoliner@pidgin.im>
parents:
7464
diff
changeset
|
40 | #include "util.h" |
| 5684 | 41 | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
42 | #include "gtkconv.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
43 | #include "gtksound.h" |
| 5684 | 44 | |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15649
diff
changeset
|
45 | struct pidgin_sound_event { |
| 5684 | 46 | char *label; |
| 47 | char *pref; | |
| 48 | char *def; | |
| 49 | }; | |
| 50 | ||
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
51 | static guint mute_login_sounds_timeout = 0; |
| 5684 | 52 | static gboolean mute_login_sounds = FALSE; |
| 53 | ||
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
54 | #ifdef USE_GSTREAMER |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
55 | static gboolean gst_init_failed; |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
56 | #endif /* USE_GSTREAMER */ |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
57 | |
|
21091
07fe1a99c47b
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents:
20234
diff
changeset
|
58 | static const struct pidgin_sound_event sounds[PURPLE_NUM_SOUNDS] = { |
| 10158 | 59 | {N_("Buddy logs in"), "login", "login.wav"}, |
| 60 | {N_("Buddy logs out"), "logout", "logout.wav"}, | |
| 5684 | 61 | {N_("Message received"), "im_recv", "receive.wav"}, |
| 62 | {N_("Message received begins conversation"), "first_im_recv", "receive.wav"}, | |
| 63 | {N_("Message sent"), "send_im", "send.wav"}, | |
| 10158 | 64 | {N_("Person enters chat"), "join_chat", "login.wav"}, |
| 65 | {N_("Person leaves chat"), "left_chat", "logout.wav"}, | |
| 5684 | 66 | {N_("You talk in chat"), "send_chat_msg", "send.wav"}, |
| 67 | {N_("Others talk in chat"), "chat_msg_recv", "receive.wav"}, | |
| 68 | /* this isn't a terminator, it's the buddy pounce default sound event ;-) */ | |
| 10158 | 69 | {NULL, "pounce_default", "alert.wav"}, |
|
24457
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
70 | {N_("Someone says your username in chat"), "nick_said", "alert.wav"}, |
|
29489
2322b6b9fcb7
Don't play the message received sound for NOTIFY messages (this will avoid
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
71 | {N_("Attention received"), "got_attention", "alert.wav"} |
| 5684 | 72 | }; |
| 73 | ||
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
74 | static gboolean |
|
11463
d672317c99c1
[gaim-migrate @ 13703]
Mark Doliner <markdoliner@pidgin.im>
parents:
11256
diff
changeset
|
75 | unmute_login_sounds_cb(gpointer data) |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
76 | { |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
77 | mute_login_sounds = FALSE; |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
78 | mute_login_sounds_timeout = 0; |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
79 | return FALSE; |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
80 | } |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
81 | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
82 | static gboolean |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
83 | chat_nick_matches_name(PurpleChatConversation *chat, const char *aname) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
84 | { |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
85 | char *nick = NULL; |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
86 | char *name = NULL; |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
87 | gboolean ret = FALSE; |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
88 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
89 | if (chat==NULL) |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
90 | return ret; |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
91 | |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
92 | nick = g_strdup(purple_normalize(purple_conversation_get_account( |
|
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
93 | PURPLE_CONVERSATION(chat)), purple_chat_conversation_get_nick(chat))); |
|
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
94 | name = g_strdup(purple_normalize(purple_conversation_get_account( |
|
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
95 | PURPLE_CONVERSATION(chat)), aname)); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
96 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
97 | if (g_utf8_collate(nick, name) == 0) |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
98 | ret = TRUE; |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
99 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
100 | g_free(nick); |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
101 | g_free(name); |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
102 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
103 | return ret; |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
104 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
105 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
106 | /* |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
107 | * play a sound event for a conversation, honoring make_sound flag |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
108 | * of conversation and checking for focus if conv_focus pref is set |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
109 | */ |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
110 | static void |
| 15884 | 111 | play_conv_event(PurpleConversation *conv, PurpleSoundEventID event) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
112 | { |
| 36083 | 113 | g_return_if_fail(event < PURPLE_NUM_SOUNDS); |
| 114 | ||
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11581
diff
changeset
|
115 | /* If we should not play the sound for some reason, then exit early */ |
|
19591
a943e8e69c5f
Make sure a conversation is a pidgin-conversation to avoid a crash.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19564
diff
changeset
|
116 | if (conv != NULL && PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11581
diff
changeset
|
117 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
118 | PidginConversation *gtkconv; |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11581
diff
changeset
|
119 | gboolean has_focus; |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
120 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
121 | gtkconv = PIDGIN_CONVERSATION(conv); |
| 15884 | 122 | has_focus = purple_conversation_has_focus(conv); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
123 | |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11581
diff
changeset
|
124 | if (!gtkconv->make_sound || |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
125 | (has_focus && !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/conv_focus"))) |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11581
diff
changeset
|
126 | { |
|
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11581
diff
changeset
|
127 | return; |
|
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11581
diff
changeset
|
128 | } |
|
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11581
diff
changeset
|
129 | } |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
130 | |
| 15884 | 131 | purple_sound_play_event(event, conv ? purple_conversation_get_account(conv) : NULL); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
132 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
133 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
134 | static void |
| 15884 | 135 | buddy_state_cb(PurpleBuddy *buddy, PurpleSoundEventID event) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
136 | { |
| 15884 | 137 | purple_sound_play_event(event, purple_buddy_get_account(buddy)); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
138 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
139 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
140 | static void |
| 15884 | 141 | im_msg_received_cb(PurpleAccount *account, char *sender, |
| 142 | char *message, PurpleConversation *conv, | |
| 143 | PurpleMessageFlags flags, PurpleSoundEventID event) | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
144 | { |
|
29489
2322b6b9fcb7
Don't play the message received sound for NOTIFY messages (this will avoid
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
145 | if (flags & PURPLE_MESSAGE_DELAYED || flags & PURPLE_MESSAGE_NOTIFY) |
|
12850
744542bdd53e
[gaim-migrate @ 15200]
Casey Harkins <charkins@pidgin.im>
parents:
12828
diff
changeset
|
146 | return; |
|
744542bdd53e
[gaim-migrate @ 15200]
Casey Harkins <charkins@pidgin.im>
parents:
12828
diff
changeset
|
147 | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
148 | if (conv==NULL) |
| 15884 | 149 | purple_sound_play_event(PURPLE_SOUND_FIRST_RECEIVE, account); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
150 | else |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
151 | play_conv_event(conv, event); |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
152 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
153 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
154 | static void |
|
36081
6764e037a308
Switch sent-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35850
diff
changeset
|
155 | im_msg_sent_cb(PurpleAccount *account, PurpleMessage *msg, |
|
6764e037a308
Switch sent-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35850
diff
changeset
|
156 | PurpleSoundEventID event) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
157 | { |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
158 | PurpleConversation *conv = PURPLE_CONVERSATION( |
|
36081
6764e037a308
Switch sent-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35850
diff
changeset
|
159 | purple_conversations_find_im_with_account( |
|
36098
4951752ad038
Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36083
diff
changeset
|
160 | purple_message_get_recipient(msg), account)); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
161 | play_conv_event(conv, event); |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
162 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
163 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
164 | static void |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34662
diff
changeset
|
165 | chat_user_join_cb(PurpleChatConversation *chat, const char *name, |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34662
diff
changeset
|
166 | PurpleChatUserFlags flags, gboolean new_arrival, |
| 15884 | 167 | PurpleSoundEventID event) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
168 | { |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
169 | if (new_arrival && !chat_nick_matches_name(chat, name)) |
|
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
170 | play_conv_event(PURPLE_CONVERSATION(chat), event); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
171 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
172 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
173 | static void |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34662
diff
changeset
|
174 | chat_user_left_cb(PurpleChatConversation *chat, const char *name, |
| 15884 | 175 | const char *reason, PurpleSoundEventID event) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
176 | { |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
177 | if (!chat_nick_matches_name(chat, name)) |
|
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
178 | play_conv_event(PURPLE_CONVERSATION(chat), event); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
179 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
180 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
181 | static void |
|
36082
247d94c903c3
Switch sent-chat-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36081
diff
changeset
|
182 | chat_msg_sent_cb(PurpleAccount *account, PurpleMessage *msg, int id, |
|
247d94c903c3
Switch sent-chat-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36081
diff
changeset
|
183 | PurpleSoundEventID event) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
184 | { |
| 15884 | 185 | PurpleConnection *conn = purple_account_get_connection(account); |
| 186 | PurpleConversation *conv = NULL; | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
187 | |
| 11581 | 188 | if (conn!=NULL) |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
189 | conv = PURPLE_CONVERSATION(purple_conversations_find_chat(conn,id)); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
190 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
191 | play_conv_event(conv, event); |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
192 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
193 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
194 | static void |
| 15884 | 195 | chat_msg_received_cb(PurpleAccount *account, char *sender, |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
196 | char *message, PurpleChatConversation *chat, |
| 15884 | 197 | PurpleMessageFlags flags, PurpleSoundEventID event) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
198 | { |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
199 | PurpleConversation *conv = PURPLE_CONVERSATION(chat); |
|
29489
2322b6b9fcb7
Don't play the message received sound for NOTIFY messages (this will avoid
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
200 | if (flags & PURPLE_MESSAGE_DELAYED || flags & PURPLE_MESSAGE_NOTIFY) |
|
12850
744542bdd53e
[gaim-migrate @ 15200]
Casey Harkins <charkins@pidgin.im>
parents:
12828
diff
changeset
|
201 | return; |
|
744542bdd53e
[gaim-migrate @ 15200]
Casey Harkins <charkins@pidgin.im>
parents:
12828
diff
changeset
|
202 | |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
203 | g_return_if_fail(conv != NULL); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
204 | |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
205 | if (purple_chat_conversation_is_ignored_user(chat, sender)) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
206 | return; |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
207 | |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
208 | if (chat_nick_matches_name(chat, sender)) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
209 | return; |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
210 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
33948
diff
changeset
|
211 | if (flags & PURPLE_MESSAGE_NICK || purple_utf8_has_word(message, purple_chat_conversation_get_nick(chat))) |
|
28542
4868e1836159
Fix fallback to default sounds when the file isn't found.
Daniel Atallah <datallah@pidgin.im>
parents:
27952
diff
changeset
|
212 | /* This isn't quite right; if you have the PURPLE_SOUND_CHAT_NICK event disabled |
|
4868e1836159
Fix fallback to default sounds when the file isn't found.
Daniel Atallah <datallah@pidgin.im>
parents:
27952
diff
changeset
|
213 | * and the PURPLE_SOUND_CHAT_SAY event enabled, you won't get a sound at all */ |
| 15884 | 214 | play_conv_event(conv, PURPLE_SOUND_CHAT_NICK); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
215 | else |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
216 | play_conv_event(conv, event); |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
217 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
218 | |
|
24457
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
219 | static void |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29653
diff
changeset
|
220 | got_attention_cb(PurpleAccount *account, const char *who, |
|
24457
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
221 | PurpleConversation *conv, guint type, PurpleSoundEventID event) |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
222 | { |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
223 | play_conv_event(conv, event); |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
224 | } |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
225 | |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
226 | /* |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
227 | * We mute sounds for the 10 seconds after you log in so that |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
228 | * you don't get flooded with sounds when the blist shows all |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
229 | * your buddies logging in. |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
230 | */ |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
231 | static void |
| 15884 | 232 | account_signon_cb(PurpleConnection *gc, gpointer data) |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
233 | { |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
234 | if (mute_login_sounds_timeout != 0) |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
235 | g_source_remove(mute_login_sounds_timeout); |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
236 | mute_login_sounds = TRUE; |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
237 | mute_login_sounds_timeout = g_timeout_add_seconds(10, unmute_login_sounds_cb, NULL); |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
238 | } |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
239 | |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
240 | const char * |
| 15884 | 241 | pidgin_sound_get_event_option(PurpleSoundEventID event) |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
242 | { |
| 15884 | 243 | if(event >= PURPLE_NUM_SOUNDS) |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
244 | return 0; |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
245 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
246 | return sounds[event].pref; |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
247 | } |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
248 | |
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14972
diff
changeset
|
249 | const char * |
| 15884 | 250 | pidgin_sound_get_event_label(PurpleSoundEventID event) |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
251 | { |
| 15884 | 252 | if(event >= PURPLE_NUM_SOUNDS) |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
253 | return NULL; |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
254 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
255 | return sounds[event].label; |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
256 | } |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
257 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
258 | void * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
259 | pidgin_sound_get_handle() |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
260 | { |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
261 | static int handle; |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
262 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
263 | return &handle; |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
264 | } |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
265 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
266 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
267 | pidgin_sound_init(void) |
| 5684 | 268 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
269 | void *gtk_sound_handle = pidgin_sound_get_handle(); |
| 15884 | 270 | void *blist_handle = purple_blist_get_handle(); |
| 271 | void *conv_handle = purple_conversations_get_handle(); | |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
272 | #ifdef USE_GSTREAMER |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
273 | GError *error = NULL; |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
274 | #endif |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
275 | |
| 15884 | 276 | purple_signal_connect(purple_connections_get_handle(), "signed-on", |
| 277 | gtk_sound_handle, PURPLE_CALLBACK(account_signon_cb), | |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
278 | NULL); |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
279 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
280 | purple_prefs_add_none(PIDGIN_PREFS_ROOT "/sound"); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
281 | purple_prefs_add_none(PIDGIN_PREFS_ROOT "/sound/enabled"); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
282 | purple_prefs_add_none(PIDGIN_PREFS_ROOT "/sound/file"); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
283 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/login", TRUE); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
284 | purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/login", ""); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
285 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/logout", TRUE); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
286 | purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/logout", ""); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
287 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/im_recv", TRUE); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
288 | purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/im_recv", ""); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
289 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/first_im_recv", FALSE); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
290 | purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/first_im_recv", ""); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
291 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/send_im", TRUE); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
292 | purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/send_im", ""); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
293 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/join_chat", FALSE); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
294 | purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/join_chat", ""); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
295 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/left_chat", FALSE); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
296 | purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/left_chat", ""); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
297 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/send_chat_msg", FALSE); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
298 | purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/send_chat_msg", ""); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
299 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/chat_msg_recv", FALSE); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
300 | purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/chat_msg_recv", ""); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
301 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/nick_said", FALSE); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
302 | purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/nick_said", ""); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
303 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/pounce_default", TRUE); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
304 | purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/pounce_default", ""); |
|
23649
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
305 | purple_prefs_add_string(PIDGIN_PREFS_ROOT "/sound/theme", ""); |
|
24457
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
306 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/sent_attention", TRUE); |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
307 | purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/sent_attention", ""); |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
308 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/got_attention", TRUE); |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
309 | purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/got_attention", ""); |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
310 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/conv_focus", TRUE); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
311 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/mute", FALSE); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
312 | purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/command", ""); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
313 | purple_prefs_add_string(PIDGIN_PREFS_ROOT "/sound/method", "automatic"); |
| 5684 | 314 | |
| 13720 | 315 | #ifdef USE_GSTREAMER |
| 15884 | 316 | purple_debug_info("sound", "Initializing sound output drivers.\n"); |
|
34293
c1da9082287f
Fix a crash in case of Ctrl+C while booting (it's fork related)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33948
diff
changeset
|
317 | gst_registry_fork_set_enabled(FALSE); |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
318 | if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) { |
| 15884 | 319 | purple_notify_error(NULL, _("GStreamer Failure"), |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
320 | _("GStreamer failed to initialize."), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34293
diff
changeset
|
321 | error ? error->message : "", NULL); |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
322 | if (error) { |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
323 | g_error_free(error); |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
324 | error = NULL; |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
325 | } |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
326 | } |
| 13720 | 327 | #endif /* USE_GSTREAMER */ |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
328 | |
| 15884 | 329 | purple_signal_connect(blist_handle, "buddy-signed-on", |
| 330 | gtk_sound_handle, PURPLE_CALLBACK(buddy_state_cb), | |
| 331 | GINT_TO_POINTER(PURPLE_SOUND_BUDDY_ARRIVE)); | |
| 332 | purple_signal_connect(blist_handle, "buddy-signed-off", | |
| 333 | gtk_sound_handle, PURPLE_CALLBACK(buddy_state_cb), | |
| 334 | GINT_TO_POINTER(PURPLE_SOUND_BUDDY_LEAVE)); | |
| 335 | purple_signal_connect(conv_handle, "received-im-msg", | |
| 336 | gtk_sound_handle, PURPLE_CALLBACK(im_msg_received_cb), | |
| 337 | GINT_TO_POINTER(PURPLE_SOUND_RECEIVE)); | |
| 338 | purple_signal_connect(conv_handle, "sent-im-msg", | |
| 339 | gtk_sound_handle, PURPLE_CALLBACK(im_msg_sent_cb), | |
| 340 | GINT_TO_POINTER(PURPLE_SOUND_SEND)); | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34662
diff
changeset
|
341 | purple_signal_connect(conv_handle, "chat-user-joined", |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34662
diff
changeset
|
342 | gtk_sound_handle, PURPLE_CALLBACK(chat_user_join_cb), |
| 15884 | 343 | GINT_TO_POINTER(PURPLE_SOUND_CHAT_JOIN)); |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34662
diff
changeset
|
344 | purple_signal_connect(conv_handle, "chat-user-left", |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34662
diff
changeset
|
345 | gtk_sound_handle, PURPLE_CALLBACK(chat_user_left_cb), |
| 15884 | 346 | GINT_TO_POINTER(PURPLE_SOUND_CHAT_LEAVE)); |
| 347 | purple_signal_connect(conv_handle, "sent-chat-msg", | |
| 348 | gtk_sound_handle, PURPLE_CALLBACK(chat_msg_sent_cb), | |
| 349 | GINT_TO_POINTER(PURPLE_SOUND_CHAT_YOU_SAY)); | |
| 350 | purple_signal_connect(conv_handle, "received-chat-msg", | |
| 351 | gtk_sound_handle, PURPLE_CALLBACK(chat_msg_received_cb), | |
| 352 | GINT_TO_POINTER(PURPLE_SOUND_CHAT_SAY)); | |
|
24457
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
353 | purple_signal_connect(conv_handle, "got-attention", gtk_sound_handle, |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
354 | PURPLE_CALLBACK(got_attention_cb), |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
355 | GINT_TO_POINTER(PURPLE_SOUND_GOT_ATTENTION)); |
|
29489
2322b6b9fcb7
Don't play the message received sound for NOTIFY messages (this will avoid
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
356 | /* for the time being, don't handle sent-attention here, since playing a |
|
2322b6b9fcb7
Don't play the message received sound for NOTIFY messages (this will avoid
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
357 | sound would result induplicate sounds. And fixing that would require changing the |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29653
diff
changeset
|
358 | conversation signal for msg-recv */ |
| 5684 | 359 | } |
| 360 | ||
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
361 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
362 | pidgin_sound_uninit(void) |
| 5684 | 363 | { |
| 13720 | 364 | #ifdef USE_GSTREAMER |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
365 | if (!gst_init_failed) |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
366 | gst_deinit(); |
| 5684 | 367 | #endif |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
368 | |
| 15884 | 369 | purple_signals_disconnect_by_handle(pidgin_sound_get_handle()); |
| 5684 | 370 | } |
| 371 | ||
| 13720 | 372 | #ifdef USE_GSTREAMER |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
373 | static gboolean |
| 13720 | 374 | bus_call (GstBus *bus, |
| 375 | GstMessage *msg, | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
376 | gpointer data) |
|
12815
5f73e8c06a9c
[gaim-migrate @ 15163]
Casey Harkins <charkins@pidgin.im>
parents:
12411
diff
changeset
|
377 | { |
| 13720 | 378 | GstElement *play = data; |
|
14941
0c27c799be04
[gaim-migrate @ 17648]
Mark Doliner <markdoliner@pidgin.im>
parents:
14762
diff
changeset
|
379 | GError *err = NULL; |
|
10074
4fab99572bf1
[gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
380 | |
| 13720 | 381 | switch (GST_MESSAGE_TYPE (msg)) { |
| 382 | case GST_MESSAGE_ERROR: | |
| 383 | gst_message_parse_error(msg, &err, NULL); | |
|
17731
6486f382fb08
Improve the formatting of some gstreamer error messages. Someone
Mark Doliner <markdoliner@pidgin.im>
parents:
17146
diff
changeset
|
384 | purple_debug_error("gstreamer", "%s\n", err->message); |
| 13720 | 385 | g_error_free(err); |
|
19564
6f04c6ab2897
Cleanup playbin on error. Thanks, Elliott Sales de Andrade. Fixes #2663
Sean Egan <seanegan@pidgin.im>
parents:
18292
diff
changeset
|
386 | /* fall-through and clean up */ |
|
6f04c6ab2897
Cleanup playbin on error. Thanks, Elliott Sales de Andrade. Fixes #2663
Sean Egan <seanegan@pidgin.im>
parents:
18292
diff
changeset
|
387 | case GST_MESSAGE_EOS: |
|
6f04c6ab2897
Cleanup playbin on error. Thanks, Elliott Sales de Andrade. Fixes #2663
Sean Egan <seanegan@pidgin.im>
parents:
18292
diff
changeset
|
388 | gst_element_set_state(play, GST_STATE_NULL); |
|
6f04c6ab2897
Cleanup playbin on error. Thanks, Elliott Sales de Andrade. Fixes #2663
Sean Egan <seanegan@pidgin.im>
parents:
18292
diff
changeset
|
389 | gst_object_unref(GST_OBJECT(play)); |
|
37243
902b1fd334bd
Remove Gstreamer pipeline after playing a sound
Jorge Villaseñor <salinasv@pidgin.im>
parents:
31294
diff
changeset
|
390 | return FALSE; |
| 13720 | 391 | break; |
| 392 | case GST_MESSAGE_WARNING: | |
| 393 | gst_message_parse_warning(msg, &err, NULL); | |
|
17732
b6325601b1ff
I left off a comma. My bad!
Mark Doliner <markdoliner@pidgin.im>
parents:
17731
diff
changeset
|
394 | purple_debug_warning("gstreamer", "%s\n", err->message); |
| 13720 | 395 | g_error_free(err); |
| 396 | break; | |
| 397 | default: | |
| 398 | break; | |
| 399 | } | |
| 400 | return TRUE; | |
| 401 | } | |
|
12930
2a65c7c86e86
[gaim-migrate @ 15283]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
402 | #endif |
|
12815
5f73e8c06a9c
[gaim-migrate @ 15163]
Casey Harkins <charkins@pidgin.im>
parents:
12411
diff
changeset
|
403 | |
|
23027
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
404 | #ifndef _WIN32 |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
405 | static gboolean |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
406 | expire_old_child(gpointer data) |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
407 | { |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
408 | pid_t pid = GPOINTER_TO_INT(data); |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
409 | |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
410 | if (waitpid(pid, NULL, WNOHANG | WUNTRACED) < 0) { |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
411 | if (errno == ECHILD) |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
412 | return FALSE; |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
413 | else |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
414 | purple_debug_warning("gtksound", "Child is ill, pid: %d (%s)\n", pid, strerror(errno)); |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
415 | } |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
416 | |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
417 | if (kill(pid, SIGKILL) < 0) |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
418 | purple_debug_error("gtksound", "Killing process %d failed (%s)\n", pid, strerror(errno)); |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
419 | |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
420 | return FALSE; |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
421 | } |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
422 | #endif |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
423 | |
|
33948
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
424 | #ifdef _WIN32 |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
425 | static void |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
426 | pidgin_sound_play_file_win32(const char *filename) |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
427 | { |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
428 | wchar_t *wc_filename = g_utf8_to_utf16(filename, |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
429 | -1, NULL, NULL, NULL); |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
430 | if (!PlaySoundW(wc_filename, NULL, SND_ASYNC | SND_FILENAME)) |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
431 | purple_debug(PURPLE_DEBUG_ERROR, "sound", "Error playing sound.\n"); |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
432 | g_free(wc_filename); |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
433 | } |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
434 | #endif /* _WIN32 */ |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
435 | |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
436 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
437 | pidgin_sound_play_file(const char *filename) |
| 5684 | 438 | { |
| 439 | const char *method; | |
| 13720 | 440 | #ifdef USE_GSTREAMER |
| 441 | char *uri; | |
| 442 | GstElement *sink = NULL; | |
| 443 | GstElement *play = NULL; | |
|
15285
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
444 | GstBus *bus = NULL; |
| 5684 | 445 | #endif |
| 446 | ||
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
447 | if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute")) |
| 5684 | 448 | return; |
| 449 | ||
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
450 | method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"); |
| 5684 | 451 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
37243
diff
changeset
|
452 | if (purple_strequal(method, "none")) { |
|
10074
4fab99572bf1
[gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
453 | return; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
37243
diff
changeset
|
454 | } else if (purple_strequal(method, "beep")) { |
| 5684 | 455 | gdk_beep(); |
| 456 | return; | |
| 457 | } | |
|
33948
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
458 | #ifdef _WIN32 |
| 38358 | 459 | else if (purple_strequal(method, "playsoundw")) { |
|
33948
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
460 | pidgin_sound_play_file_win32(filename); |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
461 | return; |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
462 | } |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
463 | #endif /* _WIN32 */ |
| 5684 | 464 | |
| 13797 | 465 | if (!g_file_test(filename, G_FILE_TEST_EXISTS)) { |
| 15884 | 466 | purple_debug_error("gtksound", "sound file (%s) does not exist.\n", filename); |
| 5684 | 467 | return; |
| 13797 | 468 | } |
| 5684 | 469 | |
| 470 | #ifndef _WIN32 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
37243
diff
changeset
|
471 | if (purple_strequal(method, "custom")) { |
| 5684 | 472 | const char *sound_cmd; |
| 473 | char *command; | |
|
16951
d7d924e847d6
Escape filename when using the command sound method. Fixes ticket #607.
Casey Harkins <charkins@pidgin.im>
parents:
16752
diff
changeset
|
474 | char *esc_filename; |
|
23027
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
475 | char **argv = NULL; |
| 5684 | 476 | GError *error = NULL; |
|
23027
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
477 | GPid pid; |
| 5684 | 478 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
479 | sound_cmd = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/sound/command"); |
| 5684 | 480 | |
| 481 | if (!sound_cmd || *sound_cmd == '\0') { | |
| 15884 | 482 | purple_debug_error("gtksound", |
| 13797 | 483 | "'Command' sound method has been chosen, " |
|
24572
d2f6abb70f4e
Missing newline in debug message.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23314
diff
changeset
|
484 | "but no command has been set.\n"); |
| 5684 | 485 | return; |
| 486 | } | |
| 487 | ||
|
16959
5ae554ed8299
Let glib handle quoting filenames for shell, it'll escape other quotes as needed.
Casey Harkins <charkins@pidgin.im>
parents:
16951
diff
changeset
|
488 | esc_filename = g_shell_quote(filename); |
|
16951
d7d924e847d6
Escape filename when using the command sound method. Fixes ticket #607.
Casey Harkins <charkins@pidgin.im>
parents:
16752
diff
changeset
|
489 | |
| 7464 | 490 | if(strstr(sound_cmd, "%s")) |
|
16951
d7d924e847d6
Escape filename when using the command sound method. Fixes ticket #607.
Casey Harkins <charkins@pidgin.im>
parents:
16752
diff
changeset
|
491 | command = purple_strreplace(sound_cmd, "%s", esc_filename); |
| 7464 | 492 | else |
|
16951
d7d924e847d6
Escape filename when using the command sound method. Fixes ticket #607.
Casey Harkins <charkins@pidgin.im>
parents:
16752
diff
changeset
|
493 | command = g_strdup_printf("%s %s", sound_cmd, esc_filename); |
| 5684 | 494 | |
|
23027
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
495 | if (!g_shell_parse_argv(command, NULL, &argv, &error)) { |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
496 | purple_debug_error("gtksound", "error parsing command %s (%s)\n", |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
497 | command, error->message); |
| 5684 | 498 | g_error_free(error); |
|
23027
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
499 | g_free(esc_filename); |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
500 | g_free(command); |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
501 | return; |
| 5684 | 502 | } |
| 503 | ||
|
23027
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
504 | if (!g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
505 | NULL, NULL, &pid, &error)) { |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
506 | purple_debug_error("gtksound", "sound command could not be launched: %s\n", |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
507 | error->message); |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
508 | g_error_free(error); |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
509 | } else { |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
510 | g_timeout_add_seconds(15, expire_old_child, GINT_TO_POINTER(pid)); |
|
23027
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
511 | } |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
512 | |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
513 | g_strfreev(argv); |
|
16951
d7d924e847d6
Escape filename when using the command sound method. Fixes ticket #607.
Casey Harkins <charkins@pidgin.im>
parents:
16752
diff
changeset
|
514 | g_free(esc_filename); |
| 5684 | 515 | g_free(command); |
| 516 | return; | |
| 517 | } | |
|
19849
e8a23f4721f0
Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <datallah@pidgin.im>
parents:
19591
diff
changeset
|
518 | #endif /* _WIN32 */ |
|
e8a23f4721f0
Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <datallah@pidgin.im>
parents:
19591
diff
changeset
|
519 | |
| 13720 | 520 | #ifdef USE_GSTREAMER |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
521 | if (gst_init_failed) /* Perhaps do gdk_beep instead? */ |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
522 | return; |
|
33948
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
523 | #ifdef _WIN32 |
| 38358 | 524 | if (purple_strequal(method, "automatic")) { |
|
33948
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
525 | sink = gst_element_factory_make("directsoundsink", "sink"); |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
526 | if (sink == NULL) |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
527 | sink = gst_element_factory_make("waveformsink", "sink"); |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
528 | if (sink == NULL) |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
529 | sink = gst_element_factory_make("gconfaudiosink", "sink"); |
| 38358 | 530 | } else if (purple_strequal(method, "directsound")) { |
|
33948
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
531 | sink = gst_element_factory_make("directsoundsink", "sink"); |
| 38358 | 532 | } else if (purple_strequal(method, "waveform")) { |
|
33948
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
533 | sink = gst_element_factory_make("waveformsink", "sink"); |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
534 | } |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
535 | #else |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
37243
diff
changeset
|
536 | if (purple_strequal(method, "automatic")) { |
|
23314
f9ed181439a4
Try gconfaudiosink first always, not just under GNOME. This is what Debian
Richard Laager <rlaager@pidgin.im>
parents:
23239
diff
changeset
|
537 | sink = gst_element_factory_make("gconfaudiosink", "sink"); |
| 38358 | 538 | } else if (purple_strequal(method, "esd")) { |
| 13720 | 539 | sink = gst_element_factory_make("esdsink", "sink"); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
37243
diff
changeset
|
540 | } else if (purple_strequal(method, "alsa")) { |
|
17146
7d256e417ef6
ALSA Gstreamer sink. Mostly to see if this still crashes Luke.
Sean Egan <seanegan@pidgin.im>
parents:
16995
diff
changeset
|
541 | sink = gst_element_factory_make("alsasink", "sink"); |
|
19849
e8a23f4721f0
Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <datallah@pidgin.im>
parents:
19591
diff
changeset
|
542 | } |
|
e8a23f4721f0
Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <datallah@pidgin.im>
parents:
19591
diff
changeset
|
543 | #endif |
|
e8a23f4721f0
Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <datallah@pidgin.im>
parents:
19591
diff
changeset
|
544 | else { |
| 15884 | 545 | purple_debug_error("sound", "Unknown sound method '%s'\n", method); |
|
15285
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
546 | return; |
| 13720 | 547 | } |
| 5684 | 548 | |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
549 | if (!purple_strequal(method, "automatic") && !sink) { |
|
23239
1aec418902fd
A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents:
23069
diff
changeset
|
550 | purple_debug_error("sound", "Unable to create GStreamer audiosink.\n"); |
|
1aec418902fd
A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents:
23069
diff
changeset
|
551 | return; |
|
1aec418902fd
A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents:
23069
diff
changeset
|
552 | } |
|
1aec418902fd
A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents:
23069
diff
changeset
|
553 | |
|
15285
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
554 | play = gst_element_factory_make("playbin", "play"); |
|
21125
e7cd2426e511
Remove unused definition.
Daniel Atallah <datallah@pidgin.im>
parents:
21091
diff
changeset
|
555 | |
|
16161
a6f32c913f9b
Fix a possible gstreamer crash
Sean Egan <seanegan@pidgin.im>
parents:
16123
diff
changeset
|
556 | if (play == NULL) { |
|
a6f32c913f9b
Fix a possible gstreamer crash
Sean Egan <seanegan@pidgin.im>
parents:
16123
diff
changeset
|
557 | return; |
|
a6f32c913f9b
Fix a possible gstreamer crash
Sean Egan <seanegan@pidgin.im>
parents:
16123
diff
changeset
|
558 | } |
|
21125
e7cd2426e511
Remove unused definition.
Daniel Atallah <datallah@pidgin.im>
parents:
21091
diff
changeset
|
559 | |
|
33948
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
560 | #ifdef _WIN32 |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
561 | uri = g_strdup_printf("file:///%s", filename); |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
562 | g_strdelimit(uri, "\\", '/'); |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
563 | #else |
| 13720 | 564 | uri = g_strdup_printf("file://%s", filename); |
|
33948
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
565 | #endif |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
566 | |
| 13720 | 567 | g_object_set(G_OBJECT(play), "uri", uri, |
| 568 | "audio-sink", sink, NULL); | |
| 5684 | 569 | |
|
15285
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
570 | bus = gst_pipeline_get_bus(GST_PIPELINE(play)); |
|
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
571 | gst_bus_add_watch(bus, bus_call, play); |
|
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
572 | |
| 13720 | 573 | gst_element_set_state(play, GST_STATE_PLAYING); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
574 | |
|
15285
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
575 | gst_object_unref(bus); |
| 13720 | 576 | g_free(uri); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
577 | |
|
23069
293830ac1149
Clarify #ifdef/#else/#endif matching; References #5770.
Ethan Blanton <elb@pidgin.im>
parents:
23027
diff
changeset
|
578 | #else /* #ifdef USE_GSTREAMER */ |
|
19849
e8a23f4721f0
Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <datallah@pidgin.im>
parents:
19591
diff
changeset
|
579 | |
|
e8a23f4721f0
Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <datallah@pidgin.im>
parents:
19591
diff
changeset
|
580 | #ifndef _WIN32 |
| 5684 | 581 | gdk_beep(); |
| 582 | #else /* _WIN32 */ | |
|
33948
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
583 | pidgin_sound_play_file_win32(filename); |
| 5684 | 584 | #endif /* _WIN32 */ |
|
19849
e8a23f4721f0
Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <datallah@pidgin.im>
parents:
19591
diff
changeset
|
585 | |
|
e8a23f4721f0
Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <datallah@pidgin.im>
parents:
19591
diff
changeset
|
586 | #endif /* USE_GSTREAMER */ |
| 5684 | 587 | } |
| 588 | ||
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
589 | static void |
| 15884 | 590 | pidgin_sound_play_event(PurpleSoundEventID event) |
| 5684 | 591 | { |
| 592 | char *enable_pref; | |
| 593 | char *file_pref; | |
|
23972
90e0da03c053
theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23661
diff
changeset
|
594 | const char *theme_name; |
|
23649
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
595 | PurpleSoundTheme *theme; |
| 5684 | 596 | |
| 15884 | 597 | if ((event == PURPLE_SOUND_BUDDY_ARRIVE) && mute_login_sounds) |
| 5684 | 598 | return; |
| 599 | ||
| 15884 | 600 | if (event >= PURPLE_NUM_SOUNDS) { |
| 601 | purple_debug_error("sound", "got request for unknown sound: %d\n", event); | |
| 5684 | 602 | return; |
| 603 | } | |
| 604 | ||
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
605 | enable_pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/enabled/%s", |
| 5684 | 606 | sounds[event].pref); |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
607 | file_pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s", sounds[event].pref); |
| 5684 | 608 | |
| 609 | /* check NULL for sounds that don't have an option, ie buddy pounce */ | |
| 15884 | 610 | if (purple_prefs_get_bool(enable_pref)) { |
| 611 | char *filename = g_strdup(purple_prefs_get_path(file_pref)); | |
|
23661
6cfcb043b068
fixed segfault when changing blist themes, changed prefs to not rely on static iter, fixed a few leaks
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23651
diff
changeset
|
612 | theme_name = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme"); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25884
diff
changeset
|
613 | |
|
25884
c00e14c20165
* Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents:
24952
diff
changeset
|
614 | if (theme_name && *theme_name && (!filename || !*filename)) { |
|
c00e14c20165
* Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents:
24952
diff
changeset
|
615 | /* Use theme */ |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
616 | g_free(filename); |
|
23649
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
617 | |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
618 | theme = PURPLE_SOUND_THEME(purple_theme_manager_find_theme(theme_name, "sound")); |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
619 | filename = purple_sound_theme_get_file_full(theme, sounds[event].pref); |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
620 | |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
621 | if(!g_file_test(filename, G_FILE_TEST_IS_REGULAR)){ /* Use Default sound in this case */ |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25884
diff
changeset
|
622 | purple_debug_error("sound", "The file: (%s) %s\n from theme: %s, was not found or wasn't readable\n", |
|
23649
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
623 | sounds[event].pref, filename, theme_name); |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
624 | g_free(filename); |
|
28542
4868e1836159
Fix fallback to default sounds when the file isn't found.
Daniel Atallah <datallah@pidgin.im>
parents:
27952
diff
changeset
|
625 | filename = NULL; |
|
23649
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
626 | } |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
627 | } |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25884
diff
changeset
|
628 | |
|
37523
02346b6472b3
Simplify checks for empty strings
Michael McConville <mmcconville@mykolab.com>
parents:
37519
diff
changeset
|
629 | if (!filename || *filename == '\0') { /* Use Default sounds */ |
|
23649
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
630 | g_free(filename); |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
631 | |
|
35850
1abeda205d6c
cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35454
diff
changeset
|
632 | filename = g_build_filename(PURPLE_DATADIR, |
|
1abeda205d6c
cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35454
diff
changeset
|
633 | "sounds", "purple", sounds[event].def, NULL); |
| 5684 | 634 | } |
| 635 | ||
| 15884 | 636 | purple_sound_play_file(filename, NULL); |
|
23649
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
637 | |
| 5684 | 638 | g_free(filename); |
| 639 | } | |
| 640 | ||
| 641 | g_free(enable_pref); | |
| 642 | g_free(file_pref); | |
| 643 | } | |
| 644 | ||
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25884
diff
changeset
|
645 | gboolean |
|
23649
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
646 | pidgin_sound_is_customized(void) |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
647 | { |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25884
diff
changeset
|
648 | gint i; |
|
28545
06aa1af52d1c
Avoid an unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
28542
diff
changeset
|
649 | gchar *path; |
|
06aa1af52d1c
Avoid an unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
28542
diff
changeset
|
650 | const char *file; |
|
23649
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
651 | |
|
25884
c00e14c20165
* Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents:
24952
diff
changeset
|
652 | for (i = 0; i < PURPLE_NUM_SOUNDS; i++) { |
|
23649
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
653 | path = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s", sounds[i].pref); |
|
28545
06aa1af52d1c
Avoid an unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
28542
diff
changeset
|
654 | file = purple_prefs_get_path(path); |
|
23649
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
655 | g_free(path); |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
656 | |
|
28545
06aa1af52d1c
Avoid an unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
28542
diff
changeset
|
657 | if (file && file[0] != '\0') |
|
23649
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
658 | return TRUE; |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
659 | } |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
660 | |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
661 | return FALSE; |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
662 | |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
663 | } |
|
5da5fe967d10
Working sound themes (option 1) theme is saved in prefs and there is no seperate custom theme, everything
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23314
diff
changeset
|
664 | |
| 15884 | 665 | static PurpleSoundUiOps sound_ui_ops = |
| 5684 | 666 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
667 | pidgin_sound_init, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
668 | pidgin_sound_uninit, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
669 | pidgin_sound_play_file, |
|
16752
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
670 | pidgin_sound_play_event, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
671 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
672 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
673 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
674 | NULL |
| 5684 | 675 | }; |
| 676 | ||
| 15884 | 677 | PurpleSoundUiOps * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
678 | pidgin_sound_get_ui_ops(void) |
| 5684 | 679 | { |
| 680 | return &sound_ui_ops; | |
| 681 | } |