diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-07-21 17:13:15 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2014-07-21 17:13:15 -0500 |
commit | 1bd1b700892a786fd01410a4b81b2f2cc93a89c1 (patch) | |
tree | 27c542a1dd09c6d21323d4c825829f1b02c4bfd9 /src/notifier.c | |
parent | 2cb851b018c5e7a0278dab75f73bb031c7c42422 (diff) | |
download | ayatana-indicator-power-1bd1b700892a786fd01410a4b81b2f2cc93a89c1.tar.gz ayatana-indicator-power-1bd1b700892a786fd01410a4b81b2f2cc93a89c1.tar.bz2 ayatana-indicator-power-1bd1b700892a786fd01410a4b81b2f2cc93a89c1.zip |
add tests for events that change whether or not a 'low battery' notification is being shown
Diffstat (limited to 'src/notifier.c')
-rw-r--r-- | src/notifier.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/notifier.c b/src/notifier.c index c805413..fc54e62 100644 --- a/src/notifier.c +++ b/src/notifier.c @@ -157,28 +157,23 @@ static void on_battery_property_changed (IndicatorPowerNotifier * self) { priv_t * p; - PowerLevel power_level; g_return_if_fail(INDICATOR_IS_POWER_NOTIFIER(self)); g_return_if_fail(INDICATOR_IS_POWER_DEVICE(self->priv->battery)); p = self->priv; - power_level = indicator_power_notifier_get_power_level (p->battery); + set_power_level_property (self, + indicator_power_notifier_get_power_level (p->battery)); - if (p->power_level != power_level) + if ((indicator_power_device_get_state(p->battery) == UP_DEVICE_STATE_DISCHARGING) && + (p->power_level != POWER_LEVEL_OK)) { - set_power_level_property (self, power_level); - - if ((power_level == POWER_LEVEL_OK) || - (indicator_power_device_get_state(p->battery) != UP_DEVICE_STATE_DISCHARGING)) - { - notification_clear (self); - } - else - { - notification_show (self); - } + notification_show (self); + } + else + { + notification_clear (self); } } |