Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > c1667e0b0419e23fe43f2b8dc70363a8 > files > 1

lxpanel-0.5.6-2.2.mga1.src.rpm

--- lxpanel-0.5.6.orig/src/plugins/batt/batt_sys.c	2010-02-08 07:37:52.000000000 +0100
+++ lxpanel-0.5.6/src/plugins/batt/batt_sys.c	2011-11-02 19:19:34.607864899 +0100
@@ -38,6 +38,13 @@
 battery* battery_new() {
     static int battery_num = 1;
     battery * b = g_new0 ( battery, 1 );
+    battery_reset(b);
+    b->battery_num = battery_num;
+    battery_num++;
+    return b;
+    }
+    
+void battery_reset( battery * b) {
     b->type_battery = TRUE;
     b->capacity_unit = "mAh";
     b->last_capacity_unit = -1;
@@ -49,9 +56,6 @@
     b->remaining_capacity = -1;
     b->present_rate = -1;
     b->state = NULL;
-    b->battery_num = battery_num;
-    battery_num++;
-    return b;
 }
 
 
@@ -136,6 +140,8 @@
     };
     const gchar *sys_file;
 
+    battery_reset(b);
+
     while ( (sys_file = sys_list[i]) != NULL ) {
     
 	gchar *file_content;
@@ -150,7 +156,7 @@
 		    b->state = "available";
 	    }
 	    else if ( strcmp("energy_now", sys_file ) == 0 ) {
-		b->remaining_capacity = get_unit_value((gchar*) file_content) / 1000;
+		b->remaining_energy = get_unit_value((gchar*) file_content) / 1000;
 		if (!b->state)
 		    b->state = "available";
 	    }