wok-next view lxpanel/stuff/battery.patch @ rev 9410
Up: lm-sensors to 3.3.0.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Tue Mar 29 01:31:00 2011 +0000 (2011-03-29) |
parents | |
children |
line source
1 --- lxpanel-0.5.5/src/plugins/batt/batt_sys.c Sat Feb 6 20:45:38 2010
2 +++ lxpanel-0.5.5-orig/src/plugins/batt/batt_sys.c Sat Jul 24 18:48:20 2010
3 @@ -38,6 +38,13 @@
4 battery* battery_new() {
5 static int battery_num = 1;
6 battery * b = g_new0 ( battery, 1 );
7 + battery_reset(b);
8 + b->battery_num = battery_num;
9 + battery_num++;
10 + return b;
11 + }
12 +
13 +void battery_reset( battery * b) {
14 b->type_battery = TRUE;
15 b->capacity_unit = "mAh";
16 b->last_capacity_unit = -1;
17 @@ -49,9 +56,6 @@
18 b->remaining_capacity = -1;
19 b->present_rate = -1;
20 b->state = NULL;
21 - b->battery_num = battery_num;
22 - battery_num++;
23 - return b;
24 }
27 @@ -136,6 +140,8 @@
28 };
29 const gchar *sys_file;
31 + battery_reset(b);
32 +
33 while ( (sys_file = sys_list[i]) != NULL ) {
35 gchar *file_content;
36 @@ -150,7 +156,7 @@
37 b->state = "available";
38 }
39 else if ( strcmp("energy_now", sys_file ) == 0 ) {
40 - b->remaining_capacity = get_unit_value((gchar*) file_content) / 1000;
41 + b->remaining_energy = get_unit_value((gchar*) file_content) / 1000;
42 if (!b->state)
43 b->state = "available";
44 }