This file is indexed.

/usr/share/cinnamon/js/ui/soundManager.js is in cinnamon-common 3.6.7-8ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-

const Lang = imports.lang;
const Gio = imports.gi.Gio;
const Main = imports.ui.main;
const Mainloop = imports.mainloop;

const iface =
    "<node> \
        <interface name='org.cinnamon.SettingsDaemon.Sound'> \
            <annotation name='org.freedesktop.DBus.GLib.CSymbol' value='csd_sound_manager'/> \
            <method name='PlaySoundFile'> \
                <arg name='id' direction='in' type='u'/> \
                <arg name='filename' direction='in' type='s'/> \
            </method> \
            <method name='PlaySoundFileVolume'> \
                <arg name='id' direction='in' type='u'/> \
                <arg name='filename' direction='in' type='s'/> \
                <arg name='volume' direction='in' type='s'/> \
            </method> \
            <method name='PlaySound'> \
                <arg name='id' direction='in' type='u'/> \
                <arg name='name' direction='in' type='s'/> \
            </method> \
            <method name='CancelSound'> \
                <arg name='id' direction='in' type='u'/> \
            </method> \
        </interface> \
    </node>";

const proxy = Gio.DBusProxy.makeProxyWrapper(iface);

const PLAY_ONCE_FLAG = 8675309;

function SoundManager() {
    this._init();
}

SoundManager.prototype = {

    _init : function() {
        this.keys = ["switch", "close", "map", "minimize", "maximize", "unmaximize", "tile", "login", "plug", "unplug", "notification"];
        this.desktop_keys = ["volume"];
        this.startup_delay = true;
        this.enabled = {};
        this.file = {};
        this.settings = new Gio.Settings({ schema_id: 'org.cinnamon.sounds' });
        this.desktop_settings = new Gio.Settings({ schema_id: 'org.cinnamon.desktop.sound' });
        this._cacheSettings();                
        this._cacheDesktopSettings();   
        this.settings.connect("changed", Lang.bind(this, this._cacheSettings));
        this.desktop_settings.connect("changed", Lang.bind(this, this._cacheDesktopSettings));
        Mainloop.timeout_add_seconds(10, Lang.bind(this, function() {
            this.startup_delay = false;
        }));

        this.proxy = new proxy(Gio.DBus.session,
                               'org.cinnamon.SettingsDaemon.Sound',
                               '/org/cinnamon/SettingsDaemon/Sound');

        /* patch public methods into global to keep backward compatibility */

        global.play_theme_sound = Lang.bind(this, this.playSound);
        global.play_sound_file = Lang.bind(this, this.playSoundFile);
        global.cancel_sound = Lang.bind(this, this.cancelSound);
    },

    _cacheSettings: function() {
        for (var i in this.keys) {
            let key = this.keys[i];
            this.enabled[key] = this.settings.get_boolean(key + "-enabled");
            this.file[key] = this.settings.get_string(key + "-file");
        }        
    },

    _cacheDesktopSettings: function() {
        for (var i in this.desktop_keys) {
            let key = this.desktop_keys[i];
            this.enabled[key] = this.desktop_settings.get_boolean(key + "-sound-enabled");
            this.file[key] = this.desktop_settings.get_string(key + "-sound-file");
        }        
    },

    play: function(sound) {
        if (this.startup_delay)
            return;
        if (this.enabled[sound] && this.file[sound] != "") {
            this.playSoundFile(0, this.file[sound]);
        }
    },

    playVolume: function(sound, volume) {
        if (this.startup_delay)
            return;
        if (this.enabled[sound] && this.file[sound] != "") {
            this.playSoundFileVolume(0, this.file[sound], volume);
        }
    },

    /* We want the login sound synced to the fade-in animation
     * but we don't want it playing every time someone restarts
     * Cinnamon - passing PLAY_ONCE_FLAG will let the sound handler
     * know not to play this more than once for its lifetime (usually
     * for the session.)
     */

    play_once_per_session: function(sound) {
        if (this.enabled[sound] && this.file[sound] != "") {
            this.playSoundFile(PLAY_ONCE_FLAG, this.file[sound]);
        }
    },

    /* Public methods. */

    playSoundFile: function(id, filename) {
        this.proxy.PlaySoundFileRemote(id, filename);
    },

    playSoundFileVolume: function(id, filename, volume) {
        //ignore volume parameter if it is not valid (no mute)
        if (!Number.isFinite(volume) || Number.isNaN(volume) || volume < 0)
            this.playSoundFile(id, filename);
        else
            this.proxy.PlaySoundFileVolumeRemote(id, filename, volume + "");
    },

    playSound: function(id, name) {
        this.proxy.PlaySoundRemote(id, name);
    },

    cancelSound: function(id) {
        this.proxy.CancelSoundRemote(id);
    }
};