Wed, 05 Nov 2003 22:12:55 +0000
[gaim-migrate @ 8041]
clean up whitespace, and make it not crash on old logs w/o HTML
| 1 | 1 | /* |
| 2 | * gaim | |
| 3 | * | |
| 4561 | 4 | * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com> |
| 1 | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * it under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19 | * | |
| 20 | */ | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
21 | #include "internal.h" |
| 3630 | 22 | |
| 4561 | 23 | #include "sound.h" |
|
5545
a8b1a1262402
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
24 | #include "prefs.h" |
| 1 | 25 | |
|
6371
e92b66ee5518
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
26 | /* XXX CORE/UI: this goes away when away messages become sane */ |
|
e92b66ee5518
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
27 | #include "gtkinternal.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
28 | #include "ui.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
29 | |
|
4019
450d7e314aea
[gaim-migrate @ 4219]
Herman Bloggs <herman@bluedigits.com>
parents:
4014
diff
changeset
|
30 | |
| 5684 | 31 | static GaimSoundUiOps *sound_ui_ops = NULL; |
| 3319 | 32 | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
33 | void gaim_sound_set_ui_ops(GaimSoundUiOps *ops) |
|
4430
95df701e8cdf
[gaim-migrate @ 4705]
Robert McQueen <robot101@debian.org>
parents:
4429
diff
changeset
|
34 | { |
| 5684 | 35 | if(sound_ui_ops && sound_ui_ops->shutdown) |
| 36 | sound_ui_ops->shutdown(); | |
| 37 | sound_ui_ops = ops; | |
| 38 | if(sound_ui_ops && sound_ui_ops->init) | |
| 39 | sound_ui_ops->init(); | |
|
4430
95df701e8cdf
[gaim-migrate @ 4705]
Robert McQueen <robot101@debian.org>
parents:
4429
diff
changeset
|
40 | } |
|
95df701e8cdf
[gaim-migrate @ 4705]
Robert McQueen <robot101@debian.org>
parents:
4429
diff
changeset
|
41 | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
42 | GaimSoundUiOps *gaim_sound_get_ui_ops(void) |
|
4430
95df701e8cdf
[gaim-migrate @ 4705]
Robert McQueen <robot101@debian.org>
parents:
4429
diff
changeset
|
43 | { |
| 5684 | 44 | return sound_ui_ops; |
| 4581 | 45 | } |
| 46 | ||
| 5684 | 47 | void gaim_sound_init() |
| 48 | { | |
| 49 | gaim_prefs_add_none("/core/sound"); | |
| 50 | gaim_prefs_add_bool("/core/sound/while_away", FALSE); | |
| 51 | } | |
| 4581 | 52 | |
| 5684 | 53 | void gaim_sound_shutdown() |
|
4430
95df701e8cdf
[gaim-migrate @ 4705]
Robert McQueen <robot101@debian.org>
parents:
4429
diff
changeset
|
54 | { |
| 5684 | 55 | if(sound_ui_ops && sound_ui_ops->shutdown) |
| 56 | sound_ui_ops->shutdown(); | |
| 57 | } | |
|
4430
95df701e8cdf
[gaim-migrate @ 4705]
Robert McQueen <robot101@debian.org>
parents:
4429
diff
changeset
|
58 | |
| 5684 | 59 | void gaim_sound_play_file(const char *filename) |
| 60 | { | |
| 61 | if(awaymessage && !gaim_prefs_get_bool("/core/sound/while_away")) | |
| 4561 | 62 | return; |
|
4430
95df701e8cdf
[gaim-migrate @ 4705]
Robert McQueen <robot101@debian.org>
parents:
4429
diff
changeset
|
63 | |
| 5684 | 64 | if(sound_ui_ops && sound_ui_ops->play_file) |
| 65 | sound_ui_ops->play_file(filename); | |
|
1006
fb2f2a403962
[gaim-migrate @ 1016]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
899
diff
changeset
|
66 | } |
|
fb2f2a403962
[gaim-migrate @ 1016]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
899
diff
changeset
|
67 | |
| 4561 | 68 | void gaim_sound_play_event(GaimSoundEventID event) |
| 1 | 69 | { |
| 5684 | 70 | if(awaymessage && !gaim_prefs_get_bool("/core/sound/while_away")) |
| 4561 | 71 | return; |
| 72 | ||
| 5684 | 73 | if(sound_ui_ops && sound_ui_ops->play_event) |
| 74 | sound_ui_ops->play_event(event); | |
| 4561 | 75 | } |