aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-07-24 23:40:28 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-07-24 23:40:28 -0500
commit35a251324cc5256c459ff4287855cd510b30a026 (patch)
treebe17af41062c83fb445aaa47e716b471eaa372bd
parentf15482d3f189c378d4e4cf2dfc69eefa522b30aa (diff)
downloadayatana-indicator-power-35a251324cc5256c459ff4287855cd510b30a026.tar.gz
ayatana-indicator-power-35a251324cc5256c459ff4287855cd510b30a026.tar.bz2
ayatana-indicator-power-35a251324cc5256c459ff4287855cd510b30a026.zip
in notify, reverse the numerical order of the now-private PowerLevel enum so that they have the more intuitive behavior of higher integer values meaning a better power level.
-rw-r--r--src/notifier.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/notifier.c b/src/notifier.c
index 7add139..6557246 100644
--- a/src/notifier.c
+++ b/src/notifier.c
@@ -29,10 +29,10 @@
typedef enum
{
- POWER_LEVEL_OK,
- POWER_LEVEL_LOW,
+ POWER_LEVEL_CRITICAL,
POWER_LEVEL_VERY_LOW,
- POWER_LEVEL_CRITICAL
+ POWER_LEVEL_LOW,
+ POWER_LEVEL_OK
}
PowerLevel;
@@ -92,10 +92,10 @@ power_level_to_dbus_string (const PowerLevel power_level)
{
switch (power_level)
{
- case POWER_LEVEL_LOW: return "low";
- case POWER_LEVEL_VERY_LOW: return "very_low";
- case POWER_LEVEL_CRITICAL: return "critical";
- default: return "ok";
+ case POWER_LEVEL_LOW: return POWER_LEVEL_STR_LOW;
+ case POWER_LEVEL_VERY_LOW: return POWER_LEVEL_STR_VERY_LOW;
+ case POWER_LEVEL_CRITICAL: return POWER_LEVEL_STR_CRITICAL;
+ default: return POWER_LEVEL_STR_OK;
}
}
@@ -223,7 +223,7 @@ on_battery_property_changed (IndicatorPowerNotifier * self)
/* pop up a 'low battery' notification if either:
a) it's already discharging, and its PowerLevel worsens, OR
b) it's already got a bad PowerLevel and its state becomes 'discharging */
- if ((new_discharging && (new_power_level > old_power_level)) ||
+ if ((new_discharging && (old_power_level > new_power_level)) ||
((new_power_level != POWER_LEVEL_OK) && new_discharging && !old_discharging))
{
notification_show (self);
@@ -317,6 +317,8 @@ indicator_power_notifier_init (IndicatorPowerNotifier * self)
p->dbus_battery = dbus_battery_skeleton_new ();
+ p->power_level = POWER_LEVEL_OK;
+
if (!instance_count++)
{
if (!notify_init("indicator-power-service"))