1.1 --- a/Extras/HardwareGrowler/PowerNotifier.c Mon Jan 15 10:30:57 2007 +0000
1.2 +++ b/Extras/HardwareGrowler/PowerNotifier.c Tue May 05 00:50:25 2009 -0700
1.3 @@ -17,6 +17,8 @@
1.4
1.5 static CFRunLoopSourceRef powerNotifierRunLoopSource = NULL;
1.6 static HGPowerSource lastPowerSource;
1.7 +static CFBooleanRef lastChargingState;
1.8 +static int lastBatteryTime = -1;
1.9
1.10 static bool stringsAreEqual(CFStringRef a, CFStringRef b)
1.11 {
1.12 @@ -95,9 +97,11 @@
1.13 hgPowerSource = HGUPSPower;
1.14 }
1.15
1.16 - //Avoid sending notifications on the same power source multiple times
1.17 - if (lastPowerSource != hgPowerSource) {
1.18 + //Avoid sending notifications on the same power source multiple times, unless the charging state or presence/absence of a time estimate has changed.
1.19 + if (lastPowerSource != hgPowerSource || lastChargingState != charging || (lastBatteryTime == -1) != (batteryTime == -1)) {
1.20 lastPowerSource = hgPowerSource;
1.21 + lastChargingState = charging;
1.22 + lastBatteryTime = batteryTime;
1.23 AppController_powerSwitched(hgPowerSource, charging, batteryTime, percentageCapacity);
1.24 }
1.25 }