cleanup: Use method syntax

Modern javascript has a short-hand for function properties, embrace
it for better readability and to prepare for an eventual port to
ES6 classes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
This commit is contained in:
Florian Müllner 2017-10-31 01:03:21 +01:00 committed by Florian Müllner
parent cff0b81f32
commit 76f09b1e49
116 changed files with 3140 additions and 3140 deletions

View file

@ -41,7 +41,7 @@ var BeginRequestType = {
var AuthPrompt = new Lang.Class({
Name: 'AuthPrompt',
_init: function(gdmClient, mode) {
_init(gdmClient, mode) {
this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
this._gdmClient = gdmClient;
@ -136,12 +136,12 @@ var AuthPrompt = new Lang.Class({
this._defaultButtonWell.add_child(this._spinner.actor);
},
_onDestroy: function() {
_onDestroy() {
this._userVerifier.destroy();
this._userVerifier = null;
},
_initButtons: function() {
_initButtons() {
this.cancelButton = new St.Button({ style_class: 'modal-dialog-button button',
button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE,
reactive: true,
@ -196,7 +196,7 @@ var AuthPrompt = new Lang.Class({
}));
},
_onAskQuestion: function(verifier, serviceName, question, passwordChar) {
_onAskQuestion(verifier, serviceName, question, passwordChar) {
if (this._queryingService)
this.clear();
@ -222,12 +222,12 @@ var AuthPrompt = new Lang.Class({
this.emit('prompted');
},
_onOVirtUserAuthenticated: function() {
_onOVirtUserAuthenticated() {
if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED)
this.reset();
},
_onSmartcardStatusChanged: function() {
_onSmartcardStatusChanged() {
this.smartcardDetected = this._userVerifier.smartcardDetected;
// Most of the time we want to reset if the user inserts or removes
@ -246,12 +246,12 @@ var AuthPrompt = new Lang.Class({
this.reset();
},
_onShowMessage: function(userVerifier, message, type) {
_onShowMessage(userVerifier, message, type) {
this.setMessage(message, type);
this.emit('prompted');
},
_onVerificationFailed: function() {
_onVerificationFailed() {
this._queryingService = null;
this.clear();
@ -260,22 +260,22 @@ var AuthPrompt = new Lang.Class({
this.verificationStatus = AuthPromptStatus.VERIFICATION_FAILED;
},
_onVerificationComplete: function() {
_onVerificationComplete() {
this.setActorInDefaultButtonWell(null);
this.verificationStatus = AuthPromptStatus.VERIFICATION_SUCCEEDED;
this.cancelButton.reactive = false;
},
_onReset: function() {
_onReset() {
this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
this.reset();
},
addActorToDefaultButtonWell: function(actor) {
addActorToDefaultButtonWell(actor) {
this._defaultButtonWell.add_child(actor);
},
setActorInDefaultButtonWell: function(actor, animate) {
setActorInDefaultButtonWell(actor, animate) {
if (!this._defaultButtonWellActor &&
!actor)
return;
@ -312,7 +312,7 @@ var AuthPrompt = new Lang.Class({
delay: DEFAULT_BUTTON_WELL_ANIMATION_DELAY,
transition: 'linear',
onCompleteScope: this,
onComplete: function() {
onComplete() {
if (wasSpinner) {
if (this._spinner)
this._spinner.stop();
@ -339,25 +339,25 @@ var AuthPrompt = new Lang.Class({
this._defaultButtonWellActor = actor;
},
startSpinning: function() {
startSpinning() {
this.setActorInDefaultButtonWell(this._spinner.actor, true);
},
stopSpinning: function() {
stopSpinning() {
this.setActorInDefaultButtonWell(null, false);
},
clear: function() {
clear() {
this._entry.text = '';
this.stopSpinning();
},
setPasswordChar: function(passwordChar) {
setPasswordChar(passwordChar) {
this._entry.clutter_text.set_password_char(passwordChar);
this._entry.menu.isPassword = passwordChar != '';
},
setQuestion: function(question) {
setQuestion(question) {
this._label.set_text(question);
this._label.show();
@ -366,7 +366,7 @@ var AuthPrompt = new Lang.Class({
this._entry.grab_key_focus();
},
getAnswer: function() {
getAnswer() {
let text;
if (this._preemptiveAnswer) {
@ -379,7 +379,7 @@ var AuthPrompt = new Lang.Class({
return text;
},
_fadeOutMessage: function() {
_fadeOutMessage() {
if (this._message.opacity == 0)
return;
Tweener.removeTweens(this._message);
@ -390,7 +390,7 @@ var AuthPrompt = new Lang.Class({
});
},
setMessage: function(message, type) {
setMessage(message, type) {
if (type == GdmUtil.MessageType.ERROR)
this._message.add_style_class_name('login-dialog-message-warning');
else
@ -410,18 +410,18 @@ var AuthPrompt = new Lang.Class({
}
},
_updateNextButtonSensitivity: function(sensitive) {
_updateNextButtonSensitivity(sensitive) {
this.nextButton.reactive = sensitive;
this.nextButton.can_focus = sensitive;
},
updateSensitivity: function(sensitive) {
updateSensitivity(sensitive) {
this._updateNextButtonSensitivity(sensitive && (this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING));
this._entry.reactive = sensitive;
this._entry.clutter_text.editable = sensitive;
},
hide: function() {
hide() {
this.setActorInDefaultButtonWell(null, true);
this.actor.hide();
this._message.opacity = 0;
@ -432,7 +432,7 @@ var AuthPrompt = new Lang.Class({
this._entry.set_text('');
},
setUser: function(user) {
setUser(user) {
let oldChild = this._userWell.get_child();
if (oldChild)
oldChild.destroy();
@ -443,7 +443,7 @@ var AuthPrompt = new Lang.Class({
}
},
reset: function() {
reset() {
let oldStatus = this.verificationStatus;
this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
this.cancelButton.reactive = true;
@ -480,7 +480,7 @@ var AuthPrompt = new Lang.Class({
this.emit('reset', beginRequestType);
},
addCharacter: function(unichar) {
addCharacter(unichar) {
if (!this._entry.visible)
return;
@ -488,7 +488,7 @@ var AuthPrompt = new Lang.Class({
this._entry.clutter_text.insert_unichar(unichar);
},
begin: function(params) {
begin(params) {
params = Params.parse(params, { userName: null,
hold: null });
@ -502,7 +502,7 @@ var AuthPrompt = new Lang.Class({
this.verificationStatus = AuthPromptStatus.VERIFYING;
},
finish: function(onComplete) {
finish(onComplete) {
if (!this._userVerifier.hasPendingMessages) {
this._userVerifier.clear();
onComplete();
@ -517,7 +517,7 @@ var AuthPrompt = new Lang.Class({
}));
},
cancel: function() {
cancel() {
if (this.verificationStatus == AuthPromptStatus.VERIFICATION_SUCCEEDED) {
return;
}

View file

@ -50,7 +50,7 @@ const Signals = imports.signals;
var Task = new Lang.Class({
Name: 'Task',
_init: function(scope, handler) {
_init(scope, handler) {
if (scope)
this.scope = scope;
else
@ -59,7 +59,7 @@ var Task = new Lang.Class({
this.handler = handler;
},
run: function() {
run() {
if (this.handler)
return this.handler.call(this.scope);
@ -72,7 +72,7 @@ var Hold = new Lang.Class({
Name: 'Hold',
Extends: Task,
_init: function() {
_init() {
this.parent(this, function () {
return this;
});
@ -80,13 +80,13 @@ var Hold = new Lang.Class({
this._acquisitions = 1;
},
acquire: function() {
acquire() {
if (this._acquisitions <= 0)
throw new Error("Cannot acquire hold after it's been released");
this._acquisitions++;
},
acquireUntilAfter: function(hold) {
acquireUntilAfter(hold) {
if (!hold.isAcquired())
return;
@ -97,14 +97,14 @@ var Hold = new Lang.Class({
}));
},
release: function() {
release() {
this._acquisitions--;
if (this._acquisitions == 0)
this.emit('release');
},
isAcquired: function() {
isAcquired() {
return this._acquisitions > 0;
}
});
@ -114,7 +114,7 @@ var Batch = new Lang.Class({
Name: 'Batch',
Extends: Task,
_init: function(scope, tasks) {
_init(scope, tasks) {
this.parent();
this.tasks = [];
@ -134,11 +134,11 @@ var Batch = new Lang.Class({
}
},
process: function() {
process() {
throw new Error('Not implemented');
},
runTask: function() {
runTask() {
if (!(this._currentTaskIndex in this.tasks)) {
return null;
}
@ -146,11 +146,11 @@ var Batch = new Lang.Class({
return this.tasks[this._currentTaskIndex].run();
},
_finish: function() {
_finish() {
this.hold.release();
},
nextTask: function() {
nextTask() {
this._currentTaskIndex++;
// if the entire batch of tasks is finished, release
@ -163,7 +163,7 @@ var Batch = new Lang.Class({
this.process();
},
_start: function() {
_start() {
// acquire a hold to get released when the entire
// batch of tasks is finished
this.hold = new Hold();
@ -171,7 +171,7 @@ var Batch = new Lang.Class({
this.process();
},
run: function() {
run() {
this._start();
// hold may be destroyed at this point
@ -179,7 +179,7 @@ var Batch = new Lang.Class({
return this.hold;
},
cancel: function() {
cancel() {
this.tasks = this.tasks.splice(0, this._currentTaskIndex + 1);
}
});
@ -189,7 +189,7 @@ var ConcurrentBatch = new Lang.Class({
Name: 'ConcurrentBatch',
Extends: Batch,
process: function() {
process() {
let hold = this.runTask();
if (hold) {
@ -208,7 +208,7 @@ var ConsecutiveBatch = new Lang.Class({
Name: 'ConsecutiveBatch',
Extends: Batch,
process: function() {
process() {
let hold = this.runTask();
if (hold && hold.isAcquired()) {

View file

@ -54,7 +54,7 @@ const _MAX_BOTTOM_MENU_ITEMS = 5;
var UserListItem = new Lang.Class({
Name: 'UserListItem',
_init: function(user) {
_init(user) {
this.user = user;
this._userChangedId = this.user.connect('changed',
Lang.bind(this, this._onUserChanged));
@ -94,26 +94,26 @@ var UserListItem = new Lang.Class({
this._onUserChanged();
},
_onUserChanged: function() {
_onUserChanged() {
this._updateLoggedIn();
},
_updateLoggedIn: function() {
_updateLoggedIn() {
if (this.user.is_logged_in())
this.actor.add_style_pseudo_class('logged-in');
else
this.actor.remove_style_pseudo_class('logged-in');
},
_onDestroy: function() {
_onDestroy() {
this.user.disconnect(this._userChangedId);
},
_onClicked: function() {
_onClicked() {
this.emit('activate');
},
_setSelected: function(selected) {
_setSelected(selected) {
if (selected) {
this.actor.add_style_pseudo_class('selected');
this.actor.grab_key_focus();
@ -122,7 +122,7 @@ var UserListItem = new Lang.Class({
}
},
showTimedLoginIndicator: function(time) {
showTimedLoginIndicator(time) {
let hold = new Batch.Hold();
this.hideTimedLoginIndicator();
@ -149,7 +149,7 @@ var UserListItem = new Lang.Class({
return hold;
},
hideTimedLoginIndicator: function() {
hideTimedLoginIndicator() {
if (this._timedLoginTimeoutId) {
GLib.source_remove(this._timedLoginTimeoutId);
this._timedLoginTimeoutId = 0;
@ -162,7 +162,7 @@ Signals.addSignalMethods(UserListItem.prototype);
var UserList = new Lang.Class({
Name: 'UserList',
_init: function() {
_init() {
this.actor = new St.ScrollView({ style_class: 'login-dialog-user-list-view'});
this.actor.set_policy(Gtk.PolicyType.NEVER,
Gtk.PolicyType.AUTOMATIC);
@ -177,7 +177,7 @@ var UserList = new Lang.Class({
this.actor.connect('key-focus-in', Lang.bind(this, this._moveFocusToItems));
},
_moveFocusToItems: function() {
_moveFocusToItems() {
let hasItems = Object.keys(this._items).length > 0;
if (!hasItems)
@ -195,11 +195,11 @@ var UserList = new Lang.Class({
}
},
_onItemActivated: function(activatedItem) {
_onItemActivated(activatedItem) {
this.emit('activate', activatedItem);
},
updateStyle: function(isExpanded) {
updateStyle(isExpanded) {
let tasks = [];
if (isExpanded)
@ -213,7 +213,7 @@ var UserList = new Lang.Class({
}
},
scrollToItem: function(item) {
scrollToItem(item) {
let box = item.actor.get_allocation_box();
let adjustment = this.actor.get_vscroll_bar().get_adjustment();
@ -226,7 +226,7 @@ var UserList = new Lang.Class({
transition: 'easeOutQuad' });
},
jumpToItem: function(item) {
jumpToItem(item) {
let box = item.actor.get_allocation_box();
let adjustment = this.actor.get_vscroll_bar().get_adjustment();
@ -236,7 +236,7 @@ var UserList = new Lang.Class({
adjustment.set_value(value);
},
getItemFromUserName: function(userName) {
getItemFromUserName(userName) {
let item = this._items[userName];
if (!item)
@ -245,11 +245,11 @@ var UserList = new Lang.Class({
return item;
},
containsUser: function(user) {
containsUser(user) {
return this._items[user.get_user_name()] != null;
},
addUser: function(user) {
addUser(user) {
if (!user.is_loaded)
return;
@ -286,7 +286,7 @@ var UserList = new Lang.Class({
this.emit('item-added', item);
},
removeUser: function(user) {
removeUser(user) {
if (!user.is_loaded)
return;
@ -304,7 +304,7 @@ var UserList = new Lang.Class({
delete this._items[userName];
},
numItems: function() {
numItems() {
return Object.keys(this._items).length;
}
});
@ -313,7 +313,7 @@ Signals.addSignalMethods(UserList.prototype);
var SessionMenuButton = new Lang.Class({
Name: 'SessionMenuButton',
_init: function() {
_init() {
let gearIcon = new St.Icon({ icon_name: 'emblem-system-symbolic' });
this._button = new St.Button({ style_class: 'login-dialog-session-list-button',
reactive: true,
@ -358,13 +358,13 @@ var SessionMenuButton = new Lang.Class({
this._populate();
},
updateSensitivity: function(sensitive) {
updateSensitivity(sensitive) {
this._button.reactive = sensitive;
this._button.can_focus = sensitive;
this._menu.close(BoxPointer.PopupAnimation.NONE);
},
_updateOrnament: function() {
_updateOrnament() {
let itemIds = Object.keys(this._items);
for (let i = 0; i < itemIds.length; i++) {
if (itemIds[i] == this._activeSessionId)
@ -374,7 +374,7 @@ var SessionMenuButton = new Lang.Class({
}
},
setActiveSession: function(sessionId) {
setActiveSession(sessionId) {
if (sessionId == this._activeSessionId)
return;
@ -382,11 +382,11 @@ var SessionMenuButton = new Lang.Class({
this._updateOrnament();
},
close: function() {
close() {
this._menu.close();
},
_populate: function() {
_populate() {
let ids = Gdm.get_session_ids();
ids.sort();
@ -415,7 +415,7 @@ Signals.addSignalMethods(SessionMenuButton.prototype);
var LoginDialog = new Lang.Class({
Name: 'LoginDialog',
_init: function(parentActor) {
_init(parentActor) {
this.actor = new Shell.GenericContainer({ style_class: 'login-dialog',
visible: false });
this.actor.get_accessible().set_role(Atk.Role.WINDOW);
@ -537,7 +537,7 @@ var LoginDialog = new Lang.Class({
Lang.bind(this, this._updateDisableUserList));
},
_getBannerAllocation: function (dialogBox) {
_getBannerAllocation(dialogBox) {
let actorBox = new Clutter.ActorBox();
let [minWidth, minHeight, natWidth, natHeight] = this._bannerView.get_preferred_size();
@ -551,7 +551,7 @@ var LoginDialog = new Lang.Class({
return actorBox;
},
_getLogoBinAllocation: function (dialogBox) {
_getLogoBinAllocation(dialogBox) {
let actorBox = new Clutter.ActorBox();
let [minWidth, minHeight, natWidth, natHeight] = this._logoBin.get_preferred_size();
@ -565,7 +565,7 @@ var LoginDialog = new Lang.Class({
return actorBox;
},
_getCenterActorAllocation: function (dialogBox, actor) {
_getCenterActorAllocation(dialogBox, actor) {
let actorBox = new Clutter.ActorBox();
let [minWidth, minHeight, natWidth, natHeight] = actor.get_preferred_size();
@ -583,7 +583,7 @@ var LoginDialog = new Lang.Class({
return actorBox;
},
_onAllocate: function (actor, dialogBox, flags) {
_onAllocate(actor, dialogBox, flags) {
let dialogWidth = dialogBox.x2 - dialogBox.x1;
let dialogHeight = dialogBox.y2 - dialogBox.y1;
@ -721,7 +721,7 @@ var LoginDialog = new Lang.Class({
this._logoBin.allocate(logoAllocation, flags);
},
_ensureUserListLoaded: function() {
_ensureUserListLoaded() {
if (!this._userManager.is_loaded) {
this._userManagerLoadedId = this._userManager.connect('notify::is-loaded',
Lang.bind(this, function() {
@ -737,7 +737,7 @@ var LoginDialog = new Lang.Class({
}
},
_updateDisableUserList: function() {
_updateDisableUserList() {
let disableUserList = this._settings.get_boolean(GdmUtil.DISABLE_USER_LIST_KEY);
// Disable user list when there are no users.
@ -752,7 +752,7 @@ var LoginDialog = new Lang.Class({
}
},
_updateCancelButton: function() {
_updateCancelButton() {
let cancelVisible;
// Hide the cancel button if the user list is disabled and we're asking for
@ -765,7 +765,7 @@ var LoginDialog = new Lang.Class({
this._authPrompt.cancelButton.visible = cancelVisible;
},
_updateBanner: function() {
_updateBanner() {
let enabled = this._settings.get_boolean(GdmUtil.BANNER_MESSAGE_KEY);
let text = this._settings.get_string(GdmUtil.BANNER_MESSAGE_TEXT_KEY);
@ -777,7 +777,7 @@ var LoginDialog = new Lang.Class({
}
},
_fadeInBannerView: function() {
_fadeInBannerView() {
this._bannerView.show();
Tweener.addTween(this._bannerView,
{ opacity: 255,
@ -785,13 +785,13 @@ var LoginDialog = new Lang.Class({
transition: 'easeOutQuad' });
},
_hideBannerView: function() {
_hideBannerView() {
Tweener.removeTweens(this._bannerView);
this._bannerView.opacity = 0;
this._bannerView.hide();
},
_updateLogoTexture: function(cache, file) {
_updateLogoTexture(cache, file) {
if (this._logoFile && !this._logoFile.equal(file))
return;
@ -804,14 +804,14 @@ var LoginDialog = new Lang.Class({
}
},
_updateLogo: function() {
_updateLogo() {
let path = this._settings.get_string(GdmUtil.LOGO_KEY);
this._logoFile = path ? Gio.file_new_for_path(path) : null;
this._updateLogoTexture(this._textureCache, this._logoFile);
},
_onPrompted: function() {
_onPrompted() {
if (this._shouldShowSessionMenuButton()) {
this._sessionMenuButton.updateSensitivity(true);
this._authPrompt.setActorInDefaultButtonWell(this._sessionMenuButton.actor);
@ -821,7 +821,7 @@ var LoginDialog = new Lang.Class({
this._showPrompt();
},
_resetGreeterProxy: function() {
_resetGreeterProxy() {
if (GLib.getenv('GDM_GREETER_TEST') != '1') {
if (this._greeter) {
this._greeter.run_dispose();
@ -837,7 +837,7 @@ var LoginDialog = new Lang.Class({
}
},
_onReset: function(authPrompt, beginRequest) {
_onReset(authPrompt, beginRequest) {
this._resetGreeterProxy();
this._sessionMenuButton.updateSensitivity(true);
@ -858,11 +858,11 @@ var LoginDialog = new Lang.Class({
}
},
_onDefaultSessionChanged: function(client, sessionId) {
_onDefaultSessionChanged(client, sessionId) {
this._sessionMenuButton.setActiveSession(sessionId);
},
_shouldShowSessionMenuButton: function() {
_shouldShowSessionMenuButton() {
if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.VERIFYING &&
this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.VERIFICATION_FAILED)
return false;
@ -873,7 +873,7 @@ var LoginDialog = new Lang.Class({
return true;
},
_showPrompt: function() {
_showPrompt() {
if (this._authPrompt.actor.visible)
return;
this._authPrompt.actor.opacity = 0;
@ -885,7 +885,7 @@ var LoginDialog = new Lang.Class({
this._fadeInBannerView();
},
_showRealmLoginHint: function(realmManager, hint) {
_showRealmLoginHint(realmManager, hint) {
if (!hint)
return;
@ -898,7 +898,7 @@ var LoginDialog = new Lang.Class({
this._authPrompt.setMessage(_("(e.g., user or %s)").format(hint), GdmUtil.MessageType.HINT);
},
_askForUsernameAndBeginVerification: function() {
_askForUsernameAndBeginVerification() {
this._authPrompt.setPasswordChar('');
this._authPrompt.setQuestion(_("Username: "));
@ -925,7 +925,7 @@ var LoginDialog = new Lang.Class({
this._showPrompt();
},
_loginScreenSessionActivated: function() {
_loginScreenSessionActivated() {
if (this.actor.opacity == 255 && this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
return;
@ -933,7 +933,7 @@ var LoginDialog = new Lang.Class({
{ opacity: 255,
time: _FADE_ANIMATION_TIME,
transition: 'easeOutQuad',
onUpdate: function() {
onUpdate() {
let children = Main.layoutManager.uiGroup.get_children();
for (let i = 0; i < children.length; i++) {
@ -942,14 +942,14 @@ var LoginDialog = new Lang.Class({
}
},
onUpdateScope: this,
onComplete: function() {
onComplete() {
if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
this._authPrompt.reset();
},
onCompleteScope: this });
},
_gotGreeterSessionProxy: function(proxy) {
_gotGreeterSessionProxy(proxy) {
this._greeterSessionProxy = proxy;
this._greeterSessionProxyChangedId =
proxy.connect('g-properties-changed', Lang.bind(this, function() {
@ -958,12 +958,12 @@ var LoginDialog = new Lang.Class({
}));
},
_startSession: function(serviceName) {
_startSession(serviceName) {
Tweener.addTween(this.actor,
{ opacity: 0,
time: _FADE_ANIMATION_TIME,
transition: 'easeOutQuad',
onUpdate: function() {
onUpdate() {
let children = Main.layoutManager.uiGroup.get_children();
for (let i = 0; i < children.length; i++) {
@ -972,19 +972,19 @@ var LoginDialog = new Lang.Class({
}
},
onUpdateScope: this,
onComplete: function() {
onComplete() {
this._greeter.call_start_session_when_ready_sync(serviceName, true, null);
},
onCompleteScope: this });
},
_onSessionOpened: function(client, serviceName) {
_onSessionOpened(client, serviceName) {
this._authPrompt.finish(Lang.bind(this, function() {
this._startSession(serviceName);
}));
},
_waitForItemForUser: function(userName) {
_waitForItemForUser(userName) {
let item = this._userList.getItemFromUserName(userName);
if (item)
@ -1006,12 +1006,12 @@ var LoginDialog = new Lang.Class({
return hold;
},
_showTimedLoginAnimation: function() {
_showTimedLoginAnimation() {
this._timedLoginItem.actor.grab_key_focus();
return this._timedLoginItem.showTimedLoginIndicator(this._timedLoginAnimationTime);
},
_blockTimedLoginUntilIdle: function() {
_blockTimedLoginUntilIdle() {
// This blocks timed login from starting until a few
// seconds after the user stops interacting with the
// login screen.
@ -1033,7 +1033,7 @@ var LoginDialog = new Lang.Class({
return hold;
},
_startTimedLogin: function(userName, delay) {
_startTimedLogin(userName, delay) {
this._timedLoginItem = null;
this._timedLoginDelay = delay;
this._timedLoginAnimationTime = delay;
@ -1072,7 +1072,7 @@ var LoginDialog = new Lang.Class({
return this._timedLoginBatch.run();
},
_resetTimedLogin: function() {
_resetTimedLogin() {
if (this._timedLoginBatch) {
this._timedLoginBatch.cancel();
this._timedLoginBatch = null;
@ -1087,7 +1087,7 @@ var LoginDialog = new Lang.Class({
this._startTimedLogin(userName, this._timedLoginDelay);
},
_onTimedLoginRequested: function(client, userName, seconds) {
_onTimedLoginRequested(client, userName, seconds) {
this._startTimedLogin(userName, seconds);
global.stage.connect('captured-event',
@ -1110,28 +1110,28 @@ var LoginDialog = new Lang.Class({
}));
},
_setUserListExpanded: function(expanded) {
_setUserListExpanded(expanded) {
this._userList.updateStyle(expanded);
this._userSelectionBox.visible = expanded;
},
_hideUserList: function() {
_hideUserList() {
this._setUserListExpanded(false);
if (this._userSelectionBox.visible)
GdmUtil.cloneAndFadeOutActor(this._userSelectionBox);
},
_hideUserListAskForUsernameAndBeginVerification: function() {
_hideUserListAskForUsernameAndBeginVerification() {
this._hideUserList();
this._askForUsernameAndBeginVerification();
},
_hideUserListAndBeginVerification: function() {
_hideUserListAndBeginVerification() {
this._hideUserList();
this._authPrompt.begin();
},
_showUserList: function() {
_showUserList() {
this._ensureUserListLoaded();
this._authPrompt.hide();
this._hideBannerView();
@ -1141,7 +1141,7 @@ var LoginDialog = new Lang.Class({
this._userList.actor.grab_key_focus();
},
_beginVerificationForItem: function(item) {
_beginVerificationForItem(item) {
this._authPrompt.setUser(item.user);
let userName = item.user.get_user_name();
@ -1152,7 +1152,7 @@ var LoginDialog = new Lang.Class({
return hold;
},
_onUserListActivated: function(activatedItem) {
_onUserListActivated(activatedItem) {
this._user = activatedItem.user;
this._updateCancelButton();
@ -1162,7 +1162,7 @@ var LoginDialog = new Lang.Class({
batch.run();
},
_onDestroy: function() {
_onDestroy() {
if (this._userManagerLoadedId) {
this._userManager.disconnect(this._userManagerLoadedId);
this._userManagerLoadedId = 0;
@ -1203,7 +1203,7 @@ var LoginDialog = new Lang.Class({
}
},
_loadUserList: function() {
_loadUserList() {
if (this._userListLoaded)
return GLib.SOURCE_REMOVE;
@ -1241,7 +1241,7 @@ var LoginDialog = new Lang.Class({
return GLib.SOURCE_REMOVE;
},
open: function() {
open() {
Main.ctrlAltTabManager.addGroup(this.actor,
_("Login Window"),
'dialog-password-symbolic',
@ -1260,20 +1260,20 @@ var LoginDialog = new Lang.Class({
return true;
},
close: function() {
close() {
Main.popModal(this.actor);
Main.ctrlAltTabManager.removeGroup(this.actor);
},
cancel: function() {
cancel() {
this._authPrompt.cancel();
},
addCharacter: function(unichar) {
addCharacter(unichar) {
// Don't allow type ahead at the login screen
},
finish: function(onComplete) {
finish(onComplete) {
this._authPrompt.finish(onComplete);
},
});

View file

@ -29,7 +29,7 @@ function OVirtCredentials() {
var OVirtCredentialsManager = new Lang.Class({
Name: 'OVirtCredentialsManager',
_init: function() {
_init() {
this._token = null;
this._credentials = new OVirtCredentials();
@ -37,20 +37,20 @@ var OVirtCredentialsManager = new Lang.Class({
Lang.bind(this, this._onUserAuthenticated));
},
_onUserAuthenticated: function(proxy, sender, [token]) {
_onUserAuthenticated(proxy, sender, [token]) {
this._token = token;
this.emit('user-authenticated', token);
},
hasToken: function() {
hasToken() {
return this._token != null;
},
getToken: function() {
getToken() {
return this._token;
},
resetToken: function() {
resetToken() {
this._token = null;
}
});

View file

@ -62,7 +62,7 @@ const Realm = Gio.DBusProxy.makeProxyWrapper(RealmIface);
var Manager = new Lang.Class({
Name: 'Manager',
_init: function(parentActor) {
_init(parentActor) {
this._aggregateProvider = Provider(Gio.DBus.system,
'org.freedesktop.realmd',
'/org/freedesktop/realmd',
@ -76,7 +76,7 @@ var Manager = new Lang.Class({
}));
},
_reloadRealms: function() {
_reloadRealms() {
let realmPaths = this._aggregateProvider.Realms;
if (!realmPaths)
@ -90,7 +90,7 @@ var Manager = new Lang.Class({
}
},
_reloadRealm: function(realm) {
_reloadRealm(realm) {
if (!realm.Configured) {
if (this._realms[realm.get_object_path()])
delete this._realms[realm.get_object_path()];
@ -103,7 +103,7 @@ var Manager = new Lang.Class({
this._updateLoginFormat();
},
_onRealmLoaded: function(realm, error) {
_onRealmLoaded(realm, error) {
if (error)
return;
@ -116,7 +116,7 @@ var Manager = new Lang.Class({
}));
},
_updateLoginFormat: function() {
_updateLoginFormat() {
let newLoginFormat;
for (let realmPath in this._realms) {
@ -142,7 +142,7 @@ var Manager = new Lang.Class({
return this._loginFormat;
},
release: function() {
release() {
Service(Gio.DBus.system,
'org.freedesktop.realmd',
'/org/freedesktop/realmd',

View file

@ -60,7 +60,7 @@ function fadeInActor(actor) {
height: naturalHeight,
time: FADE_ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete: function() {
onComplete() {
this.set_height(-1);
hold.release();
},
@ -82,7 +82,7 @@ function fadeOutActor(actor) {
height: 0,
time: FADE_ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete: function() {
onComplete() {
this.hide();
this.set_height(-1);
hold.release();
@ -111,7 +111,7 @@ function cloneAndFadeOutActor(actor) {
{ opacity: 0,
time: CLONE_FADE_ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete: function() {
onComplete() {
clone.destroy();
hold.release();
}
@ -122,7 +122,7 @@ function cloneAndFadeOutActor(actor) {
var ShellUserVerifier = new Lang.Class({
Name: 'ShellUserVerifier',
_init: function(client, params) {
_init(client, params) {
params = Params.parse(params, { reauthenticationOnly: false });
this._reauthOnly = params.reauthenticationOnly;
@ -167,7 +167,7 @@ var ShellUserVerifier = new Lang.Class({
Lang.bind(this, this._oVirtUserAuthenticated));
},
begin: function(userName, hold) {
begin(userName, hold) {
this._cancellable = new Gio.Cancellable();
this._hold = hold;
this._userName = userName;
@ -185,7 +185,7 @@ var ShellUserVerifier = new Lang.Class({
}
},
cancel: function() {
cancel() {
if (this._cancellable)
this._cancellable.cancel();
@ -195,14 +195,14 @@ var ShellUserVerifier = new Lang.Class({
}
},
_clearUserVerifier: function() {
_clearUserVerifier() {
if (this._userVerifier) {
this._userVerifier.run_dispose();
this._userVerifier = null;
}
},
clear: function() {
clear() {
if (this._cancellable) {
this._cancellable.cancel();
this._cancellable = null;
@ -212,7 +212,7 @@ var ShellUserVerifier = new Lang.Class({
this._clearMessageQueue();
},
destroy: function() {
destroy() {
this.clear();
this._settings.run_dispose();
@ -226,7 +226,7 @@ var ShellUserVerifier = new Lang.Class({
this._oVirtCredentialsManager = null;
},
answerQuery: function(serviceName, answer) {
answerQuery(serviceName, answer) {
if (!this.hasPendingMessages) {
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
} else {
@ -238,12 +238,12 @@ var ShellUserVerifier = new Lang.Class({
}
},
_getIntervalForMessage: function(message) {
_getIntervalForMessage(message) {
// We probably could be smarter here
return message.length * USER_READ_TIME;
},
finishMessageQueue: function() {
finishMessageQueue() {
if (!this.hasPendingMessages)
return;
@ -253,7 +253,7 @@ var ShellUserVerifier = new Lang.Class({
this.emit('no-more-messages');
},
_queueMessageTimeout: function() {
_queueMessageTimeout() {
if (this._messageQueue.length == 0) {
this.finishMessageQueue();
return;
@ -276,7 +276,7 @@ var ShellUserVerifier = new Lang.Class({
GLib.Source.set_name_by_id(this._messageQueueTimeoutId, '[gnome-shell] this._queueMessageTimeout');
},
_queueMessage: function(message, messageType) {
_queueMessage(message, messageType) {
let interval = this._getIntervalForMessage(message);
this.hasPendingMessages = true;
@ -284,7 +284,7 @@ var ShellUserVerifier = new Lang.Class({
this._queueMessageTimeout();
},
_clearMessageQueue: function() {
_clearMessageQueue() {
this.finishMessageQueue();
if (this._messageQueueTimeoutId != 0) {
@ -294,7 +294,7 @@ var ShellUserVerifier = new Lang.Class({
this.emit('show-message', null, MessageType.NONE);
},
_checkForFingerprintReader: function() {
_checkForFingerprintReader() {
this._haveFingerprintReader = false;
if (!this._settings.get_boolean(FINGERPRINT_AUTHENTICATION_KEY) ||
@ -312,12 +312,12 @@ var ShellUserVerifier = new Lang.Class({
}));
},
_oVirtUserAuthenticated: function(token) {
_oVirtUserAuthenticated(token) {
this._preemptingService = OVIRT_SERVICE_NAME;
this.emit('ovirt-user-authenticated');
},
_checkForSmartcard: function() {
_checkForSmartcard() {
let smartcardDetected;
if (!this._settings.get_boolean(SMARTCARD_AUTHENTICATION_KEY))
@ -339,7 +339,7 @@ var ShellUserVerifier = new Lang.Class({
}
},
_reportInitError: function(where, error) {
_reportInitError(where, error) {
logError(error, where);
this._hold.release();
@ -347,7 +347,7 @@ var ShellUserVerifier = new Lang.Class({
this._verificationFailed(false);
},
_reauthenticationChannelOpened: function(client, result) {
_reauthenticationChannelOpened(client, result) {
try {
this._clearUserVerifier();
this._userVerifier = client.open_reauthentication_channel_finish(result);
@ -371,7 +371,7 @@ var ShellUserVerifier = new Lang.Class({
this._hold.release();
},
_userVerifierGot: function(client, result) {
_userVerifierGot(client, result) {
try {
this._clearUserVerifier();
this._userVerifier = client.get_user_verifier_finish(result);
@ -387,7 +387,7 @@ var ShellUserVerifier = new Lang.Class({
this._hold.release();
},
_connectSignals: function() {
_connectSignals() {
this._userVerifier.connect('info', Lang.bind(this, this._onInfo));
this._userVerifier.connect('problem', Lang.bind(this, this._onProblem));
this._userVerifier.connect('info-query', Lang.bind(this, this._onInfoQuery));
@ -397,22 +397,22 @@ var ShellUserVerifier = new Lang.Class({
this._userVerifier.connect('verification-complete', Lang.bind(this, this._onVerificationComplete));
},
_getForegroundService: function() {
_getForegroundService() {
if (this._preemptingService)
return this._preemptingService;
return this._defaultService;
},
serviceIsForeground: function(serviceName) {
serviceIsForeground(serviceName) {
return serviceName == this._getForegroundService();
},
serviceIsDefault: function(serviceName) {
serviceIsDefault(serviceName) {
return serviceName == this._defaultService;
},
_updateDefaultService: function() {
_updateDefaultService() {
if (this._settings.get_boolean(PASSWORD_AUTHENTICATION_KEY))
this._defaultService = PASSWORD_SERVICE_NAME;
else if (this._settings.get_boolean(SMARTCARD_AUTHENTICATION_KEY))
@ -426,7 +426,7 @@ var ShellUserVerifier = new Lang.Class({
}
},
_startService: function(serviceName) {
_startService(serviceName) {
this._hold.acquire();
if (this._userName) {
this._userVerifier.call_begin_verification_for_user(serviceName,
@ -462,14 +462,14 @@ var ShellUserVerifier = new Lang.Class({
}
},
_beginVerification: function() {
_beginVerification() {
this._startService(this._getForegroundService());
if (this._userName && this._haveFingerprintReader && !this.serviceIsForeground(FINGERPRINT_SERVICE_NAME))
this._startService(FINGERPRINT_SERVICE_NAME);
},
_onInfo: function(client, serviceName, info) {
_onInfo(client, serviceName, info) {
if (this.serviceIsForeground(serviceName)) {
this._queueMessage(info, MessageType.INFO);
} else if (serviceName == FINGERPRINT_SERVICE_NAME &&
@ -484,21 +484,21 @@ var ShellUserVerifier = new Lang.Class({
}
},
_onProblem: function(client, serviceName, problem) {
_onProblem(client, serviceName, problem) {
if (!this.serviceIsForeground(serviceName))
return;
this._queueMessage(problem, MessageType.ERROR);
},
_onInfoQuery: function(client, serviceName, question) {
_onInfoQuery(client, serviceName, question) {
if (!this.serviceIsForeground(serviceName))
return;
this.emit('ask-question', serviceName, question, '');
},
_onSecretInfoQuery: function(client, serviceName, secretQuestion) {
_onSecretInfoQuery(client, serviceName, secretQuestion) {
if (!this.serviceIsForeground(serviceName))
return;
@ -511,7 +511,7 @@ var ShellUserVerifier = new Lang.Class({
this.emit('ask-question', serviceName, secretQuestion, '\u25cf');
},
_onReset: function() {
_onReset() {
// Clear previous attempts to authenticate
this._failCounter = 0;
this._updateDefaultService();
@ -519,20 +519,20 @@ var ShellUserVerifier = new Lang.Class({
this.emit('reset');
},
_onVerificationComplete: function() {
_onVerificationComplete() {
this.emit('verification-complete');
},
_cancelAndReset: function() {
_cancelAndReset() {
this.cancel();
this._onReset();
},
_retry: function() {
_retry() {
this.begin(this._userName, new Batch.Hold());
},
_verificationFailed: function(retry) {
_verificationFailed(retry) {
// For Not Listed / enterprise logins, immediately reset
// the dialog
// Otherwise, we allow ALLOWED_FAILURES attempts. After that, we
@ -568,7 +568,7 @@ var ShellUserVerifier = new Lang.Class({
this.emit('verification-failed');
},
_onConversationStopped: function(client, serviceName) {
_onConversationStopped(client, serviceName) {
// If the login failed with the preauthenticated oVirt credentials
// then discard the credentials and revert to default authentication
// mechanism.