panel: Delegate container destruction to PanelMenu.ButtonBox
Instead of taking care of the PanelMenu.ButtonBox.container destruction by itself, delegate that to the very object that created it in the first place: PanelMenu.ButtonBox itself.
This commit is contained in:
parent
b719744e75
commit
557b232c89
@ -1158,7 +1158,6 @@ var Panel = new Lang.Class({
|
|||||||
let destroyId = indicator.connect('destroy', emitter => {
|
let destroyId = indicator.connect('destroy', emitter => {
|
||||||
delete this.statusArea[role];
|
delete this.statusArea[role];
|
||||||
emitter.disconnect(destroyId);
|
emitter.disconnect(destroyId);
|
||||||
container.destroy();
|
|
||||||
});
|
});
|
||||||
indicator.connect('menu-set', this._onMenuSet.bind(this));
|
indicator.connect('menu-set', this._onMenuSet.bind(this));
|
||||||
this._onMenuSet(indicator);
|
this._onMenuSet(indicator);
|
||||||
|
@ -30,6 +30,8 @@ var ButtonBox = new Lang.Class({
|
|||||||
child: this.actor });
|
child: this.actor });
|
||||||
|
|
||||||
this.connect('style-changed', this._onStyleChanged.bind(this));
|
this.connect('style-changed', this._onStyleChanged.bind(this));
|
||||||
|
this.connect('destroy', this._onDestroy.bind(this));
|
||||||
|
|
||||||
this._minHPadding = this._natHPadding = 0.0;
|
this._minHPadding = this._natHPadding = 0.0;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -90,6 +92,11 @@ var ButtonBox = new Lang.Class({
|
|||||||
|
|
||||||
child.allocate(childBox, flags);
|
child.allocate(childBox, flags);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onDestroy() {
|
||||||
|
this.container.child = null;
|
||||||
|
this.container.destroy();
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
var Button = new Lang.Class({
|
var Button = new Lang.Class({
|
||||||
@ -106,7 +113,6 @@ var Button = new Lang.Class({
|
|||||||
|
|
||||||
this.connect('event', this._onEvent.bind(this));
|
this.connect('event', this._onEvent.bind(this));
|
||||||
this.connect('notify::visible', this._onVisibilityChanged.bind(this));
|
this.connect('notify::visible', this._onVisibilityChanged.bind(this));
|
||||||
this.connect('destroy', this._onDestroy.bind(this));
|
|
||||||
|
|
||||||
if (dontCreateMenu)
|
if (dontCreateMenu)
|
||||||
this.menu = new PopupMenu.PopupDummyMenu(this.actor);
|
this.menu = new PopupMenu.PopupDummyMenu(this.actor);
|
||||||
@ -190,6 +196,8 @@ var Button = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy() {
|
_onDestroy() {
|
||||||
|
this.parent();
|
||||||
|
|
||||||
if (this.menu)
|
if (this.menu)
|
||||||
this.menu.destroy();
|
this.menu.destroy();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user