cleanup: Remove unused variables

Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
This commit is contained in:
Florian Müllner 2019-01-31 15:04:56 +01:00
parent e7d44bb349
commit e56d7f5021
33 changed files with 16 additions and 103 deletions

View File

@ -187,8 +187,6 @@ var UserList = class {
}
updateStyle(isExpanded) {
let tasks = [];
if (isExpanded)
this._box.add_style_pseudo_class('expanded');
else
@ -575,19 +573,15 @@ var LoginDialog = GObject.registerClass({
// First find out what space the children require
let bannerAllocation = null;
let bannerHeight = 0;
let bannerWidth = 0;
if (this._bannerView.visible) {
bannerAllocation = this._getBannerAllocation(dialogBox, this._bannerView);
bannerHeight = bannerAllocation.y2 - bannerAllocation.y1;
bannerWidth = bannerAllocation.x2 - bannerAllocation.x1;
}
let authPromptAllocation = null;
let authPromptHeight = 0;
let authPromptWidth = 0;
if (this._authPrompt.actor.visible) {
authPromptAllocation = this._getCenterActorAllocation(dialogBox, this._authPrompt.actor);
authPromptHeight = authPromptAllocation.y2 - authPromptAllocation.y1;
authPromptWidth = authPromptAllocation.x2 - authPromptAllocation.x1;
}

View File

@ -36,10 +36,10 @@ var Manager = class {
return;
for (let i = 0; i < realmPaths.length; i++) {
let realm = Realm(Gio.DBus.system,
'org.freedesktop.realmd',
realmPaths[i],
this._onRealmLoaded.bind(this));
Realm(Gio.DBus.system,
'org.freedesktop.realmd',
realmPaths[i],
this._onRealmLoaded.bind(this));
}
}

View File

@ -162,8 +162,6 @@ function isOutOfDate(extension) {
}
function createExtensionObject(uuid, dir, type) {
let info;
let metadataFile = dir.get_child('metadata.json');
if (!metadataFile.query_exists(null)) {
throw new Error('Missing metadata.json');

View File

@ -36,7 +36,7 @@ function recursivelyDeleteDir(dir, deleteParent) {
let children = dir.enumerate_children('standard::name,standard::type',
Gio.FileQueryInfoFlags.NONE, null);
let info, child;
let info;
while ((info = children.next_file(null)) != null) {
let type = info.get_file_type();
let child = dir.get_child(info.get_name());
@ -57,7 +57,7 @@ function recursivelyMoveDir(srcDir, destDir) {
if (!destDir.query_exists(null))
destDir.make_directory_with_parents(null);
let info, child;
let info;
while ((info = children.next_file(null)) != null) {
let type = info.get_file_type();
let srcChild = srcDir.get_child(info.get_name());

View File

@ -92,7 +92,6 @@ var ObjectManager = class {
proxy.init_async(GLib.PRIORITY_DEFAULT,
this._cancellable,
(initable, result) => {
let error = null;
try {
initable.init_finish(result);
} catch(e) {
@ -155,7 +154,6 @@ var ObjectManager = class {
}
_onManagerProxyLoaded(initable, result) {
let error = null;
try {
initable.init_finish(result);
} catch(e) {

View File

@ -136,7 +136,6 @@ let overviewFrames;
let overviewLatency;
let mallocUsedSize = 0;
let overviewShowCount = 0;
let firstOverviewUsedSize;
let haveSwapComplete = false;
let applicationsShowStart;
let applicationsShowCount = 0;

View File

@ -19,7 +19,6 @@ const PortalHelperSecurityLevel = {
INSECURE: 2
};
const INACTIVITY_TIMEOUT = 30000; //ms
const CONNECTIVITY_CHECK_HOST = 'nmcheck.gnome.org';
const CONNECTIVITY_CHECK_URI = 'http://' + CONNECTIVITY_CHECK_HOST;
const CONNECTIVITY_RECHECK_RATELIMIT_TIMEOUT = 30 * GLib.USEC_PER_SEC;

View File

@ -841,7 +841,6 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
this._removeIcon(app);
});
let n = this._arrows.length;
let arrow = new St.DrawingArea({ style_class: 'switcher-arrow' });
arrow.connect('repaint', () => { SwitcherPopup.drawArrow(arrow, St.Side.BOTTOM); });
this.add_actor(arrow);

View File

@ -20,7 +20,6 @@ const SystemActions = imports.misc.systemActions;
const { loadInterfaceXML } = imports.misc.fileUtils;
var MAX_APPLICATION_WORK_MILLIS = 75;
var MENU_POPUP_TIMEOUT = 600;
var MAX_COLUMNS = 6;
var MIN_COLUMNS = 4;
@ -34,23 +33,9 @@ var FOLDER_SUBICON_FRACTION = .4;
var MIN_FREQUENT_APPS_COUNT = 3;
var INDICATORS_BASE_TIME = 0.25;
var INDICATORS_ANIMATION_DELAY = 0.125;
var INDICATORS_ANIMATION_MAX_TIME = 0.75;
var VIEWS_SWITCH_TIME = 0.4;
var VIEWS_SWITCH_ANIMATION_DELAY = 0.1;
// Follow iconGrid animations approach and divide by 2 to animate out to
// not annoy the user when the user wants to quit appDisplay.
// Also, make sure we don't exceed iconGrid animation total time or
// views switch time.
var INDICATORS_BASE_TIME_OUT = 0.125;
var INDICATORS_ANIMATION_DELAY_OUT = 0.0625;
var INDICATORS_ANIMATION_MAX_TIME_OUT =
Math.min (VIEWS_SWITCH_TIME,
IconGrid.ANIMATION_TIME_OUT + IconGrid.ANIMATION_MAX_DELAY_OUT_FOR_ITEM);
var PAGE_SWITCH_TIME = 0.3;
const SWITCHEROO_BUS_NAME = 'net.hadess.SwitcherooControl';
@ -373,7 +358,7 @@ var AllView = class AllView extends BaseAppView {
_loadApps() {
this._appInfoList = Shell.AppSystem.get_default().get_installed().filter(appInfo => {
try {
let id = appInfo.get_id(); // catch invalid file encodings
(appInfo.get_id()); // catch invalid file encodings
} catch(e) {
return false;
}

View File

@ -108,7 +108,6 @@ const PRIMARY_COLOR_KEY = 'primary-color';
const SECONDARY_COLOR_KEY = 'secondary-color';
const COLOR_SHADING_TYPE_KEY = 'color-shading-type';
const BACKGROUND_STYLE_KEY = 'picture-options';
const PICTURE_OPACITY_KEY = 'picture-opacity';
const PICTURE_URI_KEY = 'picture-uri';
var FADE_ANIMATION_TIME = 1.0;

View File

@ -546,8 +546,6 @@ var Calendar = class Calendar {
this._calendarBegin = new Date(beginDate);
this._markedAsToday = now;
let year = beginDate.getYear();
let daysToWeekStart = (7 + beginDate.getDay() - this._weekStart) % 7;
let startsOnWeekStart = daysToWeekStart == 0;
let weekPadding = startsOnWeekStart ? 7 : 0;
@ -559,7 +557,7 @@ var Calendar = class Calendar {
let row = 2;
// nRows here means 6 weeks + one header + one navbar
let nRows = 8;
while (row < 8) {
while (row < nRows) {
// xgettext:no-javascript-format
let button = new St.Button({ label: iter.toLocaleFormat(C_("date day number format", "%d")),
can_focus: true });

View File

@ -236,7 +236,6 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
_get8021xSecrets(secrets) {
let ieee8021xSetting = this._connection.get_setting_802_1x();
let phase2method;
/* If hints were given we know exactly what we need to ask */
if (this._settingName == "802-1x" && this._hints.length) {
@ -696,7 +695,6 @@ var NetworkAgent = class {
break;
case 'gsm':
if (hints.includes('pin')) {
let gsmSetting = connection.get_setting_gsm();
title = _("PIN code required");
body = _("PIN code is needed for the mobile broadband device");
break;

View File

@ -7,7 +7,6 @@ const SwitcherPopup = imports.ui.switcherPopup;
const Params = imports.misc.params;
var POPUP_APPICON_SIZE = 96;
var POPUP_FADE_TIME = 0.1; // seconds
var SortGroup = {
TOP: 0,

View File

@ -459,7 +459,6 @@ class CalendarColumnLayout extends Clutter.BoxLayout {
var DateMenuButton = GObject.registerClass(
class DateMenuButton extends PanelMenu.Button {
_init() {
let item;
let hbox;
let vbox;

View File

@ -29,13 +29,9 @@ const UserWidget = imports.ui.userWidget;
const { loadInterfaceXML } = imports.misc.fileUtils;
let _endSessionDialog = null;
const _ITEM_ICON_SIZE = 48;
const _DIALOG_ICON_SIZE = 48;
var GSM_SESSION_MANAGER_LOGOUT_FORCE = 2;
const EndSessionDialogIface = loadInterfaceXML('org.gnome.SessionManager.EndSessionDialog');
const logoutDialogContent = {
@ -223,7 +219,7 @@ function init() {
// This always returns the same singleton object
// By instantiating it initially, we register the
// bus object, etc.
_endSessionDialog = new EndSessionDialog();
(new EndSessionDialog());
}
var EndSessionDialog = GObject.registerClass(

View File

@ -9,8 +9,6 @@ const ExtensionSystem = imports.ui.extensionSystem;
const FileUtils = imports.misc.fileUtils;
const ModalDialog = imports.ui.modalDialog;
const _signals = ExtensionSystem._signals;
var REPOSITORY_URL_BASE = 'https://extensions.gnome.org';
var REPOSITORY_URL_DOWNLOAD = REPOSITORY_URL_BASE + '/download-extension/%s.shell-extension.zip';
var REPOSITORY_URL_INFO = REPOSITORY_URL_BASE + '/extension-info/';

View File

@ -743,7 +743,6 @@ var IconGrid = GObject.registerClass({
this._fixedHItemSize = this._hItemSize;
this._fixedVItemSize = this._vItemSize;
this._updateSpacingForSize(availWidth, availHeight);
let spacing = this._getSpacing();
if (this.columnsForWidth(availWidth) < this._minColumns || this.rowsForHeight(availHeight) < this._minRows) {
let neededWidth = this.usedWidthForNColumns(this._minColumns) - availWidth ;
@ -802,7 +801,6 @@ var PaginatedIconGrid = GObject.registerClass({
}
let children = this._getVisibleChildren();
let availWidth = box.x2 - box.x1;
let availHeight = box.y2 - box.y1;
let spacing = this._getSpacing();
let [nColumns, usedWidth] = this._computeLayout(availWidth);
@ -821,7 +819,6 @@ var PaginatedIconGrid = GObject.registerClass({
let x = box.x1 + leftEmptySpace + this.leftPadding;
let y = box.y1 + this.topPadding;
let columnIndex = 0;
let rowIndex = 0;
for (let i = 0; i < children.length; i++) {
let childBox = this._calculateChildBox(children[i], x, y, box);
@ -831,7 +828,6 @@ var PaginatedIconGrid = GObject.registerClass({
columnIndex++;
if (columnIndex == nColumns) {
columnIndex = 0;
rowIndex++;
}
if (columnIndex == 0) {
y += this._getVItemSize() + spacing;
@ -863,7 +859,6 @@ var PaginatedIconGrid = GObject.registerClass({
if (this._rowLimit)
nRows = Math.min(nRows, this._rowLimit);
let spacing = this._getSpacing();
// We want to contain the grid inside the parent box with padding
this._rowsPerPage = this.rowsForHeight(availHeightPerPage);
this._nPages = Math.ceil(nRows / this._rowsPerPage);

View File

@ -405,9 +405,6 @@ var Key = class Key {
return Clutter.EVENT_PROPAGATE;
});
button.connect('touch-event', (actor, event) => {
let device = event.get_device();
let sequence = event.get_event_sequence();
// We only handle touch events here on wayland. On X11
// we do get emulated pointer events, which already works
// for single-touch cases. Besides, the X11 passive touch grab
@ -913,7 +910,6 @@ var EmojiSelection = class EmojiSelection {
contents = imports.byteArray.toString(contents);
let emoji = JSON.parse(contents);
let pages = [];
let variants = [];
let currentKey = 0;
let currentSection = null;
@ -1406,8 +1402,6 @@ var Keyboard = class Keyboard {
}
_getDefaultKeysForRow(row, numRows, level) {
let pre, post;
/* The first 2 rows in defaultKeysPre/Post belong together with
* the first 2 rows on each keymap. On keymaps that have more than
* 4 rows, the last 2 default key rows must be respectively
@ -1646,8 +1640,7 @@ var Keyboard = class Keyboard {
}
_windowSlideAnimationComplete(window, delta) {
// Synchronize window and actor positions again.
let windowActor = window.get_compositor_private();
// Synchronize window positions again.
let frameRect = window.get_frame_rect();
frameRect.y += delta;
window.move_frame(true, frameRect.x, frameRect.y);
@ -1693,7 +1686,6 @@ var Keyboard = class Keyboard {
if (window && monitor) {
let keyboardHeight = Main.layoutManager.keyboardBox.height;
let focusObscured = false;
if (y + h >= monitor.y + monitor.height - keyboardHeight) {
if (this._keyboardVisible)
@ -1744,7 +1736,6 @@ var KeyboardController = class {
}
_onContentPurposeHintsChanged(method) {
let hints = method.content_hints;
let purpose = method.content_purpose;
let emojiVisible = false;
let keypadVisible = false;

View File

@ -394,7 +394,6 @@ var ObjInspector = class ObjInspector {
for (let i = 0; i < properties.length; i++) {
let propName = properties[i];
let valueStr;
let link;
try {
let prop = obj[propName];
@ -403,7 +402,6 @@ var ObjInspector = class ObjInspector {
link = new St.Label({ text: '<error>' });
}
let hbox = new St.BoxLayout();
let propText = propName + ': ' + valueStr;
hbox.add(new St.Label({ text: propName + ': ' }));
hbox.add(link);
this._container.add_actor(hbox);
@ -710,7 +708,6 @@ var Extensions = class Extensions {
let metaBox = new St.BoxLayout({ style_class: 'lg-extension-meta' });
box.add(metaBox);
let stateString = this._stateToString(extension.state);
let state = new St.Label({ style_class: 'lg-extension-state',
text: this._stateToString(extension.state) });
metaBox.add(state);

View File

@ -41,8 +41,6 @@ const CROSS_HAIRS_OPACITY_KEY = 'cross-hairs-opacity';
const CROSS_HAIRS_LENGTH_KEY = 'cross-hairs-length';
const CROSS_HAIRS_CLIP_KEY = 'cross-hairs-clip';
let magDBusService = null;
var MouseSpriteContent = GObject.registerClass({
Implements: [ Clutter.Content ],
}, class MouseSpriteContent extends GObject.Object {
@ -122,7 +120,7 @@ var Magnifier = class Magnifier {
});
// Export to dbus.
magDBusService = new MagnifierDBus.ShellMagnifier();
(new MagnifierDBus.ShellMagnifier());
this.setActive(St.Settings.get().magnifier_active);
}
@ -1818,9 +1816,7 @@ var Crosshairs = class Crosshairs {
reCenter(clipSize) {
let [groupWidth, groupHeight] = this._actor.get_size();
let leftLength = this._horizLeftHair.get_width();
let rightLength = this._horizRightHair.get_width();
let topLength = this._vertTopHair.get_height();
let bottomLength = this._vertBottomHair.get_height();
let thickness = this._horizLeftHair.get_height();
// Deal with clip rectangle.

View File

@ -84,7 +84,6 @@ let _cssStylesheet = null;
let _a11ySettings = null;
let _themeResource = null;
let _oskResource = null;
let pointerA11yTimeout = null;
function _sessionUpdated() {
if (sessionMode.isPrimary)
@ -192,7 +191,7 @@ function _initializeUI() {
layoutManager.init();
overview.init();
pointerA11yTimeout = new PointerA11yTimeout.PointerA11yTimeout();
(new PointerA11yTimeout.PointerA11yTimeout());
_a11ySettings = new Gio.Settings({ schema_id: A11Y_SCHEMA });

View File

@ -4,8 +4,6 @@ const { Clutter, Gio, Meta, St } = imports.gi;
const Main = imports.ui.main;
var FADE_TIME = 0.1;
var OsdMonitorLabel = class {
constructor(monitor, label) {
this._actor = new St.Widget({ x_expand: true,

View File

@ -3,8 +3,6 @@ const Tweener = imports.ui.tweener;
const Main = imports.ui.main;
const Cairo = imports.cairo;
const ANIMATION_STEPS = 36.;
var PieTimer = GObject.registerClass(
class PieTimer extends St.DrawingArea {
_init() {

View File

@ -9,8 +9,6 @@ const Tweener = imports.ui.tweener;
const Util = imports.misc.util;
const History = imports.misc.history;
var MAX_FILE_DELETED_BEFORE_INVALID = 10;
const HISTORY_KEY = 'command-history';
const LOCKDOWN_SCHEMA = 'org.gnome.desktop.lockdown';

View File

@ -44,11 +44,9 @@ var SUMMARY_ICON_SIZE = 48;
// - STANDARD_FADE_TIME is used when the session goes idle
// - MANUAL_FADE_TIME is used for lowering the shield when asked by the user,
// or when cancelling the dialog
// - BACKGROUND_FADE_TIME is used when the background changes to crossfade to new background
// - CURTAIN_SLIDE_TIME is used when raising the shield before unlocking
var STANDARD_FADE_TIME = 10;
var MANUAL_FADE_TIME = 0.3;
var BACKGROUND_FADE_TIME = 1.0;
var CURTAIN_SLIDE_TIME = 0.3;
var Clock = class {

View File

@ -42,8 +42,6 @@ var Slider = class extends BarLevel.BarLevel {
let [hasHandleColor, handleBorderColor] =
themeNode.lookup_color('-slider-handle-border-color', false);
const TAU = Math.PI * 2;
let handleX = handleRadius + (width - 2 * handleRadius) * this._value / this._maxValue;
let handleY = height / 2;
@ -185,10 +183,9 @@ var Slider = class extends BarLevel.BarLevel {
}
_moveHandle(absX, absY) {
let relX, relY, sliderX, sliderY;
[sliderX, sliderY] = this.actor.get_transformed_position();
let relX, sliderX;
[sliderX] = this.actor.get_transformed_position();
relX = absX - sliderX;
relY = absY - sliderY;
let width = this._barLevelWidth;
let handleRadius = this.actor.get_theme_node().get_length('-slider-handle-radius');

View File

@ -10,8 +10,6 @@ const Slider = imports.ui.slider;
const ALLOW_AMPLIFIED_VOLUME_KEY = 'allow-volume-above-100-percent';
var VOLUME_NOTIFY_ID = 1;
// Each Gvc.MixerControl is a connection to PulseAudio,
// so it's better to make it a singleton
let _mixerControl;

View File

@ -2,7 +2,7 @@
//
// A widget showing the user avatar and name
const { Clutter, Gio, GLib, GObject, St } = imports.gi;
const { Clutter, GLib, GObject, St } = imports.gi;
const Params = imports.misc.params;
@ -44,7 +44,6 @@ var Avatar = class {
iconFile = null;
if (iconFile) {
let file = Gio.File.new_for_path(iconFile);
this.actor.child = null;
this.actor.style = `
background-image: url("${iconFile}");
@ -107,9 +106,6 @@ class UserWidgetLabel extends St.Widget {
let [minRealNameWidth, minRealNameHeight,
natRealNameWidth, natRealNameHeight] = this._realNameLabel.get_preferred_size();
let [minUserNameWidth, minUserNameHeight,
natUserNameWidth, natUserNameHeight] = this._userNameLabel.get_preferred_size();
if (natRealNameWidth <= availWidth)
this._currentLabel = this._realNameLabel;
else

View File

@ -403,7 +403,6 @@ var ViewSelector = class {
if (Main.modalCount > 1)
return Clutter.EVENT_PROPAGATE;
let modifiers = event.get_state();
let symbol = event.get_key_symbol();
if (symbol == Clutter.Escape) {

View File

@ -331,7 +331,6 @@ var WorkspaceTracker = class {
if (oldNumWorkspaces == newNumWorkspaces)
return false;
let lostWorkspaces = [];
if (newNumWorkspaces > oldNumWorkspaces) {
let w;

View File

@ -1002,7 +1002,6 @@ var UnalignedLayoutStrategy = class extends LayoutStrategy {
let idealRowWidth = totalWidth / numRows;
let windowIdx = 0;
for (let i = 0; i < numRows; i++) {
let col = 0;
let row = this._newRow();
rows.push(row);
@ -1363,7 +1362,6 @@ var Workspace = class {
for (let i = 0; i < clones.length; i++) {
let clone = clones[i];
let metaWindow = clone.metaWindow;
if (i == 0) {
clone.setStackAbove(this._dropRect);
} else {

View File

@ -324,7 +324,6 @@ var WorkspaceThumbnail = class {
for (let i = 0; i < this._windows.length; i++) {
let clone = this._windows[i];
let metaWindow = clone.metaWindow;
if (i == 0) {
clone.setStackAbove(this._bgManager.backgroundActor);
} else {
@ -914,7 +913,6 @@ class ThumbnailsBox extends St.Widget {
let workspaceManager = global.workspace_manager;
let oldNumWorkspaces = validThumbnails.length;
let newNumWorkspaces = workspaceManager.n_workspaces;
let active = workspaceManager.get_active_workspace_index();
if (newNumWorkspaces > oldNumWorkspaces) {
this.addThumbnails(oldNumWorkspaces, newNumWorkspaces - oldNumWorkspaces);
@ -1248,7 +1246,7 @@ class ThumbnailsBox extends St.Widget {
if (i == this._dropPlaceholderPos) {
let [minHeight, placeholderHeight] = this._dropPlaceholder.get_preferred_height(-1);
childBox.x1 = x1;
childBox.x2 = x1 + thumbnailWidth;
childBox.x2 = x2;
childBox.y1 = Math.round(y);
childBox.y2 = Math.round(y + placeholderHeight);
this._dropPlaceholder.allocate(childBox, flags);

View File

@ -246,7 +246,6 @@ var WorkspacesView = class extends WorkspacesViewBase {
this.scrollAdjustment.upper = newNumWorkspaces;
let needsUpdate = false;
for (let j = 0; j < newNumWorkspaces; j++) {
let metaWorkspace = workspaceManager.get_workspace_by_index(j);
let workspace;