Fix runtime issue and expose new indicator

This commit is contained in:
Nathaniel van Diepen 2022-11-20 18:42:13 -07:00
parent af03075ef3
commit 11affed9bb
No known key found for this signature in database
GPG key ID: 87F4F19E784573DA
2 changed files with 4 additions and 2 deletions

View file

@ -6,13 +6,14 @@ class BaTimeExtension {
constructor() { constructor() {
this.aggregateMenu = Panel.statusArea.quickSettings; this.aggregateMenu = Panel.statusArea.quickSettings;
this.originalIndicator = this.aggregateMenu._system; this.originalIndicator = this.aggregateMenu._system;
this.customIndicator = new BaTime.imports.power.Indicator(); this.aggregateMenu._system = this.customIndicator = new BaTime.imports.power.Indicator();
this.aggregateMenu._indicators.replace_child( this.aggregateMenu._indicators.replace_child(
this.originalIndicator, this.originalIndicator,
this.customIndicator this.customIndicator
); );
} }
destroy() { destroy() {
this.aggregateMenu._system = this.originalIndicator;
this.aggregateMenu._indicators.replace_child( this.aggregateMenu._indicators.replace_child(
this.customIndicator, this.customIndicator,
this.originalIndicator this.originalIndicator

View file

@ -7,7 +7,8 @@ var Indicator = GObject.registerClass(
// Adapted from _getStatus of the parent. // Adapted from _getStatus of the parent.
_getTime() { _getTime() {
let seconds = 0; let seconds = 0;
let state = this._systemItem.powerToggle._proxy.State; let proxy = this._systemItem.powerToggle._proxy;
let state = proxy.State;
if (state === UPower.DeviceState.FULLY_CHARGED) { if (state === UPower.DeviceState.FULLY_CHARGED) {
return ''; return '';