aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <dbphillipsnz@gmail.com>2015-11-20 14:11:56 +1300
committerDavid Phillips <dbphillipsnz@gmail.com>2015-11-20 14:11:56 +1300
commit78f9e2dedc923de295a17a7c9571c72dd73a38e5 (patch)
tree465a1e81653bbaa5290145abd51ea327457add22
parentc239a8bf0767a31ca87d3d3cecc3006789992753 (diff)
downloadparamano-0.7.tar.xz
Don't change governor unless required0.7
-rw-r--r--tray.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/tray.c b/tray.c
index 058f741..0db6fb8 100644
--- a/tray.c
+++ b/tray.c
@@ -242,10 +242,23 @@ static void update_icon()
**********************************************************************/
static gboolean update()
{
+ static int last_bat_state = -1;
+ int now_bat_state = STATE_UNKNOWN;
unsigned int i;
- switch ( get_battery_state() )
+
+ update_tooltip_cache();
+ update_icon();
+
+ now_bat_state = get_battery_state();
+ if (now_bat_state == last_bat_state)
+ return true;
+
+ last_bat_state = now_bat_state;
+
+ switch ( now_bat_state )
{
case STATE_DISCHARGING:
+ fprintf(stderr, "discharging\n");
if (DEFAULT_BAT_GOV)
{
for (i = 0; i < gc_number(); i++)
@@ -255,6 +268,7 @@ static gboolean update()
case STATE_CHARGING:
case STATE_FULL:
+ fprintf(stderr, "ac power\n");
if (DEFAULT_AC_GOV)
{
for (i = 0; i < gc_number(); i++)
@@ -263,9 +277,6 @@ static gboolean update()
break;
}
-
- update_tooltip_cache();
- update_icon();
return true;
}