annotate pidgin/gtksound.c @ 25432:8c8948b9f602

propagate from branch 'im.pidgin.pidgin' (head 8ae2fca06a3be4b99cc677c8f880d9521a35ec8b) to branch 'im.pidgin.pidgin.next.minor' (head 3725318168b46a11998066b36f9311e26d51885b)
author Mark Doliner <mark@kingant.net>
date Wed, 28 Jan 2009 10:23:37 +0000
parents 584063555949
children b162300ab1e7 b98519a42e53
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file gtksound.c GTK+ Sound
16193
247e421c4fa6 Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@wiktel.com>
parents: 16101
diff changeset
3 * @ingroup pidgin
20074
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19680
diff changeset
4 */
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19680
diff changeset
5
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19680
diff changeset
6 /* pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15863
diff changeset
8 * Pidgin is the legal property of its developers, whose names are too numerous
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19671
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "internal.h"
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
28 #include "pidgin.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #ifdef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include <windows.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include <mmsystem.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #ifdef USE_GSTREAMER
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 # include <gst/gst.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 #endif /* USE_GSTREAMER */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 #include "prefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 #include "sound.h"
23468
cf7625d4d7e0 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: 23173
diff changeset
43 #include "sound-theme.h"
cf7625d4d7e0 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: 23173
diff changeset
44 #include "theme-manager.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 #include "util.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 #include "gtkconv.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 #include "gtksound.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49
15820
c02a897a67c7 More Gaim to Pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15588
diff changeset
50 struct pidgin_sound_event {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 char *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 char *pref;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 char *def;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 static guint mute_login_sounds_timeout = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 static gboolean mute_login_sounds = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 #ifdef USE_GSTREAMER
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 static gboolean gst_init_failed;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 #endif /* USE_GSTREAMER */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62
21015
787b3897ba9f Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@hxbc.us>
parents: 20342
diff changeset
63 static const struct pidgin_sound_event sounds[PURPLE_NUM_SOUNDS] = {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 {N_("Buddy logs in"), "login", "login.wav"},
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 {N_("Buddy logs out"), "logout", "logout.wav"},
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 {N_("Message received"), "im_recv", "receive.wav"},
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 {N_("Message received begins conversation"), "first_im_recv", "receive.wav"},
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 {N_("Message sent"), "send_im", "send.wav"},
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 {N_("Person enters chat"), "join_chat", "login.wav"},
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 {N_("Person leaves chat"), "left_chat", "logout.wav"},
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 {N_("You talk in chat"), "send_chat_msg", "send.wav"},
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 {N_("Others talk in chat"), "chat_msg_recv", "receive.wav"},
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 /* this isn't a terminator, it's the buddy pounce default sound event ;-) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 {NULL, "pounce_default", "alert.wav"},
22770
cc8903c59d6b Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents: 22484
diff changeset
75 {N_("Someone says your username in chat"), "nick_said", "alert.wav"}
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 unmute_login_sounds_cb(gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 mute_login_sounds = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 mute_login_sounds_timeout = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
87 chat_nick_matches_name(PurpleConversation *conv, const char *aname)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
89 PurpleConvChat *chat = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 char *nick = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 char *name = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 gboolean ret = FALSE;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
93 chat = purple_conversation_get_chat_data(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 if (chat==NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
98 nick = g_strdup(purple_normalize(conv->account, chat->nick));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
99 name = g_strdup(purple_normalize(conv->account, aname));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 if (g_utf8_collate(nick, name) == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 ret = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 g_free(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 * play a sound event for a conversation, honoring make_sound flag
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 * of conversation and checking for focus if conv_focus pref is set
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
115 play_conv_event(PurpleConversation *conv, PurpleSoundEventID event)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 /* If we should not play the sound for some reason, then exit early */
19414
3d42c005fc17 Make sure a conversation is a pidgin-conversation to avoid a crash.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19384
diff changeset
118 if (conv != NULL && PIDGIN_IS_PIDGIN_CONVERSATION(conv))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
120 PidginConversation *gtkconv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 gboolean has_focus;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
123 gtkconv = PIDGIN_CONVERSATION(conv);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
124 has_focus = purple_conversation_has_focus(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 if (!gtkconv->make_sound ||
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
127 (has_focus && !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/conv_focus")))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
133 purple_sound_play_event(event, conv ? purple_conversation_get_account(conv) : NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
137 buddy_state_cb(PurpleBuddy *buddy, PurpleSoundEventID event)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
139 purple_sound_play_event(event, purple_buddy_get_account(buddy));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
143 im_msg_received_cb(PurpleAccount *account, char *sender,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
144 char *message, PurpleConversation *conv,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
145 PurpleMessageFlags flags, PurpleSoundEventID event)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
147 if (flags & PURPLE_MESSAGE_DELAYED)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 if (conv==NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
151 purple_sound_play_event(PURPLE_SOUND_FIRST_RECEIVE, account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 play_conv_event(conv, event);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
157 im_msg_sent_cb(PurpleAccount *account, const char *receiver,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
158 const char *message, PurpleSoundEventID event)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
160 PurpleConversation *conv = purple_find_conversation_with_account(
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
161 PURPLE_CONV_TYPE_ANY, receiver, account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 play_conv_event(conv, event);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
166 chat_buddy_join_cb(PurpleConversation *conv, const char *name,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
167 PurpleConvChatBuddyFlags flags, gboolean new_arrival,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
168 PurpleSoundEventID event)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 if (new_arrival && !chat_nick_matches_name(conv, name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 play_conv_event(conv, event);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
175 chat_buddy_left_cb(PurpleConversation *conv, const char *name,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
176 const char *reason, PurpleSoundEventID event)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 if (!chat_nick_matches_name(conv, name))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 play_conv_event(conv, event);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
183 chat_msg_sent_cb(PurpleAccount *account, const char *message,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
184 int id, PurpleSoundEventID event)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
186 PurpleConnection *conn = purple_account_get_connection(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
187 PurpleConversation *conv = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 if (conn!=NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
190 conv = purple_find_chat(conn,id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 play_conv_event(conv, event);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
196 chat_msg_received_cb(PurpleAccount *account, char *sender,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
197 char *message, PurpleConversation *conv,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
198 PurpleMessageFlags flags, PurpleSoundEventID event)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
200 PurpleConvChat *chat;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
202 if (flags & PURPLE_MESSAGE_DELAYED)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
205 chat = purple_conversation_get_chat_data(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 g_return_if_fail(chat != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
208 if (purple_conv_chat_is_user_ignored(chat, sender))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 if (chat_nick_matches_name(conv, sender))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
214 if (flags & PURPLE_MESSAGE_NICK || purple_utf8_has_word(message, chat->nick))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
215 play_conv_event(conv, PURPLE_SOUND_CHAT_NICK);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 play_conv_event(conv, event);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 * We mute sounds for the 10 seconds after you log in so that
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 * you don't get flooded with sounds when the blist shows all
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 * your buddies logging in.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
226 account_signon_cb(PurpleConnection *gc, gpointer data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 if (mute_login_sounds_timeout != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 g_source_remove(mute_login_sounds_timeout);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 mute_login_sounds = TRUE;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
231 mute_login_sounds_timeout = purple_timeout_add(10000, unmute_login_sounds_cb, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 const char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
235 pidgin_sound_get_event_option(PurpleSoundEventID event)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
237 if(event >= PURPLE_NUM_SOUNDS)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 return sounds[event].pref;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 const char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
244 pidgin_sound_get_event_label(PurpleSoundEventID event)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
246 if(event >= PURPLE_NUM_SOUNDS)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 return sounds[event].label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 void *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
253 pidgin_sound_get_handle()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 static int handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 return &handle;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
261 pidgin_sound_init(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
263 void *gtk_sound_handle = pidgin_sound_get_handle();
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
264 void *blist_handle = purple_blist_get_handle();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
265 void *conv_handle = purple_conversations_get_handle();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 #ifdef USE_GSTREAMER
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267 GError *error = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
270 purple_signal_connect(purple_connections_get_handle(), "signed-on",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
271 gtk_sound_handle, PURPLE_CALLBACK(account_signon_cb),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
274 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/sound");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
275 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/sound/enabled");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
276 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/sound/file");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
277 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/login", TRUE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
278 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/login", "");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
279 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/logout", TRUE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
280 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/logout", "");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
281 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/im_recv", TRUE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
282 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/im_recv", "");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
283 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/first_im_recv", FALSE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
284 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/first_im_recv", "");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
285 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/send_im", TRUE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
286 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/send_im", "");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
287 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/join_chat", FALSE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
288 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/join_chat", "");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
289 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/left_chat", FALSE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
290 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/left_chat", "");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
291 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/send_chat_msg", FALSE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
292 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/send_chat_msg", "");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
293 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/chat_msg_recv", FALSE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
294 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/chat_msg_recv", "");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
295 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/nick_said", FALSE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
296 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/nick_said", "");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
297 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/pounce_default", TRUE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
298 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/pounce_default", "");
23468
cf7625d4d7e0 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: 23173
diff changeset
299 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/sound/theme", "");
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
300 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/conv_focus", TRUE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
301 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/mute", FALSE);
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
302 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/command", "");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
303 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/sound/method", "automatic");
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
304 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/sound/volume", 50);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 #ifdef USE_GSTREAMER
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
307 purple_debug_info("sound", "Initializing sound output drivers.\n");
22484
5c216e2c5405 Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents: 22417
diff changeset
308 #ifdef GST_CAN_DISABLE_FORKING
22417
eab5bc54e163 Tell gstreamer not to fork; remove the SIGCHLD -> SIGALRM hack, which made
Will Thompson <will.thompson@collabora.co.uk>
parents: 21054
diff changeset
309 gst_registry_fork_set_enabled (FALSE);
22484
5c216e2c5405 Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents: 22417
diff changeset
310 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
312 purple_notify_error(NULL, _("GStreamer Failure"),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 _("GStreamer failed to initialize."),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 error ? error->message : "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 if (error) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 g_error_free(error);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 error = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320 #endif /* USE_GSTREAMER */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
322 purple_signal_connect(blist_handle, "buddy-signed-on",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
323 gtk_sound_handle, PURPLE_CALLBACK(buddy_state_cb),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
324 GINT_TO_POINTER(PURPLE_SOUND_BUDDY_ARRIVE));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
325 purple_signal_connect(blist_handle, "buddy-signed-off",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
326 gtk_sound_handle, PURPLE_CALLBACK(buddy_state_cb),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
327 GINT_TO_POINTER(PURPLE_SOUND_BUDDY_LEAVE));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
328 purple_signal_connect(conv_handle, "received-im-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
329 gtk_sound_handle, PURPLE_CALLBACK(im_msg_received_cb),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
330 GINT_TO_POINTER(PURPLE_SOUND_RECEIVE));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
331 purple_signal_connect(conv_handle, "sent-im-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
332 gtk_sound_handle, PURPLE_CALLBACK(im_msg_sent_cb),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
333 GINT_TO_POINTER(PURPLE_SOUND_SEND));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
334 purple_signal_connect(conv_handle, "chat-buddy-joined",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
335 gtk_sound_handle, PURPLE_CALLBACK(chat_buddy_join_cb),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
336 GINT_TO_POINTER(PURPLE_SOUND_CHAT_JOIN));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
337 purple_signal_connect(conv_handle, "chat-buddy-left",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
338 gtk_sound_handle, PURPLE_CALLBACK(chat_buddy_left_cb),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
339 GINT_TO_POINTER(PURPLE_SOUND_CHAT_LEAVE));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
340 purple_signal_connect(conv_handle, "sent-chat-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
341 gtk_sound_handle, PURPLE_CALLBACK(chat_msg_sent_cb),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
342 GINT_TO_POINTER(PURPLE_SOUND_CHAT_YOU_SAY));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
343 purple_signal_connect(conv_handle, "received-chat-msg",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
344 gtk_sound_handle, PURPLE_CALLBACK(chat_msg_received_cb),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
345 GINT_TO_POINTER(PURPLE_SOUND_CHAT_SAY));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
349 pidgin_sound_uninit(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351 #ifdef USE_GSTREAMER
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 if (!gst_init_failed)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 gst_deinit();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
356 purple_signals_disconnect_by_handle(pidgin_sound_get_handle());
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
357 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
358
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359 #ifdef USE_GSTREAMER
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 bus_call (GstBus *bus,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 GstMessage *msg,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365 GstElement *play = data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 GError *err = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 switch (GST_MESSAGE_TYPE (msg)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 case GST_MESSAGE_ERROR:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 gst_message_parse_error(msg, &err, NULL);
17862
177ff4b22285 Improve the formatting of some gstreamer error messages. Someone
Mark Doliner <mark@kingant.net>
parents: 17049
diff changeset
371 purple_debug_error("gstreamer", "%s\n", err->message);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 g_error_free(err);
19384
630938110521 Cleanup playbin on error. Thanks, Elliott Sales de Andrade. Fixes #2663
Sean Egan <seanegan@gmail.com>
parents: 19115
diff changeset
373 /* fall-through and clean up */
630938110521 Cleanup playbin on error. Thanks, Elliott Sales de Andrade. Fixes #2663
Sean Egan <seanegan@gmail.com>
parents: 19115
diff changeset
374 case GST_MESSAGE_EOS:
630938110521 Cleanup playbin on error. Thanks, Elliott Sales de Andrade. Fixes #2663
Sean Egan <seanegan@gmail.com>
parents: 19115
diff changeset
375 gst_element_set_state(play, GST_STATE_NULL);
630938110521 Cleanup playbin on error. Thanks, Elliott Sales de Andrade. Fixes #2663
Sean Egan <seanegan@gmail.com>
parents: 19115
diff changeset
376 gst_object_unref(GST_OBJECT(play));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 case GST_MESSAGE_WARNING:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 gst_message_parse_warning(msg, &err, NULL);
17863
b6145c9b6483 I left off a comma. My bad!
Mark Doliner <mark@kingant.net>
parents: 17862
diff changeset
380 purple_debug_warning("gstreamer", "%s\n", err->message);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 g_error_free(err);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389
22836
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
390 #ifndef _WIN32
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
391 static gboolean
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
392 expire_old_child(gpointer data)
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
393 {
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
394 pid_t pid = GPOINTER_TO_INT(data);
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
395
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
396 if (waitpid(pid, NULL, WNOHANG | WUNTRACED) < 0) {
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
397 if (errno == ECHILD)
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
398 return FALSE;
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
399 else
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
400 purple_debug_warning("gtksound", "Child is ill, pid: %d (%s)\n", pid, strerror(errno));
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
401 }
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
402
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
403 if (kill(pid, SIGKILL) < 0)
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
404 purple_debug_error("gtksound", "Killing process %d failed (%s)\n", pid, strerror(errno));
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
405
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
406 return FALSE;
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
407 }
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
408 #endif
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
409
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
411 pidgin_sound_play_file(const char *filename)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 const char *method;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 #ifdef USE_GSTREAMER
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 float volume;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 char *uri;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417 GstElement *sink = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 GstElement *play = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 GstBus *bus = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
422 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
425 method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 if (!strcmp(method, "none")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 } else if (!strcmp(method, "beep")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 gdk_beep();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 if (!g_file_test(filename, G_FILE_TEST_EXISTS)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
435 purple_debug_error("gtksound", "sound file (%s) does not exist.\n", filename);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439 #ifndef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 if (!strcmp(method, "custom")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 const char *sound_cmd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 char *command;
16906
64b7d4ebd2b2 Escape filename when using the command sound method. Fixes ticket #607.
Casey Harkins <charkins@pidgin.im>
parents: 16681
diff changeset
443 char *esc_filename;
22836
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
444 char **argv = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 GError *error = NULL;
22836
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
446 GPid pid;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
448 sound_cmd = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/sound/command");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 if (!sound_cmd || *sound_cmd == '\0') {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
451 purple_debug_error("gtksound",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 "'Command' sound method has been chosen, "
24295
8d040d580a44 Missing newline in debug message.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23173
diff changeset
453 "but no command has been set.\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456
16921
ba47cfaa013b Let glib handle quoting filenames for shell, it'll escape other quotes as needed.
Casey Harkins <charkins@pidgin.im>
parents: 16906
diff changeset
457 esc_filename = g_shell_quote(filename);
16906
64b7d4ebd2b2 Escape filename when using the command sound method. Fixes ticket #607.
Casey Harkins <charkins@pidgin.im>
parents: 16681
diff changeset
458
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 if(strstr(sound_cmd, "%s"))
16906
64b7d4ebd2b2 Escape filename when using the command sound method. Fixes ticket #607.
Casey Harkins <charkins@pidgin.im>
parents: 16681
diff changeset
460 command = purple_strreplace(sound_cmd, "%s", esc_filename);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 else
16906
64b7d4ebd2b2 Escape filename when using the command sound method. Fixes ticket #607.
Casey Harkins <charkins@pidgin.im>
parents: 16681
diff changeset
462 command = g_strdup_printf("%s %s", sound_cmd, esc_filename);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463
22836
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
464 if (!g_shell_parse_argv(command, NULL, &argv, &error)) {
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
465 purple_debug_error("gtksound", "error parsing command %s (%s)\n",
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
466 command, error->message);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467 g_error_free(error);
22836
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
468 g_free(esc_filename);
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
469 g_free(command);
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
470 return;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472
22836
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
473 if (!g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
474 NULL, NULL, &pid, &error)) {
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
475 purple_debug_error("gtksound", "sound command could not be launched: %s\n",
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
476 error->message);
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
477 g_error_free(error);
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
478 } else {
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
479 purple_timeout_add_seconds(15, expire_old_child, GINT_TO_POINTER(pid));
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
480 }
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
481
56a38b60576e Kill off sound playing child processes if they are still around after 15
Stu Tomlinson <stu@nosnilmot.com>
parents: 22770
diff changeset
482 g_strfreev(argv);
16906
64b7d4ebd2b2 Escape filename when using the command sound method. Fixes ticket #607.
Casey Harkins <charkins@pidgin.im>
parents: 16681
diff changeset
483 g_free(esc_filename);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 g_free(command);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 }
19671
0914ce0f3e0e Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19414
diff changeset
487 #endif /* _WIN32 */
0914ce0f3e0e Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19414
diff changeset
488
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 #ifdef USE_GSTREAMER
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490 if (gst_init_failed) /* Perhaps do gdk_beep instead? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 return;
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
492 volume = (float)(CLAMP(purple_prefs_get_int(PIDGIN_PREFS_ROOT "/sound/volume"),0,100)) / 50;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493 if (!strcmp(method, "automatic")) {
23173
c767bcb40b36 Try gconfaudiosink first always, not just under GNOME. This is what Debian
Richard Laager <rlaager@wiktel.com>
parents: 23074
diff changeset
494 sink = gst_element_factory_make("gconfaudiosink", "sink");
19671
0914ce0f3e0e Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19414
diff changeset
495 }
0914ce0f3e0e Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19414
diff changeset
496 #ifndef _WIN32
0914ce0f3e0e Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19414
diff changeset
497 else if (!strcmp(method, "esd")) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 sink = gst_element_factory_make("esdsink", "sink");
17049
5a308f09c871 ALSA Gstreamer sink. Mostly to see if this still crashes Luke.
Sean Egan <seanegan@gmail.com>
parents: 16958
diff changeset
499 } else if (!strcmp(method, "alsa")) {
5a308f09c871 ALSA Gstreamer sink. Mostly to see if this still crashes Luke.
Sean Egan <seanegan@gmail.com>
parents: 16958
diff changeset
500 sink = gst_element_factory_make("alsasink", "sink");
19671
0914ce0f3e0e Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19414
diff changeset
501 }
0914ce0f3e0e Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19414
diff changeset
502 #endif
0914ce0f3e0e Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19414
diff changeset
503 else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
504 purple_debug_error("sound", "Unknown sound method '%s'\n", method);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507
23074
fb87b6d77543 A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents: 22906
diff changeset
508 if (strcmp(method, "automatic") != 0 && !sink) {
fb87b6d77543 A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents: 22906
diff changeset
509 purple_debug_error("sound", "Unable to create GStreamer audiosink.\n");
fb87b6d77543 A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents: 22906
diff changeset
510 return;
fb87b6d77543 A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents: 22906
diff changeset
511 }
fb87b6d77543 A (modified) patch from Felipe to simplify our GStreamer sink selection
Felipe Contreras <felipe.contreras@gmail.com>
parents: 22906
diff changeset
512
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 play = gst_element_factory_make("playbin", "play");
21054
901b3e13c633 Remove unused definition.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21015
diff changeset
514
16101
cbb2ee5464b4 Fix a possible gstreamer crash
Sean Egan <seanegan@gmail.com>
parents: 16062
diff changeset
515 if (play == NULL) {
cbb2ee5464b4 Fix a possible gstreamer crash
Sean Egan <seanegan@gmail.com>
parents: 16062
diff changeset
516 return;
cbb2ee5464b4 Fix a possible gstreamer crash
Sean Egan <seanegan@gmail.com>
parents: 16062
diff changeset
517 }
21054
901b3e13c633 Remove unused definition.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21015
diff changeset
518
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 uri = g_strdup_printf("file://%s", filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 g_object_set(G_OBJECT(play), "uri", uri,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522 "volume", volume,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 "audio-sink", sink, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 bus = gst_pipeline_get_bus(GST_PIPELINE(play));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526 gst_bus_add_watch(bus, bus_call, play);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528 gst_element_set_state(play, GST_STATE_PLAYING);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 gst_object_unref(bus);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531 g_free(uri);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532
22906
5b27a807abf9 Clarify #ifdef/#else/#endif matching; References #5770.
Ethan Blanton <elb@pidgin.im>
parents: 22836
diff changeset
533 #else /* #ifdef USE_GSTREAMER */
19671
0914ce0f3e0e Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19414
diff changeset
534
0914ce0f3e0e Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19414
diff changeset
535 #ifndef _WIN32
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 gdk_beep();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 #else /* _WIN32 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
538 purple_debug_info("sound", "Playing %s\n", filename);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 if (G_WIN32_HAVE_WIDECHAR_API ()) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 wchar_t *wc_filename = g_utf8_to_utf16(filename,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 -1, NULL, NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543 if (!PlaySoundW(wc_filename, NULL, SND_ASYNC | SND_FILENAME))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
544 purple_debug(PURPLE_DEBUG_ERROR, "sound", "Error playing sound.\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 g_free(wc_filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 char *l_filename = g_locale_from_utf8(filename,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548 -1, NULL, NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 if (!PlaySoundA(l_filename, NULL, SND_ASYNC | SND_FILENAME))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
550 purple_debug(PURPLE_DEBUG_ERROR, "sound", "Error playing sound.\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 g_free(l_filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 #endif /* _WIN32 */
19671
0914ce0f3e0e Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19414
diff changeset
554
0914ce0f3e0e Don't assume that the Gstreamer stuff isn't used on win32. There really isn't anything to see here.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19414
diff changeset
555 #endif /* USE_GSTREAMER */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
559 pidgin_sound_play_event(PurpleSoundEventID event)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 char *enable_pref;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 char *file_pref;
23702
9525fb966efb theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23480
diff changeset
563 const char *theme_name;
23468
cf7625d4d7e0 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: 23173
diff changeset
564 PurpleSoundTheme *theme;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
566 if ((event == PURPLE_SOUND_BUDDY_ARRIVE) && mute_login_sounds)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
569 if (event >= PURPLE_NUM_SOUNDS) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
570 purple_debug_error("sound", "got request for unknown sound: %d\n", event);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
574 enable_pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/enabled/%s",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 sounds[event].pref);
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
576 file_pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s", sounds[event].pref);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 /* check NULL for sounds that don't have an option, ie buddy pounce */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
579 if (purple_prefs_get_bool(enable_pref)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
580 char *filename = g_strdup(purple_prefs_get_path(file_pref));
23480
2ccad3a8d9fe 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: 23470
diff changeset
581 theme_name = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme");
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25411
diff changeset
582
25411
c0e3b62f8098 * Alphabetize files in a few Makefile.am files
Mark Doliner <mark@kingant.net>
parents: 25296
diff changeset
583 if (theme_name && *theme_name && (!filename || !*filename)) {
c0e3b62f8098 * Alphabetize files in a few Makefile.am files
Mark Doliner <mark@kingant.net>
parents: 25296
diff changeset
584 /* Use theme */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
585 g_free(filename);
23468
cf7625d4d7e0 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: 23173
diff changeset
586
cf7625d4d7e0 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: 23173
diff changeset
587 theme = PURPLE_SOUND_THEME(purple_theme_manager_find_theme(theme_name, "sound"));
cf7625d4d7e0 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: 23173
diff changeset
588 filename = purple_sound_theme_get_file_full(theme, sounds[event].pref);
cf7625d4d7e0 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: 23173
diff changeset
589
cf7625d4d7e0 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: 23173
diff changeset
590 if(!g_file_test(filename, G_FILE_TEST_IS_REGULAR)){ /* Use Default sound in this case */
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25411
diff changeset
591 purple_debug_error("sound", "The file: (%s) %s\n from theme: %s, was not found or wasn't readable\n",
23468
cf7625d4d7e0 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: 23173
diff changeset
592 sounds[event].pref, filename, theme_name);
cf7625d4d7e0 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: 23173
diff changeset
593 g_free(filename);
cf7625d4d7e0 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: 23173
diff changeset
594 }
cf7625d4d7e0 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: 23173
diff changeset
595 }
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25411
diff changeset
596
23468
cf7625d4d7e0 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: 23173
diff changeset
597 if (!filename || !strlen(filename)) { /* Use Default sounds */
cf7625d4d7e0 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: 23173
diff changeset
598 g_free(filename);
cf7625d4d7e0 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: 23173
diff changeset
599
19115
Eric Polino <aluink@pidgin.im>
parents: 17863
diff changeset
600 /* XXX Consider creating a constant for "sounds/purple" to be shared with Finch */
Eric Polino <aluink@pidgin.im>
parents: 17863
diff changeset
601 filename = g_build_filename(DATADIR, "sounds", "purple", sounds[event].def, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
604 purple_sound_play_file(filename, NULL);
23468
cf7625d4d7e0 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: 23173
diff changeset
605
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
606 g_free(filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609 g_free(enable_pref);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610 g_free(file_pref);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25411
diff changeset
613 gboolean
23468
cf7625d4d7e0 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: 23173
diff changeset
614 pidgin_sound_is_customized(void)
cf7625d4d7e0 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: 23173
diff changeset
615 {
25415
584063555949 Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 25411
diff changeset
616 gint i;
23468
cf7625d4d7e0 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: 23173
diff changeset
617 gchar *path, *file;
cf7625d4d7e0 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: 23173
diff changeset
618
25411
c0e3b62f8098 * Alphabetize files in a few Makefile.am files
Mark Doliner <mark@kingant.net>
parents: 25296
diff changeset
619 for (i = 0; i < PURPLE_NUM_SOUNDS; i++) {
23468
cf7625d4d7e0 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: 23173
diff changeset
620 path = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s", sounds[i].pref);
cf7625d4d7e0 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: 23173
diff changeset
621 file = g_strdup(purple_prefs_get_path(path));
cf7625d4d7e0 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: 23173
diff changeset
622 g_free(path);
cf7625d4d7e0 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: 23173
diff changeset
623
25411
c0e3b62f8098 * Alphabetize files in a few Makefile.am files
Mark Doliner <mark@kingant.net>
parents: 25296
diff changeset
624 if (file && file[0] != '\0'){
23468
cf7625d4d7e0 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: 23173
diff changeset
625 g_free(file);
cf7625d4d7e0 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: 23173
diff changeset
626 return TRUE;
cf7625d4d7e0 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: 23173
diff changeset
627 }
cf7625d4d7e0 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: 23173
diff changeset
628
cf7625d4d7e0 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: 23173
diff changeset
629 g_free(file);
cf7625d4d7e0 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: 23173
diff changeset
630 }
cf7625d4d7e0 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: 23173
diff changeset
631
cf7625d4d7e0 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: 23173
diff changeset
632 return FALSE;
cf7625d4d7e0 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: 23173
diff changeset
633
cf7625d4d7e0 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: 23173
diff changeset
634 }
cf7625d4d7e0 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: 23173
diff changeset
635
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
636 static PurpleSoundUiOps sound_ui_ops =
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
638 pidgin_sound_init,
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
639 pidgin_sound_uninit,
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
640 pidgin_sound_play_file,
16681
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16193
diff changeset
641 pidgin_sound_play_event,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16193
diff changeset
642 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16193
diff changeset
643 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16193
diff changeset
644 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16193
diff changeset
645 NULL
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
647
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
648 PurpleSoundUiOps *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
649 pidgin_sound_get_ui_ops(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
651 return &sound_ui_ops;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 }