diff options
| author | Johan Hedberg <johan.hedberg@nokia.com> | 2008-12-03 20:56:08 +0200 | 
|---|---|---|
| committer | Johan Hedberg <johan.hedberg@nokia.com> | 2008-12-08 16:10:58 +0200 | 
| commit | 0d21737bb959c0374c113254297d0207519fa816 (patch) | |
| tree | 11b1260839ced0964b3d0fc2eafa465cba228519 | |
| parent | 716ec2c6433e73509f4349a5402b5c7989d66e39 (diff) | |
Only send battchg when it really changed
| -rw-r--r-- | audio/telephony-maemo.c | 17 | 
1 files changed, 11 insertions, 6 deletions
| diff --git a/audio/telephony-maemo.c b/audio/telephony-maemo.c index 208df5fe..72b7fcd4 100644 --- a/audio/telephony-maemo.c +++ b/audio/telephony-maemo.c @@ -1131,16 +1131,21 @@ static void hal_battery_level_reply(DBusPendingCall *call, void *user_data)  	*value = (int) level;  	if (value == &battchg_max) -		debug("battery.charge_level.last_full is %d", *value); +		debug("telephony-maemo: battery.charge_level.last_full is %d", +				*value);  	else -		debug("battery.charge_level.current is %d", *value); +		debug("telephony-maemo: battery.charge_level.current is %d", +				*value); -	if (battchg_max > 0 && battchg > 0) { -		int battchg_norm; +	if (battchg_max > 0 && battchg >= 0) { +		int new, cur; -		battchg_norm = battchg * 5 / battchg_max; +	        cur = telephony_get_indicator(maemo_indicators, "battchg"); +		new = battchg * 5 / battchg_max; -		telephony_update_indicator(maemo_indicators, "battchg", battchg_norm); +		if (new != cur) +			telephony_update_indicator(maemo_indicators, "battchg", +							new);  	}  done:  	dbus_message_unref(reply); | 
