mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
cleanup: Replace signal connections with virtual functions
Inheriting from actors allows to use virtual functions instead of signal connections for multiple cases, so just use them when possible. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
This commit is contained in:
parent
320df13b65
commit
55b57421dc
30 changed files with 434 additions and 414 deletions
|
|
@ -44,16 +44,17 @@ var PadChooser = GObject.registerClass({
|
|||
this._ensureMenu(groupDevices);
|
||||
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
this.connect('clicked', actor => {
|
||||
if (actor.get_checked()) {
|
||||
if (this._padChooserMenu != null)
|
||||
this._padChooserMenu.open(true);
|
||||
else
|
||||
this.set_checked(false);
|
||||
} else {
|
||||
this._padChooserMenu.close(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
vfunc_clicked() {
|
||||
if (this.get_checked()) {
|
||||
if (this._padChooserMenu != null)
|
||||
this._padChooserMenu.open(true);
|
||||
else
|
||||
this.set_checked(false);
|
||||
} else {
|
||||
this._padChooserMenu.close(true);
|
||||
}
|
||||
}
|
||||
|
||||
_ensureMenu(devices) {
|
||||
|
|
@ -93,10 +94,9 @@ var KeybindingEntry = GObject.registerClass({
|
|||
}, class KeybindingEntry extends St.Entry {
|
||||
_init() {
|
||||
super._init({ hint_text: _("New shortcut…"), style: 'width: 10em' });
|
||||
this.connect('captured-event', this._onCapturedEvent.bind(this));
|
||||
}
|
||||
|
||||
_onCapturedEvent(actor, event) {
|
||||
vfunc_captured_event(event) {
|
||||
if (event.type() != Clutter.EventType.KEY_PRESS)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
|
|
@ -116,7 +116,6 @@ var ActionComboBox = GObject.registerClass({
|
|||
}, class ActionComboBox extends St.Button {
|
||||
_init() {
|
||||
super._init({ style_class: 'button' });
|
||||
this.connect('clicked', this._onButtonClicked.bind(this));
|
||||
this.set_toggle_mode(true);
|
||||
|
||||
let boxLayout = new Clutter.BoxLayout({ orientation: Clutter.Orientation.HORIZONTAL,
|
||||
|
|
@ -182,7 +181,7 @@ var ActionComboBox = GObject.registerClass({
|
|||
this._editMenu.close(true);
|
||||
}
|
||||
|
||||
_onButtonClicked() {
|
||||
vfunc_clicked() {
|
||||
if (this.get_checked())
|
||||
this.popup();
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue