File: systray.js

package info (click to toggle)
cinnamon 3.2.7-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 11,624 kB
  • sloc: ansic: 33,269; python: 18,048; xml: 1,504; makefile: 780; sh: 90; cpp: 54
file content (45 lines) | stat: -rw-r--r-- 1,085 bytes parent folder | download | duplicates (5)
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
const Signals = imports.signals;


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

SystrayManager.prototype = {
    _init: function() {
        this._roles = [];
    },
    
    registerRole: function(role, id) {
        this._roles.push({role: role, id: id});
        this.emit("changed");
    },
    
    unregisterRole: function(role, id) {
        for (let i = this._roles.length - 1; i >= 0; i--) {
            if (this._roles[i].id == id && this._roles[i].role == role) {
                this._roles.splice(i, 1);
            }
        }
        this.emit("changed");
    },
    
    unregisterId: function(id) {
        for (let i = this._roles.length - 1; i >= 0; i--) {
            if (this._roles[i].id == id) {
                this._roles.splice(i, 1);
            }
        }
        this.emit("changed");
    },
    
    getRoles: function(id) {
        let roles = [];
        for (let i = 0; i < this._roles.length; i++) {
            roles.push(this._roles[i].role);
        }
        
        return roles;
    }
}
Signals.addSignalMethods(SystrayManager.prototype);