cleanup: Use spaces for indentation
Our indentation style has always mandated spaces, but over the years some tabs sneaked in. Fix up those places. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
This commit is contained in:
parent
6f8dd065a4
commit
5ec4c2e43e
@ -37,8 +37,8 @@ var ComponentManager = class {
|
|||||||
if (component)
|
if (component)
|
||||||
return component;
|
return component;
|
||||||
|
|
||||||
if (Main.sessionMode.isLocked)
|
if (Main.sessionMode.isLocked)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
let constructor = this._importComponent(name);
|
let constructor = this._importComponent(name);
|
||||||
component = new constructor();
|
component = new constructor();
|
||||||
@ -48,7 +48,7 @@ var ComponentManager = class {
|
|||||||
|
|
||||||
_enableComponent(name) {
|
_enableComponent(name) {
|
||||||
let component = this._ensureComponent(name);
|
let component = this._ensureComponent(name);
|
||||||
if (component)
|
if (component)
|
||||||
component.enable();
|
component.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,14 +177,14 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
|
|||||||
let value = secret.value;
|
let value = secret.value;
|
||||||
if (secret.wep_key_type == NM.WepKeyType.KEY) {
|
if (secret.wep_key_type == NM.WepKeyType.KEY) {
|
||||||
if (value.length == 10 || value.length == 26) {
|
if (value.length == 10 || value.length == 26) {
|
||||||
for (let i = 0; i < value.length; i++) {
|
for (let i = 0; i < value.length; i++) {
|
||||||
if (!((value[i] >= 'a' && value[i] <= 'f')
|
if (!((value[i] >= 'a' && value[i] <= 'f')
|
||||||
|| (value[i] >= 'A' && value[i] <= 'F')
|
|| (value[i] >= 'A' && value[i] <= 'F')
|
||||||
|| (value[i] >= '0' && value[i] <= '9')))
|
|| (value[i] >= '0' && value[i] <= '9')))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (value.length == 5 || value.length == 13) {
|
} else if (value.length == 5 || value.length == 13) {
|
||||||
for (let i = 0; i < value.length; i++) {
|
for (let i = 0; i < value.length; i++) {
|
||||||
if (!((value[i] >= 'a' && value[i] <= 'z')
|
if (!((value[i] >= 'a' && value[i] <= 'z')
|
||||||
|| (value[i] >= 'A' && value[i] <= 'Z')))
|
|| (value[i] >= 'A' && value[i] <= 'Z')))
|
||||||
return false;
|
return false;
|
||||||
@ -192,10 +192,10 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (secret.wep_key_type == NM.WepKeyType.PASSPHRASE) {
|
} else if (secret.wep_key_type == NM.WepKeyType.PASSPHRASE) {
|
||||||
if (value.length < 0 || value.length > 64)
|
if (value.length < 0 || value.length > 64)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ var FocusCaretTracker = class FocusCaretTracker {
|
|||||||
this._atspiInited = true;
|
this._atspiInited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._atspiInited;
|
return this._atspiInited;
|
||||||
}
|
}
|
||||||
|
|
||||||
registerFocusListener() {
|
registerFocusListener() {
|
||||||
|
@ -358,7 +358,7 @@ var PadDiagram = GObject.registerClass({
|
|||||||
for (let i = 0; i < this._activeButtons.length; i++) {
|
for (let i = 0; i < this._activeButtons.length; i++) {
|
||||||
let ch = String.fromCharCode('A'.charCodeAt() + this._activeButtons[i]);
|
let ch = String.fromCharCode('A'.charCodeAt() + this._activeButtons[i]);
|
||||||
css += ('.' + ch + ' { ' +
|
css += ('.' + ch + ' { ' +
|
||||||
' stroke: ' + ACTIVE_COLOR + ' !important; ' +
|
' stroke: ' + ACTIVE_COLOR + ' !important; ' +
|
||||||
' fill: ' + ACTIVE_COLOR + ' !important; ' +
|
' fill: ' + ACTIVE_COLOR + ' !important; ' +
|
||||||
'} ');
|
'} ');
|
||||||
}
|
}
|
||||||
|
@ -763,15 +763,15 @@ var ScreenShield = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_onDragMotion() {
|
_onDragMotion() {
|
||||||
let [origX, origY] = this._dragAction.get_press_coords(0);
|
let [origX, origY] = this._dragAction.get_press_coords(0);
|
||||||
let [currentX, currentY] = this._dragAction.get_motion_coords(0);
|
let [currentX, currentY] = this._dragAction.get_motion_coords(0);
|
||||||
|
|
||||||
let newY = currentY - origY;
|
let newY = currentY - origY;
|
||||||
newY = clamp(newY, -global.stage.height, 0);
|
newY = clamp(newY, -global.stage.height, 0);
|
||||||
|
|
||||||
this._lockScreenGroup.y = newY;
|
this._lockScreenGroup.y = newY;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_onDragEnd(action, actor, eventX, eventY, modifiers) {
|
_onDragEnd(action, actor, eventX, eventY, modifiers) {
|
||||||
@ -779,7 +779,7 @@ var ScreenShield = class {
|
|||||||
return;
|
return;
|
||||||
if (this._lockScreenGroup.y < -(ARROW_DRAG_THRESHOLD * global.stage.height)) {
|
if (this._lockScreenGroup.y < -(ARROW_DRAG_THRESHOLD * global.stage.height)) {
|
||||||
// Complete motion automatically
|
// Complete motion automatically
|
||||||
let [velocity, velocityX, velocityY] = this._dragAction.get_velocity(0);
|
let [velocity, velocityX, velocityY] = this._dragAction.get_velocity(0);
|
||||||
this._liftShield(true, -velocityY);
|
this._liftShield(true, -velocityY);
|
||||||
} else {
|
} else {
|
||||||
// restore the lock screen to its original place
|
// restore the lock screen to its original place
|
||||||
|
@ -943,14 +943,14 @@ class NMWirelessDialog extends ModalDialog.ModalDialog {
|
|||||||
if (rsnFlags != NM80211ApSecurityFlags.NONE) {
|
if (rsnFlags != NM80211ApSecurityFlags.NONE) {
|
||||||
/* RSN check first so that WPA+WPA2 APs are treated as RSN/WPA2 */
|
/* RSN check first so that WPA+WPA2 APs are treated as RSN/WPA2 */
|
||||||
if (rsnFlags & NM80211ApSecurityFlags.KEY_MGMT_802_1X)
|
if (rsnFlags & NM80211ApSecurityFlags.KEY_MGMT_802_1X)
|
||||||
type = NMAccessPointSecurity.WPA2_ENT;
|
type = NMAccessPointSecurity.WPA2_ENT;
|
||||||
else if (rsnFlags & NM80211ApSecurityFlags.KEY_MGMT_PSK)
|
else if (rsnFlags & NM80211ApSecurityFlags.KEY_MGMT_PSK)
|
||||||
type = NMAccessPointSecurity.WPA2_PSK;
|
type = NMAccessPointSecurity.WPA2_PSK;
|
||||||
} else if (wpaFlags != NM80211ApSecurityFlags.NONE) {
|
} else if (wpaFlags != NM80211ApSecurityFlags.NONE) {
|
||||||
if (wpaFlags & NM80211ApSecurityFlags.KEY_MGMT_802_1X)
|
if (wpaFlags & NM80211ApSecurityFlags.KEY_MGMT_802_1X)
|
||||||
type = NMAccessPointSecurity.WPA_ENT;
|
type = NMAccessPointSecurity.WPA_ENT;
|
||||||
else if (wpaFlags & NM80211ApSecurityFlags.KEY_MGMT_PSK)
|
else if (wpaFlags & NM80211ApSecurityFlags.KEY_MGMT_PSK)
|
||||||
type = NMAccessPointSecurity.WPA_PSK;
|
type = NMAccessPointSecurity.WPA_PSK;
|
||||||
} else {
|
} else {
|
||||||
if (flags & NM80211ApFlags.PRIVACY)
|
if (flags & NM80211ApFlags.PRIVACY)
|
||||||
type = NMAccessPointSecurity.WEP;
|
type = NMAccessPointSecurity.WEP;
|
||||||
|
@ -50,7 +50,7 @@ const BOLT_DBUS_PATH = '/org/freedesktop/bolt';
|
|||||||
|
|
||||||
var Client = class {
|
var Client = class {
|
||||||
constructor() {
|
constructor() {
|
||||||
this._proxy = null;
|
this._proxy = null;
|
||||||
let nodeInfo = Gio.DBusNodeInfo.new_for_xml(BoltClientInterface);
|
let nodeInfo = Gio.DBusNodeInfo.new_for_xml(BoltClientInterface);
|
||||||
Gio.DBusProxy.new(Gio.DBus.system,
|
Gio.DBusProxy.new(Gio.DBus.system,
|
||||||
Gio.DBusProxyFlags.DO_NOT_AUTO_START,
|
Gio.DBusProxyFlags.DO_NOT_AUTO_START,
|
||||||
@ -61,40 +61,40 @@ var Client = class {
|
|||||||
null,
|
null,
|
||||||
this._onProxyReady.bind(this));
|
this._onProxyReady.bind(this));
|
||||||
|
|
||||||
this.probing = false;
|
this.probing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_onProxyReady(o, res) {
|
_onProxyReady(o, res) {
|
||||||
try {
|
try {
|
||||||
this._proxy = Gio.DBusProxy.new_finish(res);
|
this._proxy = Gio.DBusProxy.new_finish(res);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log('error creating bolt proxy: %s'.format(e.message));
|
log('error creating bolt proxy: %s'.format(e.message));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._propsChangedId = this._proxy.connect('g-properties-changed', this._onPropertiesChanged.bind(this));
|
this._propsChangedId = this._proxy.connect('g-properties-changed', this._onPropertiesChanged.bind(this));
|
||||||
this._deviceAddedId = this._proxy.connectSignal('DeviceAdded', this._onDeviceAdded.bind(this));
|
this._deviceAddedId = this._proxy.connectSignal('DeviceAdded', this._onDeviceAdded.bind(this));
|
||||||
|
|
||||||
this.probing = this._proxy.Probing;
|
this.probing = this._proxy.Probing;
|
||||||
if (this.probing)
|
if (this.probing)
|
||||||
this.emit('probing-changed', this.probing);
|
this.emit('probing-changed', this.probing);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_onPropertiesChanged(proxy, properties) {
|
_onPropertiesChanged(proxy, properties) {
|
||||||
let unpacked = properties.deep_unpack();
|
let unpacked = properties.deep_unpack();
|
||||||
if (!('Probing' in unpacked))
|
if (!('Probing' in unpacked))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.probing = this._proxy.Probing;
|
this.probing = this._proxy.Probing;
|
||||||
this.emit('probing-changed', this.probing);
|
this.emit('probing-changed', this.probing);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onDeviceAdded(proxy, emitter, params) {
|
_onDeviceAdded(proxy, emitter, params) {
|
||||||
let [path] = params;
|
let [path] = params;
|
||||||
let device = new BoltDeviceProxy(Gio.DBus.system,
|
let device = new BoltDeviceProxy(Gio.DBus.system,
|
||||||
BOLT_DBUS_NAME,
|
BOLT_DBUS_NAME,
|
||||||
path);
|
path);
|
||||||
this.emit('device-added', device);
|
this.emit('device-added', device);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public methods */
|
/* public methods */
|
||||||
@ -102,26 +102,26 @@ var Client = class {
|
|||||||
if (!this._proxy)
|
if (!this._proxy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._proxy.disconnectSignal(this._deviceAddedId);
|
this._proxy.disconnectSignal(this._deviceAddedId);
|
||||||
this._proxy.disconnect(this._propsChangedId);
|
this._proxy.disconnect(this._propsChangedId);
|
||||||
this._proxy = null;
|
this._proxy = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
enrollDevice(id, policy, callback) {
|
enrollDevice(id, policy, callback) {
|
||||||
this._proxy.EnrollDeviceRemote(id, policy, AuthCtrl.NONE,
|
this._proxy.EnrollDeviceRemote(id, policy, AuthCtrl.NONE,
|
||||||
(res, error) => {
|
(res, error) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
Gio.DBusError.strip_remote_error(error);
|
Gio.DBusError.strip_remote_error(error);
|
||||||
callback(null, error);
|
callback(null, error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let [path] = res;
|
let [path] = res;
|
||||||
let device = new BoltDeviceProxy(Gio.DBus.system,
|
let device = new BoltDeviceProxy(Gio.DBus.system,
|
||||||
BOLT_DBUS_NAME,
|
BOLT_DBUS_NAME,
|
||||||
path);
|
path);
|
||||||
callback(device, null);
|
callback(device, null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get authMode () {
|
get authMode () {
|
||||||
@ -133,17 +133,17 @@ Signals.addSignalMethods(Client.prototype);
|
|||||||
/* helper class to automatically authorize new devices */
|
/* helper class to automatically authorize new devices */
|
||||||
var AuthRobot = class {
|
var AuthRobot = class {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
this._client = client;
|
this._client = client;
|
||||||
|
|
||||||
this._devicesToEnroll = [];
|
this._devicesToEnroll = [];
|
||||||
this._enrolling = false;
|
this._enrolling = false;
|
||||||
|
|
||||||
this._client.connect('device-added', this._onDeviceAdded.bind(this));
|
this._client.connect('device-added', this._onDeviceAdded.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
this.disconnectAll();
|
this.disconnectAll();
|
||||||
this._client = null;
|
this._client = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the "device-added" signal will be emitted by boltd for every
|
/* the "device-added" signal will be emitted by boltd for every
|
||||||
@ -151,8 +151,8 @@ var AuthRobot = class {
|
|||||||
* only interested in those devices, because all known devices
|
* only interested in those devices, because all known devices
|
||||||
* will be handled by the user himself */
|
* will be handled by the user himself */
|
||||||
_onDeviceAdded(cli, dev) {
|
_onDeviceAdded(cli, dev) {
|
||||||
if (dev.Status !== Status.CONNECTED)
|
if (dev.Status !== Status.CONNECTED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* check if authorization is enabled in the daemon. if not
|
/* check if authorization is enabled in the daemon. if not
|
||||||
* we won't even bother authorizing, because we will only
|
* we won't even bother authorizing, because we will only
|
||||||
@ -162,16 +162,16 @@ var AuthRobot = class {
|
|||||||
if (!cli.authMode.split('|').includes(AuthMode.ENABLED))
|
if (!cli.authMode.split('|').includes(AuthMode.ENABLED))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* check if we should enroll the device */
|
/* check if we should enroll the device */
|
||||||
let res = [false];
|
let res = [false];
|
||||||
this.emit('enroll-device', dev, res);
|
this.emit('enroll-device', dev, res);
|
||||||
if (res[0] !== true)
|
if (res[0] !== true)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* ok, we should authorize the device, add it to the back
|
/* ok, we should authorize the device, add it to the back
|
||||||
* of the list */
|
* of the list */
|
||||||
this._devicesToEnroll.push(dev);
|
this._devicesToEnroll.push(dev);
|
||||||
this._enrollDevices();
|
this._enrollDevices();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The enrollment queue:
|
/* The enrollment queue:
|
||||||
@ -181,40 +181,40 @@ var AuthRobot = class {
|
|||||||
* enrolled.
|
* enrolled.
|
||||||
*/
|
*/
|
||||||
_enrollDevices() {
|
_enrollDevices() {
|
||||||
if (this._enrolling)
|
if (this._enrolling)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._enrolling = true;
|
this._enrolling = true;
|
||||||
GLib.idle_add(GLib.PRIORITY_DEFAULT,
|
GLib.idle_add(GLib.PRIORITY_DEFAULT,
|
||||||
this._enrollDevicesIdle.bind(this));
|
this._enrollDevicesIdle.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
_onEnrollDone(device, error) {
|
_onEnrollDone(device, error) {
|
||||||
if (error)
|
if (error)
|
||||||
this.emit('enroll-failed', device, error);
|
this.emit('enroll-failed', device, error);
|
||||||
|
|
||||||
/* TODO: scan the list of devices to be authorized for children
|
/* TODO: scan the list of devices to be authorized for children
|
||||||
* of this device and remove them (and their children and
|
* of this device and remove them (and their children and
|
||||||
* their children and ....) from the device queue
|
* their children and ....) from the device queue
|
||||||
*/
|
*/
|
||||||
this._enrolling = this._devicesToEnroll.length > 0;
|
this._enrolling = this._devicesToEnroll.length > 0;
|
||||||
|
|
||||||
if (this._enrolling)
|
if (this._enrolling)
|
||||||
GLib.idle_add(GLib.PRIORITY_DEFAULT,
|
GLib.idle_add(GLib.PRIORITY_DEFAULT,
|
||||||
this._enrollDevicesIdle.bind(this));
|
this._enrollDevicesIdle.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
_enrollDevicesIdle() {
|
_enrollDevicesIdle() {
|
||||||
let devices = this._devicesToEnroll;
|
let devices = this._devicesToEnroll;
|
||||||
|
|
||||||
let dev = devices.shift();
|
let dev = devices.shift();
|
||||||
if (dev === undefined)
|
if (dev === undefined)
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
|
|
||||||
this._client.enrollDevice(dev.Uid,
|
this._client.enrollDevice(dev.Uid,
|
||||||
Policy.DEFAULT,
|
Policy.DEFAULT,
|
||||||
this._onEnrollDone.bind(this));
|
this._onEnrollDone.bind(this));
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Signals.addSignalMethods(AuthRobot.prototype);
|
Signals.addSignalMethods(AuthRobot.prototype);
|
||||||
@ -225,21 +225,21 @@ var Indicator = class extends PanelMenu.SystemIndicator {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this._indicator = this._addIndicator();
|
this._indicator = this._addIndicator();
|
||||||
this._indicator.icon_name = 'thunderbolt-symbolic';
|
this._indicator.icon_name = 'thunderbolt-symbolic';
|
||||||
|
|
||||||
this._client = new Client();
|
this._client = new Client();
|
||||||
this._client.connect('probing-changed', this._onProbing.bind(this));
|
this._client.connect('probing-changed', this._onProbing.bind(this));
|
||||||
|
|
||||||
this._robot = new AuthRobot(this._client);
|
this._robot = new AuthRobot(this._client);
|
||||||
|
|
||||||
this._robot.connect('enroll-device', this._onEnrollDevice.bind(this));
|
this._robot.connect('enroll-device', this._onEnrollDevice.bind(this));
|
||||||
this._robot.connect('enroll-failed', this._onEnrollFailed.bind(this));
|
this._robot.connect('enroll-failed', this._onEnrollFailed.bind(this));
|
||||||
|
|
||||||
Main.sessionMode.connect('updated', this._sync.bind(this));
|
Main.sessionMode.connect('updated', this._sync.bind(this));
|
||||||
this._sync();
|
this._sync();
|
||||||
|
|
||||||
this._source = null;
|
this._source = null;
|
||||||
this._perm = null;
|
this._perm = null;
|
||||||
|
|
||||||
Polkit.Permission.new('org.freedesktop.bolt.enroll', null, null, (source, res) => {
|
Polkit.Permission.new('org.freedesktop.bolt.enroll', null, null, (source, res) => {
|
||||||
@ -253,7 +253,7 @@ var Indicator = class extends PanelMenu.SystemIndicator {
|
|||||||
|
|
||||||
_onDestroy() {
|
_onDestroy() {
|
||||||
this._robot.close();
|
this._robot.close();
|
||||||
this._client.close();
|
this._client.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
_ensureSource() {
|
_ensureSource() {
|
||||||
@ -274,8 +274,8 @@ var Indicator = class extends PanelMenu.SystemIndicator {
|
|||||||
|
|
||||||
let source = this._ensureSource();
|
let source = this._ensureSource();
|
||||||
|
|
||||||
this._notification = new MessageTray.Notification(source, title, body);
|
this._notification = new MessageTray.Notification(source, title, body);
|
||||||
this._notification.setUrgency(MessageTray.Urgency.HIGH);
|
this._notification.setUrgency(MessageTray.Urgency.HIGH);
|
||||||
this._notification.connect('destroy', () => {
|
this._notification.connect('destroy', () => {
|
||||||
this._notification = null;
|
this._notification = null;
|
||||||
});
|
});
|
||||||
@ -290,15 +290,15 @@ var Indicator = class extends PanelMenu.SystemIndicator {
|
|||||||
/* Session callbacks */
|
/* Session callbacks */
|
||||||
_sync() {
|
_sync() {
|
||||||
let active = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
let active = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
||||||
this._indicator.visible = active && this._client.probing;
|
this._indicator.visible = active && this._client.probing;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bolt.Client callbacks */
|
/* Bolt.Client callbacks */
|
||||||
_onProbing(cli, probing) {
|
_onProbing(cli, probing) {
|
||||||
if (probing)
|
if (probing)
|
||||||
this._indicator.icon_name = 'thunderbolt-acquiring-symbolic';
|
this._indicator.icon_name = 'thunderbolt-acquiring-symbolic';
|
||||||
else
|
else
|
||||||
this._indicator.icon_name = 'thunderbolt-symbolic';
|
this._indicator.icon_name = 'thunderbolt-symbolic';
|
||||||
|
|
||||||
this._sync();
|
this._sync();
|
||||||
}
|
}
|
||||||
@ -306,32 +306,32 @@ var Indicator = class extends PanelMenu.SystemIndicator {
|
|||||||
/* AuthRobot callbacks */
|
/* AuthRobot callbacks */
|
||||||
_onEnrollDevice(obj, device, policy) {
|
_onEnrollDevice(obj, device, policy) {
|
||||||
/* only authorize new devices when in an unlocked user session */
|
/* only authorize new devices when in an unlocked user session */
|
||||||
let unlocked = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
let unlocked = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
||||||
/* and if we have the permission to do so, otherwise we trigger a PolKit dialog */
|
/* and if we have the permission to do so, otherwise we trigger a PolKit dialog */
|
||||||
let allowed = this._perm && this._perm.allowed;
|
let allowed = this._perm && this._perm.allowed;
|
||||||
|
|
||||||
let auth = unlocked && allowed;
|
let auth = unlocked && allowed;
|
||||||
policy[0] = auth;
|
policy[0] = auth;
|
||||||
|
|
||||||
log(`thunderbolt: [${device.Name}] auto enrollment: ${auth ? 'yes' : 'no'} (allowed: ${allowed ? 'yes' : 'no'})`);
|
log(`thunderbolt: [${device.Name}] auto enrollment: ${auth ? 'yes' : 'no'} (allowed: ${allowed ? 'yes' : 'no'})`);
|
||||||
|
|
||||||
if (auth)
|
if (auth)
|
||||||
return; /* we are done */
|
return; /* we are done */
|
||||||
|
|
||||||
if (!unlocked) {
|
if (!unlocked) {
|
||||||
const title = _("Unknown Thunderbolt device");
|
const title = _("Unknown Thunderbolt device");
|
||||||
const body = _("New device has been detected while you were away. Please disconnect and reconnect the device to start using it.");
|
const body = _("New device has been detected while you were away. Please disconnect and reconnect the device to start using it.");
|
||||||
this._notify(title, body);
|
this._notify(title, body);
|
||||||
} else {
|
} else {
|
||||||
const title = _("Unauthorized Thunderbolt device");
|
const title = _("Unauthorized Thunderbolt device");
|
||||||
const body = _("New device has been detected and needs to be authorized by an administrator.");
|
const body = _("New device has been detected and needs to be authorized by an administrator.");
|
||||||
this._notify(title, body);
|
this._notify(title, body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_onEnrollFailed(obj, device, error) {
|
_onEnrollFailed(obj, device, error) {
|
||||||
const title = _("Thunderbolt authorization error");
|
const title = _("Thunderbolt authorization error");
|
||||||
const body = _("Could not authorize the Thunderbolt device: %s").format(error.message);
|
const body = _("Could not authorize the Thunderbolt device: %s").format(error.message);
|
||||||
this._notify(title, body);
|
this._notify(title, body);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -462,7 +462,7 @@ var TouchpadWorkspaceSwitchAction = class {
|
|||||||
this._dy = 0;
|
this._dy = 0;
|
||||||
this._enabled = true;
|
this._enabled = true;
|
||||||
actor.connect('captured-event', this._handleEvent.bind(this));
|
actor.connect('captured-event', this._handleEvent.bind(this));
|
||||||
this._touchpadSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.peripherals.touchpad' });
|
this._touchpadSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.peripherals.touchpad' });
|
||||||
}
|
}
|
||||||
|
|
||||||
get enabled() {
|
get enabled() {
|
||||||
@ -515,10 +515,10 @@ var TouchpadWorkspaceSwitchAction = class {
|
|||||||
// Scale deltas up a bit to make it feel snappier
|
// Scale deltas up a bit to make it feel snappier
|
||||||
this._dx += dx * 2;
|
this._dx += dx * 2;
|
||||||
if (!(this._touchpadSettings.get_boolean('natural-scroll')))
|
if (!(this._touchpadSettings.get_boolean('natural-scroll')))
|
||||||
this._dy -= dy * 2;
|
this._dy -= dy * 2;
|
||||||
else
|
else
|
||||||
this._dy += dy * 2;
|
this._dy += dy * 2;
|
||||||
|
|
||||||
this.emit('motion', this._dx, this._dy);
|
this.emit('motion', this._dx, this._dy);
|
||||||
} else {
|
} else {
|
||||||
if ((event.get_gesture_phase() == Clutter.TouchpadGesturePhase.END && ! this._checkActivated()) ||
|
if ((event.get_gesture_phase() == Clutter.TouchpadGesturePhase.END && ! this._checkActivated()) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user