wok-6.x view lxpanel/stuff/battery.patch @ rev 7055

Add sudoku
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Nov 01 17:25:01 2010 +0100 (2010-11-01)
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 }