Code review from JustPerfection

This commit is contained in:
Grégory Soutadé 2024-08-31 13:58:43 +02:00
parent 66d79cc804
commit d0e8f0cde5
2 changed files with 9 additions and 5 deletions

View File

@ -79,7 +79,7 @@ class SignalMgt {
this.onScroll = hashGet(item, 'on-scroll', ''); this.onScroll = hashGet(item, 'on-scroll', '');
} }
destructor() { destroy() {
for(let widgetIdx in this.widgets) for(let widgetIdx in this.widgets)
this.disconnectWidgetSignals(this.widgets[widgetIdx]); this.disconnectWidgetSignals(this.widgets[widgetIdx]);
for(let timeoutIdx in this.timeouts) for(let timeoutIdx in this.timeouts)
@ -394,6 +394,7 @@ class MonitorWidget extends PanelMenu.Button {
destroy() { destroy() {
this.menu.close(); this.menu.close();
this.signalManager.destroy();
super.destroy(); super.destroy();
} }
@ -570,7 +571,10 @@ function loadInterfaceXml(extension, filename) {
// is no `XML` on very recent SpiderMonkey releases (or, if SpiderMonkey is old enough, // is no `XML` on very recent SpiderMonkey releases (or, if SpiderMonkey is old enough,
// will spit out a TypeError soon). // will spit out a TypeError soon).
if (contents instanceof Uint8Array) if (contents instanceof Uint8Array)
contents = imports.byteArray.toString(contents); {
const decoder = new TextDecoder();
contents = decoder.decode(contents);
}
const res = `<node>${contents}</node>`; const res = `<node>${contents}</node>`;
return res; return res;
} else { } else {
@ -786,7 +790,7 @@ class GenericMonitorDBUS {
monitorWidget.togglePopup(); monitorWidget.togglePopup();
} }
destructor() { destroy() {
this._dbusImpl.emit_signal('onDeactivate', null); this._dbusImpl.emit_signal('onDeactivate', null);
for (let groupIndex in this.monitor_groups) { for (let groupIndex in this.monitor_groups) {
const group = this.monitor_groups[groupIndex]; const group = this.monitor_groups[groupIndex];
@ -810,7 +814,7 @@ export default class GenericMonitorExtension extends Extension.Extension {
disable() { disable() {
if (this.textDBusService !== null) { if (this.textDBusService !== null) {
this.textDBusService.destructor(); this.textDBusService.destroy();
delete this.textDBusService; delete this.textDBusService;
this.textDBusService = null; this.textDBusService = null;
} }

View File

@ -8,5 +8,5 @@
"46", "46",
"45" "45"
], ],
"url": "http://indefero.soutade.fr/p/genericmonitor" "url": "https://forge.soutade.fr/soutade/GnomeShellGenericMonitor"
} }