wok-stable diff lxpanel/stuff/battery.patch @ rev 6590

Added battery patch to lxpanel to fix 100% battery power bug.
author Christopher Rogers <slaxemulator@gmail.com>
date Sat Oct 09 04:48:51 2010 +0000 (2010-10-09)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lxpanel/stuff/battery.patch	Sat Oct 09 04:48:51 2010 +0000
     1.3 @@ -0,0 +1,44 @@
     1.4 +--- lxpanel-0.5.5/src/plugins/batt/batt_sys.c	Sat Feb  6 20:45:38 2010
     1.5 ++++ lxpanel-0.5.5-orig/src/plugins/batt/batt_sys.c	Sat Jul 24 18:48:20 2010
     1.6 +@@ -38,6 +38,13 @@
     1.7 + battery* battery_new() {
     1.8 +     static int battery_num = 1;
     1.9 +     battery * b = g_new0 ( battery, 1 );
    1.10 ++	battery_reset(b);
    1.11 ++	b->battery_num = battery_num;
    1.12 ++	battery_num++;
    1.13 ++	return b;
    1.14 ++	}
    1.15 ++
    1.16 ++void battery_reset( battery * b) {
    1.17 +     b->type_battery = TRUE;
    1.18 +     b->capacity_unit = "mAh";
    1.19 +     b->last_capacity_unit = -1;
    1.20 +@@ -49,9 +56,6 @@
    1.21 +     b->remaining_capacity = -1;
    1.22 +     b->present_rate = -1;
    1.23 +     b->state = NULL;
    1.24 +-    b->battery_num = battery_num;
    1.25 +-    battery_num++;
    1.26 +-    return b;
    1.27 + }
    1.28 + 
    1.29 + 
    1.30 +@@ -136,6 +140,8 @@
    1.31 +     };
    1.32 +     const gchar *sys_file;
    1.33 + 
    1.34 ++	battery_reset(b);
    1.35 ++
    1.36 +     while ( (sys_file = sys_list[i]) != NULL ) {
    1.37 +     
    1.38 + 	gchar *file_content;
    1.39 +@@ -150,7 +156,7 @@
    1.40 + 		    b->state = "available";
    1.41 + 	    }
    1.42 + 	    else if ( strcmp("energy_now", sys_file ) == 0 ) {
    1.43 +-		b->remaining_capacity = get_unit_value((gchar*) file_content) / 1000;
    1.44 ++		b->remaining_energy = get_unit_value((gchar*) file_content) / 1000;
    1.45 + 		if (!b->state)
    1.46 + 		    b->state = "available";
    1.47 + 	    }