Small optimization
This commit is contained in:
parent
4dd9ac58de
commit
af03075ef3
1 changed files with 5 additions and 5 deletions
|
|
@ -7,15 +7,15 @@ 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 proxy = this._systemItem.powerToggle._proxy;
|
let state = this._systemItem.powerToggle._proxy.State;
|
||||||
|
|
||||||
if (proxy.State === UPower.DeviceState.FULLY_CHARGED) {
|
if (state === UPower.DeviceState.FULLY_CHARGED) {
|
||||||
return '';
|
return '';
|
||||||
} else if (proxy.State === UPower.DeviceState.CHARGING) {
|
} else if (state === UPower.DeviceState.CHARGING) {
|
||||||
seconds = proxy.TimeToFull;
|
seconds = proxy.TimeToFull;
|
||||||
} else if (proxy.State === UPower.DeviceState.DISCHARGING) {
|
} else if (state === UPower.DeviceState.DISCHARGING) {
|
||||||
seconds = proxy.TimeToEmpty;
|
seconds = proxy.TimeToEmpty;
|
||||||
} else if (proxy.State === UPower.DeviceState.PENDING_CHARGE) {
|
} else if (state === UPower.DeviceState.PENDING_CHARGE) {
|
||||||
return '';
|
return '';
|
||||||
} else {
|
} else {
|
||||||
// state is PENDING_DISCHARGE or UNKNOWN
|
// state is PENDING_DISCHARGE or UNKNOWN
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue