cleanup: Avoid unnecessary braces
Our coding style has always been to avoid braces when all blocks are single-lines. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
This commit is contained in:
parent
69f63dc94f
commit
67ea424525
@ -78,11 +78,10 @@ var AuthPrompt = GObject.registerClass({
|
||||
this.connect('next', () => {
|
||||
this.updateSensitivity(false);
|
||||
this.startSpinning();
|
||||
if (this._queryingService) {
|
||||
if (this._queryingService)
|
||||
this._userVerifier.answerQuery(this._queryingService, this._entry.text);
|
||||
} else {
|
||||
else
|
||||
this._preemptiveAnswer = this._entry.text;
|
||||
}
|
||||
});
|
||||
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
@ -525,9 +524,9 @@ var AuthPrompt = GObject.registerClass({
|
||||
}
|
||||
|
||||
cancel() {
|
||||
if (this.verificationStatus == AuthPromptStatus.VERIFICATION_SUCCEEDED) {
|
||||
if (this.verificationStatus == AuthPromptStatus.VERIFICATION_SUCCEEDED)
|
||||
return;
|
||||
}
|
||||
|
||||
this.reset();
|
||||
this.emit('cancelled');
|
||||
}
|
||||
|
@ -112,13 +112,12 @@ var Batch = class extends Task {
|
||||
for (let i = 0; i < tasks.length; i++) {
|
||||
let task;
|
||||
|
||||
if (tasks[i] instanceof Task) {
|
||||
if (tasks[i] instanceof Task)
|
||||
task = tasks[i];
|
||||
} else if (typeof tasks[i] == 'function') {
|
||||
else if (typeof tasks[i] == 'function')
|
||||
task = new Task(scope, tasks[i]);
|
||||
} else {
|
||||
else
|
||||
throw new Error('Batch tasks must be functions or Task, Hold or Batch objects');
|
||||
}
|
||||
|
||||
this.tasks.push(task);
|
||||
}
|
||||
@ -129,9 +128,8 @@ var Batch = class extends Task {
|
||||
}
|
||||
|
||||
runTask() {
|
||||
if (!(this._currentTaskIndex in this.tasks)) {
|
||||
if (!(this._currentTaskIndex in this.tasks))
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.tasks[this._currentTaskIndex].run();
|
||||
}
|
||||
@ -179,9 +177,8 @@ var ConcurrentBatch = class extends Batch {
|
||||
process() {
|
||||
let hold = this.runTask();
|
||||
|
||||
if (hold) {
|
||||
if (hold)
|
||||
this.hold.acquireUntilAfter(hold);
|
||||
}
|
||||
|
||||
// Regardless of the state of the just run task,
|
||||
// fire off the next one, so all the tasks can run
|
||||
|
@ -702,9 +702,8 @@ var LoginDialog = GObject.registerClass({
|
||||
}
|
||||
|
||||
// Finally hand out the allocations
|
||||
if (bannerAllocation) {
|
||||
if (bannerAllocation)
|
||||
this._bannerView.allocate(bannerAllocation, flags);
|
||||
}
|
||||
|
||||
if (authPromptAllocation)
|
||||
this._authPrompt.allocate(authPromptAllocation, flags);
|
||||
@ -820,9 +819,9 @@ var LoginDialog = GObject.registerClass({
|
||||
|
||||
_resetGreeterProxy() {
|
||||
if (GLib.getenv('GDM_GREETER_TEST') != '1') {
|
||||
if (this._greeter) {
|
||||
if (this._greeter)
|
||||
this._greeter.run_dispose();
|
||||
}
|
||||
|
||||
this._greeter = this._gdmClient.get_greeter_sync(null);
|
||||
|
||||
this._defaultSessionChangedId = this._greeter.connect('default-session-name-changed',
|
||||
@ -1039,9 +1038,8 @@ var LoginDialog = GObject.registerClass({
|
||||
|
||||
() => {
|
||||
// If we're just starting out, start on the right item.
|
||||
if (!this._userManager.is_loaded) {
|
||||
if (!this._userManager.is_loaded)
|
||||
this._userList.jumpToItem(loginItem);
|
||||
}
|
||||
},
|
||||
|
||||
() => {
|
||||
@ -1092,9 +1090,8 @@ var LoginDialog = GObject.registerClass({
|
||||
// Restart timed login on user interaction
|
||||
global.stage.connect('captured-event', (actor, event) => {
|
||||
if (event.type() == Clutter.EventType.KEY_PRESS ||
|
||||
event.type() == Clutter.EventType.BUTTON_PRESS) {
|
||||
event.type() == Clutter.EventType.BUTTON_PRESS)
|
||||
this._startTimedLogin(userName, seconds);
|
||||
}
|
||||
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
});
|
||||
@ -1201,9 +1198,8 @@ var LoginDialog = GObject.registerClass({
|
||||
|
||||
let users = this._userManager.list_users();
|
||||
|
||||
for (let i = 0; i < users.length; i++) {
|
||||
for (let i = 0; i < users.length; i++)
|
||||
this._userList.addUser(users[i]);
|
||||
}
|
||||
|
||||
this._updateDisableUserList();
|
||||
|
||||
|
@ -571,9 +571,8 @@ var ShellUserVerifier = class {
|
||||
// if the password service fails, then cancel everything.
|
||||
// But if, e.g., fingerprint fails, still give
|
||||
// password authentication a chance to succeed
|
||||
if (this.serviceIsForeground(serviceName)) {
|
||||
if (this.serviceIsForeground(serviceName))
|
||||
this._verificationFailed(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
Signals.addSignalMethods(ShellUserVerifier.prototype);
|
||||
|
@ -82,11 +82,11 @@ var HistoryManager = class {
|
||||
|
||||
_onEntryKeyPress(entry, event) {
|
||||
let symbol = event.get_key_symbol();
|
||||
if (symbol == Clutter.KEY_Up) {
|
||||
if (symbol == Clutter.KEY_Up)
|
||||
return this._setPrevItem(entry.get_text());
|
||||
} else if (symbol == Clutter.KEY_Down) {
|
||||
else if (symbol == Clutter.KEY_Down)
|
||||
return this._setNextItem(entry.get_text());
|
||||
}
|
||||
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,8 @@ function getCompletions(text, commandHeader, globalCompletionList) {
|
||||
let methods = [];
|
||||
let expr_, base;
|
||||
let attrHead = '';
|
||||
if (globalCompletionList == null) {
|
||||
if (globalCompletionList == null)
|
||||
globalCompletionList = [];
|
||||
}
|
||||
|
||||
let offset = getExpressionOffset(text, text.length - 1);
|
||||
if (offset >= 0) {
|
||||
@ -59,20 +58,18 @@ function isStopChar(c) {
|
||||
function findMatchingQuote(expr, offset) {
|
||||
let quoteChar = expr.charAt(offset);
|
||||
for (let i = offset - 1; i >= 0; --i) {
|
||||
if (expr.charAt(i) == quoteChar && expr.charAt(i - 1) != '\\') {
|
||||
if (expr.charAt(i) == quoteChar && expr.charAt(i - 1) != '\\')
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Given the ending position of a regex, find where it starts
|
||||
function findMatchingSlash(expr, offset) {
|
||||
for (let i = offset - 1; i >= 0; --i) {
|
||||
if (expr.charAt(i) == '/' && expr.charAt(i - 1) != '\\') {
|
||||
if (expr.charAt(i) == '/' && expr.charAt(i - 1) != '\\')
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -117,13 +114,11 @@ function getExpressionOffset(expr, offset) {
|
||||
while (offset >= 0) {
|
||||
let currChar = expr.charAt(offset);
|
||||
|
||||
if (isStopChar(currChar)) {
|
||||
if (isStopChar(currChar))
|
||||
return offset + 1;
|
||||
}
|
||||
|
||||
if (currChar.match(/[)\]]/)) {
|
||||
if (currChar.match(/[)\]]/))
|
||||
offset = findMatchingBrace(expr, offset);
|
||||
}
|
||||
|
||||
--offset;
|
||||
}
|
||||
@ -140,9 +135,9 @@ function isValidPropertyName(w) {
|
||||
// To get all properties (enumerable and not), we need to walk
|
||||
// the prototype chain ourselves
|
||||
function getAllProps(obj) {
|
||||
if (obj === null || obj === undefined) {
|
||||
if (obj === null || obj === undefined)
|
||||
return [];
|
||||
}
|
||||
|
||||
return Object.getOwnPropertyNames(obj).concat( getAllProps(Object.getPrototypeOf(obj)) );
|
||||
}
|
||||
|
||||
|
@ -192,9 +192,8 @@ var ObjectManager = class {
|
||||
_onNameAppeared() {
|
||||
this._managerProxy.GetManagedObjectsRemote((result, error) => {
|
||||
if (!result) {
|
||||
if (error) {
|
||||
if (error)
|
||||
logError(error, `could not get remote objects for service ${this._serviceName} path ${this._managerPath}`);
|
||||
}
|
||||
|
||||
this._tryToCompleteLoad();
|
||||
return;
|
||||
|
@ -72,12 +72,11 @@ var SmartcardManager = class {
|
||||
if ('IsInserted' in properties.deep_unpack()) {
|
||||
this._updateToken(token);
|
||||
|
||||
if (token.IsInserted) {
|
||||
if (token.IsInserted)
|
||||
this.emit('smartcard-inserted', token);
|
||||
} else {
|
||||
else
|
||||
this.emit('smartcard-removed', token);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Emit a smartcard-inserted at startup if it's already plugged in
|
||||
|
@ -174,12 +174,11 @@ function script_applicationsShowDone(time) {
|
||||
}
|
||||
|
||||
function script_afterShowHide(_time) {
|
||||
if (overviewShowCount == 1) {
|
||||
if (overviewShowCount == 1)
|
||||
METRICS.usedAfterOverview.value = mallocUsedSize;
|
||||
} else {
|
||||
else
|
||||
METRICS.leakedAfterOverview.value = mallocUsedSize - METRICS.usedAfterOverview.value;
|
||||
}
|
||||
}
|
||||
|
||||
function malloc_usedSize(time, bytes) {
|
||||
mallocUsedSize = bytes;
|
||||
|
@ -722,9 +722,9 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
|
||||
|
||||
_setIconSize() {
|
||||
let j = 0;
|
||||
while (this._items.length > 1 && this._items[j].style_class != 'item-box') {
|
||||
while (this._items.length > 1 && this._items[j].style_class != 'item-box')
|
||||
j++;
|
||||
}
|
||||
|
||||
let themeNode = this._items[j].get_theme_node();
|
||||
this._list.ensure_style();
|
||||
|
||||
|
@ -110,10 +110,9 @@ function _findBestFolderName(apps) {
|
||||
// If a category is present in all apps, its counter will
|
||||
// reach appInfos.length
|
||||
if (category.length > 0 &&
|
||||
categoryCounter[category] == appInfos.length) {
|
||||
categoryCounter[category] == appInfos.length)
|
||||
categories.push(category);
|
||||
}
|
||||
}
|
||||
return categories;
|
||||
}, commonCategories);
|
||||
|
||||
@ -764,9 +763,8 @@ var AllView = GObject.registerClass({
|
||||
|
||||
// Within the grid boundaries, or already animating
|
||||
if (dragEvent.y > gridY && dragEvent.y < gridBottom ||
|
||||
this._adjustment.get_transition('value') != null) {
|
||||
this._adjustment.get_transition('value') != null)
|
||||
return;
|
||||
}
|
||||
|
||||
// Moving above the grid
|
||||
let currentY = this._adjustment.value;
|
||||
@ -777,10 +775,9 @@ var AllView = GObject.registerClass({
|
||||
|
||||
// Moving below the grid
|
||||
let maxY = this._adjustment.upper - this._adjustment.page_size;
|
||||
if (dragEvent.y >= gridBottom && currentY < maxY) {
|
||||
if (dragEvent.y >= gridBottom && currentY < maxY)
|
||||
this.goToPage(this._grid.currentPage + 1);
|
||||
}
|
||||
}
|
||||
|
||||
_onDragBegin() {
|
||||
this._dragMonitor = {
|
||||
@ -2257,12 +2254,11 @@ var AppIcon = GObject.registerClass({
|
||||
}
|
||||
|
||||
activateWindow(metaWindow) {
|
||||
if (metaWindow) {
|
||||
if (metaWindow)
|
||||
Main.activateWindow(metaWindow);
|
||||
} else {
|
||||
else
|
||||
Main.overview.hide();
|
||||
}
|
||||
}
|
||||
|
||||
_onMenuPoppedDown() {
|
||||
this.sync_hover();
|
||||
|
@ -269,9 +269,9 @@ var Background = GObject.registerClass({
|
||||
|
||||
let i;
|
||||
let keys = Object.keys(this._fileWatches);
|
||||
for (i = 0; i < keys.length; i++) {
|
||||
for (i = 0; i < keys.length; i++)
|
||||
this._cache.disconnect(this._fileWatches[keys[i]]);
|
||||
}
|
||||
|
||||
this._fileWatches = null;
|
||||
|
||||
if (this._timezoneChangedId != 0)
|
||||
|
@ -247,12 +247,11 @@ var BoxPointer = GObject.registerClass({
|
||||
let [absX, absY] = this.get_transformed_position();
|
||||
|
||||
if (this._arrowSide == St.Side.TOP ||
|
||||
this._arrowSide == St.Side.BOTTOM) {
|
||||
this._arrowSide == St.Side.BOTTOM)
|
||||
this._arrowOrigin = sourceX - absX + sourceWidth / 2;
|
||||
} else {
|
||||
else
|
||||
this._arrowOrigin = sourceY - absY + sourceHeight / 2;
|
||||
}
|
||||
}
|
||||
|
||||
let borderWidth = themeNode.get_length('-arrow-border-width');
|
||||
let base = themeNode.get_length('-arrow-base');
|
||||
@ -266,20 +265,19 @@ var BoxPointer = GObject.registerClass({
|
||||
|
||||
let [width, height] = area.get_surface_size();
|
||||
let [boxWidth, boxHeight] = [width, height];
|
||||
if (this._arrowSide == St.Side.TOP || this._arrowSide == St.Side.BOTTOM) {
|
||||
if (this._arrowSide == St.Side.TOP || this._arrowSide == St.Side.BOTTOM)
|
||||
boxHeight -= rise;
|
||||
} else {
|
||||
else
|
||||
boxWidth -= rise;
|
||||
}
|
||||
|
||||
let cr = area.get_context();
|
||||
|
||||
// Translate so that box goes from 0,0 to boxWidth,boxHeight,
|
||||
// with the arrow poking out of that
|
||||
if (this._arrowSide == St.Side.TOP) {
|
||||
if (this._arrowSide == St.Side.TOP)
|
||||
cr.translate(0, rise);
|
||||
} else if (this._arrowSide == St.Side.LEFT) {
|
||||
else if (this._arrowSide == St.Side.LEFT)
|
||||
cr.translate(rise, 0);
|
||||
}
|
||||
|
||||
let [x1, y1] = [halfBorder, halfBorder];
|
||||
let [x2, y2] = [boxWidth - halfBorder, boxHeight - halfBorder];
|
||||
|
@ -326,10 +326,9 @@ class DBusEventSource extends EventSourceBase {
|
||||
for (let n = 0; n < this._events.length; n++) {
|
||||
let event = this._events[n];
|
||||
|
||||
if (_dateIntervalsOverlap (event.date, event.end, begin, end)) {
|
||||
if (_dateIntervalsOverlap(event.date, event.end, begin, end))
|
||||
result.push(event);
|
||||
}
|
||||
}
|
||||
result.sort((event1, event2) => {
|
||||
// sort events by end time on ending day
|
||||
let d1 = event1.date < begin && event1.end <= end ? event1.end : event1.date;
|
||||
|
@ -58,9 +58,8 @@ var AutomountManager = class {
|
||||
_InhibitorsChanged(_object, _senderName, [_inhibitor]) {
|
||||
this._session.IsInhibitedRemote(GNOME_SESSION_AUTOMOUNT_INHIBIT,
|
||||
(result, error) => {
|
||||
if (!error) {
|
||||
if (!error)
|
||||
this._inhibited = result[0];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -245,11 +245,10 @@ var AutorunDispatcher = class {
|
||||
let success = false;
|
||||
let app = null;
|
||||
|
||||
if (setting == AutorunSetting.RUN) {
|
||||
if (setting == AutorunSetting.RUN)
|
||||
app = Gio.app_info_get_default_for_type(contentTypes[0], false);
|
||||
} else if (setting == AutorunSetting.FILES) {
|
||||
else if (setting == AutorunSetting.FILES)
|
||||
app = Gio.app_info_get_default_for_type('inode/directory', false);
|
||||
}
|
||||
|
||||
if (app)
|
||||
success = startAppForMount(app, mount);
|
||||
|
@ -349,12 +349,11 @@ class ChatSource extends MessageTray.Source {
|
||||
|
||||
getIcon() {
|
||||
let file = this._contact.get_avatar_file();
|
||||
if (file) {
|
||||
if (file)
|
||||
return new Gio.FileIcon({ file: file });
|
||||
} else {
|
||||
else
|
||||
return new Gio.ThemedIcon({ name: 'avatar-default' });
|
||||
}
|
||||
}
|
||||
|
||||
getSecondaryIcon() {
|
||||
let iconName;
|
||||
|
@ -16,12 +16,11 @@ var DASH_ITEM_LABEL_HIDE_TIME = 100;
|
||||
var DASH_ITEM_HOVER_TIMEOUT = 300;
|
||||
|
||||
function getAppFromSource(source) {
|
||||
if (source instanceof AppDisplay.AppIcon) {
|
||||
if (source instanceof AppDisplay.AppIcon)
|
||||
return source.app;
|
||||
} else {
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
var DashIcon = GObject.registerClass(
|
||||
class DashIcon extends AppDisplay.AppIcon {
|
||||
@ -755,9 +754,8 @@ var Dash = GObject.registerClass({
|
||||
if (!this._shownInitially)
|
||||
this._shownInitially = true;
|
||||
|
||||
for (let i = 0; i < addedItems.length; i++) {
|
||||
for (let i = 0; i < addedItems.length; i++)
|
||||
addedItems[i].item.show(animate);
|
||||
}
|
||||
|
||||
// Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=692744
|
||||
// Without it, StBoxLayout may use a stale size cache
|
||||
@ -865,9 +863,8 @@ var Dash = GObject.registerClass({
|
||||
let app = getAppFromSource(source);
|
||||
|
||||
// Don't allow favoriting of transient apps
|
||||
if (app == null || app.is_window_backed()) {
|
||||
if (app == null || app.is_window_backed())
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!global.settings.is_writable('favorite-apps'))
|
||||
return false;
|
||||
|
@ -635,11 +635,11 @@ class DateMenuButton extends PanelMenu.Button {
|
||||
_sessionUpdated() {
|
||||
let eventSource;
|
||||
let showEvents = Main.sessionMode.showCalendarEvents;
|
||||
if (showEvents) {
|
||||
if (showEvents)
|
||||
eventSource = this._getEventSource();
|
||||
} else {
|
||||
else
|
||||
eventSource = new Calendar.EmptyEventSource();
|
||||
}
|
||||
|
||||
this._setEventSource(eventSource);
|
||||
|
||||
// Displays are not actually expected to launch Settings when activated
|
||||
|
@ -258,11 +258,11 @@ var _Draggable = class _Draggable {
|
||||
} else if (event.type() == Clutter.EventType.MOTION ||
|
||||
(event.type() == Clutter.EventType.TOUCH_UPDATE &&
|
||||
global.display.is_pointer_emulating_sequence(event.get_event_sequence()))) {
|
||||
if (this._dragActor && this._dragState == DragState.DRAGGING) {
|
||||
if (this._dragActor && this._dragState == DragState.DRAGGING)
|
||||
return this._updateDragPosition(event);
|
||||
} else if (this._dragActor == null && this._dragState != DragState.CANCELLED) {
|
||||
else if (this._dragActor == null && this._dragState != DragState.CANCELLED)
|
||||
return this._maybeStartDrag(event);
|
||||
}
|
||||
|
||||
// We intercept KEY_PRESS event so that we can process Esc key press to cancel
|
||||
// dragging and ignore all other key presses.
|
||||
} else if (event.type() == Clutter.EventType.KEY_PRESS && this._dragState == DragState.DRAGGING) {
|
||||
|
@ -200,9 +200,8 @@ var ExtensionManager = class {
|
||||
|
||||
createExtensionObject(uuid, dir, type) {
|
||||
let metadataFile = dir.get_child('metadata.json');
|
||||
if (!metadataFile.query_exists(null)) {
|
||||
if (!metadataFile.query_exists(null))
|
||||
throw new Error('Missing metadata.json');
|
||||
}
|
||||
|
||||
let metadataContents, success_;
|
||||
try {
|
||||
@ -222,14 +221,12 @@ var ExtensionManager = class {
|
||||
let requiredProperties = ['uuid', 'name', 'description', 'shell-version'];
|
||||
for (let i = 0; i < requiredProperties.length; i++) {
|
||||
let prop = requiredProperties[i];
|
||||
if (!meta[prop]) {
|
||||
if (!meta[prop])
|
||||
throw new Error(`missing "${prop}" property in metadata.json`);
|
||||
}
|
||||
}
|
||||
|
||||
if (uuid != meta.uuid) {
|
||||
if (uuid != meta.uuid)
|
||||
throw new Error(`uuid "${meta.uuid}" from metadata.json does not match directory name "${uuid}"`);
|
||||
}
|
||||
|
||||
let extension = {
|
||||
metadata: meta,
|
||||
|
@ -815,9 +815,9 @@ var IconGrid = GObject.registerClass({
|
||||
this._updateIconSizesLaterId = 0;
|
||||
let scale = Math.min(this._fixedHItemSize, this._fixedVItemSize) / Math.max(this._hItemSize, this._vItemSize);
|
||||
let newIconSize = Math.floor(ICON_SIZE * scale);
|
||||
for (let i in this._items) {
|
||||
for (let i in this._items)
|
||||
this._items[i].icon.setIconSize(newIconSize);
|
||||
}
|
||||
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}
|
||||
});
|
||||
@ -879,9 +879,9 @@ var PaginatedIconGrid = GObject.registerClass({
|
||||
children[i].show();
|
||||
|
||||
columnIndex++;
|
||||
if (columnIndex == nColumns) {
|
||||
if (columnIndex == nColumns)
|
||||
columnIndex = 0;
|
||||
}
|
||||
|
||||
if (columnIndex == 0) {
|
||||
y += this._getVItemSize() + spacing;
|
||||
if ((i + 1) % this._childrenPerPage == 0)
|
||||
|
@ -311,9 +311,8 @@ var Key = GObject.registerClass({
|
||||
_press(key) {
|
||||
this.emit('activated');
|
||||
|
||||
if (key != this.key || this._extended_keys.length == 0) {
|
||||
if (key != this.key || this._extended_keys.length == 0)
|
||||
this.emit('pressed', this._getKeyval(key), key);
|
||||
}
|
||||
|
||||
if (key == this.key) {
|
||||
this._pressTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
|
||||
|
@ -54,9 +54,9 @@ var AutoComplete = class AutoComplete {
|
||||
}
|
||||
|
||||
_processCompletionRequest(event) {
|
||||
if (event.completions.length == 0) {
|
||||
if (event.completions.length == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
// Unique match = go ahead and complete; multiple matches + single tab = complete the common starting string;
|
||||
// multiple matches + double tab = emit a suggest event with all possible options
|
||||
if (event.completions.length == 1) {
|
||||
@ -78,10 +78,10 @@ var AutoComplete = class AutoComplete {
|
||||
_entryKeyPressEvent(actor, event) {
|
||||
let cursorPos = this._entry.clutter_text.get_cursor_position();
|
||||
let text = this._entry.get_text();
|
||||
if (cursorPos != -1) {
|
||||
if (cursorPos != -1)
|
||||
text = text.slice(0, cursorPos);
|
||||
}
|
||||
if (event.get_key_symbol() === Clutter.KEY_Tab) {
|
||||
|
||||
if (event.get_key_symbol() == Clutter.KEY_Tab) {
|
||||
let [completions, attrHead] = JsParse.getCompletions(text, commandHeader, AUTO_COMPLETE_GLOBAL_KEYWORDS);
|
||||
let currTime = global.get_current_time();
|
||||
if ((currTime - this._lastTabTime) < AUTO_COMPLETE_DOUBLE_TAB_DELAY) {
|
||||
@ -224,18 +224,16 @@ var Notebook = GObject.registerClass({
|
||||
|
||||
nextTab() {
|
||||
let nextIndex = this._selectedIndex;
|
||||
if (nextIndex < this._tabs.length - 1) {
|
||||
if (nextIndex < this._tabs.length - 1)
|
||||
++nextIndex;
|
||||
}
|
||||
|
||||
this.selectIndex(nextIndex);
|
||||
}
|
||||
|
||||
prevTab() {
|
||||
let prevIndex = this._selectedIndex;
|
||||
if (prevIndex > 0) {
|
||||
if (prevIndex > 0)
|
||||
--prevIndex;
|
||||
}
|
||||
|
||||
this.selectIndex(prevIndex);
|
||||
}
|
||||
@ -412,9 +410,8 @@ class ObjInspector extends St.ScrollView {
|
||||
hbox.add(button);
|
||||
if (typeof obj == typeof {}) {
|
||||
let properties = [];
|
||||
for (let propName in obj) {
|
||||
for (let propName in obj)
|
||||
properties.push(propName);
|
||||
}
|
||||
properties.sort();
|
||||
|
||||
for (let i = 0; i < properties.length; i++) {
|
||||
@ -1096,22 +1093,20 @@ class LookingGlass extends St.BoxLayout {
|
||||
// Handle key events which are relevant for all tabs of the LookingGlass
|
||||
vfunc_key_press_event(keyPressEvent) {
|
||||
let symbol = keyPressEvent.keyval;
|
||||
if (symbol === Clutter.KEY_Escape) {
|
||||
if (this._objInspector.visible) {
|
||||
if (symbol == Clutter.KEY_Escape) {
|
||||
if (this._objInspector.visible)
|
||||
this._objInspector.close();
|
||||
} else {
|
||||
else
|
||||
this.close();
|
||||
}
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
// Ctrl+PgUp and Ctrl+PgDown switches tabs in the notebook view
|
||||
if (keyPressEvent.modifier_state & Clutter.ModifierType.CONTROL_MASK) {
|
||||
if (symbol == Clutter.KEY_Page_Up) {
|
||||
if (symbol == Clutter.KEY_Page_Up)
|
||||
this._notebook.prevTab();
|
||||
} else if (symbol == Clutter.KEY_Page_Down) {
|
||||
else if (symbol == Clutter.KEY_Page_Down)
|
||||
this._notebook.nextTab();
|
||||
}
|
||||
}
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
|
@ -623,10 +623,9 @@ var Magnifier = class Magnifier {
|
||||
|
||||
_updateLensMode() {
|
||||
// Applies only to the first zoom region.
|
||||
if (this._zoomRegions.length) {
|
||||
if (this._zoomRegions.length)
|
||||
this._zoomRegions[0].setLensMode(this._settings.get_boolean(LENS_MODE_KEY));
|
||||
}
|
||||
}
|
||||
|
||||
_updateClampMode() {
|
||||
// Applies only to the first zoom region.
|
||||
@ -1182,10 +1181,9 @@ var ZoomRegion = class ZoomRegion {
|
||||
|
||||
// If the crossHairs is not already within a larger container, add it
|
||||
// to this zoom region. Otherwise, add a clone.
|
||||
if (crossHairs && this.isActive()) {
|
||||
if (crossHairs && this.isActive())
|
||||
this._crossHairsActor = crossHairs.addToZoomRegion(this, this._mouseActor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* setInvertLightness:
|
||||
@ -1448,13 +1446,12 @@ var ZoomRegion = class ZoomRegion {
|
||||
let xMouse = this._magnifier.xMouse;
|
||||
let yMouse = this._magnifier.yMouse;
|
||||
|
||||
if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PROPORTIONAL) {
|
||||
if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PROPORTIONAL)
|
||||
return this._centerFromPointProportional(xMouse, yMouse);
|
||||
} else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PUSH) {
|
||||
else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PUSH)
|
||||
return this._centerFromPointPush(xMouse, yMouse);
|
||||
} else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.CENTERED) {
|
||||
else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.CENTERED)
|
||||
return this._centerFromPointCentered(xMouse, yMouse);
|
||||
}
|
||||
|
||||
return null; // Should never be hit
|
||||
}
|
||||
|
@ -248,12 +248,12 @@ function _initializeUI() {
|
||||
}
|
||||
|
||||
layoutManager.connect('startup-complete', () => {
|
||||
if (actionMode == Shell.ActionMode.NONE) {
|
||||
if (actionMode == Shell.ActionMode.NONE)
|
||||
actionMode = Shell.ActionMode.NORMAL;
|
||||
}
|
||||
if (screenShield) {
|
||||
|
||||
if (screenShield)
|
||||
screenShield.lockIfWasLocked();
|
||||
}
|
||||
|
||||
if (sessionMode.currentMode != 'gdm' &&
|
||||
sessionMode.currentMode != 'initial-setup') {
|
||||
GLib.log_structured(LOG_DOMAIN, GLib.LogLevelFlags.LEVEL_MESSAGE, {
|
||||
@ -573,16 +573,16 @@ function popModal(actor, timestamp) {
|
||||
}
|
||||
|
||||
function createLookingGlass() {
|
||||
if (lookingGlass == null) {
|
||||
if (lookingGlass == null)
|
||||
lookingGlass = new LookingGlass.LookingGlass();
|
||||
}
|
||||
|
||||
return lookingGlass;
|
||||
}
|
||||
|
||||
function openRunDialog() {
|
||||
if (runDialog == null) {
|
||||
if (runDialog == null)
|
||||
runDialog = new RunDialog.RunDialog();
|
||||
}
|
||||
|
||||
runDialog.open();
|
||||
}
|
||||
|
||||
|
@ -856,12 +856,11 @@ var Source = GObject.registerClass({
|
||||
notification.acknowledged = false;
|
||||
this.pushNotification(notification);
|
||||
|
||||
if (this.policy.showBanners || notification.urgency == Urgency.CRITICAL) {
|
||||
if (this.policy.showBanners || notification.urgency == Urgency.CRITICAL)
|
||||
this.emit('notification-show', notification);
|
||||
} else {
|
||||
else
|
||||
notification.playSound();
|
||||
}
|
||||
}
|
||||
|
||||
notify(propName) {
|
||||
if (propName instanceof Notification) {
|
||||
|
@ -179,11 +179,10 @@ class SlidingControl extends St.Widget {
|
||||
let translation = this._getTranslation();
|
||||
|
||||
let shouldShow = (this._getSlide() > 0);
|
||||
if (shouldShow) {
|
||||
if (shouldShow)
|
||||
translationStart = translation;
|
||||
} else {
|
||||
else
|
||||
translationEnd = translation;
|
||||
}
|
||||
|
||||
if (this.layout.translation_x == translationEnd)
|
||||
return;
|
||||
|
@ -708,16 +708,15 @@ class AggregateMenu extends PanelMenu.Button {
|
||||
this._indicators = new St.BoxLayout({ style_class: 'panel-status-indicators-box' });
|
||||
this.add_child(this._indicators);
|
||||
|
||||
if (Config.HAVE_NETWORKMANAGER) {
|
||||
if (Config.HAVE_NETWORKMANAGER)
|
||||
this._network = new imports.ui.status.network.NMApplet();
|
||||
} else {
|
||||
else
|
||||
this._network = null;
|
||||
}
|
||||
if (Config.HAVE_BLUETOOTH) {
|
||||
|
||||
if (Config.HAVE_BLUETOOTH)
|
||||
this._bluetooth = new imports.ui.status.bluetooth.Indicator();
|
||||
} else {
|
||||
else
|
||||
this._bluetooth = null;
|
||||
}
|
||||
|
||||
this._remoteAccess = new imports.ui.status.remoteAccess.RemoteAccessApplet();
|
||||
this._power = new imports.ui.status.power.Indicator();
|
||||
@ -734,12 +733,10 @@ class AggregateMenu extends PanelMenu.Button {
|
||||
this._indicators.add_child(this._screencast);
|
||||
this._indicators.add_child(this._location);
|
||||
this._indicators.add_child(this._nightLight);
|
||||
if (this._network) {
|
||||
if (this._network)
|
||||
this._indicators.add_child(this._network);
|
||||
}
|
||||
if (this._bluetooth) {
|
||||
if (this._bluetooth)
|
||||
this._indicators.add_child(this._bluetooth);
|
||||
}
|
||||
this._indicators.add_child(this._remoteAccess);
|
||||
this._indicators.add_child(this._rfkill);
|
||||
this._indicators.add_child(this._volume);
|
||||
@ -749,12 +746,12 @@ class AggregateMenu extends PanelMenu.Button {
|
||||
this.menu.addMenuItem(this._volume.menu);
|
||||
this.menu.addMenuItem(this._brightness.menu);
|
||||
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
||||
if (this._network) {
|
||||
if (this._network)
|
||||
this.menu.addMenuItem(this._network.menu);
|
||||
}
|
||||
if (this._bluetooth) {
|
||||
|
||||
if (this._bluetooth)
|
||||
this.menu.addMenuItem(this._bluetooth.menu);
|
||||
}
|
||||
|
||||
this.menu.addMenuItem(this._remoteAccess.menu);
|
||||
this.menu.addMenuItem(this._location.menu);
|
||||
this.menu.addMenuItem(this._rfkill.menu);
|
||||
|
@ -175,12 +175,11 @@ class RunDialog extends ModalDialog.ModalDialog {
|
||||
}
|
||||
|
||||
_getCompletion(text) {
|
||||
if (text.includes('/')) {
|
||||
if (text.includes('/'))
|
||||
return this._pathCompleter.get_completion_suffix(text);
|
||||
} else {
|
||||
else
|
||||
return this._getCommandCompletion(text);
|
||||
}
|
||||
}
|
||||
|
||||
_run(input, inTerminal) {
|
||||
let command = input;
|
||||
|
@ -123,10 +123,9 @@ var NotificationsBox = GObject.registerClass({
|
||||
}
|
||||
|
||||
let items = this._sources.entries();
|
||||
for (let [source, obj] of items) {
|
||||
for (let [source, obj] of items)
|
||||
this._removeSource(source, obj);
|
||||
}
|
||||
}
|
||||
|
||||
_updateVisibility() {
|
||||
this._notificationBox.visible =
|
||||
@ -205,11 +204,10 @@ var NotificationsBox = GObject.registerClass({
|
||||
}
|
||||
|
||||
_showSource(source, obj, box) {
|
||||
if (obj.detailed) {
|
||||
if (obj.detailed)
|
||||
[obj.titleLabel, obj.countLabel] = this._makeNotificationDetailedSource(source, box);
|
||||
} else {
|
||||
else
|
||||
[obj.titleLabel, obj.countLabel] = this._makeNotificationSource(source, box);
|
||||
}
|
||||
|
||||
box.visible = obj.visible && (source.unseenCount > 0);
|
||||
}
|
||||
@ -704,9 +702,8 @@ var ScreenShield = class {
|
||||
this._lockScreenScrollCounter += delta;
|
||||
|
||||
// 7 standard scrolls to lift up
|
||||
if (this._lockScreenScrollCounter > 35) {
|
||||
if (this._lockScreenScrollCounter > 35)
|
||||
this._liftShield(true, 0);
|
||||
}
|
||||
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
@ -87,9 +87,8 @@ class ListSearchResult extends SearchResult {
|
||||
|
||||
// An icon for, or thumbnail of, content
|
||||
let icon = this.metaInfo['createIcon'](this.ICON_SIZE);
|
||||
if (icon) {
|
||||
if (icon)
|
||||
titleBox.add(icon);
|
||||
}
|
||||
|
||||
let title = new St.Label({
|
||||
text: this.metaInfo['name'],
|
||||
@ -689,13 +688,12 @@ var SearchResultsView = GObject.registerClass({
|
||||
this._statusBin.visible = !haveResults;
|
||||
|
||||
if (!haveResults) {
|
||||
if (this.searchInProgress) {
|
||||
if (this.searchInProgress)
|
||||
this._statusText.set_text(_("Searching…"));
|
||||
} else {
|
||||
else
|
||||
this._statusText.set_text(_("No results."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_updateResults(provider, results) {
|
||||
let terms = this._terms;
|
||||
|
@ -362,9 +362,8 @@ var NMConnectionDevice = class NMConnectionDevice extends NMConnectionSection {
|
||||
if the reason is no secrets, as that indicates the user
|
||||
cancelled the agent dialog */
|
||||
if (newstate == NM.DeviceState.FAILED &&
|
||||
reason != NM.DeviceStateReason.NO_SECRETS) {
|
||||
reason != NM.DeviceStateReason.NO_SECRETS)
|
||||
this.emit('activation-failed', reason);
|
||||
}
|
||||
|
||||
this._sync();
|
||||
}
|
||||
@ -1053,9 +1052,8 @@ class NMWirelessDialog extends ModalDialog.ModalDialog {
|
||||
_checkConnections(network, accessPoint) {
|
||||
this._connections.forEach(connection => {
|
||||
if (accessPoint.connection_valid(connection) &&
|
||||
!network.connections.includes(connection)) {
|
||||
!network.connections.includes(connection))
|
||||
network.connections.push(connection);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -1241,9 +1239,8 @@ var NMDeviceWireless = class {
|
||||
if the reason is no secrets, as that indicates the user
|
||||
cancelled the agent dialog */
|
||||
if (newstate == NM.DeviceState.FAILED &&
|
||||
reason != NM.DeviceStateReason.NO_SECRETS) {
|
||||
reason != NM.DeviceStateReason.NO_SECRETS)
|
||||
this.emit('activation-failed', reason);
|
||||
}
|
||||
|
||||
this._sync();
|
||||
}
|
||||
@ -1511,9 +1508,9 @@ var NMVpnSection = class extends NMConnectionSection {
|
||||
|
||||
setActiveConnections(vpnConnections) {
|
||||
let connections = this._connectionItems.values();
|
||||
for (let item of connections) {
|
||||
for (let item of connections)
|
||||
item.setActiveConnection(null);
|
||||
}
|
||||
|
||||
vpnConnections.forEach(a => {
|
||||
if (a.connection) {
|
||||
let item = this._connectionItems.get(a.connection.get_uuid());
|
||||
|
@ -59,9 +59,8 @@ var StreamSlider = class {
|
||||
}
|
||||
|
||||
set stream(stream) {
|
||||
if (this._stream) {
|
||||
if (this._stream)
|
||||
this._disconnectStream(this._stream);
|
||||
}
|
||||
|
||||
this._stream = stream;
|
||||
|
||||
|
@ -85,11 +85,10 @@ var ShowOverviewAction = GObject.registerClass({
|
||||
for (let i = 0; i < this.get_n_current_points(); i++) {
|
||||
let x, y;
|
||||
|
||||
if (motion == true) {
|
||||
if (motion == true)
|
||||
[x, y] = this.get_motion_coords(i);
|
||||
} else {
|
||||
else
|
||||
[x, y] = this.get_press_coords(i);
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
minX = maxX = x;
|
||||
|
@ -1023,9 +1023,8 @@ var WindowManager = class {
|
||||
this._gsdWacomProxy = new GsdWacomProxy(Gio.DBus.session, GSD_WACOM_BUS_NAME,
|
||||
GSD_WACOM_OBJECT_PATH,
|
||||
(proxy, error) => {
|
||||
if (error) {
|
||||
if (error)
|
||||
log(error.message);
|
||||
}
|
||||
});
|
||||
|
||||
global.display.connect('pad-mode-switch', (display, pad, group, mode) => {
|
||||
@ -1170,10 +1169,9 @@ var WindowManager = class {
|
||||
|
||||
_lookupIndex(windows, metaWindow) {
|
||||
for (let i = 0; i < windows.length; i++) {
|
||||
if (windows[i].metaWindow == metaWindow) {
|
||||
if (windows[i].metaWindow == metaWindow)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1588,16 +1588,14 @@ class Workspace extends St.Widget {
|
||||
}
|
||||
|
||||
_windowEnteredMonitor(metaDisplay, monitorIndex, metaWin) {
|
||||
if (monitorIndex == this.monitorIndex) {
|
||||
if (monitorIndex == this.monitorIndex)
|
||||
this._doAddWindow(metaWin);
|
||||
}
|
||||
}
|
||||
|
||||
_windowLeftMonitor(metaDisplay, monitorIndex, metaWin) {
|
||||
if (monitorIndex == this.monitorIndex) {
|
||||
if (monitorIndex == this.monitorIndex)
|
||||
this._doRemoveWindow(metaWin);
|
||||
}
|
||||
}
|
||||
|
||||
// check for maximized windows on the workspace
|
||||
hasMaximizedWindows() {
|
||||
|
@ -293,10 +293,9 @@ var WorkspaceThumbnail = GObject.registerClass({
|
||||
this._allWindows.push(windows[i].meta_window);
|
||||
this._minimizedChangedIds.push(minimizedChangedId);
|
||||
|
||||
if (this._isMyWindow(windows[i]) && this._isOverviewWindow(windows[i])) {
|
||||
if (this._isMyWindow(windows[i]) && this._isOverviewWindow(windows[i]))
|
||||
this._addWindowClone(windows[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Track window changes
|
||||
this._windowAddedId = this.metaWorkspace.connect('window-added',
|
||||
@ -450,16 +449,14 @@ var WorkspaceThumbnail = GObject.registerClass({
|
||||
}
|
||||
|
||||
_windowEnteredMonitor(metaDisplay, monitorIndex, metaWin) {
|
||||
if (monitorIndex == this.monitorIndex) {
|
||||
if (monitorIndex == this.monitorIndex)
|
||||
this._doAddWindow(metaWin);
|
||||
}
|
||||
}
|
||||
|
||||
_windowLeftMonitor(metaDisplay, monitorIndex, metaWin) {
|
||||
if (monitorIndex == this.monitorIndex) {
|
||||
if (monitorIndex == this.monitorIndex)
|
||||
this._doRemoveWindow(metaWin);
|
||||
}
|
||||
}
|
||||
|
||||
_updateMinimized(metaWin) {
|
||||
if (metaWin.minimized)
|
||||
|
Loading…
Reference in New Issue
Block a user