Update eslintrc from GJS, fix errors and missing JSDocs
This commit is contained in:
@@ -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