cleanup: Port non-GObject classes to JS6 classes

ES6 finally adds standard class syntax to the language, so we can
replace our custom Lang.Class framework with the new syntax. Any
classes that inherit from GObject will need special treatment,
so limit the port to regular javascript classes for now.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/361
This commit is contained in:
Florian Müllner
2017-10-31 02:19:44 +01:00
committed by Georges Basile Stavracas Neto
parent 99ce3deeb0
commit bacfdbbb03
102 changed files with 3454 additions and 4183 deletions

View File

@ -1,17 +1,13 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Lang = imports.lang;
const Meta = imports.gi.Meta;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
var RemoteAccessApplet = new Lang.Class({
Name: 'RemoteAccessApplet',
Extends: PanelMenu.SystemIndicator,
_init() {
this.parent();
var RemoteAccessApplet = class extends PanelMenu.SystemIndicator {
constructor() {
super();
let backend = Meta.get_backend();
let controller = backend.get_remote_access_controller();
@ -33,7 +29,7 @@ var RemoteAccessApplet = new Lang.Class({
controller.connect('new-handle', (controller, handle) => {
this._onNewHandle(handle);
});
},
}
_ensureControls() {
if (this._indicator)
@ -52,7 +48,7 @@ var RemoteAccessApplet = new Lang.Class({
});
this._item.icon.icon_name = 'screen-shared-symbolic';
this.menu.addMenuItem(this._item);
},
}
_sync() {
if (this._handles.size == 0) {
@ -62,12 +58,12 @@ var RemoteAccessApplet = new Lang.Class({
this._indicator.visible = true;
this._item.actor.visible = true;
}
},
}
_onStopped(handle) {
this._handles.delete(handle);
this._sync();
},
}
_onNewHandle(handle) {
this._handles.add(handle);
@ -77,5 +73,5 @@ var RemoteAccessApplet = new Lang.Class({
this._ensureControls();
this._sync();
}
},
});
}
};