switcherPopup: Rename destroy() to fadeAndDestroy()

In the process of purging all usages of Shell.GenericContainer
of GNOME Shell, one specific problematic situation that might
occur is when classes have functions that would clash with any
ClutterActor or StWidget function name.

One of such example is SwitcherPopup.destroy(). Right now, this
class is a pure JavaScript class that wraps a real actor, but
soon this will change, and it'll become a St.Widget subclass.

Another problem with functions that mimic the toolkit ones is
the predictability of them; after calling destroy(), that widget
is expected to not be available anymore. In SwitcherPopup case,
it is still available for a short while. In this case, that's not
a big problem, but the show() and hide() functions in other clases
are more problematic because the actor's visibility does not
follow that.

This commit is a first step in cleaning that up, and changes the
SwitcherPopup.destroy() to fadeAndDestroy().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
This commit is contained in:
Georges Basile Stavracas Neto 2018-08-13 20:05:50 -03:00
parent 286ffbe2b6
commit e82c68accd
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385
3 changed files with 7 additions and 7 deletions

View File

@ -262,7 +262,7 @@ var AppSwitcherPopup = new Lang.Class({
_windowActivated(thumbnailList, n) {
let appIcon = this._items[this._selectedIndex];
Main.activateWindow(appIcon.cachedWindows[n]);
this.destroy();
this.fadeAndDestroy();
},
_windowEntered(thumbnailList, n) {

View File

@ -414,7 +414,7 @@ var InputSourceManager = new Lang.Class({
let popup = new InputSourcePopup(this._mruSources, this._keybindingAction, this._keybindingActionBackward);
if (!popup.show(binding.is_reversed(), binding.get_name(), binding.get_mask()))
popup.destroy();
popup.fadeAndDestroy();
},
_keyboardOptionsChanged() {

View File

@ -195,7 +195,7 @@ var SwitcherPopup = new Lang.Class({
// Note: pressing one of the below keys will destroy the popup only if
// that key is not used by the active popup's keyboard shortcut
if (keysym == Clutter.Escape || keysym == Clutter.Tab)
this.destroy();
this.fadeAndDestroy();
return Clutter.EVENT_STOP;
},
@ -215,7 +215,7 @@ var SwitcherPopup = new Lang.Class({
},
_clickedOutside(actor, event) {
this.destroy();
this.fadeAndDestroy();
return Clutter.EVENT_PROPAGATE;
},
@ -255,7 +255,7 @@ var SwitcherPopup = new Lang.Class({
let newIndex = Math.min(n, this._items.length - 1);
this._select(newIndex);
} else {
this.actor.destroy();
this.fadeAndDestroy();
}
},
@ -298,7 +298,7 @@ var SwitcherPopup = new Lang.Class({
}
},
destroy() {
fadeAndDestroy() {
this._popModal();
if (this.actor.visible) {
Tweener.addTween(this.actor,
@ -314,7 +314,7 @@ var SwitcherPopup = new Lang.Class({
},
_finish(timestamp) {
this.destroy();
this.fadeAndDestroy();
},
_onDestroy() {