gex: more cleanup

This commit is contained in:
Luke D. Jones
2023-06-30 11:30:09 +12:00
parent 59b1059aee
commit bc776deb70

View File

@@ -18,12 +18,12 @@ import { Platform } from './modules/dbus/platform';
const QuickMiniLed = GObject.registerClass( const QuickMiniLed = GObject.registerClass(
class QuickMiniLed extends QuickToggle { class QuickMiniLed extends QuickToggle {
_init() { constructor() {
super._init({ super({
title: 'MiniLED', title: 'MiniLED',
iconName: 'selection-mode-symbolic', iconName: 'selection-mode-symbolic',
toggleMode: true, toggleMode: true,
checked: extensionInstance.dbus_platform.bios.mini_led_mode, checked: extensionInstance.dbus_platform.bios.mini_led_mode,
}); });
this.label = 'MiniLED'; this.label = 'MiniLED';
@@ -58,8 +58,8 @@ const QuickMiniLed = GObject.registerClass(
const IndicateMiniLed = GObject.registerClass( const IndicateMiniLed = GObject.registerClass(
class IndicateMiniLed extends SystemIndicator { class IndicateMiniLed extends SystemIndicator {
_init() { constructor() {
super._init(); super();
// Create the icon for the indicator // Create the icon for the indicator
this._indicator = this._addIndicator(); this._indicator = this._addIndicator();
@@ -88,8 +88,8 @@ const IndicateMiniLed = GObject.registerClass(
const QuickPanelOd = GObject.registerClass( const QuickPanelOd = GObject.registerClass(
class QuickPanelOd extends QuickToggle { class QuickPanelOd extends QuickToggle {
_init() { constructor() {
super._init({ super({
title: 'Panel Overdrive', title: 'Panel Overdrive',
iconName: 'selection-mode-symbolic', iconName: 'selection-mode-symbolic',
toggleMode: true, toggleMode: true,
@@ -118,8 +118,8 @@ const QuickPanelOd = GObject.registerClass(
const IndicatePanelOd = GObject.registerClass( const IndicatePanelOd = GObject.registerClass(
class IndicatePanelOd extends SystemIndicator { class IndicatePanelOd extends SystemIndicator {
_init() { constructor() {
super._init(); super();
this.quickSettingsItems.push(new QuickPanelOd()); this.quickSettingsItems.push(new QuickPanelOd());
// this.connect('destroy', () => { // this.connect('destroy', () => {
@@ -134,36 +134,44 @@ class Extension {
private _indicateMiniLed: typeof IndicateMiniLed; private _indicateMiniLed: typeof IndicateMiniLed;
private _indicatePanelOd: typeof IndicatePanelOd; private _indicatePanelOd: typeof IndicatePanelOd;
private _dbus_power!: Power; private _dbus_power!: Power;
dbus_platform!: Platform;
private _dbus_anime!: AnimeDbus; private _dbus_anime!: AnimeDbus;
dbus_supported!: Supported;
public dbus_platform!: Platform;
public dbus_supported!: Supported;
constructor() { constructor() {
this._indicateMiniLed = null; this._indicateMiniLed = null;
this._indicatePanelOd = null; this._indicatePanelOd = null;
this.dbus_supported = new Supported(); this.dbus_supported = new Supported();
this.dbus_platform = new Platform();
this._dbus_power = new Power();
this._dbus_anime = new AnimeDbus();
this.dbus_supported.start(); this.dbus_supported.start();
this.dbus_platform = new Platform();
this.dbus_platform.start(); this.dbus_platform.start();
this._dbus_power = new Power();
this._dbus_power.start(); this._dbus_power.start();
this._dbus_anime = new AnimeDbus();
this._dbus_anime.start(); this._dbus_anime.start();
} }
enable() { enable() {
this._indicateMiniLed = new IndicateMiniLed(); if (this.dbus_supported.supported.rog_bios_ctrl.mini_led_mode)
this._indicateMiniLed.checked = this.dbus_platform.bios.mini_led_mode; this._indicateMiniLed = new IndicateMiniLed();
this._indicatePanelOd = new IndicatePanelOd(); if (this.dbus_supported.supported.rog_bios_ctrl.panel_overdrive)
this._indicatePanelOd = new IndicatePanelOd();
} }
disable() { disable() {
this._indicateMiniLed.destroy(); if (this.dbus_supported.supported.rog_bios_ctrl.mini_led_mode) {
this._indicateMiniLed = null; this._indicateMiniLed.destroy();
this._indicatePanelOd.destroy(); this._indicateMiniLed = null;
this._indicatePanelOd = null; }
if (this.dbus_supported.supported.rog_bios_ctrl.panel_overdrive) {
this._indicatePanelOd.destroy();
this._indicatePanelOd = null;
}
this._dbus_power.stop(); this._dbus_power.stop();
this.dbus_platform.stop(); this.dbus_platform.stop();