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:
Marco Trevisan (Treviño)
2019-09-10 07:42:48 +02:00
committed by Florian Müllner
parent 320df13b65
commit 55b57421dc
30 changed files with 434 additions and 414 deletions

View File

@ -97,17 +97,25 @@ var AnimatedPageIndicators = GObject.registerClass(
class AnimatedPageIndicators extends PageIndicators {
_init() {
super._init();
this.connect('destroy', this._onDestroy.bind(this));
}
this.connect('notify::mapped', () => {
if (!this.mapped)
return;
_onDestroy() {
if (this.animateLater) {
Meta.later_remove(this.animateLater);
this.animateLater = 0;
}
}
// Implicit animations are skipped for unmapped actors, and our
// children aren't mapped yet, so defer to a later handler
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this.animateIndicators(AnimationDirection.IN);
return GLib.SOURCE_REMOVE;
});
vfunc_map() {
super.vfunc_map();
// Implicit animations are skipped for unmapped actors, and our
// children aren't mapped yet, so defer to a later handler
this.animateLater = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this.animateLater = 0;
this.animateIndicators(AnimationDirection.IN);
return GLib.SOURCE_REMOVE;
});
}