Fri, 03 Sep 2010 07:28:41 +0000
merge of '6780237a96eeae80ce228502c6ab378052777367'
and '00b022749a3f398567ccbe083507f804b5d5f7d9'
| 5684 | 1 | /* |
|
14547
389330a9e9b5
[gaim-migrate @ 17204]
Mark Doliner <markdoliner@pidgin.im>
parents:
14316
diff
changeset
|
2 | * @file gtksound.c GTK+ Sound |
|
16254
eeb2bba4dc94
Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@pidgin.im>
parents:
16161
diff
changeset
|
3 | * @ingroup pidgin |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
6 | /* pidgin |
| 5684 | 7 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15923
diff
changeset
|
8 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 8046 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
| 5684 | 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify | |
| 13 | * it under the terms of the GNU General Public License as published by | |
| 14 | * the Free Software Foundation; either version 2 of the License, or | |
| 15 | * (at your option) any later version. | |
| 16 | * | |
| 17 | * This program is distributed in the hope that it will be useful, | |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | * GNU General Public License for more details. | |
| 21 | * | |
| 22 | * You should have received a copy of the GNU General Public License | |
| 23 | * 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
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5684 | 25 | * |
| 26 | */ | |
| 9791 | 27 | #include "internal.h" |
| 15577 | 28 | #include "pidgin.h" |
| 5684 | 29 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
30 | #ifdef _WIN32 |
| 5684 | 31 | #include <windows.h> |
| 32 | #include <mmsystem.h> | |
| 33 | #endif | |
| 34 | ||
| 13720 | 35 | #ifdef USE_GSTREAMER |
| 36 | # include <gst/gst.h> | |
| 37 | #endif /* USE_GSTREAMER */ | |
| 5684 | 38 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
39 | #include "debug.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
40 | #include "notify.h" |
| 5684 | 41 | #include "prefs.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
42 | #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
|
43 | #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
|
44 | #include "theme-manager.h" |
|
7465
17e1e9e996ad
[gaim-migrate @ 8078]
Mark Doliner <markdoliner@pidgin.im>
parents:
7464
diff
changeset
|
45 | #include "util.h" |
| 5684 | 46 | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
47 | #include "gtkconv.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
48 | #include "gtksound.h" |
| 5684 | 49 | |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15649
diff
changeset
|
50 | struct pidgin_sound_event { |
| 5684 | 51 | char *label; |
| 52 | char *pref; | |
| 53 | char *def; | |
| 54 | }; | |
| 55 | ||
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
56 | static guint mute_login_sounds_timeout = 0; |
| 5684 | 57 | static gboolean mute_login_sounds = FALSE; |
| 58 | ||
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
59 | #ifdef USE_GSTREAMER |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
60 | static gboolean gst_init_failed; |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
61 | #endif /* USE_GSTREAMER */ |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
62 | |
|
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
|
63 | static const struct pidgin_sound_event sounds[PURPLE_NUM_SOUNDS] = { |
| 10158 | 64 | {N_("Buddy logs in"), "login", "login.wav"}, |
| 65 | {N_("Buddy logs out"), "logout", "logout.wav"}, | |
| 5684 | 66 | {N_("Message received"), "im_recv", "receive.wav"}, |
| 67 | {N_("Message received begins conversation"), "first_im_recv", "receive.wav"}, | |
| 68 | {N_("Message sent"), "send_im", "send.wav"}, | |
| 10158 | 69 | {N_("Person enters chat"), "join_chat", "login.wav"}, |
| 70 | {N_("Person leaves chat"), "left_chat", "logout.wav"}, | |
| 5684 | 71 | {N_("You talk in chat"), "send_chat_msg", "send.wav"}, |
| 72 | {N_("Others talk in chat"), "chat_msg_recv", "receive.wav"}, | |
| 73 | /* this isn't a terminator, it's the buddy pounce default sound event ;-) */ | |
| 10158 | 74 | {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
|
75 | {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
|
76 | {N_("Attention received"), "got_attention", "alert.wav"} |
| 5684 | 77 | }; |
| 78 | ||
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
79 | static gboolean |
|
11463
d672317c99c1
[gaim-migrate @ 13703]
Mark Doliner <markdoliner@pidgin.im>
parents:
11256
diff
changeset
|
80 | unmute_login_sounds_cb(gpointer data) |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
81 | { |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
82 | mute_login_sounds = FALSE; |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
83 | mute_login_sounds_timeout = 0; |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
84 | return FALSE; |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
85 | } |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
86 | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
87 | static gboolean |
| 15884 | 88 | chat_nick_matches_name(PurpleConversation *conv, const char *aname) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
89 | { |
| 15884 | 90 | PurpleConvChat *chat = NULL; |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
91 | char *nick = NULL; |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
92 | char *name = NULL; |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
93 | gboolean ret = FALSE; |
| 15884 | 94 | chat = purple_conversation_get_chat_data(conv); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
95 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
96 | if (chat==NULL) |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
97 | return ret; |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
98 | |
| 15884 | 99 | nick = g_strdup(purple_normalize(conv->account, chat->nick)); |
| 100 | name = g_strdup(purple_normalize(conv->account, aname)); | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
101 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
102 | if (g_utf8_collate(nick, name) == 0) |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
103 | ret = TRUE; |
|
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 | g_free(nick); |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
106 | g_free(name); |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
107 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
108 | return ret; |
|
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 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
111 | /* |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
112 | * play a sound event for a conversation, honoring make_sound flag |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
113 | * 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
|
114 | */ |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
115 | static void |
| 15884 | 116 | play_conv_event(PurpleConversation *conv, PurpleSoundEventID event) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
117 | { |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11581
diff
changeset
|
118 | /* 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
|
119 | if (conv != NULL && PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11581
diff
changeset
|
120 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
121 | PidginConversation *gtkconv; |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11581
diff
changeset
|
122 | gboolean has_focus; |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
123 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
124 | gtkconv = PIDGIN_CONVERSATION(conv); |
| 15884 | 125 | has_focus = purple_conversation_has_focus(conv); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
126 | |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11581
diff
changeset
|
127 | 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
|
128 | (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
|
129 | { |
|
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11581
diff
changeset
|
130 | return; |
|
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11581
diff
changeset
|
131 | } |
|
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11581
diff
changeset
|
132 | } |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
133 | |
| 15884 | 134 | 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
|
135 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
136 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
137 | static void |
| 15884 | 138 | buddy_state_cb(PurpleBuddy *buddy, PurpleSoundEventID event) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
139 | { |
| 15884 | 140 | purple_sound_play_event(event, purple_buddy_get_account(buddy)); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
141 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
142 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
143 | static void |
| 15884 | 144 | im_msg_received_cb(PurpleAccount *account, char *sender, |
| 145 | char *message, PurpleConversation *conv, | |
| 146 | PurpleMessageFlags flags, PurpleSoundEventID event) | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
147 | { |
|
29489
2322b6b9fcb7
Don't play the message received sound for NOTIFY messages (this will avoid
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
148 | if (flags & PURPLE_MESSAGE_DELAYED || flags & PURPLE_MESSAGE_NOTIFY) |
|
12850
744542bdd53e
[gaim-migrate @ 15200]
Casey Harkins <charkins@pidgin.im>
parents:
12828
diff
changeset
|
149 | return; |
|
744542bdd53e
[gaim-migrate @ 15200]
Casey Harkins <charkins@pidgin.im>
parents:
12828
diff
changeset
|
150 | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
151 | if (conv==NULL) |
| 15884 | 152 | purple_sound_play_event(PURPLE_SOUND_FIRST_RECEIVE, account); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
153 | else |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
154 | play_conv_event(conv, event); |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
155 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
156 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
157 | static void |
| 15884 | 158 | im_msg_sent_cb(PurpleAccount *account, const char *receiver, |
| 159 | const char *message, PurpleSoundEventID event) | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
160 | { |
| 15884 | 161 | PurpleConversation *conv = purple_find_conversation_with_account( |
|
27952
f0b5d4786136
Minor cleanup: this callback is only triggered for IMs.
Paul Aurich <darkrain42@pidgin.im>
parents:
26753
diff
changeset
|
162 | PURPLE_CONV_TYPE_IM, receiver, account); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
163 | play_conv_event(conv, event); |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
164 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
165 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
166 | static void |
| 15884 | 167 | chat_buddy_join_cb(PurpleConversation *conv, const char *name, |
| 168 | PurpleConvChatBuddyFlags flags, gboolean new_arrival, | |
| 169 | PurpleSoundEventID event) | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
170 | { |
|
12850
744542bdd53e
[gaim-migrate @ 15200]
Casey Harkins <charkins@pidgin.im>
parents:
12828
diff
changeset
|
171 | if (new_arrival && !chat_nick_matches_name(conv, name)) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
172 | play_conv_event(conv, event); |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
173 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
174 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
175 | static void |
| 15884 | 176 | chat_buddy_left_cb(PurpleConversation *conv, const char *name, |
| 177 | const char *reason, PurpleSoundEventID event) | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
178 | { |
| 11581 | 179 | if (!chat_nick_matches_name(conv, name)) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
180 | play_conv_event(conv, event); |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
181 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
182 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
183 | static void |
| 15884 | 184 | chat_msg_sent_cb(PurpleAccount *account, const char *message, |
| 185 | int id, PurpleSoundEventID event) | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
186 | { |
| 15884 | 187 | PurpleConnection *conn = purple_account_get_connection(account); |
| 188 | PurpleConversation *conv = NULL; | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
189 | |
| 11581 | 190 | if (conn!=NULL) |
| 15884 | 191 | conv = purple_find_chat(conn,id); |
|
11552
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 | play_conv_event(conv, event); |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
194 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
195 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
196 | static void |
| 15884 | 197 | chat_msg_received_cb(PurpleAccount *account, char *sender, |
| 198 | char *message, PurpleConversation *conv, | |
| 199 | PurpleMessageFlags flags, PurpleSoundEventID event) | |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
200 | { |
| 15884 | 201 | PurpleConvChat *chat; |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
202 | |
|
29489
2322b6b9fcb7
Don't play the message received sound for NOTIFY messages (this will avoid
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
203 | if (flags & PURPLE_MESSAGE_DELAYED || flags & PURPLE_MESSAGE_NOTIFY) |
|
12850
744542bdd53e
[gaim-migrate @ 15200]
Casey Harkins <charkins@pidgin.im>
parents:
12828
diff
changeset
|
204 | return; |
|
744542bdd53e
[gaim-migrate @ 15200]
Casey Harkins <charkins@pidgin.im>
parents:
12828
diff
changeset
|
205 | |
| 15884 | 206 | chat = purple_conversation_get_chat_data(conv); |
|
13413
8cdf761df65c
[gaim-migrate @ 15787]
Richard Laager <rlaager@pidgin.im>
parents:
13046
diff
changeset
|
207 | g_return_if_fail(chat != NULL); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
208 | |
| 15884 | 209 | if (purple_conv_chat_is_user_ignored(chat, sender)) |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
210 | return; |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
211 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
212 | if (chat_nick_matches_name(conv, sender)) |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
213 | return; |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
214 | |
| 15884 | 215 | if (flags & PURPLE_MESSAGE_NICK || purple_utf8_has_word(message, chat->nick)) |
|
28542
4868e1836159
Fix fallback to default sounds when the file isn't found.
Daniel Atallah <datallah@pidgin.im>
parents:
27952
diff
changeset
|
216 | /* 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
|
217 | * and the PURPLE_SOUND_CHAT_SAY event enabled, you won't get a sound at all */ |
| 15884 | 218 | play_conv_event(conv, PURPLE_SOUND_CHAT_NICK); |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
219 | else |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
220 | play_conv_event(conv, event); |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
221 | } |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
222 | |
|
24457
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
223 | static void |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
224 | got_attention_cb(PurpleAccount *account, const char *who, |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
225 | 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
|
226 | { |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
227 | 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
|
228 | } |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
23314
diff
changeset
|
229 | |
|
10320
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 | * 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
|
232 | * 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
|
233 | * your buddies logging in. |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
234 | */ |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
235 | static void |
| 15884 | 236 | account_signon_cb(PurpleConnection *gc, gpointer data) |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
237 | { |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
238 | if (mute_login_sounds_timeout != 0) |
|
26753
a8dca8faae69
A patch from Arunan Balasubramaniam to use timeouts in seconds instead of
Arunan Balasubramaniam <foss@abala.me>
parents:
25888
diff
changeset
|
239 | purple_timeout_remove(mute_login_sounds_timeout); |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
240 | mute_login_sounds = TRUE; |
|
26753
a8dca8faae69
A patch from Arunan Balasubramaniam to use timeouts in seconds instead of
Arunan Balasubramaniam <foss@abala.me>
parents:
25888
diff
changeset
|
241 | mute_login_sounds_timeout = purple_timeout_add_seconds(10, unmute_login_sounds_cb, NULL); |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
242 | } |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
243 | |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
244 | const char * |
| 15884 | 245 | pidgin_sound_get_event_option(PurpleSoundEventID event) |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
246 | { |
| 15884 | 247 | if(event >= PURPLE_NUM_SOUNDS) |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
248 | return 0; |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
249 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
250 | return sounds[event].pref; |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
251 | } |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
252 | |
|
15165
0ff631dfbbca
[gaim-migrate @ 17889]
Daniel Atallah <datallah@pidgin.im>
parents:
14972
diff
changeset
|
253 | const char * |
| 15884 | 254 | pidgin_sound_get_event_label(PurpleSoundEventID event) |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
255 | { |
| 15884 | 256 | if(event >= PURPLE_NUM_SOUNDS) |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
257 | return NULL; |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
258 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
259 | return sounds[event].label; |
|
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 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
262 | void * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
263 | pidgin_sound_get_handle() |
|
10322
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 | static int handle; |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
266 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
267 | return &handle; |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
268 | } |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
269 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
270 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
271 | pidgin_sound_init(void) |
| 5684 | 272 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
273 | void *gtk_sound_handle = pidgin_sound_get_handle(); |
| 15884 | 274 | void *blist_handle = purple_blist_get_handle(); |
| 275 | void *conv_handle = purple_conversations_get_handle(); | |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
276 | #ifdef USE_GSTREAMER |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
277 | GError *error = NULL; |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
278 | #endif |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
279 | |
| 15884 | 280 | purple_signal_connect(purple_connections_get_handle(), "signed-on", |
| 281 | gtk_sound_handle, PURPLE_CALLBACK(account_signon_cb), | |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
282 | NULL); |
|
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
283 | |
|
16123
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_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
|
285 | 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
|
286 | 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
|
287 | 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
|
288 | 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
|
289 | 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
|
290 | 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
|
291 | 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
|
292 | 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
|
293 | 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
|
294 | 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
|
295 | 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
|
296 | 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
|
297 | 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
|
298 | 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
|
299 | 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
|
300 | 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
|
301 | 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
|
302 | 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
|
303 | 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
|
304 | 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
|
305 | 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
|
306 | 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
|
307 | 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
|
308 | 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
|
309 | 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
|
310 | 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
|
311 | 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
|
312 | 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
|
313 | 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
|
314 | 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
|
315 | 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
|
316 | 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
|
317 | purple_prefs_add_string(PIDGIN_PREFS_ROOT "/sound/method", "automatic"); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
318 | purple_prefs_add_int(PIDGIN_PREFS_ROOT "/sound/volume", 50); |
| 5684 | 319 | |
| 13720 | 320 | #ifdef USE_GSTREAMER |
| 15884 | 321 | purple_debug_info("sound", "Initializing sound output drivers.\n"); |
|
22631
ba53b0eadb20
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <resiak@pidgin.im>
parents:
22565
diff
changeset
|
322 | #ifdef GST_CAN_DISABLE_FORKING |
|
22565
d1943619d6f9
Tell gstreamer not to fork; remove the SIGCHLD -> SIGALRM hack, which made
Will Thompson <resiak@pidgin.im>
parents:
21125
diff
changeset
|
323 | gst_registry_fork_set_enabled (FALSE); |
|
22631
ba53b0eadb20
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <resiak@pidgin.im>
parents:
22565
diff
changeset
|
324 | #endif |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
325 | if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) { |
| 15884 | 326 | purple_notify_error(NULL, _("GStreamer Failure"), |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
327 | _("GStreamer failed to initialize."), |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
328 | error ? error->message : ""); |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
329 | if (error) { |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
330 | g_error_free(error); |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
331 | error = NULL; |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
332 | } |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
333 | } |
| 13720 | 334 | #endif /* USE_GSTREAMER */ |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
335 | |
| 15884 | 336 | purple_signal_connect(blist_handle, "buddy-signed-on", |
| 337 | gtk_sound_handle, PURPLE_CALLBACK(buddy_state_cb), | |
| 338 | GINT_TO_POINTER(PURPLE_SOUND_BUDDY_ARRIVE)); | |
| 339 | purple_signal_connect(blist_handle, "buddy-signed-off", | |
| 340 | gtk_sound_handle, PURPLE_CALLBACK(buddy_state_cb), | |
| 341 | GINT_TO_POINTER(PURPLE_SOUND_BUDDY_LEAVE)); | |
| 342 | purple_signal_connect(conv_handle, "received-im-msg", | |
| 343 | gtk_sound_handle, PURPLE_CALLBACK(im_msg_received_cb), | |
| 344 | GINT_TO_POINTER(PURPLE_SOUND_RECEIVE)); | |
| 345 | purple_signal_connect(conv_handle, "sent-im-msg", | |
| 346 | gtk_sound_handle, PURPLE_CALLBACK(im_msg_sent_cb), | |
| 347 | GINT_TO_POINTER(PURPLE_SOUND_SEND)); | |
| 348 | purple_signal_connect(conv_handle, "chat-buddy-joined", | |
| 349 | gtk_sound_handle, PURPLE_CALLBACK(chat_buddy_join_cb), | |
| 350 | GINT_TO_POINTER(PURPLE_SOUND_CHAT_JOIN)); | |
| 351 | purple_signal_connect(conv_handle, "chat-buddy-left", | |
| 352 | gtk_sound_handle, PURPLE_CALLBACK(chat_buddy_left_cb), | |
| 353 | GINT_TO_POINTER(PURPLE_SOUND_CHAT_LEAVE)); | |
| 354 | purple_signal_connect(conv_handle, "sent-chat-msg", | |
| 355 | gtk_sound_handle, PURPLE_CALLBACK(chat_msg_sent_cb), | |
| 356 | GINT_TO_POINTER(PURPLE_SOUND_CHAT_YOU_SAY)); | |
| 357 | purple_signal_connect(conv_handle, "received-chat-msg", | |
| 358 | gtk_sound_handle, PURPLE_CALLBACK(chat_msg_received_cb), | |
| 359 | 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
|
360 | 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
|
361 | 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
|
362 | 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
|
363 | /* 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
|
364 | sound would result induplicate sounds. And fixing that would require changing the |
|
2322b6b9fcb7
Don't play the message received sound for NOTIFY messages (this will avoid
Marcus Lundblad <malu@pidgin.im>
parents:
28573
diff
changeset
|
365 | conversation signal for msg-recv */ |
| 5684 | 366 | } |
| 367 | ||
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
368 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
369 | pidgin_sound_uninit(void) |
| 5684 | 370 | { |
| 13720 | 371 | #ifdef USE_GSTREAMER |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
372 | if (!gst_init_failed) |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
373 | gst_deinit(); |
| 5684 | 374 | #endif |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
375 | |
| 15884 | 376 | purple_signals_disconnect_by_handle(pidgin_sound_get_handle()); |
| 5684 | 377 | } |
| 378 | ||
| 13720 | 379 | #ifdef USE_GSTREAMER |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
380 | static gboolean |
| 13720 | 381 | bus_call (GstBus *bus, |
| 382 | GstMessage *msg, | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
383 | gpointer data) |
|
12815
5f73e8c06a9c
[gaim-migrate @ 15163]
Casey Harkins <charkins@pidgin.im>
parents:
12411
diff
changeset
|
384 | { |
| 13720 | 385 | GstElement *play = data; |
|
14941
0c27c799be04
[gaim-migrate @ 17648]
Mark Doliner <markdoliner@pidgin.im>
parents:
14762
diff
changeset
|
386 | GError *err = NULL; |
|
10074
4fab99572bf1
[gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
387 | |
| 13720 | 388 | switch (GST_MESSAGE_TYPE (msg)) { |
| 389 | case GST_MESSAGE_ERROR: | |
| 390 | 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
|
391 | purple_debug_error("gstreamer", "%s\n", err->message); |
| 13720 | 392 | 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
|
393 | /* 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
|
394 | 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
|
395 | 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
|
396 | gst_object_unref(GST_OBJECT(play)); |
| 13720 | 397 | break; |
| 398 | case GST_MESSAGE_WARNING: | |
| 399 | 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
|
400 | purple_debug_warning("gstreamer", "%s\n", err->message); |
| 13720 | 401 | g_error_free(err); |
| 402 | break; | |
| 403 | default: | |
| 404 | break; | |
| 405 | } | |
| 406 | return TRUE; | |
| 407 | } | |
|
12930
2a65c7c86e86
[gaim-migrate @ 15283]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
408 | #endif |
|
12815
5f73e8c06a9c
[gaim-migrate @ 15163]
Casey Harkins <charkins@pidgin.im>
parents:
12411
diff
changeset
|
409 | |
|
23027
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
410 | #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
|
411 | 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
|
412 | 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
|
413 | { |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
414 | 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
|
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 | 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
|
417 | 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
|
418 | 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
|
419 | else |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
420 | 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
|
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 | |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
423 | 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
|
424 | 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
|
425 | |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
426 | 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
|
427 | } |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
428 | #endif |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
429 | |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
430 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
431 | pidgin_sound_play_file(const char *filename) |
| 5684 | 432 | { |
| 433 | const char *method; | |
| 13720 | 434 | #ifdef USE_GSTREAMER |
| 435 | float volume; | |
| 436 | char *uri; | |
| 437 | GstElement *sink = NULL; | |
| 438 | GstElement *play = NULL; | |
|
15285
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
439 | GstBus *bus = NULL; |
| 5684 | 440 | #endif |
| 441 | ||
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
442 | if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute")) |
| 5684 | 443 | return; |
| 444 | ||
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
445 | method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"); |
| 5684 | 446 | |
|
10074
4fab99572bf1
[gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
447 | if (!strcmp(method, "none")) { |
|
4fab99572bf1
[gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
448 | return; |
|
4fab99572bf1
[gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
449 | } else if (!strcmp(method, "beep")) { |
| 5684 | 450 | gdk_beep(); |
| 451 | return; | |
| 452 | } | |
| 453 | ||
| 13797 | 454 | if (!g_file_test(filename, G_FILE_TEST_EXISTS)) { |
| 15884 | 455 | purple_debug_error("gtksound", "sound file (%s) does not exist.\n", filename); |
| 5684 | 456 | return; |
| 13797 | 457 | } |
| 5684 | 458 | |
| 459 | #ifndef _WIN32 | |
| 460 | if (!strcmp(method, "custom")) { | |
| 461 | const char *sound_cmd; | |
| 462 | char *command; | |
|
16951
d7d924e847d6
Escape filename when using the command sound method. Fixes ticket #607.
Casey Harkins <charkins@pidgin.im>
parents:
16752
diff
changeset
|
463 | 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
|
464 | char **argv = NULL; |
| 5684 | 465 | 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
|
466 | GPid pid; |
| 5684 | 467 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
468 | sound_cmd = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/sound/command"); |
| 5684 | 469 | |
| 470 | if (!sound_cmd || *sound_cmd == '\0') { | |
| 15884 | 471 | purple_debug_error("gtksound", |
| 13797 | 472 | "'Command' sound method has been chosen, " |
|
24572
d2f6abb70f4e
Missing newline in debug message.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23314
diff
changeset
|
473 | "but no command has been set.\n"); |
| 5684 | 474 | return; |
| 475 | } | |
| 476 | ||
|
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
|
477 | 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
|
478 | |
| 7464 | 479 | 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
|
480 | command = purple_strreplace(sound_cmd, "%s", esc_filename); |
| 7464 | 481 | else |
|
16951
d7d924e847d6
Escape filename when using the command sound method. Fixes ticket #607.
Casey Harkins <charkins@pidgin.im>
parents:
16752
diff
changeset
|
482 | command = g_strdup_printf("%s %s", sound_cmd, esc_filename); |
| 5684 | 483 | |
|
23027
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
484 | 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
|
485 | 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
|
486 | command, error->message); |
| 5684 | 487 | 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
|
488 | 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
|
489 | 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
|
490 | return; |
| 5684 | 491 | } |
| 492 | ||
|
23027
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
493 | 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
|
494 | 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
|
495 | 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
|
496 | 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
|
497 | 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
|
498 | } else { |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
499 | purple_timeout_add_seconds(15, expire_old_child, GINT_TO_POINTER(pid)); |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
500 | } |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
501 | |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
502 | 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
|
503 | g_free(esc_filename); |
| 5684 | 504 | g_free(command); |
| 505 | return; | |
| 506 | } | |
|
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
|
507 | #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
|
508 | |
| 13720 | 509 | #ifdef USE_GSTREAMER |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
510 | if (gst_init_failed) /* Perhaps do gdk_beep instead? */ |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
511 | return; |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
512 | volume = (float)(CLAMP(purple_prefs_get_int(PIDGIN_PREFS_ROOT "/sound/volume"),0,100)) / 50; |
| 13720 | 513 | if (!strcmp(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
|
514 | sink = gst_element_factory_make("gconfaudiosink", "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
|
515 | } |
|
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
|
516 | #ifndef _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
|
517 | else if (!strcmp(method, "esd")) { |
| 13720 | 518 | sink = gst_element_factory_make("esdsink", "sink"); |
|
17146
7d256e417ef6
ALSA Gstreamer sink. Mostly to see if this still crashes Luke.
Sean Egan <seanegan@pidgin.im>
parents:
16995
diff
changeset
|
519 | } else if (!strcmp(method, "alsa")) { |
|
7d256e417ef6
ALSA Gstreamer sink. Mostly to see if this still crashes Luke.
Sean Egan <seanegan@pidgin.im>
parents:
16995
diff
changeset
|
520 | 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
|
521 | } |
|
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
|
522 | #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
|
523 | else { |
| 15884 | 524 | purple_debug_error("sound", "Unknown sound method '%s'\n", method); |
|
15285
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
525 | return; |
| 13720 | 526 | } |
| 5684 | 527 | |
|
23239
1aec418902fd
A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents:
23069
diff
changeset
|
528 | if (strcmp(method, "automatic") != 0 && !sink) { |
|
1aec418902fd
A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents:
23069
diff
changeset
|
529 | 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
|
530 | return; |
|
1aec418902fd
A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents:
23069
diff
changeset
|
531 | } |
|
1aec418902fd
A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents:
23069
diff
changeset
|
532 | |
|
15285
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
533 | play = gst_element_factory_make("playbin", "play"); |
|
21125
e7cd2426e511
Remove unused definition.
Daniel Atallah <datallah@pidgin.im>
parents:
21091
diff
changeset
|
534 | |
|
16161
a6f32c913f9b
Fix a possible gstreamer crash
Sean Egan <seanegan@pidgin.im>
parents:
16123
diff
changeset
|
535 | if (play == NULL) { |
|
a6f32c913f9b
Fix a possible gstreamer crash
Sean Egan <seanegan@pidgin.im>
parents:
16123
diff
changeset
|
536 | return; |
|
a6f32c913f9b
Fix a possible gstreamer crash
Sean Egan <seanegan@pidgin.im>
parents:
16123
diff
changeset
|
537 | } |
|
21125
e7cd2426e511
Remove unused definition.
Daniel Atallah <datallah@pidgin.im>
parents:
21091
diff
changeset
|
538 | |
| 13720 | 539 | uri = g_strdup_printf("file://%s", filename); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
540 | |
| 13720 | 541 | g_object_set(G_OBJECT(play), "uri", uri, |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
542 | "volume", volume, |
| 13720 | 543 | "audio-sink", sink, NULL); |
| 5684 | 544 | |
|
15285
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
545 | bus = gst_pipeline_get_bus(GST_PIPELINE(play)); |
|
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
546 | gst_bus_add_watch(bus, bus_call, play); |
|
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
547 | |
| 13720 | 548 | gst_element_set_state(play, GST_STATE_PLAYING); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
549 | |
|
15285
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
550 | gst_object_unref(bus); |
| 13720 | 551 | g_free(uri); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
552 | |
|
23069
293830ac1149
Clarify #ifdef/#else/#endif matching; References #5770.
Ethan Blanton <elb@pidgin.im>
parents:
23027
diff
changeset
|
553 | #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
|
554 | |
|
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
|
555 | #ifndef _WIN32 |
| 5684 | 556 | gdk_beep(); |
| 557 | #else /* _WIN32 */ | |
| 15884 | 558 | purple_debug_info("sound", "Playing %s\n", filename); |
| 5684 | 559 | |
|
29508
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
27952
diff
changeset
|
560 | { |
|
10922
a27fde43df3b
[gaim-migrate @ 12691]
Daniel Atallah <datallah@pidgin.im>
parents:
10322
diff
changeset
|
561 | wchar_t *wc_filename = g_utf8_to_utf16(filename, |
|
a27fde43df3b
[gaim-migrate @ 12691]
Daniel Atallah <datallah@pidgin.im>
parents:
10322
diff
changeset
|
562 | -1, NULL, NULL, NULL); |
|
a27fde43df3b
[gaim-migrate @ 12691]
Daniel Atallah <datallah@pidgin.im>
parents:
10322
diff
changeset
|
563 | if (!PlaySoundW(wc_filename, NULL, SND_ASYNC | SND_FILENAME)) |
| 15884 | 564 | purple_debug(PURPLE_DEBUG_ERROR, "sound", "Error playing sound.\n"); |
|
10922
a27fde43df3b
[gaim-migrate @ 12691]
Daniel Atallah <datallah@pidgin.im>
parents:
10322
diff
changeset
|
565 | g_free(wc_filename); |
|
a27fde43df3b
[gaim-migrate @ 12691]
Daniel Atallah <datallah@pidgin.im>
parents:
10322
diff
changeset
|
566 | } |
| 5684 | 567 | #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
|
568 | |
|
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
|
569 | #endif /* USE_GSTREAMER */ |
| 5684 | 570 | } |
| 571 | ||
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
572 | static void |
| 15884 | 573 | pidgin_sound_play_event(PurpleSoundEventID event) |
| 5684 | 574 | { |
| 575 | char *enable_pref; | |
| 576 | char *file_pref; | |
|
23972
90e0da03c053
theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23661
diff
changeset
|
577 | 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
|
578 | PurpleSoundTheme *theme; |
| 5684 | 579 | |
| 15884 | 580 | if ((event == PURPLE_SOUND_BUDDY_ARRIVE) && mute_login_sounds) |
| 5684 | 581 | return; |
| 582 | ||
| 15884 | 583 | if (event >= PURPLE_NUM_SOUNDS) { |
| 584 | purple_debug_error("sound", "got request for unknown sound: %d\n", event); | |
| 5684 | 585 | return; |
| 586 | } | |
| 587 | ||
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
588 | enable_pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/enabled/%s", |
| 5684 | 589 | 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
|
590 | file_pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s", sounds[event].pref); |
| 5684 | 591 | |
| 592 | /* check NULL for sounds that don't have an option, ie buddy pounce */ | |
| 15884 | 593 | if (purple_prefs_get_bool(enable_pref)) { |
| 594 | 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
|
595 | 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
|
596 | |
|
25884
c00e14c20165
* Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents:
24952
diff
changeset
|
597 | 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
|
598 | /* Use theme */ |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
599 | 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
|
600 | |
|
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
|
601 | 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
|
602 | 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
|
603 | |
|
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
|
604 | 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
|
605 | 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
|
606 | 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
|
607 | 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
|
608 | 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
|
609 | } |
|
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
|
610 | } |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25884
diff
changeset
|
611 | |
|
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
|
612 | if (!filename || !strlen(filename)) { /* Use Default sounds */ |
|
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
|
613 | 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
|
614 | |
| 18292 | 615 | /* XXX Consider creating a constant for "sounds/purple" to be shared with Finch */ |
| 616 | filename = g_build_filename(DATADIR, "sounds", "purple", sounds[event].def, NULL); | |
| 5684 | 617 | } |
| 618 | ||
| 15884 | 619 | 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
|
620 | |
| 5684 | 621 | g_free(filename); |
| 622 | } | |
| 623 | ||
| 624 | g_free(enable_pref); | |
| 625 | g_free(file_pref); | |
| 626 | } | |
| 627 | ||
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25884
diff
changeset
|
628 | 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
|
629 | 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
|
630 | { |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25884
diff
changeset
|
631 | gint i; |
|
28545
06aa1af52d1c
Avoid an unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
28542
diff
changeset
|
632 | gchar *path; |
|
06aa1af52d1c
Avoid an unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
28542
diff
changeset
|
633 | 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
|
634 | |
|
25884
c00e14c20165
* Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents:
24952
diff
changeset
|
635 | 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
|
636 | 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
|
637 | 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
|
638 | 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
|
639 | |
|
28545
06aa1af52d1c
Avoid an unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
28542
diff
changeset
|
640 | 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
|
641 | 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
|
642 | } |
|
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
|
643 | |
|
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
|
644 | 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
|
645 | |
|
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 | } |
|
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 | |
| 15884 | 648 | static PurpleSoundUiOps sound_ui_ops = |
| 5684 | 649 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
650 | pidgin_sound_init, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
651 | pidgin_sound_uninit, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
652 | 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
|
653 | 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
|
654 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
655 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
656 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
657 | NULL |
| 5684 | 658 | }; |
| 659 | ||
| 15884 | 660 | PurpleSoundUiOps * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
661 | pidgin_sound_get_ui_ops(void) |
| 5684 | 662 | { |
| 663 | return &sound_ui_ops; | |
| 664 | } |