diff options
| author | David Phillips <dbphillipsnz@gmail.com> | 2015-11-20 14:11:56 +1300 | 
|---|---|---|
| committer | David Phillips <dbphillipsnz@gmail.com> | 2015-11-20 14:11:56 +1300 | 
| commit | 78f9e2dedc923de295a17a7c9571c72dd73a38e5 (patch) | |
| tree | 465a1e81653bbaa5290145abd51ea327457add22 | |
| parent | c239a8bf0767a31ca87d3d3cecc3006789992753 (diff) | |
| download | paramano-78f9e2dedc923de295a17a7c9571c72dd73a38e5.tar.xz | |
Don't change governor unless required0.7
| -rw-r--r-- | tray.c | 19 | 
1 files changed, 15 insertions, 4 deletions
| @@ -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;  } | 
