[gnome-shell] power: Stop making time estimates



commit 6c08799c7b7a4d824acc8f2cf546749b7cc041f0
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Sep 25 01:38:59 2015 +0200

    power: Stop making time estimates
    
    Any time estimates we can come up with are notoriously unreliable;
    even on devices that report correct (dis)charging rates, any change
    in workload, screen brightness etc. can throw our estimate off by
    a huge amount. This is further compounded by bad firmware and battery
    firmware which reports inaccurate data as neither Windows nor Android do
    not use that data.
    
    So instead, limit ourselves to only showing the current percentage
    and leave its interpretation to the user.
    
    As an added bonus, we end up with shorter strings that are less likely
    to cause problems with ellipsization when translated.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708472

 js/ui/status/power.js |   32 ++------------------------------
 1 files changed, 2 insertions(+), 30 deletions(-)
---
diff --git a/js/ui/status/power.js b/js/ui/status/power.js
index 0bec19c..7f494f4 100644
--- a/js/ui/status/power.js
+++ b/js/ui/status/power.js
@@ -59,39 +59,11 @@ const Indicator = new Lang.Class({
     },
 
     _getStatus: function() {
-        let seconds = 0;
-
         if (this._proxy.State == UPower.DeviceState.FULLY_CHARGED)
             return _("Fully Charged");
         else if (this._proxy.State == UPower.DeviceState.CHARGING)
-            seconds = this._proxy.TimeToFull;
-        else if (this._proxy.State == UPower.DeviceState.DISCHARGING)
-            seconds = this._proxy.TimeToEmpty;
-        // state is one of PENDING_CHARGING, PENDING_DISCHARGING
-        else
-            return _("Estimating…");
-
-        let time = Math.round(seconds / 60);
-        if (time == 0) {
-            // 0 is reported when UPower does not have enough data
-            // to estimate battery life
-            return _("Estimating…");
-        }
-
-        let minutes = time % 60;
-        let hours = Math.floor(time / 60);
-
-        if (this._proxy.State == UPower.DeviceState.DISCHARGING) {
-            // Translators: this is <hours>:<minutes> Remaining (<percentage>)
-            return _("%d\u2236%02d Remaining (%d\u2009%%)").format(hours, minutes, this._proxy.Percentage);
-        }
-
-        if (this._proxy.State == UPower.DeviceState.CHARGING) {
-            // Translators: this is <hours>:<minutes> Until Full (<percentage>)
-            return _("%d\u2236%02d Until Full (%d\u2009%%)").format(hours, minutes, this._proxy.Percentage);
-        }
-
-        return null;
+            return _("%d\u2009%% Charging").format(hours, minutes, this._proxy.Percentage);
+        return _("%d\u2009%% Charged").format(this._proxy.Percentage);
     },
 
     _sync: function() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]