[gnome-shell-extensions/wip/fmuellner/js-cleanup: 4/7] cleanup: Use method syntax
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions/wip/fmuellner/js-cleanup: 4/7] cleanup: Use method syntax
- Date: Fri, 24 Nov 2017 17:05:39 +0000 (UTC)
commit 490c778007eb128fbd28892efc9d2685ce3878e9
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Oct 27 17:26:36 2017 +0200
cleanup: Use method syntax
Modern javascript has a short-hand for function properties, embrace
it for better readability and to prepare for porting to ES6 classes.
https://bugzilla.gnome.org/show_bug.cgi?id=790301
extensions/alternate-tab/prefs.js | 2 +-
extensions/apps-menu/extension.js | 94 +++++++-------
extensions/auto-move-windows/extension.js | 8 +-
extensions/auto-move-windows/prefs.js | 18 +--
extensions/drive-menu/extension.js | 28 ++--
extensions/example/prefs.js | 2 +-
extensions/native-window-placement/extension.js | 20 +--
extensions/places-menu/extension.js | 16 +--
extensions/places-menu/placeDisplay.js | 52 ++++----
extensions/user-theme/extension.js | 8 +-
extensions/window-list/extension.js | 162 ++++++++++++------------
extensions/window-list/prefs.js | 2 +-
extensions/workspace-indicator/extension.js | 14 +-
extensions/workspace-indicator/prefs.js | 18 +--
14 files changed, 222 insertions(+), 222 deletions(-)
---
diff --git a/extensions/alternate-tab/prefs.js b/extensions/alternate-tab/prefs.js
index 64cf4ed..dda78ee 100644
--- a/extensions/alternate-tab/prefs.js
+++ b/extensions/alternate-tab/prefs.js
@@ -26,7 +26,7 @@ const AltTabSettingsWidget = new GObject.Class({
GTypeName: 'AltTabSettingsWidget',
Extends: Gtk.Grid,
- _init: function(params) {
+ _init(params) {
this.parent(params);
this.margin = 24;
this.row_spacing = 6;
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index c632455..ad324cd 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -35,13 +35,13 @@ const ActivitiesMenuItem = new Lang.Class({
Name: 'ActivitiesMenuItem',
Extends: PopupMenu.PopupBaseMenuItem,
- _init: function(button) {
+ _init(button) {
this.parent();
this._button = button;
this.actor.add_child(new St.Label({ text: _("Activities Overview") }));
},
- activate: function(event) {
+ activate(event) {
this._button.menu.toggle();
Main.overview.toggle();
this.parent(event);
@@ -52,7 +52,7 @@ const ApplicationMenuItem = new Lang.Class({
Name: 'ApplicationMenuItem',
Extends: PopupMenu.PopupBaseMenuItem,
- _init: function(button, app) {
+ _init(button, app) {
this.parent();
this._app = app;
this._button = button;
@@ -91,32 +91,32 @@ const ApplicationMenuItem = new Lang.Class({
});
},
- activate: function(event) {
+ activate(event) {
this._app.open_new_window(-1);
this._button.selectCategory(null, null);
this._button.menu.toggle();
this.parent(event);
},
- setActive: function(active, params) {
+ setActive(active, params) {
if (active)
this._button.scrollToButton(this);
this.parent(active, params);
},
- setDragEnabled: function(enable) {
+ setDragEnabled(enable) {
this._dragEnabled = enable;
},
- getDragActor: function() {
+ getDragActor() {
return this._app.create_icon_texture(APPLICATION_ICON_SIZE);
},
- getDragActorSource: function() {
+ getDragActorSource() {
return this._iconBin;
},
- _updateIcon: function() {
+ _updateIcon() {
this._iconBin.set_child(this.getDragActor());
}
});
@@ -125,7 +125,7 @@ const CategoryMenuItem = new Lang.Class({
Name: 'CategoryMenuItem',
Extends: PopupMenu.PopupBaseMenuItem,
- _init: function(button, category) {
+ _init(button, category) {
this.parent();
this._category = category;
this._button = button;
@@ -143,13 +143,13 @@ const CategoryMenuItem = new Lang.Class({
this.actor.connect('motion-event', Lang.bind(this, this._onMotionEvent));
},
- activate: function(event) {
+ activate(event) {
this._button.selectCategory(this._category, this);
this._button.scrollToCatButton(this);
this.parent(event);
},
- _isNavigatingSubmenu: function([x, y]) {
+ _isNavigatingSubmenu([x, y]) {
let [posX, posY] = this.actor.get_transformed_position();
if (this._oldX == -1) {
@@ -206,7 +206,7 @@ const CategoryMenuItem = new Lang.Class({
return false;
},
- _onMotionEvent: function(actor, event) {
+ _onMotionEvent(actor, event) {
if (!Clutter.get_pointer_grab()) {
this._oldX = -1;
this._oldY = -1;
@@ -229,7 +229,7 @@ const CategoryMenuItem = new Lang.Class({
return false;
},
- setActive: function(active, params) {
+ setActive(active, params) {
if (active) {
this._button.selectCategory(this._category, this);
this._button.scrollToCatButton(this);
@@ -242,23 +242,23 @@ const ApplicationsMenu = new Lang.Class({
Name: 'ApplicationsMenu',
Extends: PopupMenu.PopupMenu,
- _init: function(sourceActor, arrowAlignment, arrowSide, button) {
+ _init(sourceActor, arrowAlignment, arrowSide, button) {
this.parent(sourceActor, arrowAlignment, arrowSide);
this._button = button;
},
- isEmpty: function() {
+ isEmpty() {
return false;
},
- open: function(animate) {
+ open(animate) {
this._button.hotCorner.setBarrierSize(0);
if (this._button.hotCorner.actor) // fallback corner
this._button.hotCorner.actor.hide();
this.parent(animate);
},
- close: function(animate) {
+ close(animate) {
let size = Main.layoutManager.panelBox.height;
this._button.hotCorner.setBarrierSize(size);
if (this._button.hotCorner.actor) // fallback corner
@@ -266,7 +266,7 @@ const ApplicationsMenu = new Lang.Class({
this.parent(animate);
},
- toggle: function() {
+ toggle() {
if (this.isOpen) {
this._button.selectCategory(null, null);
} else {
@@ -280,7 +280,7 @@ const ApplicationsMenu = new Lang.Class({
const DesktopTarget = new Lang.Class({
Name: 'DesktopTarget',
- _init: function() {
+ _init() {
this._desktop = null;
this._desktopDestroyedId = 0;
@@ -297,7 +297,7 @@ const DesktopTarget = new Lang.Class({
return this._desktop != null;
},
- _onWindowAdded: function(group, actor) {
+ _onWindowAdded(group, actor) {
if (!(actor instanceof Meta.WindowActor))
return;
@@ -305,7 +305,7 @@ const DesktopTarget = new Lang.Class({
this._setDesktop(actor);
},
- _setDesktop: function(desktop) {
+ _setDesktop(desktop) {
if (this._desktop) {
this._desktop.disconnect(this._desktopDestroyedId);
this._desktopDestroyedId = 0;
@@ -324,13 +324,13 @@ const DesktopTarget = new Lang.Class({
}
},
- _getSourceAppInfo: function(source) {
+ _getSourceAppInfo(source) {
if (!(source instanceof ApplicationMenuItem))
return null;
return source._app.app_info;
},
- _touchFile: function(file) {
+ _touchFile(file) {
let queryFlags = Gio.FileQueryInfoFlags.NONE;
let ioPriority = GLib.PRIORITY_DEFAULT;
@@ -347,7 +347,7 @@ const DesktopTarget = new Lang.Class({
});
},
- _markTrusted: function(file) {
+ _markTrusted(file) {
let modeAttr = Gio.FILE_ATTRIBUTE_UNIX_MODE;
let trustedAttr = 'metadata::trusted';
let queryFlags = Gio.FileQueryInfoFlags.NONE;
@@ -374,7 +374,7 @@ const DesktopTarget = new Lang.Class({
});
},
- destroy: function() {
+ destroy() {
if (this._windowAddedId)
global.window_group.disconnect(this._windowAddedId);
this._windowAddedId = 0;
@@ -382,7 +382,7 @@ const DesktopTarget = new Lang.Class({
this._setDesktop(null);
},
- handleDragOver: function(source, actor, x, y, time) {
+ handleDragOver(source, actor, x, y, time) {
let appInfo = this._getSourceAppInfo(source);
if (!appInfo)
return DND.DragMotionResult.CONTINUE;
@@ -390,7 +390,7 @@ const DesktopTarget = new Lang.Class({
return DND.DragMotionResult.COPY_DROP;
},
- acceptDrop: function(source, actor, x, y, time) {
+ acceptDrop(source, actor, x, y, time) {
let appInfo = this._getSourceAppInfo(source);
if (!appInfo)
return false;
@@ -419,7 +419,7 @@ const ApplicationsButton = new Lang.Class({
Name: 'ApplicationsButton',
Extends: PanelMenu.Button,
- _init: function() {
+ _init() {
this.parent(1.0, null, false);
this.setMenu(new ApplicationsMenu(this.actor, 1.0, St.Side.TOP, this));
@@ -483,14 +483,14 @@ const ApplicationsButton = new Lang.Class({
return Main.layoutManager.hotCorners[Main.layoutManager.primaryIndex];
},
- _createVertSeparator: function() {
+ _createVertSeparator() {
let separator = new St.DrawingArea({ style_class: 'calendar-vertical-separator',
pseudo_class: 'highlighted' });
separator.connect('repaint', Lang.bind(this, this._onVertSepRepaint));
return separator;
},
- _onDestroy: function() {
+ _onDestroy() {
Main.overview.disconnect(this._showingId);
Main.overview.disconnect(this._hidingId);
appSys.disconnect(this._installedChangedId);
@@ -505,7 +505,7 @@ const ApplicationsButton = new Lang.Class({
this._desktopTarget.destroy();
},
- _onCapturedEvent: function(actor, event) {
+ _onCapturedEvent(actor, event) {
if (event.type() == Clutter.EventType.BUTTON_PRESS) {
if (!Main.overview.shouldToggleByCornerOrButton())
return true;
@@ -513,7 +513,7 @@ const ApplicationsButton = new Lang.Class({
return false;
},
- _onMenuKeyPress: function(actor, event) {
+ _onMenuKeyPress(actor, event) {
let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) {
let direction = symbol == Clutter.KEY_Left ? Gtk.DirectionType.LEFT
@@ -524,7 +524,7 @@ const ApplicationsButton = new Lang.Class({
return this.parent(actor, event);
},
- _onVertSepRepaint: function(area) {
+ _onVertSepRepaint(area) {
let cr = area.get_context();
let themeNode = area.get_theme_node();
let [width, height] = area.get_surface_size();
@@ -539,7 +539,7 @@ const ApplicationsButton = new Lang.Class({
cr.stroke();
},
- _onOpenStateChanged: function(menu, open) {
+ _onOpenStateChanged(menu, open) {
if (open) {
if (this.reloadFlag) {
this._redisplay();
@@ -550,20 +550,20 @@ const ApplicationsButton = new Lang.Class({
this.parent(menu, open);
},
- _setKeybinding: function() {
+ _setKeybinding() {
Main.wm.setCustomKeybindingHandler('panel-main-menu',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
() => { this.menu.toggle(); });
},
- _redisplay: function() {
+ _redisplay() {
this.applicationsBox.destroy_all_children();
this.categoriesBox.destroy_all_children();
this._display();
},
- _loadCategory: function(categoryId, dir) {
+ _loadCategory(categoryId, dir) {
let iter = dir.iter();
let nextType;
while ((nextType = iter.next()) != GMenu.TreeItemType.INVALID) {
@@ -588,7 +588,7 @@ const ApplicationsButton = new Lang.Class({
}
},
- scrollToButton: function(button) {
+ scrollToButton(button) {
let appsScrollBoxAdj = this.applicationsScrollBox.get_vscroll_bar().get_adjustment();
let appsScrollBoxAlloc = this.applicationsScrollBox.get_allocation_box();
let currentScrollValue = appsScrollBoxAdj.get_value();
@@ -603,7 +603,7 @@ const ApplicationsButton = new Lang.Class({
appsScrollBoxAdj.set_value(newScrollValue);
},
- scrollToCatButton: function(button) {
+ scrollToCatButton(button) {
let catsScrollBoxAdj = this.categoriesScrollBox.get_vscroll_bar().get_adjustment();
let catsScrollBoxAlloc = this.categoriesScrollBox.get_allocation_box();
let currentScrollValue = catsScrollBoxAdj.get_value();
@@ -618,7 +618,7 @@ const ApplicationsButton = new Lang.Class({
catsScrollBoxAdj.set_value(newScrollValue);
},
- _createLayout: function() {
+ _createLayout() {
let section = new PopupMenu.PopupMenuSection();
this.menu.addMenuItem(section);
this.mainBox = new St.BoxLayout({ vertical: false });
@@ -661,7 +661,7 @@ const ApplicationsButton = new Lang.Class({
section.actor.add_actor(this.mainBox);
},
- _display: function() {
+ _display() {
this._applicationsButtons.clear();
this.mainBox.style=('width: 35em;');
this.mainBox.hide();
@@ -697,7 +697,7 @@ const ApplicationsButton = new Lang.Class({
this.mainBox.style+=('height: ' + height);
},
- _clearApplicationsBox: function(selectedActor) {
+ _clearApplicationsBox(selectedActor) {
let actors = this.applicationsBox.get_children();
for (let i = 0; i < actors.length; i++) {
let actor = actors[i];
@@ -705,7 +705,7 @@ const ApplicationsButton = new Lang.Class({
}
},
- selectCategory: function(dir, categoryMenuItem) {
+ selectCategory(dir, categoryMenuItem) {
if (categoryMenuItem)
this._clearApplicationsBox(categoryMenuItem.actor);
else
@@ -717,7 +717,7 @@ const ApplicationsButton = new Lang.Class({
this._displayButtons(this._listApplications(null));
},
- _displayButtons: function(apps) {
+ _displayButtons(apps) {
if (apps) {
for (let i = 0; i < apps.length; i++) {
let app = apps[i];
@@ -733,7 +733,7 @@ const ApplicationsButton = new Lang.Class({
}
},
- _listApplications: function(category_menu_id) {
+ _listApplications(category_menu_id) {
let applist;
if (category_menu_id) {
@@ -754,7 +754,7 @@ const ApplicationsButton = new Lang.Class({
return applist;
},
- destroy: function() {
+ destroy() {
this.menu.actor.get_children().forEach(c => { c.destroy() });
this.parent();
}
diff --git a/extensions/auto-move-windows/extension.js b/extensions/auto-move-windows/extension.js
index 4d367d7..19be352 100644
--- a/extensions/auto-move-windows/extension.js
+++ b/extensions/auto-move-windows/extension.js
@@ -22,7 +22,7 @@ let settings;
const WindowMover = new Lang.Class({
Name: 'AutoMoveWindows.WindowMover',
- _init: function() {
+ _init() {
this._settings = settings;
this._windowTracker = Shell.WindowTracker.get_default();
@@ -31,21 +31,21 @@ const WindowMover = new Lang.Class({
this._windowCreatedId = display.connect_after('window-created', Lang.bind(this, this._findAndMove));
},
- destroy: function() {
+ destroy() {
if (this._windowCreatedId) {
global.screen.get_display().disconnect(this._windowCreatedId);
this._windowCreatedId = 0;
}
},
- _ensureAtLeastWorkspaces: function(num, window) {
+ _ensureAtLeastWorkspaces(num, window) {
for (let j = global.screen.n_workspaces; j <= num; j++) {
window.change_workspace_by_index(j-1, false);
global.screen.append_new_workspace(false, 0);
}
},
- _findAndMove: function(display, window, noRecurse) {
+ _findAndMove(display, window, noRecurse) {
if (window.skip_taskbar)
return;
diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js
index e562a9d..52e25fd 100644
--- a/extensions/auto-move-windows/prefs.js
+++ b/extensions/auto-move-windows/prefs.js
@@ -31,7 +31,7 @@ const Widget = new GObject.Class({
GTypeName: 'AutoMoveWindowsPrefsWidget',
Extends: Gtk.Grid,
- _init: function(params) {
+ _init(params) {
this.parent(params);
this.set_orientation(Gtk.Orientation.VERTICAL);
@@ -97,7 +97,7 @@ const Widget = new GObject.Class({
this._refresh();
},
- _createNew: function() {
+ _createNew() {
let dialog = new Gtk.Dialog({ title: _("Create new matching rule"),
transient_for: this.get_toplevel(),
use_header_bar: true,
@@ -160,7 +160,7 @@ const Widget = new GObject.Class({
dialog.show_all();
},
- _deleteSelected: function() {
+ _deleteSelected() {
let [any, model, iter] = this._treeView.get_selection().get_selected();
if (any) {
@@ -173,7 +173,7 @@ const Widget = new GObject.Class({
}
},
- _workspaceEdited: function(renderer, pathString, text) {
+ _workspaceEdited(renderer, pathString, text) {
let index = parseInt(text);
if (isNaN(index) || index < 0)
index = 1;
@@ -187,7 +187,7 @@ const Widget = new GObject.Class({
this._changedPermitted = true;
},
- _refresh: function() {
+ _refresh() {
if (!this._changedPermitted)
// Ignore this notification, model is being modified outside
return;
@@ -217,18 +217,18 @@ const Widget = new GObject.Class({
this._settings.set_strv(SETTINGS_KEY, validItems);
},
- _checkId: function(id) {
+ _checkId(id) {
let items = this._settings.get_strv(SETTINGS_KEY);
return !items.some(i => i.startsWith(id + ':'));
},
- _appendItem: function(id, workspace) {
+ _appendItem(id, workspace) {
let currentItems = this._settings.get_strv(SETTINGS_KEY);
currentItems.push(id + ':' + workspace);
this._settings.set_strv(SETTINGS_KEY, currentItems);
},
- _removeItem: function(id) {
+ _removeItem(id) {
let currentItems = this._settings.get_strv(SETTINGS_KEY);
let index = currentItems.map(el => el.split(':')[0]).indexOf(id);
@@ -238,7 +238,7 @@ const Widget = new GObject.Class({
this._settings.set_strv(SETTINGS_KEY, currentItems);
},
- _changeItem: function(id, workspace) {
+ _changeItem(id, workspace) {
let currentItems = this._settings.get_strv(SETTINGS_KEY);
let index = currentItems.map(el => el.split(':')[0]).indexOf(id);
diff --git a/extensions/drive-menu/extension.js b/extensions/drive-menu/extension.js
index 249600c..12af236 100644
--- a/extensions/drive-menu/extension.js
+++ b/extensions/drive-menu/extension.js
@@ -22,7 +22,7 @@ const MountMenuItem = new Lang.Class({
Name: 'DriveMenu.MountMenuItem',
Extends: PopupMenu.PopupBaseMenuItem,
- _init: function(mount) {
+ _init(mount) {
this.parent();
this.label = new St.Label({ text: mount.get_name() });
@@ -41,7 +41,7 @@ const MountMenuItem = new Lang.Class({
this._syncVisibility();
},
- destroy: function() {
+ destroy() {
if (this._changedId) {
this.mount.disconnect(this._changedId);
this._changedId = 0;
@@ -50,7 +50,7 @@ const MountMenuItem = new Lang.Class({
this.parent();
},
- _isInteresting: function() {
+ _isInteresting() {
if (!this.mount.can_eject() && !this.mount.can_unmount())
return false;
if (this.mount.is_shadowed())
@@ -67,11 +67,11 @@ const MountMenuItem = new Lang.Class({
return volume.get_identifier('class') != 'network';
},
- _syncVisibility: function() {
+ _syncVisibility() {
this.actor.visible = this._isInteresting();
},
- _eject: function() {
+ _eject() {
let mountOp = new ShellMountOperation.ShellMountOperation(this.mount);
if (this.mount.can_eject())
@@ -86,7 +86,7 @@ const MountMenuItem = new Lang.Class({
Lang.bind(this, this._unmountFinish));
},
- _unmountFinish: function(mount, result) {
+ _unmountFinish(mount, result) {
try {
mount.unmount_with_operation_finish(result);
} catch(e) {
@@ -94,7 +94,7 @@ const MountMenuItem = new Lang.Class({
}
},
- _ejectFinish: function(mount, result) {
+ _ejectFinish(mount, result) {
try {
mount.eject_with_operation_finish(result);
} catch(e) {
@@ -102,13 +102,13 @@ const MountMenuItem = new Lang.Class({
}
},
- _reportFailure: function(exception) {
+ _reportFailure(exception) {
// TRANSLATORS: %s is the filesystem name
let msg = _("Ejecting drive “%s” failed:").format(this.mount.get_name());
Main.notifyError(msg, exception.message);
},
- activate: function(event) {
+ activate(event) {
let context = global.create_app_launch_context(event.get_time(), -1);
Gio.AppInfo.launch_default_for_uri(this.mount.get_root().get_uri(),
context);
@@ -121,7 +121,7 @@ const DriveMenu = new Lang.Class({
Name: 'DriveMenu.DriveMenu',
Extends: PanelMenu.Button,
- _init: function() {
+ _init() {
this.parent(0.0, _("Removable devices"));
let hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' });
@@ -156,20 +156,20 @@ const DriveMenu = new Lang.Class({
this._updateMenuVisibility();
},
- _updateMenuVisibility: function() {
+ _updateMenuVisibility() {
if (this._mounts.filter(i => i.actor.visible).length > 0)
this.actor.show();
else
this.actor.hide();
},
- _addMount: function(mount) {
+ _addMount(mount) {
let item = new MountMenuItem(mount);
this._mounts.unshift(item);
this.menu.addMenuItem(item, 0);
},
- _removeMount: function(mount) {
+ _removeMount(mount) {
for (let i = 0; i < this._mounts.length; i++) {
let item = this._mounts[i];
if (item.mount == mount) {
@@ -181,7 +181,7 @@ const DriveMenu = new Lang.Class({
log ('Removing a mount that was never added to the menu');
},
- destroy: function() {
+ destroy() {
if (this._connectedId) {
this._monitor.disconnect(this._connectedId);
this._monitor.disconnect(this._disconnectedId);
diff --git a/extensions/example/prefs.js b/extensions/example/prefs.js
index c40e809..40ff041 100644
--- a/extensions/example/prefs.js
+++ b/extensions/example/prefs.js
@@ -21,7 +21,7 @@ const ExamplePrefsWidget = new GObject.Class({
GTypeName: 'ExamplePrefsWidget',
Extends: Gtk.Grid,
- _init: function(params) {
+ _init(params) {
this.parent(params);
this.margin = 12;
this.row_spacing = this.column_spacing = 6;
diff --git a/extensions/native-window-placement/extension.js b/extensions/native-window-placement/extension.js
index 0796bf0..8a479cc 100644
--- a/extensions/native-window-placement/extension.js
+++ b/extensions/native-window-placement/extension.js
@@ -17,18 +17,18 @@ const WINDOW_PLACEMENT_NATURAL_MAX_TRANSLATIONS = 5000; // safety li
const Rect = new Lang.Class({
Name: 'NativeWindowPlacement.Rect',
- _init: function(x, y, width, height) {
+ _init(x, y, width, height) {
[this.x, this.y, this.width, this.height] = [x, y, width, height];
},
/**
* used in _calculateWindowTransformationsNatural to replace Meta.Rectangle that is too slow.
*/
- copy: function() {
+ copy() {
return new Rect(this.x, this.y, this.width, this.height);
},
- union: function(rect2) {
+ union(rect2) {
let dest = this.copy();
if (rect2.x < dest.x)
{
@@ -48,7 +48,7 @@ const Rect = new Lang.Class({
return dest;
},
- adjusted: function(dx, dy, dx2, dy2) {
+ adjusted(dx, dy, dx2, dy2) {
let dest = this.copy();
dest.x += dx;
dest.y += dy;
@@ -57,18 +57,18 @@ const Rect = new Lang.Class({
return dest;
},
- overlap: function(rect2) {
+ overlap(rect2) {
return !((this.x + this.width <= rect2.x) ||
(rect2.x + rect2.width <= this.x) ||
(this.y + this.height <= rect2.y) ||
(rect2.y + rect2.height <= this.y));
},
- center: function() {
+ center() {
return [this.x + this.width / 2, this.y + this.height / 2];
},
- translate: function(dx, dy) {
+ translate(dx, dy) {
this.x += dx;
this.y += dy;
}
@@ -78,11 +78,11 @@ const NaturalLayoutStrategy = new Lang.Class({
Name: 'NaturalLayoutStrategy',
Extends: Workspace.LayoutStrategy,
- _init: function(settings) {
+ _init(settings) {
this._settings = settings;
},
- computeLayout: function(windows, layout) {
+ computeLayout(windows, layout) {
layout.windows = windows;
},
@@ -92,7 +92,7 @@ const NaturalLayoutStrategy = new Lang.Class({
* PresentWindowsEffect::calculateWindowTransformationsNatural() from KDE, see:
*
https://projects.kde.org/projects/kde/kdebase/kde-workspace/repository/revisions/master/entry/kwin/effects/presentwindows/presentwindows.cpp
*/
- computeWindowSlots: function(layout, area) {
+ computeWindowSlots(layout, area) {
// As we are using pseudo-random movement (See "slot") we need to make sure the list
// is always sorted the same way no matter which window is currently active.
diff --git a/extensions/places-menu/extension.js b/extensions/places-menu/extension.js
index 3543f4c..4a0f599 100644
--- a/extensions/places-menu/extension.js
+++ b/extensions/places-menu/extension.js
@@ -27,7 +27,7 @@ const PlaceMenuItem = new Lang.Class({
Name: 'PlaceMenuItem',
Extends: PopupMenu.PopupBaseMenuItem,
- _init: function(info) {
+ _init(info) {
this.parent();
this._info = info;
@@ -42,7 +42,7 @@ const PlaceMenuItem = new Lang.Class({
Lang.bind(this, this._propertiesChanged));
},
- destroy: function() {
+ destroy() {
if (this._changedId) {
this._info.disconnect(this._changedId);
this._changedId = 0;
@@ -51,13 +51,13 @@ const PlaceMenuItem = new Lang.Class({
this.parent();
},
- activate: function(event) {
+ activate(event) {
this._info.launch(event.get_time());
this.parent(event);
},
- _propertiesChanged: function(info) {
+ _propertiesChanged(info) {
this._icon.gicon = info.icon;
this._label.text = info.name;
},
@@ -74,7 +74,7 @@ const PlacesMenu = new Lang.Class({
Name: 'PlacesMenu.PlacesMenu',
Extends: PanelMenu.Button,
- _init: function() {
+ _init() {
this.parent(0.0, _("Places"));
let hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' });
@@ -102,18 +102,18 @@ const PlacesMenu = new Lang.Class({
}
},
- destroy: function() {
+ destroy() {
this.placesManager.destroy();
this.parent();
},
- _redisplay: function(id) {
+ _redisplay(id) {
this._sections[id].removeAll();
this._create(id);
},
- _create: function(id) {
+ _create(id) {
let places = this.placesManager.get(id);
for (let i = 0; i < places.length; i++)
diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js
index 8dd6214..57a8517 100644
--- a/extensions/places-menu/placeDisplay.js
+++ b/extensions/places-menu/placeDisplay.js
@@ -31,21 +31,21 @@ const Hostname1 = Gio.DBusProxy.makeProxyWrapper(Hostname1Iface);
const PlaceInfo = new Lang.Class({
Name: 'PlaceInfo',
- _init: function(kind, file, name, icon) {
+ _init(kind, file, name, icon) {
this.kind = kind;
this.file = file;
this.name = name || this._getFileName();
this.icon = icon ? new Gio.ThemedIcon({ name: icon }) : this.getIcon();
},
- destroy: function() {
+ destroy() {
},
- isRemovable: function() {
+ isRemovable() {
return false;
},
- _createLaunchCallback: function(launchContext, tryMount) {
+ _createLaunchCallback(launchContext, tryMount) {
return (_ignored, result) => {
try {
Gio.AppInfo.launch_default_for_uri_finish(result);
@@ -80,7 +80,7 @@ const PlaceInfo = new Lang.Class({
}
},
- launch: function(timestamp) {
+ launch(timestamp) {
let launchContext = global.create_app_launch_context(timestamp, -1);
let callback = this._createLaunchCallback(launchContext, true);
Gio.AppInfo.launch_default_for_uri_async(this.file.get_uri(),
@@ -89,7 +89,7 @@ const PlaceInfo = new Lang.Class({
callback);
},
- getIcon: function() {
+ getIcon() {
this.file.query_info_async('standard::symbolic-icon', 0, 0, null,
(file, result) => {
try {
@@ -118,7 +118,7 @@ const PlaceInfo = new Lang.Class({
}
},
- _getFileName: function() {
+ _getFileName() {
try {
let info = this.file.query_info('standard::display-name', 0, null);
return info.get_display_name();
@@ -133,7 +133,7 @@ const RootInfo = new Lang.Class({
Name: 'RootInfo',
Extends: PlaceInfo,
- _init: function() {
+ _init() {
this.parent('devices', Gio.File.new_for_path('/'), _("Computer"));
this._proxy = new Hostname1(Gio.DBus.system,
@@ -149,11 +149,11 @@ const RootInfo = new Lang.Class({
});
},
- getIcon: function() {
+ getIcon() {
return new Gio.ThemedIcon({ name: 'drive-harddisk-symbolic' });
},
- _propertiesChanged: function(proxy) {
+ _propertiesChanged(proxy) {
// GDBusProxy will emit a g-properties-changed when hostname1 goes down
// ignore it
if (proxy.g_name_owner) {
@@ -162,7 +162,7 @@ const RootInfo = new Lang.Class({
}
},
- destroy: function() {
+ destroy() {
this._proxy.run_dispose();
this.parent();
}
@@ -173,12 +173,12 @@ const PlaceDeviceInfo = new Lang.Class({
Name: 'PlaceDeviceInfo',
Extends: PlaceInfo,
- _init: function(kind, mount) {
+ _init(kind, mount) {
this._mount = mount;
this.parent(kind, mount.get_root(), mount.get_name());
},
- getIcon: function() {
+ getIcon() {
return this._mount.get_symbolic_icon();
}
});
@@ -187,12 +187,12 @@ const PlaceVolumeInfo = new Lang.Class({
Name: 'PlaceVolumeInfo',
Extends: PlaceInfo,
- _init: function(kind, volume) {
+ _init(kind, volume) {
this._volume = volume;
this.parent(kind, volume.get_activation_root(), volume.get_name());
},
- launch: function(timestamp) {
+ launch(timestamp) {
if (this.file) {
this.parent(timestamp);
return;
@@ -207,7 +207,7 @@ const PlaceVolumeInfo = new Lang.Class({
});
},
- getIcon: function() {
+ getIcon() {
return this._volume.get_symbolic_icon();
}
});
@@ -223,7 +223,7 @@ const DEFAULT_DIRECTORIES = [
var PlacesManager = new Lang.Class({
Name: 'PlacesManager',
- _init: function() {
+ _init() {
this._places = {
special: [],
devices: [],
@@ -265,7 +265,7 @@ var PlacesManager = new Lang.Class({
}
},
- _connectVolumeMonitorSignals: function() {
+ _connectVolumeMonitorSignals() {
const signals = ['volume-added', 'volume-removed', 'volume-changed',
'mount-added', 'mount-removed', 'mount-changed',
'drive-connected', 'drive-disconnected', 'drive-changed'];
@@ -278,7 +278,7 @@ var PlacesManager = new Lang.Class({
}
},
- destroy: function() {
+ destroy() {
if (this._settings)
this._settings.disconnect(this._showDesktopIconsChangedId);
this._settings = null;
@@ -292,7 +292,7 @@ var PlacesManager = new Lang.Class({
Mainloop.source_remove(this._bookmarkTimeoutId);
},
- _updateSpecials: function() {
+ _updateSpecials() {
this._places.special.forEach(p => { p.destroy(); });
this._places.special = [];
@@ -329,7 +329,7 @@ var PlacesManager = new Lang.Class({
this.emit('special-updated');
},
- _updateMounts: function() {
+ _updateMounts() {
let networkMounts = [];
let networkVolumes = [];
@@ -412,7 +412,7 @@ var PlacesManager = new Lang.Class({
this.emit('network-updated');
},
- _findBookmarksFile: function() {
+ _findBookmarksFile() {
let paths = [
GLib.build_filenamev([GLib.get_user_config_dir(), 'gtk-3.0', 'bookmarks']),
GLib.build_filenamev([GLib.get_home_dir(), '.gtk-bookmarks']),
@@ -426,7 +426,7 @@ var PlacesManager = new Lang.Class({
return null;
},
- _reloadBookmarks: function() {
+ _reloadBookmarks() {
this._bookmarks = [];
@@ -476,7 +476,7 @@ var PlacesManager = new Lang.Class({
this.emit('bookmarks-updated');
},
- _addMount: function(kind, mount) {
+ _addMount(kind, mount) {
let devItem;
try {
@@ -488,7 +488,7 @@ var PlacesManager = new Lang.Class({
this._places[kind].push(devItem);
},
- _addVolume: function(kind, volume) {
+ _addVolume(kind, volume) {
let volItem;
try {
@@ -500,7 +500,7 @@ var PlacesManager = new Lang.Class({
this._places[kind].push(volItem);
},
- get: function(kind) {
+ get(kind) {
return this._places[kind];
}
});
diff --git a/extensions/user-theme/extension.js b/extensions/user-theme/extension.js
index b36d36a..13dc457 100644
--- a/extensions/user-theme/extension.js
+++ b/extensions/user-theme/extension.js
@@ -15,16 +15,16 @@ const Convenience = Me.imports.convenience;
const ThemeManager = new Lang.Class({
Name: 'UserTheme.ThemeManager',
- _init: function() {
+ _init() {
this._settings = Convenience.getSettings();
},
- enable: function() {
+ enable() {
this._changedId = this._settings.connect('changed::'+SETTINGS_KEY, Lang.bind(this,
this._changeTheme));
this._changeTheme();
},
- disable: function() {
+ disable() {
if (this._changedId) {
this._settings.disconnect(this._changedId);
this._changedId = 0;
@@ -34,7 +34,7 @@ const ThemeManager = new Lang.Class({
Main.loadTheme();
},
- _changeTheme: function() {
+ _changeTheme() {
let _stylesheet = null;
let _themeName = this._settings.get_string(SETTINGS_KEY);
diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js
index 9f34b31..5a5ce95 100644
--- a/extensions/window-list/extension.js
+++ b/extensions/window-list/extension.js
@@ -68,7 +68,7 @@ const WindowContextMenu = new Lang.Class({
Name: 'WindowContextMenu',
Extends: PopupMenu.PopupMenu,
- _init: function(source, metaWindow) {
+ _init(source, metaWindow) {
this.parent(source, 0.5, St.Side.BOTTOM);
this._metaWindow = metaWindow;
@@ -125,19 +125,19 @@ const WindowContextMenu = new Lang.Class({
});
},
- _updateMinimizeItem: function() {
+ _updateMinimizeItem() {
this._minimizeItem.label.text = this._metaWindow.minimized ? _("Unminimize")
: _("Minimize");
},
- _updateMaximizeItem: function() {
+ _updateMaximizeItem() {
let maximized = this._metaWindow.maximized_vertically &&
this._metaWindow.maximized_horizontally;
this._maximizeItem.label.text = maximized ? _("Unmaximize")
: _("Maximize");
},
- _onDestroy: function() {
+ _onDestroy() {
this._metaWindow.disconnect(this._notifyMinimizedId);
this._metaWindow.disconnect(this._notifyMaximizedHId);
this._metaWindow.disconnect(this._notifyMaximizedVId);
@@ -147,7 +147,7 @@ const WindowContextMenu = new Lang.Class({
const WindowTitle = new Lang.Class({
Name: 'WindowTitle',
- _init: function(metaWindow) {
+ _init(metaWindow) {
this._metaWindow = metaWindow;
this.actor = new St.BoxLayout({ style_class: 'window-button-box',
x_expand: true, y_expand: true });
@@ -180,12 +180,12 @@ const WindowTitle = new Lang.Class({
this._minimizedChanged();
},
- _minimizedChanged: function() {
+ _minimizedChanged() {
this._icon.opacity = this._metaWindow.minimized ? 128 : 255;
this._updateTitle();
},
- _updateTitle: function() {
+ _updateTitle() {
if (!this._metaWindow.title)
return;
@@ -195,7 +195,7 @@ const WindowTitle = new Lang.Class({
this.label_actor.text = this._metaWindow.title;
},
- _updateIcon: function() {
+ _updateIcon() {
let app = Shell.WindowTracker.get_default().get_window_app(this._metaWindow);
if (app)
this._icon.child = app.create_icon_texture(ICON_TEXTURE_SIZE);
@@ -204,7 +204,7 @@ const WindowTitle = new Lang.Class({
icon_size: ICON_TEXTURE_SIZE });
},
- _onDestroy: function() {
+ _onDestroy() {
this._textureCache.disconnect(this._iconThemeChangedId);
this._metaWindow.disconnect(this._notifyTitleId);
this._metaWindow.disconnect(this._notifyMinimizedId);
@@ -218,7 +218,7 @@ const BaseButton = new Lang.Class({
Name: 'BaseButton',
Abstract: true,
- _init: function(perMonitor, monitorIndex) {
+ _init(perMonitor, monitorIndex) {
this._perMonitor = perMonitor;
this._monitorIndex = monitorIndex;
@@ -256,43 +256,43 @@ const BaseButton = new Lang.Class({
return this.actor.has_style_class_name('focused');
},
- activate: function() {
+ activate() {
if (this.active)
return;
this._onClicked(this.actor, 1);
},
- _onClicked: function(actor, button) {
+ _onClicked(actor, button) {
throw new Error('Not implemented');
},
- _canOpenPopupMenu: function() {
+ _canOpenPopupMenu() {
return true;
},
- _onPopupMenu: function(actor) {
+ _onPopupMenu(actor) {
if (!this._canOpenPopupMenu() || this._contextMenu.isOpen)
return;
_openMenu(this._contextMenu);
},
- _isFocused: function() {
+ _isFocused() {
throw new Error('Not implemented');
},
- _updateStyle: function() {
+ _updateStyle() {
if (this._isFocused())
this.actor.add_style_class_name('focused');
else
this.actor.remove_style_class_name('focused');
},
- _windowEnteredOrLeftMonitor: function(metaScreen, monitorIndex, metaWindow) {
+ _windowEnteredOrLeftMonitor(metaScreen, monitorIndex, metaWindow) {
throw new Error('Not implemented');
},
- _isWindowVisible: function(window) {
+ _isWindowVisible(window) {
let workspace = global.screen.get_active_workspace();
return !window.skip_taskbar &&
@@ -300,11 +300,11 @@ const BaseButton = new Lang.Class({
(!this._perMonitor || window.get_monitor() == this._monitorIndex);
},
- _updateVisibility: function() {
+ _updateVisibility() {
throw new Error('Not implemented');
},
- _getIconGeometry: function() {
+ _getIconGeometry() {
let rect = new Meta.Rectangle();
[rect.x, rect.y] = this.actor.get_transformed_position();
@@ -313,11 +313,11 @@ const BaseButton = new Lang.Class({
return rect;
},
- _updateIconGeometry: function() {
+ _updateIconGeometry() {
throw new Error('Not implemented');
},
- _onDestroy: function() {
+ _onDestroy() {
global.window_manager.disconnect(this._switchWorkspaceId);
if (this._windowEnteredMonitorId)
@@ -335,7 +335,7 @@ const WindowButton = new Lang.Class({
Name: 'WindowButton',
Extends: BaseButton,
- _init: function(metaWindow, perMonitor, monitorIndex) {
+ _init(metaWindow, perMonitor, monitorIndex) {
this.parent(perMonitor, monitorIndex);
this.metaWindow = metaWindow;
@@ -361,7 +361,7 @@ const WindowButton = new Lang.Class({
this._updateStyle();
},
- _onClicked: function(actor, button) {
+ _onClicked(actor, button) {
if (this._contextMenu.isOpen) {
this._contextMenu.close();
return;
@@ -373,11 +373,11 @@ const WindowButton = new Lang.Class({
_openMenu(this._contextMenu);
},
- _isFocused: function() {
+ _isFocused() {
return global.display.focus_window == this.metaWindow;
},
- _updateStyle: function() {
+ _updateStyle() {
this.parent();
if (this.metaWindow.minimized)
@@ -386,20 +386,20 @@ const WindowButton = new Lang.Class({
this.actor.remove_style_class_name('minimized');
},
- _windowEnteredOrLeftMonitor: function(metaScreen, monitorIndex, metaWindow) {
+ _windowEnteredOrLeftMonitor(metaScreen, monitorIndex, metaWindow) {
if (monitorIndex == this._monitorIndex && metaWindow == this.metaWindow)
this._updateVisibility();
},
- _updateVisibility: function() {
+ _updateVisibility() {
this.actor.visible = this._isWindowVisible(this.metaWindow);
},
- _updateIconGeometry: function() {
+ _updateIconGeometry() {
this.metaWindow.set_icon_geometry(this._getIconGeometry());
},
- _onDestroy: function() {
+ _onDestroy() {
this.parent();
this.metaWindow.disconnect(this._workspaceChangedId);
global.display.disconnect(this._notifyFocusId);
@@ -412,7 +412,7 @@ const AppContextMenu = new Lang.Class({
Name: 'AppContextMenu',
Extends: PopupMenu.PopupMenu,
- _init: function(source, appButton) {
+ _init(source, appButton) {
this.parent(source, 0.5, St.Side.BOTTOM);
this._appButton = appButton;
@@ -456,7 +456,7 @@ const AppContextMenu = new Lang.Class({
this.addMenuItem(item);
},
- open: function(animate) {
+ open(animate) {
let windows = this._appButton.getWindowList();
this._minimizeItem.actor.visible = windows.some(w => !w.minimized);
this._unminimizeItem.actor.visible = windows.some(w => w.minimized);
@@ -475,7 +475,7 @@ const AppButton = new Lang.Class({
Name: 'AppButton',
Extends: BaseButton,
- _init: function(app, perMonitor, monitorIndex) {
+ _init(app, perMonitor, monitorIndex) {
this.parent(perMonitor, monitorIndex);
this.app = app;
@@ -533,7 +533,7 @@ const AppButton = new Lang.Class({
this._updateStyle();
},
- _windowEnteredOrLeftMonitor: function(metaScreen, monitorIndex, metaWindow) {
+ _windowEnteredOrLeftMonitor(metaScreen, monitorIndex, metaWindow) {
if (this._windowTracker.get_window_app(metaWindow) == this.app &&
monitorIndex == this._monitorIndex) {
this._updateVisibility();
@@ -541,7 +541,7 @@ const AppButton = new Lang.Class({
}
},
- _updateVisibility: function() {
+ _updateVisibility() {
if (!this._perMonitor) {
// fast path: use ShellApp API to avoid iterating over all windows.
let workspace = global.screen.get_active_workspace();
@@ -551,22 +551,22 @@ const AppButton = new Lang.Class({
}
},
- _isFocused: function() {
+ _isFocused() {
return this._windowTracker.focus_app == this.app;
},
- _updateIconGeometry: function() {
+ _updateIconGeometry() {
let rect = this._getIconGeometry();
let windows = this.app.get_windows();
windows.forEach(w => { w.set_icon_geometry(rect); });
},
- getWindowList: function() {
+ getWindowList() {
return this.app.get_windows().filter(win => this._isWindowVisible(win));
},
- _windowsChanged: function() {
+ _windowsChanged() {
let windows = this.getWindowList();
this._singleWindowTitle.visible = windows.length == 1;
this._multiWindowTitle.visible = !this._singleWindowTitle.visible;
@@ -601,7 +601,7 @@ const AppButton = new Lang.Class({
},
- _onClicked: function(actor, button) {
+ _onClicked(actor, button) {
let menuWasOpen = this._menu.isOpen;
if (menuWasOpen)
this._menu.close();
@@ -638,15 +638,15 @@ const AppButton = new Lang.Class({
}
},
- _canOpenPopupMenu: function() {
+ _canOpenPopupMenu() {
return !this._menu.isOpen;
},
- _onMenuActivate: function(menu, child) {
+ _onMenuActivate(menu, child) {
child._window.activate(global.get_current_time());
},
- _onDestroy: function() {
+ _onDestroy() {
this.parent();
this._textureCache.disconnect(this._iconThemeChangedId);
this._windowTracker.disconnect(this._notifyFocusId);
@@ -660,7 +660,7 @@ const WorkspaceIndicator = new Lang.Class({
Name: 'WindowList.WorkspaceIndicator',
Extends: PanelMenu.Button,
- _init: function() {
+ _init() {
this.parent(0.0, _("Workspace Indicator"), true);
this.setMenu(new PopupMenu.PopupMenu(this.actor, 0.0, St.Side.BOTTOM));
this.actor.add_style_class_name('window-list-workspace-indicator');
@@ -689,7 +689,7 @@ const WorkspaceIndicator = new Lang.Class({
this._settingsChangedId = this._settings.connect('changed::workspace-names', Lang.bind(this,
this._updateMenu));
},
- destroy: function() {
+ destroy() {
for (let i = 0; i < this._screenSignals.length; i++)
global.screen.disconnect(this._screenSignals[i]);
@@ -701,7 +701,7 @@ const WorkspaceIndicator = new Lang.Class({
this.parent();
},
- _updateIndicator: function() {
+ _updateIndicator() {
this.workspacesItems[this._currentWorkspace].setOrnament(PopupMenu.Ornament.NONE);
this._currentWorkspace = global.screen.get_active_workspace().index();
this.workspacesItems[this._currentWorkspace].setOrnament(PopupMenu.Ornament.DOT);
@@ -709,14 +709,14 @@ const WorkspaceIndicator = new Lang.Class({
this.statusLabel.set_text(this._getStatusText());
},
- _getStatusText: function() {
+ _getStatusText() {
let current = global.screen.get_active_workspace().index();
let total = global.screen.n_workspaces;
return '%d / %d'.format(current + 1, total);
},
- _updateMenu: function() {
+ _updateMenu() {
this.menu.removeAll();
this.workspacesItems = [];
this._currentWorkspace = global.screen.get_active_workspace().index();
@@ -740,14 +740,14 @@ const WorkspaceIndicator = new Lang.Class({
this.statusLabel.set_text(this._getStatusText());
},
- _activate: function(index) {
+ _activate(index) {
if(index >= 0 && index < global.screen.n_workspaces) {
let metaWorkspace = global.screen.get_workspace_by_index(index);
metaWorkspace.activate(global.get_current_time());
}
},
- _onScrollEvent: function(actor, event) {
+ _onScrollEvent(actor, event) {
let direction = event.get_scroll_direction();
let diff = 0;
if (direction == Clutter.ScrollDirection.DOWN) {
@@ -762,7 +762,7 @@ const WorkspaceIndicator = new Lang.Class({
this._activate(newIndex);
},
- _allocate: function(actor, box, flags) {
+ _allocate(actor, box, flags) {
if (actor.get_n_children() > 0)
actor.get_first_child().allocate(box, flags);
}
@@ -771,7 +771,7 @@ const WorkspaceIndicator = new Lang.Class({
const WindowList = new Lang.Class({
Name: 'WindowList',
- _init: function(perMonitor, monitor) {
+ _init(perMonitor, monitor) {
this._perMonitor = perMonitor;
this._monitor = monitor;
@@ -897,20 +897,20 @@ const WindowList = new Lang.Class({
this._groupingModeChanged();
},
- _getDynamicWorkspacesSettings: function() {
+ _getDynamicWorkspacesSettings() {
if (this._workspaceSettings.list_keys().indexOf('dynamic-workspaces') > -1)
return this._workspaceSettings;
return this._mutterSettings;
},
- _getWorkspaceSettings: function() {
+ _getWorkspaceSettings() {
let settings = global.get_overrides_settings();
if (settings.list_keys().indexOf('workspaces-only-on-primary') > -1)
return settings;
return this._mutterSettings;
},
- _onScrollEvent: function(actor, event) {
+ _onScrollEvent(actor, event) {
let direction = event.get_scroll_direction();
let diff = 0;
if (direction == Clutter.ScrollDirection.DOWN)
@@ -933,12 +933,12 @@ const WindowList = new Lang.Class({
children[active].activate();
},
- _updatePosition: function() {
+ _updatePosition() {
this.actor.set_position(this._monitor.x,
this._monitor.y + this._monitor.height - this.actor.height);
},
- _updateWorkspaceIndicatorVisibility: function() {
+ _updateWorkspaceIndicatorVisibility() {
let hasWorkspaces = this._dynamicWorkspacesSettings.get_boolean('dynamic-workspaces') ||
global.screen.n_workspaces > 1;
let workspacesOnMonitor = this._monitor == Main.layoutManager.primaryMonitor ||
@@ -947,7 +947,7 @@ const WindowList = new Lang.Class({
this._workspaceIndicator.actor.visible = hasWorkspaces && workspacesOnMonitor;
},
- _getPreferredUngroupedWindowListWidth: function() {
+ _getPreferredUngroupedWindowListWidth() {
if (this._windowList.get_n_children() == 0)
return this._windowList.get_preferred_width(-1)[1];
@@ -966,12 +966,12 @@ const WindowList = new Lang.Class({
return nWindows * childWidth + (nWindows - 1) * spacing;
},
- _getMaxWindowListWidth: function() {
+ _getMaxWindowListWidth() {
let indicatorsBox = this._workspaceIndicator.actor.get_parent();
return this.actor.width - indicatorsBox.get_preferred_width(-1)[1];
},
- _groupingModeChanged: function() {
+ _groupingModeChanged() {
this._groupingMode = this._settings.get_enum('grouping-mode');
if (this._groupingMode == GroupingMode.AUTO) {
@@ -982,7 +982,7 @@ const WindowList = new Lang.Class({
}
},
- _checkGrouping: function() {
+ _checkGrouping() {
if (this._groupingMode != GroupingMode.AUTO)
return;
@@ -996,7 +996,7 @@ const WindowList = new Lang.Class({
}
},
- _populateWindowList: function() {
+ _populateWindowList() {
this._windowList.destroy_all_children();
if (!this._grouped) {
@@ -1016,7 +1016,7 @@ const WindowList = new Lang.Class({
}
},
- _updateKeyboardAnchor: function() {
+ _updateKeyboardAnchor() {
if (!Main.keyboard.actor)
return;
@@ -1024,7 +1024,7 @@ const WindowList = new Lang.Class({
Main.keyboard.actor.anchor_y = anchorY;
},
- _onAppStateChanged: function(appSys, app) {
+ _onAppStateChanged(appSys, app) {
if (!this._grouped)
return;
@@ -1034,7 +1034,7 @@ const WindowList = new Lang.Class({
this._removeApp(app);
},
- _addApp: function(app) {
+ _addApp(app) {
let button = new AppButton(app, this._perMonitor, this._monitor.index);
this._windowList.layout_manager.pack(button.actor,
true, true, true,
@@ -1042,7 +1042,7 @@ const WindowList = new Lang.Class({
Clutter.BoxAlignment.START);
},
- _removeApp: function(app) {
+ _removeApp(app) {
let children = this._windowList.get_children();
for (let i = 0; i < children.length; i++) {
if (children[i]._delegate.app == app) {
@@ -1052,7 +1052,7 @@ const WindowList = new Lang.Class({
}
},
- _onWindowAdded: function(ws, win) {
+ _onWindowAdded(ws, win) {
if (win.skip_taskbar)
return;
@@ -1075,7 +1075,7 @@ const WindowList = new Lang.Class({
Clutter.BoxAlignment.START);
},
- _onWindowRemoved: function(ws, win) {
+ _onWindowRemoved(ws, win) {
if (this._grouped)
this._checkGrouping();
@@ -1094,7 +1094,7 @@ const WindowList = new Lang.Class({
}
},
- _onWorkspacesChanged: function() {
+ _onWorkspacesChanged() {
let numWorkspaces = global.screen.n_workspaces;
for (let i = 0; i < numWorkspaces; i++) {
let workspace = global.screen.get_workspace_by_index(i);
@@ -1114,7 +1114,7 @@ const WindowList = new Lang.Class({
this._updateWorkspaceIndicatorVisibility();
},
- _disconnectWorkspaceSignals: function() {
+ _disconnectWorkspaceSignals() {
let numWorkspaces = global.screen.n_workspaces;
for (let i = 0; i < numWorkspaces; i++) {
let workspace = global.screen.get_workspace_by_index(i);
@@ -1125,16 +1125,16 @@ const WindowList = new Lang.Class({
}
},
- _onDragBegin: function() {
+ _onDragBegin() {
DND.addDragMonitor(this._dragMonitor);
},
- _onDragEnd: function() {
+ _onDragEnd() {
DND.removeDragMonitor(this._dragMonitor);
this._removeActivateTimeout();
},
- _onDragMotion: function(dragEvent) {
+ _onDragMotion(dragEvent) {
if (Main.overview.visible ||
!this.actor.contains(dragEvent.targetActor)) {
this._removeActivateTimeout();
@@ -1159,14 +1159,14 @@ const WindowList = new Lang.Class({
return DND.DragMotionResult.CONTINUE;
},
- _removeActivateTimeout: function() {
+ _removeActivateTimeout() {
if (this._dndTimeoutId)
GLib.source_remove (this._dndTimeoutId);
this._dndTimeoutId = 0;
this._dndWindow = null;
},
- _activateWindow: function() {
+ _activateWindow() {
let [x, y] = global.get_pointer();
let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
@@ -1178,7 +1178,7 @@ const WindowList = new Lang.Class({
return false;
},
- _onDestroy: function() {
+ _onDestroy() {
this._workspaceSettings.disconnect(this._workspacesOnlyOnPrimaryChangedId);
this._dynamicWorkspacesSettings.disconnect(this._dynamicWorkspacesChangedId);
@@ -1221,12 +1221,12 @@ const WindowList = new Lang.Class({
const Extension = new Lang.Class({
Name: 'Extension',
- _init: function() {
+ _init() {
this._windowLists = null;
this._injections = {};
},
- enable: function() {
+ enable() {
this._windowLists = [];
this._settings = Convenience.getSettings();
@@ -1241,7 +1241,7 @@ const Extension = new Lang.Class({
this._buildWindowLists();
},
- _buildWindowLists: function() {
+ _buildWindowLists() {
this._windowLists.forEach(list => { list.actor.destroy(); });
this._windowLists = [];
@@ -1253,7 +1253,7 @@ const Extension = new Lang.Class({
});
},
- disable: function() {
+ disable() {
if (!this._windowLists)
return;
@@ -1270,7 +1270,7 @@ const Extension = new Lang.Class({
this._windowLists = null;
},
- someWindowListContains: function(actor) {
+ someWindowListContains(actor) {
return this._windowLists.some(list => list.actor.contains(actor));
}
});
diff --git a/extensions/window-list/prefs.js b/extensions/window-list/prefs.js
index e7026ad..c5e13ee 100644
--- a/extensions/window-list/prefs.js
+++ b/extensions/window-list/prefs.js
@@ -21,7 +21,7 @@ const WindowListPrefsWidget = new GObject.Class({
GTypeName: 'WindowListPrefsWidget',
Extends: Gtk.Grid,
- _init: function(params) {
+ _init(params) {
this.parent(params);
this.margin = 24;
diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js
index 810ffb6..eb4cfe1 100644
--- a/extensions/workspace-indicator/extension.js
+++ b/extensions/workspace-indicator/extension.js
@@ -26,7 +26,7 @@ const WorkspaceIndicator = new Lang.Class({
Name: 'WorkspaceIndicator.WorkspaceIndicator',
Extends: PanelMenu.Button,
- _init: function() {
+ _init() {
this.parent(0.0, _("Workspace Indicator"));
this._currentWorkspace = global.screen.get_active_workspace().index();
@@ -54,7 +54,7 @@ const WorkspaceIndicator = new Lang.Class({
this._settingsChangedId = this._settings.connect('changed::' + WORKSPACE_KEY, Lang.bind(this,
this._createWorkspacesSection));
},
- destroy: function() {
+ destroy() {
for (let i = 0; i < this._screenSignals.length; i++)
global.screen.disconnect(this._screenSignals[i]);
@@ -66,7 +66,7 @@ const WorkspaceIndicator = new Lang.Class({
this.parent();
},
- _updateIndicator: function() {
+ _updateIndicator() {
this.workspacesItems[this._currentWorkspace].setOrnament(PopupMenu.Ornament.NONE);
this._currentWorkspace = global.screen.get_active_workspace().index();
this.workspacesItems[this._currentWorkspace].setOrnament(PopupMenu.Ornament.DOT);
@@ -74,7 +74,7 @@ const WorkspaceIndicator = new Lang.Class({
this.statusLabel.set_text(this._labelText());
},
- _labelText: function(workspaceIndex) {
+ _labelText(workspaceIndex) {
if(workspaceIndex == undefined) {
workspaceIndex = this._currentWorkspace;
return (workspaceIndex + 1).toString();
@@ -82,7 +82,7 @@ const WorkspaceIndicator = new Lang.Class({
return Meta.prefs_get_workspace_name(workspaceIndex);
},
- _createWorkspacesSection: function() {
+ _createWorkspacesSection() {
this._workspaceSection.removeAll();
this.workspacesItems = [];
this._currentWorkspace = global.screen.get_active_workspace().index();
@@ -105,14 +105,14 @@ const WorkspaceIndicator = new Lang.Class({
this.statusLabel.set_text(this._labelText());
},
- _activate: function(index) {
+ _activate(index) {
if(index >= 0 && index < global.screen.n_workspaces) {
let metaWorkspace = global.screen.get_workspace_by_index(index);
metaWorkspace.activate(global.get_current_time());
}
},
- _onScrollEvent: function(actor, event) {
+ _onScrollEvent(actor, event) {
let direction = event.get_scroll_direction();
let diff = 0;
if (direction == Clutter.ScrollDirection.DOWN) {
diff --git a/extensions/workspace-indicator/prefs.js b/extensions/workspace-indicator/prefs.js
index 5913ab3..3dbde70 100644
--- a/extensions/workspace-indicator/prefs.js
+++ b/extensions/workspace-indicator/prefs.js
@@ -26,7 +26,7 @@ const WorkspaceNameModel = new GObject.Class({
LABEL: 0,
},
- _init: function(params) {
+ _init(params) {
this.parent(params);
this.set_column_types([GObject.TYPE_STRING]);
@@ -42,7 +42,7 @@ const WorkspaceNameModel = new GObject.Class({
this.connect('row-deleted', Lang.bind(this, this._onRowDeleted));
},
- _reloadFromSettings: function() {
+ _reloadFromSettings() {
if (this._preventChanges)
return;
this._preventChanges = true;
@@ -69,7 +69,7 @@ const WorkspaceNameModel = new GObject.Class({
this._preventChanges = false;
},
- _onRowChanged: function(self, path, iter) {
+ _onRowChanged(self, path, iter) {
if (this._preventChanges)
return;
this._preventChanges = true;
@@ -90,7 +90,7 @@ const WorkspaceNameModel = new GObject.Class({
this._preventChanges = false;
},
- _onRowInserted: function(self, path, iter) {
+ _onRowInserted(self, path, iter) {
if (this._preventChanges)
return;
this._preventChanges = true;
@@ -105,7 +105,7 @@ const WorkspaceNameModel = new GObject.Class({
this._preventChanges = false;
},
- _onRowDeleted: function(self, path) {
+ _onRowDeleted(self, path) {
if (this._preventChanges)
return;
this._preventChanges = true;
@@ -133,7 +133,7 @@ const WorkspaceSettingsWidget = new GObject.Class({
GTypeName: 'WorkspaceSettingsWidget',
Extends: Gtk.Grid,
- _init: function(params) {
+ _init(params) {
this.parent(params);
this.margin = 12;
this.orientation = Gtk.Orientation.VERTICAL;
@@ -183,14 +183,14 @@ const WorkspaceSettingsWidget = new GObject.Class({
this.add(toolbar);
},
- _cellEdited: function(renderer, path, new_text) {
+ _cellEdited(renderer, path, new_text) {
let [ok, iter] = this._store.get_iter_from_string(path);
if (ok)
this._store.set(iter, [this._store.Columns.LABEL], [new_text]);
},
- _newClicked: function() {
+ _newClicked() {
let iter = this._store.append();
let index = this._store.get_path(iter).get_indices()[0];
@@ -198,7 +198,7 @@ const WorkspaceSettingsWidget = new GObject.Class({
this._store.set(iter, [this._store.Columns.LABEL], [label]);
},
- _delClicked: function() {
+ _delClicked() {
let [any, model, iter] = this._treeView.get_selection().get_selected();
if (any)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]