mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
cleanup: Use inheritance for Actor classes instead of composition
Remove the `this.actor = ...` and `this.actor._delegate = this` patterns in most of classes, by inheriting all the actor container classes. Uses interfaces when needed for making sure that multiple classes will implement some required methods or to avoid redefining the same code multiple times. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
This commit is contained in:
parent
f67b409fc1
commit
c4c5c4fd5c
58 changed files with 2000 additions and 1757 deletions
|
|
@ -1,16 +1,19 @@
|
|||
/* exported CheckBox */
|
||||
const { Clutter, Pango, St } = imports.gi;
|
||||
const { Clutter, GObject, Pango, St } = imports.gi;
|
||||
|
||||
var CheckBox = class CheckBox {
|
||||
constructor(label) {
|
||||
var CheckBox = GObject.registerClass(
|
||||
class CheckBox extends St.Button {
|
||||
_init(label) {
|
||||
let container = new St.BoxLayout();
|
||||
this.actor = new St.Button({ style_class: 'check-box',
|
||||
child: container,
|
||||
button_mask: St.ButtonMask.ONE,
|
||||
toggle_mode: true,
|
||||
can_focus: true,
|
||||
x_fill: true,
|
||||
y_fill: true });
|
||||
super._init({
|
||||
style_class: 'check-box',
|
||||
child: container,
|
||||
button_mask: St.ButtonMask.ONE,
|
||||
toggle_mode: true,
|
||||
can_focus: true,
|
||||
x_fill: true,
|
||||
y_fill: true
|
||||
});
|
||||
|
||||
this._box = new St.Bin();
|
||||
this._box.set_y_align(Clutter.ActorAlign.START);
|
||||
|
|
@ -32,4 +35,4 @@ var CheckBox = class CheckBox {
|
|||
getLabelActor() {
|
||||
return this._label;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue