review disable

This commit is contained in:
abakkk 2019-03-08 12:28:03 +01:00
parent 743d8d7644
commit 91bb4b26a7
2 changed files with 11 additions and 9 deletions

View File

@ -534,10 +534,6 @@ var DrawingArea = new Lang.Class({
}, },
disable: function() { disable: function() {
if (this.theme && this.customStylesheetsChangedHandler) {
this.theme.disconnect(this.customStylesheetsChangedHandler);
this.customStylesheetsChangedHandler = null;
}
this.erase(); this.erase();
} }
}); });

View File

@ -55,7 +55,6 @@ var AreaManager = new Lang.Class({
_init: function() { _init: function() {
this.areas = []; this.areas = [];
this.drawingHandlers = [];
this.activeArea = null; this.activeArea = null;
this.enterGicon = new Gio.ThemedIcon({ name: 'applications-graphics-symbolic' }); this.enterGicon = new Gio.ThemedIcon({ name: 'applications-graphics-symbolic' });
this.leaveGicon = new Gio.ThemedIcon({ name: 'application-exit-symbolic' }); this.leaveGicon = new Gio.ThemedIcon({ name: 'application-exit-symbolic' });
@ -106,8 +105,8 @@ var AreaManager = new Lang.Class({
bgContainer.set_size(monitor.width, monitor.height); bgContainer.set_size(monitor.width, monitor.height);
area.set_position(monitor.x, monitor.y); area.set_position(monitor.x, monitor.y);
area.set_size(monitor.width, monitor.height); area.set_size(monitor.width, monitor.height);
this.drawingHandlers.push(area.emitter.connect('stop-drawing', this.toggleDrawing.bind(this))); area.emitter.stopDrawingHandler = area.emitter.connect('stop-drawing', this.toggleDrawing.bind(this));
this.drawingHandlers.push(area.emitter.connect('show-osd', this.showOsd.bind(this))); area.emitter.showOsdHandler = area.emitter.connect('show-osd', this.showOsd.bind(this));
this.areas.push(area); this.areas.push(area);
} }
}, },
@ -263,13 +262,15 @@ var AreaManager = new Lang.Class({
removeAreas: function() { removeAreas: function() {
for (let i = 0; i < this.areas.length; i++) { for (let i = 0; i < this.areas.length; i++) {
let area = this.areas[i]; let area = this.areas[i];
Main.uiGroup.remove_actor(area.helper);
Main.uiGroup.remove_actor(area.get_parent()); Main.uiGroup.remove_actor(area.get_parent());
area.emitter.disconnect(this.drawingHandlers[i]); area.emitter.disconnect(area.emitter.stopDrawingHandler);
area.emitter.disconnect(area.emitter.showOsdHandler);
area.disable(); area.disable();
area.helper.destroy();
area.get_parent().destroy(); area.get_parent().destroy();
} }
this.areas = []; this.areas = [];
this.drawingHandlers = [];
}, },
disable: function() { disable: function() {
@ -277,6 +278,11 @@ var AreaManager = new Lang.Class({
this.stylesheetMonitor.disconnect(this.stylesheetChangedHandler); this.stylesheetMonitor.disconnect(this.stylesheetChangedHandler);
this.stylesheetChangedHandler = null; this.stylesheetChangedHandler = null;
} }
if (this.monitorChangedHandler) {
Main.layoutManager.disconnect(this.monitorChangedHandler);
this.monitorChangedHandler = null;
}
if (this.activeArea) if (this.activeArea)
this.toggleDrawing(); this.toggleDrawing();
Main.wm.removeKeybinding('toggle-drawing'); Main.wm.removeKeybinding('toggle-drawing');