| 1 |
/* exported FlatpakDevicesModel */ |
| 2 |
|
| 3 |
/* devices.js |
| 4 |
* |
| 5 |
* Copyright 2020 Martin Abente Lahaye |
| 6 |
* |
| 7 |
* This program is free software: you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation, either version 3 of the License, or |
| 10 |
* (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
*/ |
| 20 |
|
| 21 |
const {GObject} = imports.gi; |
| 22 |
|
| 23 |
const {FlatpakSharedModel} = imports.models.shared; |
| 24 |
|
| 25 |
|
| 26 |
var FlatpakDevicesModel = GObject.registerClass({ |
| 27 |
GTypeName: 'FlatpakDevicesModel', |
| 28 |
}, class FlatpakDevicesModel extends FlatpakSharedModel { |
| 29 |
_init() { |
| 30 |
super._init({}); |
| 31 |
} |
| 32 |
|
| 33 |
getPermissions() { |
| 34 |
return { |
| 35 |
'devices-dri': { |
| 36 |
supported: this._info.supports('0.4.0'), |
| 37 |
description: _('GPU acceleration'), |
| 38 |
option: 'dri', |
| 39 |
value: this.constructor.getDefault(), |
| 40 |
example: 'device=dri', |
| 41 |
}, |
| 42 |
'devices-input': { |
| 43 |
supported: this._info.supports('1.15.6'), |
| 44 |
description: _('Input devices'), |
| 45 |
option: 'input', |
| 46 |
value: this.constructor.getDefault(), |
| 47 |
example: 'device=input', |
| 48 |
}, |
| 49 |
'devices-kvm': { |
| 50 |
supported: this._info.supports('0.6.12'), |
| 51 |
description: _('Virtualization'), |
| 52 |
option: 'kvm', |
| 53 |
value: this.constructor.getDefault(), |
| 54 |
example: 'device=kvm', |
| 55 |
}, |
| 56 |
'devices-shm': { |
| 57 |
supported: this._info.supports('1.6.1'), |
| 58 |
description: _('Shared memory'), |
| 59 |
option: 'shm', |
| 60 |
value: this.constructor.getDefault(), |
| 61 |
example: 'device=shm', |
| 62 |
}, |
| 63 |
'devices-usb': { |
| 64 |
supported: this._info.supports('1.15.11'), |
| 65 |
description: _('USB devices'), |
| 66 |
option: 'usb', |
| 67 |
value: this.constructor.getDefault(), |
| 68 |
example: 'device=usb', |
| 69 |
}, |
| 70 |
'devices-all': { |
| 71 |
supported: this._info.supports('0.6.6'), |
| 72 |
description: _('All devices (e.g. webcam)'), |
| 73 |
option: 'all', |
| 74 |
value: this.constructor.getDefault(), |
| 75 |
example: 'device=all', |
| 76 |
}, |
| 77 |
}; |
| 78 |
} |
| 79 |
|
| 80 |
static getGroup() { |
| 81 |
return 'Context'; |
| 82 |
} |
| 83 |
|
| 84 |
static getKey() { |
| 85 |
return 'devices'; |
| 86 |
} |
| 87 |
|
| 88 |
static getStyle() { |
| 89 |
return 'devices'; |
| 90 |
} |
| 91 |
|
| 92 |
static getTitle() { |
| 93 |
return 'Device'; |
| 94 |
} |
| 95 |
|
| 96 |
static getDescription() { |
| 97 |
return _('List of devices available in the sandbox'); |
| 98 |
} |
| 99 |
}); |