-diff -urp xfce4-battery-plugin-0.5.1_orig/panel-plugin/battery.c xfce4-battery-plugin-0.5.1/panel-plugin/battery.c
+diff -ur xfce4-battery-plugin-0.5.1_orig/panel-plugin/battery.c xfce4-battery-plugin-0.5.1/panel-plugin/battery.c
--- xfce4-battery-plugin-0.5.1_orig/panel-plugin/battery.c 2008-09-04 23:53:40.000000000 +0300
-+++ xfce4-battery-plugin-0.5.1/panel-plugin/battery.c 2010-02-16 20:05:45.525658063 +0200
-@@ -269,6 +269,7 @@ battmon_time_labels_fits(t_battmon *batt
++++ xfce4-battery-plugin-0.5.1/panel-plugin/battery.c 2010-03-01 15:59:38.620912872 +0200
+@@ -269,6 +269,7 @@
return labels_size <= plugin_size;
}
static gboolean
update_apm_status(t_battmon *battmon)
{
-@@ -448,6 +449,15 @@ battmon.c:241: for each function it appe
+@@ -448,6 +449,15 @@
battmon->flag = FALSE;
charge = CLAMP (charge, 0, 100);
+#endif
+
+static gboolean
-+battmon_update_graph(t_battmon *battmon, int charge, int time_remaining)
++battmon_update_graph(t_battmon *battmon, int charge, int time_remaining, int acline, const char *temp)
+{
-+ int acline = 0;
+ gchar buffer[128];
++ gboolean fan = FALSE;
+
+
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(battmon->battstatus), charge / 100.0);
if(battmon->options.display_label){
-@@ -514,7 +524,7 @@ battmon.c:241: for each function it appe
- if(battmon->options.display_power){
+@@ -515,7 +525,7 @@
gtk_widget_show((GtkWidget *)battmon->acfan);
gtk_widget_show((GtkWidget *)battmon->temp);
--
-+#if 0
- fan=get_fan_status();
+
+- fan=get_fan_status();
++ //fan=get_fan_status();
if(acline && fan)
gtk_label_set_text(battmon->acfan,"AC FAN");
-@@ -535,6 +545,7 @@ battmon.c:241: for each function it appe
- gtk_label_set_text(battmon->temp,"");
- gtk_widget_hide((GtkWidget *)battmon->temp);
+ else if(acline && !fan)
+@@ -527,7 +537,7 @@
+ gtk_widget_hide((GtkWidget *)battmon->acfan);
}
-+#endif
- } else {
- gtk_widget_hide((GtkWidget *)battmon->acfan);
- gtk_widget_hide((GtkWidget *)battmon->temp);
-@@ -596,10 +607,33 @@ do_low_warn:
- }
- }
- }
--
+
+- temp=get_temperature();
++ //temp=get_temperature();
+ DBG ("Temp: %s", temp);
+ if(temp)
+ gtk_label_set_text(battmon->temp,temp);
+@@ -600,6 +610,49 @@
return TRUE;
}
++#define SYS_DIR "/sys/class/power_supply/bq27500-0/"
++
+static gboolean
+update_apm_status(t_battmon *battmon)
+{
+ FILE *f;
+ int charge = 0;
+ int time_remaining = 0;
++ int acline = 0;
++ int temp = 0;
++ char temp_s[16];
+
+
-+ f = fopen("/sys/class/power_supply/bq27500-0/capacity", "r");
++ f = fopen(SYS_DIR "capacity", "r");
+ if (f) {
+ fscanf(f, "%d", &charge);
+ fclose(f);
+ }
+
-+ f = fopen("/sys/class/power_supply/bq27500-0/time_to_empty_now", "r");
++ f = fopen(SYS_DIR "time_to_empty_now", "r");
+ if (f) {
+ fscanf(f, "%d", &time_remaining);
+ fclose(f);
+ }
+
++ f = fopen(SYS_DIR "current_now", "r");
++ if (f) {
++ fscanf(f, "%d", &acline);
++ fclose(f);
++ acline = acline < -14000 ? 0 : 1;
++ }
++
++ f = fopen(SYS_DIR "temp", "r");
++ if (f) {
++ fscanf(f, "%d", &temp);
++ fclose(f);
++ snprintf(temp_s, sizeof(temp_s), "%d.%d°C", temp / 10, temp % 10);
++ }
++
+ battmon->method = BM_USE_APM;
-+ return battmon_update_graph(battmon, charge, time_remaining);
++ return battmon_update_graph(battmon, charge, time_remaining / 60, acline, temp_s);
+}
+
static GdkPixbuf *
battmon_icon (t_battmon *battmon)
{
-Only in xfce4-battery-plugin-0.5.1/panel-plugin: battery.c.orig