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:

committed by
Georges Basile Stavracas Neto

parent
99ce3deeb0
commit
bacfdbbb03
@ -2,12 +2,8 @@ const Clutter = imports.gi.Clutter;
|
||||
const Pango = imports.gi.Pango;
|
||||
const St = imports.gi.St;
|
||||
|
||||
const Lang = imports.lang;
|
||||
|
||||
var CheckBox = new Lang.Class({
|
||||
Name: 'CheckBox',
|
||||
|
||||
_init(label) {
|
||||
var CheckBox = class CheckBox {
|
||||
constructor(label) {
|
||||
let container = new St.BoxLayout();
|
||||
this.actor = new St.Button({ style_class: 'check-box',
|
||||
child: container,
|
||||
@ -28,13 +24,13 @@ var CheckBox = new Lang.Class({
|
||||
|
||||
if (label)
|
||||
this.setLabel(label);
|
||||
},
|
||||
}
|
||||
|
||||
setLabel(label) {
|
||||
this._label.set_text(label);
|
||||
},
|
||||
}
|
||||
|
||||
getLabelActor() {
|
||||
return this._label;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
Reference in New Issue
Block a user