Commit 3a21b903c04296141d78d4f7fafede5d3a2e2425

  • avatar
  • Daniel Beames <dbeames @beames…ptop.(none)>
  • Wed Oct 28 17:52:17 CET 2009
Updated top-bar-show-actual-battery-percent
  
1show-actual-battery-percent
2
3Tested-On: 1.1
4
5//show actual battery percent in the system user interface.
6//note: battery @ 100% will only charge on a new charge event or if power is <94%
7Index: /usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
8===================================================================
9--- .orig/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
10+++ /usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
11@@ -1382,11 +1382,11 @@ handlePowerNotifications: function(paylo
1diff --git a/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js b/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
2index ee479ac..ae3563c 100644
3--- a/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
4+++ b/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
5@@ -1435,6 +1435,10 @@ closePbapAlert: function() {
6 */
7 handlePowerNotifications: function(payload) {
128
13 Mojo.Log.info("SystemUI Power Payload "+ Object.toJSON(payload));
14 // Is the battery level provided?
15- if (payload.percent_ui != undefined) {
16+ if (payload.percent != undefined) {
17 //Save the Battery Percentage
18- this.batteryLevel = payload.percent_ui;
19+ this.batteryLevel = payload.percent;
20 for (var i = 0; i < this.powerIndicator.length; i++) {
21- if (payload.percent_ui > this.powerIndicator[i])
22+ if (payload.percent > this.powerIndicator[i])
23 continue;
24 this.lastBatteryLevel = i;
25 this.lastBatteryLevelPayload = payload;
26@@ -1397,7 +1397,7 @@ handlePowerNotifications: function(paylo
27 $('power').className = 'battery-' + i;
28
29 //Show Banner Message if the Battery level is below 20%
30- var batteryalert = $L("#{percent_ui}% battery remaining").interpolate(payload);
31+ var batteryalert = $L("#{percent}% battery remaining").interpolate(payload);
32 if(this.batteryLevel <= 5 && !this.batteryLevel5Shown) {
33 this.batteryLevel5Shown = true;
34 this.showLowBatteryAlert();
35@@ -1423,7 +1423,7 @@ handlePowerNotifications: function(paylo
36 }
37 else {
38 Mojo.Log.info("SystemUI- Is Charging "+ this.isCharging );
39- if(payload.percent_ui == 100)
40+ if(payload.percent == 100)
41 $('power').className = 'battery-charged';
42 else
43 $('power').className = 'battery-charging-' + i;
9+ //Show Actual Percent
10+ //Ugly, but it's the easiest way to keep this compatible with the Battery Icon patches.
11+ payload.percent_ui = payload.percent;
12+
13 Mojo.Log.info("SystemUI Power Payload "+ Object.toJSON(payload));
14 if(!this.powerdServiceUp) {
15 Mojo.Log.error("SystemUI PowerD down -- ignoring the notification");