Update eslintrc from GJS, fix errors and missing JSDocs
This commit is contained in:
+22
-7
@@ -3,6 +3,8 @@
|
||||
env:
|
||||
es6: true
|
||||
extends: 'eslint:recommended'
|
||||
plugins:
|
||||
- jsdoc
|
||||
rules:
|
||||
array-bracket-newline:
|
||||
- error
|
||||
@@ -60,6 +62,17 @@ rules:
|
||||
- 'CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child'
|
||||
# Allow dedenting chained member expressions
|
||||
MemberExpression: 'off'
|
||||
jsdoc/check-alignment: error
|
||||
jsdoc/check-param-names: error
|
||||
jsdoc/check-tag-names: error
|
||||
jsdoc/check-types: error
|
||||
jsdoc/implements-on-classes: error
|
||||
jsdoc/newline-after-description: error
|
||||
jsdoc/require-jsdoc: error
|
||||
jsdoc/require-param: error
|
||||
jsdoc/require-param-description: error
|
||||
jsdoc/require-param-name: error
|
||||
jsdoc/require-param-type: error
|
||||
key-spacing:
|
||||
- error
|
||||
- beforeColon: false
|
||||
@@ -109,15 +122,15 @@ rules:
|
||||
no-prototype-builtins: 'off'
|
||||
no-restricted-properties:
|
||||
- error
|
||||
- object: Lang
|
||||
property: copyProperties
|
||||
message: Use Object.assign()
|
||||
- object: Lang
|
||||
property: bind
|
||||
message: Use arrow notation or Function.prototype.bind()
|
||||
- object: Lang
|
||||
property: Class
|
||||
message: Use ES6 classes
|
||||
- object: imports
|
||||
property: mainloop
|
||||
message: Use GLib main loops and timeouts
|
||||
no-restricted-syntax:
|
||||
- error
|
||||
- selector: >-
|
||||
@@ -133,6 +146,8 @@ rules:
|
||||
BlockStatement[body.length=1]
|
||||
CallExpression[arguments.length=0][callee.object.type="Super"][callee.property.name="_init"]
|
||||
message: _init() that only calls super._init() is unnecessary
|
||||
- selector: BinaryExpression[operator="instanceof"][right.name="Array"]
|
||||
message: Use Array.isArray()
|
||||
no-return-assign: error
|
||||
no-return-await: error
|
||||
no-self-compare: error
|
||||
@@ -169,6 +184,9 @@ rules:
|
||||
object-shorthand: error
|
||||
operator-assignment: error
|
||||
operator-linebreak: error
|
||||
padded-blocks:
|
||||
- error
|
||||
- never
|
||||
# These may be a bit controversial, we can try them out and enable them later
|
||||
# prefer-const: error
|
||||
# prefer-destructuring: error
|
||||
@@ -209,9 +227,6 @@ rules:
|
||||
template-curly-spacing: error
|
||||
template-tag-spacing: error
|
||||
unicode-bom: error
|
||||
valid-jsdoc:
|
||||
- error
|
||||
- requireReturn: false
|
||||
wrap-iife:
|
||||
- error
|
||||
- inside
|
||||
@@ -229,4 +244,4 @@ globals:
|
||||
print: readonly
|
||||
printerr: readonly
|
||||
parserOptions:
|
||||
ecmaVersion: 2019
|
||||
ecmaVersion: 2020
|
||||
|
||||
Generated
+59
-3
@@ -660,6 +660,12 @@
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"dev": true
|
||||
},
|
||||
"comment-parser": {
|
||||
"version": "0.7.6",
|
||||
"resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-0.7.6.tgz",
|
||||
"integrity": "sha512-GKNxVA7/iuTnAqGADlTWX4tkhzxZKXp5fLJqKTlQLHkE65XDUKutZ3BHaJC5IGcper2tT3QRD1xr4o3jNpgXXg==",
|
||||
"dev": true
|
||||
},
|
||||
"common-path-prefix": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz",
|
||||
@@ -1020,6 +1026,44 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"eslint-plugin-jsdoc": {
|
||||
"version": "30.7.8",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.7.8.tgz",
|
||||
"integrity": "sha512-OWm2AYvXjCl7nRbpcw5xisfSVkpVAyp4lGqL9T+DeK4kaPm6ecnmTc/G5s1PtcRrwbaI8bIWGzwScqv5CdGyxA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"comment-parser": "^0.7.6",
|
||||
"debug": "^4.2.0",
|
||||
"jsdoctypeparser": "^9.0.0",
|
||||
"lodash": "^4.17.20",
|
||||
"regextras": "^0.7.1",
|
||||
"semver": "^7.3.2",
|
||||
"spdx-expression-parse": "^3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
|
||||
"integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "2.1.2"
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.20",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
|
||||
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",
|
||||
"dev": true
|
||||
},
|
||||
"semver": {
|
||||
"version": "7.3.2",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
|
||||
"integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"eslint-scope": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz",
|
||||
@@ -1610,6 +1654,12 @@
|
||||
"esprima": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"jsdoctypeparser": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsdoctypeparser/-/jsdoctypeparser-9.0.0.tgz",
|
||||
"integrity": "sha512-jrTA2jJIL6/DAEILBEh2/w9QxCuwmvNXIry39Ay/HVfhE3o2yVV0U44blYkqdHA/OKloJEqvJy0xU+GSdE2SIw==",
|
||||
"dev": true
|
||||
},
|
||||
"json-buffer": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz",
|
||||
@@ -1691,9 +1741,9 @@
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.15",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
||||
"version": "4.17.20",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
|
||||
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.clonedeep": {
|
||||
@@ -2324,6 +2374,12 @@
|
||||
"integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==",
|
||||
"dev": true
|
||||
},
|
||||
"regextras": {
|
||||
"version": "0.7.1",
|
||||
"resolved": "https://registry.npmjs.org/regextras/-/regextras-0.7.1.tgz",
|
||||
"integrity": "sha512-9YXf6xtW+qzQ+hcMQXx95MOvfqXFgsKDZodX3qZB0x2n5Z94ioetIITsBtvJbiOyxa/6s9AtyweBLCdPmPko/w==",
|
||||
"dev": true
|
||||
},
|
||||
"registry-auth-token": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.1.1.tgz",
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^3.8.2",
|
||||
"eslint": "^7.5.0"
|
||||
"eslint": "^7.5.0",
|
||||
"eslint-plugin-jsdoc": "^30.7.8"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,11 @@ const Me = extensionUtils.getCurrentExtension();
|
||||
const shellMinorVersion = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
||||
|
||||
|
||||
/**
|
||||
* Initialize translations for a given gettext domain.
|
||||
*
|
||||
* @param {string} domain Gettext domain.
|
||||
*/
|
||||
function initTranslations(domain) {
|
||||
if (shellMinorVersion <= 30)
|
||||
return Me.imports.convenience.initTranslations(domain);
|
||||
@@ -30,6 +35,12 @@ function initTranslations(domain) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the Extension Manager initialization status.
|
||||
*
|
||||
* @returns {boolean} `true` if the Extension Manager is initialized, `false`
|
||||
* otherwise.
|
||||
*/
|
||||
function extensionManagerInitialized() {
|
||||
if (shellMinorVersion > 32)
|
||||
return imports.ui.main.extensionManager._initialized;
|
||||
@@ -38,6 +49,12 @@ function extensionManagerInitialized() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a specific extension from the Extension Manager.
|
||||
*
|
||||
* @param {string} uuid UUID of the extension.
|
||||
* @returns {(object|null)} The desired extension or `null` if it doesn't exist.
|
||||
*/
|
||||
function extensionManagerLookup(uuid) {
|
||||
try {
|
||||
if (shellMinorVersion > 32)
|
||||
@@ -50,6 +67,12 @@ function extensionManagerLookup(uuid) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get GSettings for the given schema ID.
|
||||
*
|
||||
* @param {(string|null)} schema The GSettings schema ID. If not given, will use
|
||||
* the extension's schema ID.
|
||||
*/
|
||||
function getSettings(schema) {
|
||||
if (shellMinorVersion <= 30)
|
||||
return Me.imports.convenience.getSettings(schema);
|
||||
@@ -58,11 +81,17 @@ function getSettings(schema) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the extension's GSettings.
|
||||
*/
|
||||
function getExtensionSettings() {
|
||||
return getSettings();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the KeyBinding AutoRepeat flag.
|
||||
*/
|
||||
function keyBindingAutoRepeat() {
|
||||
// if version is less then 3.30 the keybinding flags are NONE
|
||||
if (shellMinorVersion < 30)
|
||||
@@ -72,6 +101,11 @@ function keyBindingAutoRepeat() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the actor from a given subject.
|
||||
*
|
||||
* @param {object} subject The object to get the actor from.
|
||||
*/
|
||||
function getActor(subject) {
|
||||
if (shellMinorVersion > 34)
|
||||
return subject;
|
||||
|
||||
+21
-2
@@ -46,16 +46,26 @@ var backgrounder = null;
|
||||
var commander = null;
|
||||
|
||||
|
||||
/**
|
||||
* Extension initialization.
|
||||
*/
|
||||
function init() {
|
||||
logDebug('Initializing extension...');
|
||||
compat.initTranslations(Me.metadata['gettext-domain']);
|
||||
logDebug('Extension initialized.');
|
||||
}
|
||||
|
||||
/**
|
||||
* When the extension is enabled, we wait for the Extension Manager to be
|
||||
* initialized before starting.
|
||||
*/
|
||||
function enable() {
|
||||
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => waitForExtensionManager(start));
|
||||
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => _waitForExtensionManager(start));
|
||||
}
|
||||
|
||||
/**
|
||||
* When the extension is started, we create and enable all the modules.
|
||||
*/
|
||||
function start() {
|
||||
logDebug('Enabling extension...');
|
||||
settings = new Settings();
|
||||
@@ -80,6 +90,9 @@ function start() {
|
||||
logDebug('Extension enabled.');
|
||||
}
|
||||
|
||||
/**
|
||||
* When the extension is disabled, we disable and remove all the modules.
|
||||
*/
|
||||
function disable() {
|
||||
logDebug('Disabling extension...');
|
||||
enabled = false;
|
||||
@@ -104,7 +117,13 @@ function disable() {
|
||||
logDebug('Extension disabled.');
|
||||
}
|
||||
|
||||
function waitForExtensionManager(callback) {
|
||||
/**
|
||||
* Wait for the Extension Manager to be initialized and run a callback function.
|
||||
*
|
||||
* @param {Function} callback The function to run when the Extension Manager
|
||||
* is initialized.
|
||||
*/
|
||||
function _waitForExtensionManager(callback) {
|
||||
logDebug('Waiting for Extension Manager initialization...');
|
||||
while (!compat.extensionManagerInitialized())
|
||||
continue;
|
||||
|
||||
@@ -31,7 +31,6 @@ const { logDebug } = Me.imports.utils;
|
||||
* settings), it will use it as the current time background.
|
||||
*/
|
||||
var Backgrounder = class {
|
||||
|
||||
constructor() {
|
||||
this._statusChangedConnect = null;
|
||||
this._backgroundChangedConnect = null;
|
||||
@@ -139,5 +138,4 @@ var Backgrounder = class {
|
||||
e.settings.system.background = e.settings.backgrounds.night;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -29,7 +29,6 @@ const { logDebug } = Me.imports.utils;
|
||||
* The Commander is responsible for spawning commands according to the time.
|
||||
*/
|
||||
var Commander = class {
|
||||
|
||||
constructor() {
|
||||
this._statusChangedConnect = null;
|
||||
this._timeChangedConnect = null;
|
||||
@@ -93,5 +92,4 @@ var Commander = class {
|
||||
GLib.spawn_async(null, ['sh', '-c', command], null, GLib.SpawnFlags.SEARCH_PATH, null);
|
||||
logDebug(`Spawned ${time} command.`);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -30,7 +30,6 @@ const { logDebug } = Me.imports.utils;
|
||||
* the time.
|
||||
*/
|
||||
var CursorThemer = class {
|
||||
|
||||
constructor() {
|
||||
this._statusChangedConnect = null;
|
||||
this._variantChangedConnect = null;
|
||||
@@ -140,5 +139,4 @@ var CursorThemer = class {
|
||||
e.settings.system.cursorTheme = e.settings.cursorVariants.night;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -41,7 +41,6 @@ const _ = Gettext.gettext;
|
||||
* change the GTK variants in the extension's preferences.
|
||||
*/
|
||||
var GtkThemer = class {
|
||||
|
||||
constructor() {
|
||||
this._statusChangedConnect = null;
|
||||
this._variantChangedConnect = null;
|
||||
@@ -184,5 +183,4 @@ var GtkThemer = class {
|
||||
e.settings.gtkVariants.night = variants.get('night');
|
||||
logDebug(`New GTK variants. { day: '${variants.get('day')}'; night: '${variants.get('night')}' }`);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -41,7 +41,6 @@ this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
* - '-darkest'
|
||||
*/
|
||||
var GtkVariants = class {
|
||||
|
||||
static guessFrom(name) {
|
||||
const variants = new Map();
|
||||
|
||||
@@ -100,5 +99,4 @@ var GtkVariants = class {
|
||||
|
||||
return variants;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -30,7 +30,6 @@ const { logDebug } = Me.imports.utils;
|
||||
* time.
|
||||
*/
|
||||
var IconThemer = class {
|
||||
|
||||
constructor() {
|
||||
this._statusChangedConnect = null;
|
||||
this._variantChangedConnect = null;
|
||||
@@ -140,5 +139,4 @@ var IconThemer = class {
|
||||
e.settings.system.iconTheme = e.settings.iconVariants.night;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -41,7 +41,6 @@ const _ = Gettext.gettext;
|
||||
* change the shell variants in the extension's preferences.
|
||||
*/
|
||||
var ShellThemer = class {
|
||||
|
||||
constructor() {
|
||||
this._statusChangedConnect = null;
|
||||
this._variantChangedConnect = null;
|
||||
@@ -190,6 +189,5 @@ var ShellThemer = class {
|
||||
e.settings.shellVariants.night = variants.get('night');
|
||||
logDebug(`New Shell variants. { day: '${variants.get('day')}'; night: '${variants.get('night')}' }`);
|
||||
}
|
||||
|
||||
};
|
||||
Signals.addSignalMethods(ShellThemer.prototype);
|
||||
|
||||
@@ -41,7 +41,6 @@ this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
* - '-darkest'
|
||||
*/
|
||||
var ShellVariants = class {
|
||||
|
||||
static guessFrom(name) {
|
||||
const variants = new Map();
|
||||
|
||||
@@ -97,5 +96,4 @@ var ShellVariants = class {
|
||||
|
||||
return variants;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -45,7 +45,6 @@ const { TimerOndemand } = Me.imports.modules.TimerOndemand;
|
||||
* schedule in the extensions's preferences.
|
||||
*/
|
||||
var Timer = class {
|
||||
|
||||
constructor() {
|
||||
this._sources = [];
|
||||
this._previousTime = null;
|
||||
@@ -199,6 +198,5 @@ var Timer = class {
|
||||
}
|
||||
return source;
|
||||
}
|
||||
|
||||
};
|
||||
Signals.addSignalMethods(Timer.prototype);
|
||||
|
||||
@@ -40,7 +40,6 @@ const { logDebug } = Me.imports.utils;
|
||||
* case.
|
||||
*/
|
||||
var TimerLocation = class {
|
||||
|
||||
constructor() {
|
||||
this._previouslyDaytime = null;
|
||||
// Before we have the location suntimes, we'll use the manual schedule
|
||||
@@ -211,6 +210,5 @@ var TimerLocation = class {
|
||||
GLib.Source.remove(this._timeChangeTimer);
|
||||
logDebug('Stopped watching for time change.');
|
||||
}
|
||||
|
||||
};
|
||||
Signals.addSignalMethods(TimerLocation.prototype);
|
||||
|
||||
@@ -42,7 +42,6 @@ const COLOR_INTERFACE = `
|
||||
* 'NightLightActive' property and will signal any change.
|
||||
*/
|
||||
var TimerNightlight = class {
|
||||
|
||||
constructor() {
|
||||
this._colorDbusProxy = null;
|
||||
this._nightlightFollowDisableConnect = null;
|
||||
@@ -135,6 +134,5 @@ var TimerNightlight = class {
|
||||
? !this._colorDbusProxy.DisabledUntilTomorrow && this._colorDbusProxy.NightLightActive
|
||||
: this._colorDbusProxy.NightLightActive;
|
||||
}
|
||||
|
||||
};
|
||||
Signals.addSignalMethods(TimerNightlight.prototype);
|
||||
|
||||
@@ -41,7 +41,6 @@ const _ = Gettext.gettext;
|
||||
* The user can change the key combination in the extension's preferences.
|
||||
*/
|
||||
var TimerOndemand = class {
|
||||
|
||||
constructor() {
|
||||
this._button = null;
|
||||
this._previousKeybinding = null;
|
||||
@@ -221,6 +220,5 @@ var TimerOndemand = class {
|
||||
e.settings.time.ondemandTime = e.timer.time === 'day' ? 'night' : 'day';
|
||||
this.emit('time-changed', this.time);
|
||||
}
|
||||
|
||||
};
|
||||
Signals.addSignalMethods(TimerOndemand.prototype);
|
||||
|
||||
@@ -35,7 +35,6 @@ const { logDebug } = Me.imports.utils;
|
||||
* The user can change the schedule in the extension's preferences.
|
||||
*/
|
||||
var TimerSchedule = class {
|
||||
|
||||
constructor() {
|
||||
this._previouslyDaytime = null;
|
||||
this._timeChangeTimer = null;
|
||||
@@ -84,6 +83,5 @@ var TimerSchedule = class {
|
||||
GLib.Source.remove(this._timeChangeTimer);
|
||||
logDebug('Stopped watching for time change.');
|
||||
}
|
||||
|
||||
};
|
||||
Signals.addSignalMethods(TimerSchedule.prototype);
|
||||
|
||||
@@ -26,7 +26,6 @@ const _ = Gettext.gettext;
|
||||
|
||||
|
||||
var BackgroundsPreferences = class {
|
||||
|
||||
constructor(settings) {
|
||||
this._builder = new Gtk.Builder();
|
||||
this._builder.add_from_file(GLib.build_filenamev([Me.path, 'preferences', 'ui', 'backgrounds.ui']));
|
||||
@@ -113,5 +112,4 @@ var BackgroundsPreferences = class {
|
||||
settings.backgrounds.connect('night-changed', () => updateNightClearButtonSensitivity());
|
||||
updateNightClearButtonSensitivity();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -26,7 +26,6 @@ const _ = Gettext.gettext;
|
||||
|
||||
|
||||
var CommandsPreferences = class {
|
||||
|
||||
constructor(settings) {
|
||||
this._builder = new Gtk.Builder();
|
||||
this._builder.add_from_file(GLib.build_filenamev([Me.path, 'preferences', 'ui', 'commands.ui']));
|
||||
@@ -91,5 +90,4 @@ var CommandsPreferences = class {
|
||||
settings.commands.connect('sunset-changed', () => updateSunsetClearButtonSensitivity());
|
||||
updateSunsetClearButtonSensitivity();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -28,7 +28,6 @@ const _ = Gettext.gettext;
|
||||
|
||||
|
||||
var CursorThemePreferences = class {
|
||||
|
||||
constructor(settings) {
|
||||
this._builder = new Gtk.Builder();
|
||||
this._builder.add_from_file(GLib.build_filenamev([Me.path, 'preferences', 'ui', 'cursor_theme.ui']));
|
||||
@@ -77,5 +76,4 @@ var CursorThemePreferences = class {
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -28,7 +28,6 @@ const _ = Gettext.gettext;
|
||||
|
||||
|
||||
var GtkThemePreferences = class {
|
||||
|
||||
constructor(settings) {
|
||||
this._builder = new Gtk.Builder();
|
||||
this._builder.add_from_file(GLib.build_filenamev([Me.path, 'preferences', 'ui', 'gtk_theme.ui']));
|
||||
@@ -93,5 +92,4 @@ var GtkThemePreferences = class {
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -28,7 +28,6 @@ const utils = Me.imports.utils;
|
||||
|
||||
|
||||
var Headerbar = class {
|
||||
|
||||
constructor(stack) {
|
||||
this._builder = new Gtk.Builder();
|
||||
this._builder.add_from_file(GLib.build_filenamev([Me.path, 'preferences', 'ui', 'headerbar.ui']));
|
||||
@@ -62,5 +61,4 @@ var Headerbar = class {
|
||||
const commandsRadio = this._builder.get_object('commands_radio');
|
||||
commandsRadio.connect('clicked', () => stack.set_visible_child_name('commands'));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -28,7 +28,6 @@ const _ = Gettext.gettext;
|
||||
|
||||
|
||||
var IconThemePreferences = class {
|
||||
|
||||
constructor(settings) {
|
||||
this._builder = new Gtk.Builder();
|
||||
this._builder.add_from_file(GLib.build_filenamev([Me.path, 'preferences', 'ui', 'icon_theme.ui']));
|
||||
@@ -77,5 +76,4 @@ var IconThemePreferences = class {
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -28,7 +28,6 @@ const utils = Me.imports.utils;
|
||||
|
||||
|
||||
var OndemandKeyboardShortcutDialog = class {
|
||||
|
||||
constructor(settings) {
|
||||
this._builder = new Gtk.Builder();
|
||||
this._builder.add_from_file(GLib.build_filenamev([Me.path, 'preferences', 'ui', 'ondemand_keyboard_shortcut_dialog.ui']));
|
||||
@@ -85,5 +84,4 @@ var OndemandKeyboardShortcutDialog = class {
|
||||
this.widget.close();
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -35,7 +35,6 @@ const { Headerbar } = Me.imports.preferences.Headerbar;
|
||||
|
||||
|
||||
var Preferences = class {
|
||||
|
||||
constructor() {
|
||||
this.settings = new Settings();
|
||||
this.settings.enable();
|
||||
@@ -70,5 +69,4 @@ var Preferences = class {
|
||||
|
||||
this.headerbar = new Headerbar(this.widget);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -28,7 +28,6 @@ const _ = Gettext.gettext;
|
||||
|
||||
|
||||
var SchedulePreferences = class {
|
||||
|
||||
constructor(settings) {
|
||||
this._builder = new Gtk.Builder();
|
||||
this._builder.add_from_file(GLib.build_filenamev([Me.path, 'preferences', 'ui', 'schedule.ui']));
|
||||
@@ -242,5 +241,4 @@ var SchedulePreferences = class {
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -28,7 +28,6 @@ const _ = Gettext.gettext;
|
||||
|
||||
|
||||
var ShellThemePreferences = class {
|
||||
|
||||
constructor(settings) {
|
||||
this._builder = new Gtk.Builder();
|
||||
this._builder.add_from_file(GLib.build_filenamev([Me.path, 'preferences', 'ui', 'shell_theme.ui']));
|
||||
@@ -94,5 +93,4 @@ var ShellThemePreferences = class {
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -27,12 +27,18 @@ const { compat, utils } = Me.imports;
|
||||
const { Preferences } = Me.imports.preferences.Preferences;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the preferences.
|
||||
*/
|
||||
function init() {
|
||||
compat.initTranslations(Me.metadata.uuid);
|
||||
const iconTheme = Gtk.IconTheme.get_default();
|
||||
iconTheme.append_search_path(GLib.build_filenamev([Me.path, 'icons']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the preferences widget.
|
||||
*/
|
||||
function buildPrefsWidget() {
|
||||
const preferences = new Preferences();
|
||||
GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
|
||||
|
||||
@@ -26,7 +26,6 @@ const { logDebug, getSettingsSchema } = Me.imports.utils;
|
||||
|
||||
|
||||
var BackgroundsSettings = class {
|
||||
|
||||
constructor() {
|
||||
logDebug('Initializing backgrounds settings...');
|
||||
this.settings = compat.getSettings(getSettingsSchema('backgrounds'));
|
||||
@@ -94,6 +93,5 @@ var BackgroundsSettings = class {
|
||||
this.emit('background-changed', 'night');
|
||||
this.emit('night-changed');
|
||||
}
|
||||
|
||||
};
|
||||
Signals.addSignalMethods(BackgroundsSettings.prototype);
|
||||
|
||||
@@ -26,7 +26,6 @@ const { logDebug, getSettingsSchema } = Me.imports.utils;
|
||||
|
||||
|
||||
var CommandsSettings = class {
|
||||
|
||||
constructor() {
|
||||
logDebug('Initializing commands settings...');
|
||||
this.settings = compat.getSettings(getSettingsSchema('commands'));
|
||||
@@ -94,6 +93,5 @@ var CommandsSettings = class {
|
||||
this.emit('command-changed', 'sunset');
|
||||
this.emit('sunset-changed');
|
||||
}
|
||||
|
||||
};
|
||||
Signals.addSignalMethods(CommandsSettings.prototype);
|
||||
|
||||
@@ -26,7 +26,6 @@ const { logDebug, getSettingsSchema } = Me.imports.utils;
|
||||
|
||||
|
||||
var CursorVariantsSettings = class {
|
||||
|
||||
constructor() {
|
||||
logDebug('Initializing cursor variants settings...');
|
||||
this.settings = compat.getSettings(getSettingsSchema('cursor-variants'));
|
||||
@@ -96,6 +95,5 @@ var CursorVariantsSettings = class {
|
||||
logDebug(`Cursor night variant has changed to '${this.night}'.`);
|
||||
this.emit('variant-changed', 'night');
|
||||
}
|
||||
|
||||
};
|
||||
Signals.addSignalMethods(CursorVariantsSettings.prototype);
|
||||
|
||||
@@ -26,7 +26,6 @@ const { logDebug, getSettingsSchema } = Me.imports.utils;
|
||||
|
||||
|
||||
var GtkVariantsSettings = class {
|
||||
|
||||
constructor() {
|
||||
logDebug('Initializing GTK variants settings...');
|
||||
this.settings = compat.getSettings(getSettingsSchema('gtk-variants'));
|
||||
@@ -112,6 +111,5 @@ var GtkVariantsSettings = class {
|
||||
logDebug(`Manual GTK variants have been ${this.manual ? 'ena' : 'disa'}bled.`);
|
||||
this.emit('manual-changed', this.manual);
|
||||
}
|
||||
|
||||
};
|
||||
Signals.addSignalMethods(GtkVariantsSettings.prototype);
|
||||
|
||||
@@ -26,7 +26,6 @@ const { logDebug, getSettingsSchema } = Me.imports.utils;
|
||||
|
||||
|
||||
var IconVariantsSettings = class {
|
||||
|
||||
constructor() {
|
||||
logDebug('Initializing icon variants settings...');
|
||||
this.settings = compat.getSettings(getSettingsSchema('icon-variants'));
|
||||
@@ -96,6 +95,5 @@ var IconVariantsSettings = class {
|
||||
logDebug(`Icon night variant has changed to '${this.night}'.`);
|
||||
this.emit('variant-changed', 'night');
|
||||
}
|
||||
|
||||
};
|
||||
Signals.addSignalMethods(IconVariantsSettings.prototype);
|
||||
|
||||
@@ -34,7 +34,6 @@ const { TimeSettings } = Me.imports.settings.Time;
|
||||
|
||||
|
||||
var Settings = class {
|
||||
|
||||
constructor() {
|
||||
logDebug('Initializing settings...');
|
||||
this.extension = compat.getExtensionSettings();
|
||||
@@ -91,5 +90,4 @@ var Settings = class {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -26,7 +26,6 @@ const { logDebug, getSettingsSchema } = Me.imports.utils;
|
||||
|
||||
|
||||
var ShellVariantsSettings = class {
|
||||
|
||||
constructor() {
|
||||
logDebug('Initializing shell variants settings...');
|
||||
this.settings = compat.getSettings(getSettingsSchema('shell-variants'));
|
||||
@@ -112,6 +111,5 @@ var ShellVariantsSettings = class {
|
||||
logDebug(`Manual Shell variants have been ${this.manual ? 'ena' : 'disa'}bled.`);
|
||||
this.emit('manual-changed', this.manual);
|
||||
}
|
||||
|
||||
};
|
||||
Signals.addSignalMethods(ShellVariantsSettings.prototype);
|
||||
|
||||
@@ -32,7 +32,6 @@ const { logDebug, getUserthemesExtension, getUserthemesSettings } = Me.imports.u
|
||||
* changes.
|
||||
*/
|
||||
var SystemSettings = class {
|
||||
|
||||
constructor() {
|
||||
logDebug('Initializing system settings...');
|
||||
this.colorSettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.color' });
|
||||
@@ -172,6 +171,5 @@ var SystemSettings = class {
|
||||
logDebug(`Background has changed to '${this.background}'.`);
|
||||
this.emit('background-changed', this.background);
|
||||
}
|
||||
|
||||
};
|
||||
Signals.addSignalMethods(SystemSettings.prototype);
|
||||
|
||||
@@ -26,7 +26,6 @@ const { logDebug, getSettingsSchema } = Me.imports.utils;
|
||||
|
||||
|
||||
var TimeSettings = class {
|
||||
|
||||
constructor() {
|
||||
logDebug('Initializing time settings...');
|
||||
this.settings = compat.getSettings(getSettingsSchema('time'));
|
||||
@@ -173,7 +172,5 @@ var TimeSettings = class {
|
||||
logDebug(`On-demand button placement has changed to ${this.ondemandButtonPlacement}`);
|
||||
this.emit('ondemand-button-placement-changed', this.ondemandButtonPlacement);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
Signals.addSignalMethods(TimeSettings.prototype);
|
||||
|
||||
@@ -24,6 +24,11 @@ const compat = Me.imports.compat;
|
||||
|
||||
const { getSettingsSchema } = Me.imports.utils;
|
||||
|
||||
/**
|
||||
* Migrate settings from v0 to v1.
|
||||
*
|
||||
* @param {Settings} settings The current settings.
|
||||
*/
|
||||
function migrate(settings) {
|
||||
const oldSettings = compat.getSettings(getSettingsSchema('v0'));
|
||||
|
||||
|
||||
+18
-1
@@ -29,6 +29,7 @@ const _ = Gettext.gettext;
|
||||
|
||||
/**
|
||||
* Output a debug message to the console if the debug config is active.
|
||||
*
|
||||
* @param {string} message The message to log.
|
||||
*/
|
||||
function logDebug(message) {
|
||||
@@ -38,6 +39,7 @@ function logDebug(message) {
|
||||
|
||||
/**
|
||||
* Log an error and show a notification if it has a message.
|
||||
*
|
||||
* @param {Error} error The error to log.
|
||||
*/
|
||||
function notifyError(error) {
|
||||
@@ -49,6 +51,7 @@ function notifyError(error) {
|
||||
|
||||
/**
|
||||
* Build the full settings schema from a subschema.
|
||||
*
|
||||
* @param {string} subSchema The subschema to get.
|
||||
* @returns {string} The full schema.
|
||||
*/
|
||||
@@ -58,6 +61,7 @@ function getSettingsSchema(subSchema) {
|
||||
|
||||
/**
|
||||
* Get all the directories of the system for a resource.
|
||||
*
|
||||
* @param {string} resource The resource to get the directories.
|
||||
* @returns {string[]} An array of paths.
|
||||
*/
|
||||
@@ -71,6 +75,7 @@ function getResourcesDirsPaths(resource) {
|
||||
|
||||
/**
|
||||
* Get all the resources installed on the system.
|
||||
*
|
||||
* @param {string} type The resources to get.
|
||||
* @returns {Set} A set of installed resources.
|
||||
*/
|
||||
@@ -101,6 +106,7 @@ function getInstalledResources(type) {
|
||||
|
||||
/**
|
||||
* Get all the installed GTK themes on the system.
|
||||
*
|
||||
* @returns {Set<string>} A set containing all the installed GTK themes names.
|
||||
*/
|
||||
function getInstalledGtkThemes() {
|
||||
@@ -120,6 +126,7 @@ function getInstalledGtkThemes() {
|
||||
|
||||
/**
|
||||
* Get all the installed shell themes on the system.
|
||||
*
|
||||
* @returns {Set<string>} A set containing all the installed shell themes names.
|
||||
*/
|
||||
function getInstalledShellThemes() {
|
||||
@@ -134,6 +141,7 @@ function getInstalledShellThemes() {
|
||||
|
||||
/**
|
||||
* Get all the installed icon themes on the system.
|
||||
*
|
||||
* @returns {Set<string>} A set containing all the installed icon themes names.
|
||||
*/
|
||||
function getInstalledIconThemes() {
|
||||
@@ -149,6 +157,7 @@ function getInstalledIconThemes() {
|
||||
|
||||
/**
|
||||
* Get all the installed cursor themes on the system.
|
||||
*
|
||||
* @returns {Set<string>} A set containing all the installed cursor themes names.
|
||||
*/
|
||||
function getInstalledCursorThemes() {
|
||||
@@ -163,7 +172,8 @@ function getInstalledCursorThemes() {
|
||||
|
||||
/**
|
||||
* Get the User Themes extension.
|
||||
* @returns {Object|undefined} The User Themes extension object or undefined if
|
||||
*
|
||||
* @returns {object|undefined} The User Themes extension object or undefined if
|
||||
* it isn't installed.
|
||||
*/
|
||||
function getUserthemesExtension() {
|
||||
@@ -172,6 +182,7 @@ function getUserthemesExtension() {
|
||||
|
||||
/**
|
||||
* Get the User Themes extension settings.
|
||||
*
|
||||
* @returns {Gio.Settings|null} The User Themes extension settings or null if
|
||||
* the extension isn't installed.
|
||||
*/
|
||||
@@ -192,6 +203,7 @@ function getUserthemesSettings() {
|
||||
|
||||
/**
|
||||
* Get the shell theme stylesheet.
|
||||
*
|
||||
* @param {string} theme The shell theme name.
|
||||
* @returns {string|null} Path to the shell theme stylesheet.
|
||||
*/
|
||||
@@ -211,6 +223,7 @@ function getShellThemeStylesheet(theme) {
|
||||
|
||||
/**
|
||||
* Apply a stylesheet to the shell.
|
||||
*
|
||||
* @param {string} stylesheet The shell stylesheet to apply.
|
||||
*/
|
||||
function applyShellStylesheet(stylesheet) {
|
||||
@@ -222,6 +235,7 @@ function applyShellStylesheet(stylesheet) {
|
||||
|
||||
/**
|
||||
* Check if the given keyval is forbidden.
|
||||
*
|
||||
* @param {number} keyval The keyval number.
|
||||
* @returns {boolean} `true` if the keyval is forbidden.
|
||||
*/
|
||||
@@ -245,6 +259,7 @@ function isKeyvalForbidden(keyval) {
|
||||
|
||||
/**
|
||||
* Check if the given key combo is a valid binding
|
||||
*
|
||||
* @param {{mask: number, keycode: number, keyval:number}} combo An object
|
||||
* representing the key combo.
|
||||
* @returns {boolean} `true` if the key combo is a valid binding.
|
||||
@@ -272,6 +287,7 @@ function isBindingValid({ mask, keycode, keyval }) {
|
||||
|
||||
/**
|
||||
* Check if the given key combo is a valid accelerator.
|
||||
*
|
||||
* @param {{mask: number, keyval:number}} combo An object representing the key
|
||||
* combo.
|
||||
* @returns {boolean} `true` if the key combo is a valid accelerator.
|
||||
@@ -282,6 +298,7 @@ function isAccelValid({ mask, keyval }) {
|
||||
|
||||
/**
|
||||
* Find the position of a menu item in the Shell aggregate menu.
|
||||
*
|
||||
* @param {*} menuItem The desired menu item.
|
||||
* @returns {number} The position of the menu item, `-1` if not found.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user