Wed, 09 Dec 2015 22:29:06 -0800
Move PurpleIconScaleRules to BuddyIcon API
Move PurpleIconScaleRules to a more sensible place
Moved from protocols.h to buddyicon.h
Changed name from PurpleIconScaleRules to PurpleBuddyIconScaleFlags
|
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) |
|
26753
a8dca8faae69
A patch from Arunan Balasubramaniam to use timeouts in seconds instead of
Arunan Balasubramaniam <foss@abala.me>
parents:
25888
diff
changeset
|
235 | purple_timeout_remove(mute_login_sounds_timeout); |
|
10320
f5b0f5cf8562
[gaim-migrate @ 11527]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
236 | 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
|
237 | 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
|
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"); |
|
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_int(PIDGIN_PREFS_ROOT "/sound/volume", 50); |
| 5684 | 315 | |
| 13720 | 316 | #ifdef USE_GSTREAMER |
| 15884 | 317 | 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
|
318 | gst_registry_fork_set_enabled(FALSE); |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
319 | if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) { |
| 15884 | 320 | purple_notify_error(NULL, _("GStreamer Failure"), |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
321 | _("GStreamer failed to initialize."), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34293
diff
changeset
|
322 | error ? error->message : "", NULL); |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
323 | if (error) { |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
324 | g_error_free(error); |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
325 | error = NULL; |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
326 | } |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
327 | } |
| 13720 | 328 | #endif /* USE_GSTREAMER */ |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
329 | |
| 15884 | 330 | purple_signal_connect(blist_handle, "buddy-signed-on", |
| 331 | gtk_sound_handle, PURPLE_CALLBACK(buddy_state_cb), | |
| 332 | GINT_TO_POINTER(PURPLE_SOUND_BUDDY_ARRIVE)); | |
| 333 | purple_signal_connect(blist_handle, "buddy-signed-off", | |
| 334 | gtk_sound_handle, PURPLE_CALLBACK(buddy_state_cb), | |
| 335 | GINT_TO_POINTER(PURPLE_SOUND_BUDDY_LEAVE)); | |
| 336 | purple_signal_connect(conv_handle, "received-im-msg", | |
| 337 | gtk_sound_handle, PURPLE_CALLBACK(im_msg_received_cb), | |
| 338 | GINT_TO_POINTER(PURPLE_SOUND_RECEIVE)); | |
| 339 | purple_signal_connect(conv_handle, "sent-im-msg", | |
| 340 | gtk_sound_handle, PURPLE_CALLBACK(im_msg_sent_cb), | |
| 341 | 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
|
342 | 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
|
343 | gtk_sound_handle, PURPLE_CALLBACK(chat_user_join_cb), |
| 15884 | 344 | 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
|
345 | 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
|
346 | gtk_sound_handle, PURPLE_CALLBACK(chat_user_left_cb), |
| 15884 | 347 | GINT_TO_POINTER(PURPLE_SOUND_CHAT_LEAVE)); |
| 348 | purple_signal_connect(conv_handle, "sent-chat-msg", | |
| 349 | gtk_sound_handle, PURPLE_CALLBACK(chat_msg_sent_cb), | |
| 350 | GINT_TO_POINTER(PURPLE_SOUND_CHAT_YOU_SAY)); | |
| 351 | purple_signal_connect(conv_handle, "received-chat-msg", | |
| 352 | gtk_sound_handle, PURPLE_CALLBACK(chat_msg_received_cb), | |
| 353 | 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
|
354 | 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
|
355 | 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
|
356 | 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
|
357 | /* 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
|
358 | 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
|
359 | conversation signal for msg-recv */ |
| 5684 | 360 | } |
| 361 | ||
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
362 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
363 | pidgin_sound_uninit(void) |
| 5684 | 364 | { |
| 13720 | 365 | #ifdef USE_GSTREAMER |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
366 | if (!gst_init_failed) |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
367 | gst_deinit(); |
| 5684 | 368 | #endif |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11463
diff
changeset
|
369 | |
| 15884 | 370 | purple_signals_disconnect_by_handle(pidgin_sound_get_handle()); |
| 5684 | 371 | } |
| 372 | ||
| 13720 | 373 | #ifdef USE_GSTREAMER |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
374 | static gboolean |
| 13720 | 375 | bus_call (GstBus *bus, |
| 376 | GstMessage *msg, | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
377 | gpointer data) |
|
12815
5f73e8c06a9c
[gaim-migrate @ 15163]
Casey Harkins <charkins@pidgin.im>
parents:
12411
diff
changeset
|
378 | { |
| 13720 | 379 | GstElement *play = data; |
|
14941
0c27c799be04
[gaim-migrate @ 17648]
Mark Doliner <markdoliner@pidgin.im>
parents:
14762
diff
changeset
|
380 | GError *err = NULL; |
|
10074
4fab99572bf1
[gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
381 | |
| 13720 | 382 | switch (GST_MESSAGE_TYPE (msg)) { |
| 383 | case GST_MESSAGE_ERROR: | |
| 384 | 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
|
385 | purple_debug_error("gstreamer", "%s\n", err->message); |
| 13720 | 386 | 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
|
387 | /* 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
|
388 | 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
|
389 | 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
|
390 | 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
|
391 | return FALSE; |
| 13720 | 392 | break; |
| 393 | case GST_MESSAGE_WARNING: | |
| 394 | 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
|
395 | purple_debug_warning("gstreamer", "%s\n", err->message); |
| 13720 | 396 | g_error_free(err); |
| 397 | break; | |
| 398 | default: | |
| 399 | break; | |
| 400 | } | |
| 401 | return TRUE; | |
| 402 | } | |
|
12930
2a65c7c86e86
[gaim-migrate @ 15283]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
403 | #endif |
|
12815
5f73e8c06a9c
[gaim-migrate @ 15163]
Casey Harkins <charkins@pidgin.im>
parents:
12411
diff
changeset
|
404 | |
|
23027
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
405 | #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
|
406 | 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
|
407 | 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
|
408 | { |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
409 | 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
|
410 | |
|
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 (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
|
412 | 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
|
413 | 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
|
414 | else |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
415 | 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
|
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 | |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
418 | 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
|
419 | 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
|
420 | |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
421 | 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
|
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 | #endif |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
424 | |
|
33948
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
425 | #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
|
426 | 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
|
427 | 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
|
428 | { |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
429 | 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
|
430 | -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
|
431 | 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
|
432 | 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
|
433 | 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
|
434 | } |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
435 | #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
|
436 | |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
437 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
438 | pidgin_sound_play_file(const char *filename) |
| 5684 | 439 | { |
| 440 | const char *method; | |
| 13720 | 441 | #ifdef USE_GSTREAMER |
| 442 | float volume; | |
| 443 | char *uri; | |
| 444 | GstElement *sink = NULL; | |
| 445 | GstElement *play = NULL; | |
|
15285
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
446 | GstBus *bus = NULL; |
| 5684 | 447 | #endif |
| 448 | ||
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
449 | if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute")) |
| 5684 | 450 | return; |
| 451 | ||
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
452 | method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"); |
| 5684 | 453 | |
|
10074
4fab99572bf1
[gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
454 | if (!strcmp(method, "none")) { |
|
4fab99572bf1
[gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
455 | return; |
|
4fab99572bf1
[gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
456 | } else if (!strcmp(method, "beep")) { |
| 5684 | 457 | gdk_beep(); |
| 458 | return; | |
| 459 | } | |
|
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 | #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
|
461 | else if (!strcmp(method, "playsoundw")) { |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
462 | 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
|
463 | return; |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
464 | } |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
465 | #endif /* _WIN32 */ |
| 5684 | 466 | |
| 13797 | 467 | if (!g_file_test(filename, G_FILE_TEST_EXISTS)) { |
| 15884 | 468 | purple_debug_error("gtksound", "sound file (%s) does not exist.\n", filename); |
| 5684 | 469 | return; |
| 13797 | 470 | } |
| 5684 | 471 | |
| 472 | #ifndef _WIN32 | |
| 473 | if (!strcmp(method, "custom")) { | |
| 474 | const char *sound_cmd; | |
| 475 | char *command; | |
|
16951
d7d924e847d6
Escape filename when using the command sound method. Fixes ticket #607.
Casey Harkins <charkins@pidgin.im>
parents:
16752
diff
changeset
|
476 | 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
|
477 | char **argv = NULL; |
| 5684 | 478 | 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
|
479 | GPid pid; |
| 5684 | 480 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
481 | sound_cmd = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/sound/command"); |
| 5684 | 482 | |
| 483 | if (!sound_cmd || *sound_cmd == '\0') { | |
| 15884 | 484 | purple_debug_error("gtksound", |
| 13797 | 485 | "'Command' sound method has been chosen, " |
|
24572
d2f6abb70f4e
Missing newline in debug message.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23314
diff
changeset
|
486 | "but no command has been set.\n"); |
| 5684 | 487 | return; |
| 488 | } | |
| 489 | ||
|
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
|
490 | 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
|
491 | |
| 7464 | 492 | 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
|
493 | command = purple_strreplace(sound_cmd, "%s", esc_filename); |
| 7464 | 494 | else |
|
16951
d7d924e847d6
Escape filename when using the command sound method. Fixes ticket #607.
Casey Harkins <charkins@pidgin.im>
parents:
16752
diff
changeset
|
495 | command = g_strdup_printf("%s %s", sound_cmd, esc_filename); |
| 5684 | 496 | |
|
23027
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
497 | 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
|
498 | 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
|
499 | command, error->message); |
| 5684 | 500 | 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
|
501 | 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
|
502 | 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
|
503 | return; |
| 5684 | 504 | } |
| 505 | ||
|
23027
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
506 | 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
|
507 | 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
|
508 | 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
|
509 | 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
|
510 | 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
|
511 | } else { |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
512 | 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
|
513 | } |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
514 | |
|
5df4eac489e2
Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22942
diff
changeset
|
515 | 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
|
516 | g_free(esc_filename); |
| 5684 | 517 | g_free(command); |
| 518 | return; | |
| 519 | } | |
|
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
|
520 | #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
|
521 | |
| 13720 | 522 | #ifdef USE_GSTREAMER |
|
14315
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
523 | if (gst_init_failed) /* Perhaps do gdk_beep instead? */ |
|
908ff155af2e
[gaim-migrate @ 16935]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14253
diff
changeset
|
524 | 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
|
525 | volume = (float)(CLAMP(purple_prefs_get_int(PIDGIN_PREFS_ROOT "/sound/volume"),0,100)) / 50; |
|
33948
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
526 | #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
|
527 | if (!strcmp(method, "automatic")) { |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
528 | 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
|
529 | 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
|
530 | 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
|
531 | 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
|
532 | sink = gst_element_factory_make("gconfaudiosink", "sink"); |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
533 | } else if (!strcmp(method, "directsound")) { |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
534 | 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
|
535 | } else if (!strcmp(method, "waveform")) { |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
536 | 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
|
537 | } |
|
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
538 | #else |
| 13720 | 539 | 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
|
540 | sink = gst_element_factory_make("gconfaudiosink", "sink"); |
|
33948
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
541 | } else if (!strcmp(method, "esd")) { |
| 13720 | 542 | 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
|
543 | } 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
|
544 | 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
|
545 | } |
|
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
|
546 | #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
|
547 | else { |
| 15884 | 548 | purple_debug_error("sound", "Unknown sound method '%s'\n", method); |
|
15285
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
549 | return; |
| 13720 | 550 | } |
| 5684 | 551 | |
|
23239
1aec418902fd
A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents:
23069
diff
changeset
|
552 | 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
|
553 | 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
|
554 | return; |
|
1aec418902fd
A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents:
23069
diff
changeset
|
555 | } |
|
1aec418902fd
A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents:
23069
diff
changeset
|
556 | |
|
33509
60647bc63acc
Bump GStreamer checks to 1.0.0 instead of 0.11.0.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33486
diff
changeset
|
557 | #if GST_CHECK_VERSION(1,0,0) |
|
15285
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
558 | play = gst_element_factory_make("playbin", "play"); |
|
33486
894eb9576159
GstPlayBin2 was renamed to GstPlayBin in GStreamer-1.0.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33376
diff
changeset
|
559 | #else |
|
33372
0cd6239fcec9
Use GstPlayBin2 instead of GstPlayBin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32620
diff
changeset
|
560 | play = gst_element_factory_make("playbin2", "play"); |
|
33486
894eb9576159
GstPlayBin2 was renamed to GstPlayBin in GStreamer-1.0.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33376
diff
changeset
|
561 | #endif |
|
21125
e7cd2426e511
Remove unused definition.
Daniel Atallah <datallah@pidgin.im>
parents:
21091
diff
changeset
|
562 | |
|
16161
a6f32c913f9b
Fix a possible gstreamer crash
Sean Egan <seanegan@pidgin.im>
parents:
16123
diff
changeset
|
563 | if (play == NULL) { |
|
a6f32c913f9b
Fix a possible gstreamer crash
Sean Egan <seanegan@pidgin.im>
parents:
16123
diff
changeset
|
564 | return; |
|
a6f32c913f9b
Fix a possible gstreamer crash
Sean Egan <seanegan@pidgin.im>
parents:
16123
diff
changeset
|
565 | } |
|
21125
e7cd2426e511
Remove unused definition.
Daniel Atallah <datallah@pidgin.im>
parents:
21091
diff
changeset
|
566 | |
|
33948
b6c9e5dd95d1
VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33509
diff
changeset
|
567 | #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
|
568 | 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
|
569 | 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
|
570 | #else |
| 13720 | 571 | 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
|
572 | #endif |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
573 | |
| 13720 | 574 | g_object_set(G_OBJECT(play), "uri", uri, |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
575 | "volume", volume, |
| 13720 | 576 | "audio-sink", sink, NULL); |
| 5684 | 577 | |
|
15285
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
578 | bus = gst_pipeline_get_bus(GST_PIPELINE(play)); |
|
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
579 | gst_bus_add_watch(bus, bus_call, play); |
|
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
580 | |
| 13720 | 581 | gst_element_set_state(play, GST_STATE_PLAYING); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
582 | |
|
15285
505ff058278c
[gaim-migrate @ 18013]
Mark Doliner <markdoliner@pidgin.im>
parents:
15165
diff
changeset
|
583 | gst_object_unref(bus); |
| 13720 | 584 | g_free(uri); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
585 | |
|
23069
293830ac1149
Clarify #ifdef/#else/#endif matching; References #5770.
Ethan Blanton <elb@pidgin.im>
parents:
23027
diff
changeset
|
586 | #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
|
587 | |
|
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
|
588 | #ifndef _WIN32 |
| 5684 | 589 | gdk_beep(); |
| 590 | #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
|
591 | pidgin_sound_play_file_win32(filename); |
| 5684 | 592 | #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
|
593 | |
|
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
|
594 | #endif /* USE_GSTREAMER */ |
| 5684 | 595 | } |
| 596 | ||
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
10320
diff
changeset
|
597 | static void |
| 15884 | 598 | pidgin_sound_play_event(PurpleSoundEventID event) |
| 5684 | 599 | { |
| 600 | char *enable_pref; | |
| 601 | char *file_pref; | |
|
23972
90e0da03c053
theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23661
diff
changeset
|
602 | 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
|
603 | PurpleSoundTheme *theme; |
| 5684 | 604 | |
| 15884 | 605 | if ((event == PURPLE_SOUND_BUDDY_ARRIVE) && mute_login_sounds) |
| 5684 | 606 | return; |
| 607 | ||
| 15884 | 608 | if (event >= PURPLE_NUM_SOUNDS) { |
| 609 | purple_debug_error("sound", "got request for unknown sound: %d\n", event); | |
| 5684 | 610 | return; |
| 611 | } | |
| 612 | ||
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
613 | enable_pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/enabled/%s", |
| 5684 | 614 | 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
|
615 | file_pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s", sounds[event].pref); |
| 5684 | 616 | |
| 617 | /* check NULL for sounds that don't have an option, ie buddy pounce */ | |
| 15884 | 618 | if (purple_prefs_get_bool(enable_pref)) { |
| 619 | 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
|
620 | 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
|
621 | |
|
25884
c00e14c20165
* Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents:
24952
diff
changeset
|
622 | 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
|
623 | /* Use theme */ |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13799
diff
changeset
|
624 | 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
|
625 | |
|
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 | 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
|
627 | 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
|
628 | |
|
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 | 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
|
630 | 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
|
631 | 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
|
632 | 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
|
633 | 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
|
634 | } |
|
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
|
635 | } |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25884
diff
changeset
|
636 | |
|
35850
1abeda205d6c
cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35454
diff
changeset
|
637 | if (!filename || !strlen(filename)) { /* 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
|
638 | 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
|
639 | |
|
35850
1abeda205d6c
cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35454
diff
changeset
|
640 | 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
|
641 | "sounds", "purple", sounds[event].def, NULL); |
| 5684 | 642 | } |
| 643 | ||
| 15884 | 644 | 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
|
645 | |
| 5684 | 646 | g_free(filename); |
| 647 | } | |
| 648 | ||
| 649 | g_free(enable_pref); | |
| 650 | g_free(file_pref); | |
| 651 | } | |
| 652 | ||
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25884
diff
changeset
|
653 | 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
|
654 | 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
|
655 | { |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25884
diff
changeset
|
656 | gint i; |
|
28545
06aa1af52d1c
Avoid an unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
28542
diff
changeset
|
657 | gchar *path; |
|
06aa1af52d1c
Avoid an unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
28542
diff
changeset
|
658 | 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
|
659 | |
|
25884
c00e14c20165
* Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents:
24952
diff
changeset
|
660 | 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
|
661 | 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
|
662 | 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
|
663 | 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
|
664 | |
|
28545
06aa1af52d1c
Avoid an unnecessary alloc/free.
Daniel Atallah <datallah@pidgin.im>
parents:
28542
diff
changeset
|
665 | 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
|
666 | 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
|
667 | } |
|
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
|
668 | |
|
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
|
669 | 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
|
670 | |
|
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
|
671 | } |
|
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
|
672 | |
| 15884 | 673 | static PurpleSoundUiOps sound_ui_ops = |
| 5684 | 674 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
675 | pidgin_sound_init, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
676 | pidgin_sound_uninit, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
677 | 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
|
678 | 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
|
679 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
680 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
681 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
682 | NULL |
| 5684 | 683 | }; |
| 684 | ||
| 15884 | 685 | PurpleSoundUiOps * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
686 | pidgin_sound_get_ui_ops(void) |
| 5684 | 687 | { |
| 688 | return &sound_ui_ops; | |
| 689 | } |