2
Copyright (c) 2016 Elementary Developers
4
This program is free software; you can redistribute it and/or modify it
5
under the terms of the GNU General Public License as published by the Free
6
Software Foundation; either version 2 of the License, or (at your option)
9
This program is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14
You should have received a copy of the GNU General Public License along with
15
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16
Place, Suite 330, Boston, MA 02111-1307 USA
18
Authors : Jeremy Wootten <jeremy@elementaryos.org>
20
Some convenience wrappers around libcanberra for using sounds within pantheon-files.
26
public class SoundManager : GLib.Object {
27
private static SoundManager? instance = null;
28
public static unowned SoundManager get_instance () {
29
if (instance == null) {
30
instance = new SoundManager ();
35
Canberra.Context? ca_context;
37
private SoundManager () {
39
Canberra.Context.create (out ca_context);
40
if (ca_context != null) {
41
ca_context.change_props (Canberra.PROP_APPLICATION_NAME, PF.Sound.APP_TITLE,
42
Canberra.PROP_APPLICATION_ID, PF.Sound.APP_ID,
43
Canberra.PROP_APPLICATION_ICON_NAME, PF.Sound.APP_LOGO);
48
public void play_delete_sound () {
49
play_sound (PF.Sound.DELETE);
51
public void play_empty_trash_sound () {
52
play_sound (PF.Sound.EMPTY_TRASH);
54
public void play_sound (string pf_sound_id) {
55
if (ca_context == null) {
58
ca_context.play (0, Canberra.PROP_EVENT_ID, pf_sound_id);
63
const string APP_TITLE = "Files";
64
const string APP_ID = "org.pantheon.files";
65
const string APP_LOGO = "system-file-manager";
66
public const string THEME = "freedesktop";
67
public const string DELETE = "trash-empty";
68
public const string EMPTY_TRASH = "trash-empty";