cleanup: remove controversial naming

Replace "whitelist" and "blacklist" with "allow" and "deny" in variable
naming, which better represents the purpose of those variables.

There is no functional change.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1393
This commit is contained in:
Olivier Fourdan 2020-08-04 10:39:29 +02:00
parent 18155fc6ea
commit 3541a57570
4 changed files with 14 additions and 14 deletions

View File

@ -3,7 +3,7 @@ const { Gio, GLib, Meta, Shell, St } = imports.gi;
const INTROSPECT_SCHEMA = 'org.gnome.shell'; const INTROSPECT_SCHEMA = 'org.gnome.shell';
const INTROSPECT_KEY = 'introspect'; const INTROSPECT_KEY = 'introspect';
const APP_WHITELIST = ['org.freedesktop.impl.portal.desktop.gtk']; const APP_ALLOWLIST = ['org.freedesktop.impl.portal.desktop.gtk'];
const INTROSPECT_DBUS_API_VERSION = 3; const INTROSPECT_DBUS_API_VERSION = 3;
@ -46,13 +46,13 @@ var IntrospectService = class {
this._syncRunningApplications(); this._syncRunningApplications();
this._whitelistMap = new Map(); this._allowlistMap = new Map();
APP_WHITELIST.forEach(appName => { APP_ALLOWLIST.forEach(appName => {
Gio.DBus.watch_name(Gio.BusType.SESSION, Gio.DBus.watch_name(Gio.BusType.SESSION,
appName, appName,
Gio.BusNameWatcherFlags.NONE, Gio.BusNameWatcherFlags.NONE,
(conn, name, owner) => this._whitelistMap.set(name, owner), (conn, name, owner) => this._allowlistMap.set(name, owner),
(conn, name) => this._whitelistMap.delete(name)); (conn, name) => this._allowlistMap.delete(name));
}); });
this._settings = St.Settings.get(); this._settings = St.Settings.get();
@ -74,8 +74,8 @@ var IntrospectService = class {
return this._introspectSettings.get_boolean(INTROSPECT_KEY); return this._introspectSettings.get_boolean(INTROSPECT_KEY);
} }
_isSenderWhitelisted(sender) { _isSenderAllowed(sender) {
return [...this._whitelistMap.values()].includes(sender); return [...this._allowlistMap.values()].includes(sender);
} }
_getSandboxedAppId(app) { _getSandboxedAppId(app) {
@ -138,7 +138,7 @@ var IntrospectService = class {
if (this._isIntrospectEnabled()) if (this._isIntrospectEnabled())
return true; return true;
if (this._isSenderWhitelisted(invocation.get_sender())) if (this._isSenderAllowed(invocation.get_sender()))
return true; return true;
return false; return false;

View File

@ -121,10 +121,10 @@ var ParentalControlsManager = GObject.registerClass({
// Calculate whether the given app (a Gio.DesktopAppInfo) should be shown // Calculate whether the given app (a Gio.DesktopAppInfo) should be shown
// on the desktop, in search results, etc. The app should be shown if: // on the desktop, in search results, etc. The app should be shown if:
// - The .desktop file doesnt say it should be hidden. // - The .desktop file doesnt say it should be hidden.
// - The executable from the .desktop files Exec line isnt blacklisted in // - The executable from the .desktop files Exec line isnt denied in
// the users parental controls. // the users parental controls.
// - None of the flatpak app IDs from the X-Flatpak and the // - None of the flatpak app IDs from the X-Flatpak and the
// X-Flatpak-RenamedFrom lines are blacklisted in the users parental // X-Flatpak-RenamedFrom lines are denied in the users parental
// controls. // controls.
shouldShowApp(appInfo) { shouldShowApp(appInfo) {
// Quick decision? // Quick decision?

View File

@ -7,7 +7,7 @@ const PermissionStore = imports.misc.permissionStore;
const WAYLAND_KEYBINDINGS_SCHEMA = 'org.gnome.mutter.wayland.keybindings'; const WAYLAND_KEYBINDINGS_SCHEMA = 'org.gnome.mutter.wayland.keybindings';
const APP_WHITELIST = ['gnome-control-center.desktop']; const APP_ALLOWLIST = ['gnome-control-center.desktop'];
const APP_PERMISSIONS_TABLE = 'gnome'; const APP_PERMISSIONS_TABLE = 'gnome';
const APP_PERMISSIONS_ID = 'shortcuts-inhibitor'; const APP_PERMISSIONS_ID = 'shortcuts-inhibitor';
const GRANTED = 'GRANTED'; const GRANTED = 'GRANTED';
@ -118,7 +118,7 @@ var InhibitShortcutsDialog = GObject.registerClass({
} }
vfunc_show() { vfunc_show() {
if (this._app && APP_WHITELIST.includes(this._app.get_id())) { if (this._app && APP_ALLOWLIST.includes(this._app.get_id())) {
this._emitResponse(DialogResponse.ALLOW); this._emitResponse(DialogResponse.ALLOW);
return; return;
} }

View File

@ -113,10 +113,10 @@ function _loadMode(file, info) {
} }
_modes[modeName] = {}; _modes[modeName] = {};
let propBlacklist = ['unlockDialog']; const excludedProps = ['unlockDialog'];
for (let prop in _modes[DEFAULT_MODE]) { for (let prop in _modes[DEFAULT_MODE]) {
if (newMode[prop] !== undefined && if (newMode[prop] !== undefined &&
!propBlacklist.includes(prop)) !excludedProps.includes(prop))
_modes[modeName][prop] = newMode[prop]; _modes[modeName][prop] = newMode[prop];
} }
_modes[modeName]['isPrimary'] = true; _modes[modeName]['isPrimary'] = true;