? battstat.schemas
? d
? docs/C/battstat-C.omf.out
? docs/ja/Makefile
? docs/ja/Makefile.in
? docs/ja/battstat-ja.omf.out
? docs/ja/omf_timestamp
Index: AUTHORS
===================================================================
RCS file: /cvs/gnome/gnome-applets/battstat/AUTHORS,v
retrieving revision 1.7
diff -u -r1.7 AUTHORS
--- AUTHORS	28 Dec 2001 11:18:24 -0000	1.7
+++ AUTHORS	27 Oct 2003 11:45:14 -0000
@@ -14,3 +14,4 @@
  Joe Ammond <jra@twinight.org>
  Michael Reinsch <mr@uue.org>
  Dave Camp <dave@ximian.com>
+ Behdad Esfahbod <gnomeapplets@behdad.org>
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-applets/battstat/ChangeLog,v
retrieving revision 1.97
diff -u -r1.97 ChangeLog
--- ChangeLog	22 Oct 2003 22:01:18 -0000	1.97
+++ ChangeLog	27 Oct 2003 11:45:14 -0000
@@ -1,3 +1,10 @@
+2003-10-27  Behdad Esfahbod  <gnomeapplets@behdad.org>
+
+	* acpi-linux.c: Linearly estimate remaining charging/battery time.
+	* battstat_applet.c, properties.c, battstat_applet.h, battstat_applet.glade:
+	Added an Show remaining time option, utilizing the above change.  Some code
+	cleanup and removed duplicated code.
+
 2003-10-22  Kevin Vandersloot
 
 	* acpi-linux.c: Fix up reading /proc/acpi../info by using acpid properly.
Index: README
===================================================================
RCS file: /cvs/gnome/gnome-applets/battstat/README,v
retrieving revision 1.3
diff -u -r1.3 README
--- README	29 Mar 2001 21:32:00 -0000	1.3
+++ README	27 Oct 2003 11:45:14 -0000
@@ -11,6 +11,8 @@
  o   Displays remaining battery percentage in a progress bar. 
  
  o   Progress bar is color-coded to reflect the current battery charge.
+
+ o   Estimate remaining charge time or remaining battery time.
  
  o   An icon display if laptop is running on AC or battery power. Or if
      it's charging the battery or if the power falls under a preset
Index: acpi-linux.c
===================================================================
RCS file: /cvs/gnome/gnome-applets/battstat/acpi-linux.c,v
retrieving revision 1.8
diff -u -r1.8 acpi-linux.c
--- acpi-linux.c	22 Oct 2003 22:01:18 -0000	1.8
+++ acpi-linux.c	27 Oct 2003 11:45:14 -0000
@@ -361,7 +361,7 @@
  */
 gboolean acpi_linux_read(struct apm_info *apminfo, struct acpi_info * acpiinfo)
 {
-  guint32 remain;
+  guint32 remain, rate, seconds;
   gboolean charging;
   GHashTable *hash;
   char batt_state[60];
@@ -381,7 +381,7 @@
   g_assert(apminfo);
 
   charging = FALSE;
-  remain = 0;
+  remain = rate = seconds = 0;
 
   procdir=opendir("/proc/acpi/battery/");
   if (!procdir)
@@ -408,18 +408,27 @@
           charging = s ? (strcmp (s, "charging") == 0) : 0;
          }
         remain += read_long (hash, "remaining capacity");
+        rate += read_long (hash, "present rate");
         g_hash_table_destroy (hash);
        }
      }
    }
   closedir(procdir);
 
+  if (rate && acpiinfo->max_capacity)
+    if (charging) {
+    seconds = 3600 * (double)(acpiinfo->max_capacity - remain) / rate;
+  } else if (!acpiinfo->ac_online) {
+    seconds = 3600 * (float)remain / rate;
+  }
+
   apminfo->ac_line_status = acpiinfo->ac_online ? 1 : 0;
   apminfo->battery_status = remain < acpiinfo->low_capacity ? 1 : remain < acpiinfo->critical_capacity ? 2 : 0;
   if (!acpiinfo->max_capacity)
     apminfo->battery_percentage = -1;
   else
     apminfo->battery_percentage = (int) (remain/(float)acpiinfo->max_capacity*100);
+  apminfo->battery_time = seconds;
   apminfo->battery_flags = charging ? 0x8 : 0;
 
   return TRUE;
Index: acpi-linux.h
===================================================================
RCS file: /cvs/gnome/gnome-applets/battstat/acpi-linux.h,v
retrieving revision 1.2
diff -u -r1.2 acpi-linux.h
--- acpi-linux.h	22 Oct 2003 22:01:18 -0000	1.2
+++ acpi-linux.h	27 Oct 2003 11:45:14 -0000
@@ -25,6 +25,7 @@
   int       event_fd;
   int       max_capacity;
   int       low_capacity;
+  int       present_rate;
   int       critical_capacity;
   GIOChannel  * channel;
 };
Index: battstat.h
===================================================================
RCS file: /cvs/gnome/gnome-applets/battstat/battstat.h,v
retrieving revision 1.18
diff -u -r1.18 battstat.h
--- battstat.h	22 Oct 2003 22:01:18 -0000	1.18
+++ battstat.h	27 Oct 2003 11:45:14 -0000
@@ -58,6 +58,8 @@
   GtkWidget *radio_lay_batt_on;
   GtkWidget *radio_lay_status_on;
   GtkWidget *radio_lay_percent_on;
+  GtkWidget *radio_lay_time_on;
+  GtkWidget *radio_lay_no_label_on;
   GdkPixmap *pixbuffer;
   GdkBitmap *pixmask;
   GdkPixmap *pixbuffery;
@@ -80,6 +82,7 @@
   GtkWidget *framebattery;
   GtkWidget *frameybattery;
   GtkWidget *percent;
+  GtkWidget *time;
   GtkWidget *eventbattery;
   GtkWidget *eventybattery;
   GtkWidget *eventstatus;
@@ -89,6 +92,7 @@
   GtkWidget *statuspixmapwid;
   GtkWidget *statusvbox;
   GtkWidget *statuspercent;
+  GtkWidget *statustime;
   GtkWidget *fontpicker;
   GtkStyle *percentstyle;
   gboolean font_changed;
@@ -102,6 +106,7 @@
   gboolean showstatus;
   gboolean showbattery;
   gboolean showpercent;
+  gboolean showtime;
   gboolean suspend;
   GtkWidget *suspend_entry;
   gchar *suspend_cmd;
@@ -137,10 +142,12 @@
   /* last_* for the benefit of the timeout functions */
   guint flash;
   guint last_batt_life;
+  guint last_batt_time;
   guint last_acline_status;
   guint last_batt_state;
   guint last_pixmap_index;
   guint last_charging;
+  guint conf_changed;
 } ProgressData;
 
 enum statusimagename {BATTERY,AC,FLASH,WARNING};
Index: battstat_applet.c
===================================================================
RCS file: /cvs/gnome/gnome-applets/battstat/battstat_applet.c,v
retrieving revision 1.56
diff -u -r1.56 battstat_applet.c
--- battstat_applet.c	22 Oct 2003 22:01:18 -0000	1.56
+++ battstat_applet.c	27 Oct 2003 11:45:15 -0000
@@ -350,10 +350,11 @@
   guint progress_value;
   guint pixmap_index;
   guint charging;
+  guint batt_time;
   gint i, x;
   gboolean batterypresent;
-  gchar new_label[80];
-  gchar new_string[80];
+  gchar new_label[160];
+  gchar time_label[80];
   gchar *status[]={
     /* The following four messages will be displayed as tooltips over
      the battery meter.  
@@ -409,6 +410,7 @@
    charging = TRUE;
    batterypresent = FALSE;
 #endif
+   batt_time = (guint) apminfo.battery_time;
   if(batt_state > 3) {
     batt_state = 0;
     batterypresent = FALSE;
@@ -478,37 +480,40 @@
    if(
       acline_status != battery->last_acline_status
       || batt_life != battery->last_batt_life
+      || batt_time != battery->last_batt_time
       || batt_state != battery->last_batt_state
-      || battery->colors_changed )
+      || battery->colors_changed
+      || battery->conf_changed )
    {
       /* Something changed */
+      int hours, minutes, seconds;
 
-      /* Update the tooltip */
-
-      if(!battery->showbattery && !battery->showpercent) {
-	 if(acline_status == 0) {
-	    snprintf(new_label, sizeof(new_label),
-		     _("System is running on battery power\nBattery: %d%% (%s)"),
-		     batt_life, _(status[batt_state]));
-	 } else {
-	    snprintf(new_label, sizeof(new_label),
-		     _("System is running on AC power\nBattery: %d%% (%s)"),
-		     batt_life, _(status[batt_state]));
-	 }
+      if (batt_time > 0) {
+        seconds = batt_time;
+        hours = seconds / 3600;
+        seconds -= 3600 * hours;
+        minutes = seconds / 60;
+        seconds -= 60 * minutes;
       } else {
-	 if(acline_status == 0) {
-	    snprintf(new_label, sizeof(new_label),
-		     _("System is running on battery power"));
-	 } else {
-	    snprintf(new_label, sizeof(new_label),
-		     _("System is running on AC power"));
-	 }
+        hours = minutes = seconds = 0;
       }
 
-      gtk_tooltips_set_tip (battery->ac_tip,
-			    battery->eventstatus,
-			    new_label,
-			    NULL);
+      /* Update the remaining battery or charging time tip */
+      if (batt_time>0 && (charging || !acline_status)) {
+        
+	 *time_label = '\n';
+         if(charging) {
+            snprintf(time_label + 1, sizeof(time_label) - 1,
+                    _("Estimated time until fully charged: %d:%02d"), 
+                    hours, minutes);
+         } else {
+            snprintf(time_label + 1, sizeof(time_label) - 1,
+                    _("Estimated remaining battery time: %d:%02d"), 
+                    hours, minutes);
+         }
+      } else {
+         *time_label = 0;
+      }
    
       /* Update the battery meter, tooltip and label */
       
@@ -521,6 +526,15 @@
       gtk_label_set_text (GTK_LABEL (battery->percent), new_label);
       gtk_label_set_text (GTK_LABEL (battery->statuspercent), new_label);
       
+      if (batt_time > 0 && batterypresent) {
+         snprintf(new_label, sizeof(new_label),"%d:%02d", hours, minutes);
+      } else {
+	 *new_label = 0; 
+      }
+
+      gtk_label_set_text (GTK_LABEL (battery->time), new_label);
+      gtk_label_set_text (GTK_LABEL (battery->statustime), new_label);
+
       if (batt_life <= battery->red_val) {
 	 color=red;
 	 darkcolor=darkred;
@@ -636,39 +650,39 @@
       if (battery->showstatus == 0) {
 	 if (batterypresent) {
 	    if(acline_status == 0) {
-	       snprintf(new_string, sizeof(new_string), 
+	       snprintf(new_label, sizeof(new_label), 
 			/* This string will display as a tooltip over the battery frame
 			 when the computer is using battery power.*/
-			_("System is running on battery power. Battery: %d%% (%s)"),
+			_("System is running on battery power\nBattery: %d%% (%s)"),
 			batt_life,
 			_(status[batt_state]));
 	    } else {
-	       snprintf(new_string, sizeof(new_string), 
+	       snprintf(new_label, sizeof(new_label), 
 			/* This string will display as a tooltip over the battery frame
 			 when the computer is using AC power.*/
-			_("System is running on AC power. Battery: %d%% (%s)"),
+			_("System is running on AC power\nBattery: %d%% (%s)"),
 			batt_life,
 			_(status[batt_state]));
 	    }
 	 } else {
 	    if(acline_status == 0) {
-	       snprintf(new_string, sizeof(new_string), 
+	       snprintf(new_label, sizeof(new_label), 
 			/* This string will display as a tooltip over the
 			 battery frame when the computer is using battery
 			 power and the battery isn't present. Not a
 			 possible combination, I guess... :)*/
-			_("System is running on battery power. Battery: Not present"));
+			_("System is running on battery power\nBattery: Not present"));
 	    } else {
-	       snprintf(new_string, sizeof(new_string), 
+	       snprintf(new_label, sizeof(new_label), 
 			/* This string will display as a tooltip over the
 			 battery frame when the computer is using AC
 			 power and the battery isn't present.*/
-			_("System is running on AC power. Battery: Not present"));
+			_("System is running on AC power\nBattery: Not present"));
 	    }
 	 }
       } else {
 	 if (batterypresent) {
-	   snprintf(new_string, sizeof(new_string), 
+	   snprintf(new_label, sizeof(new_label), 
 		    /* Displayed as a tooltip over the battery meter when there is
 		     a battery present. %d will hold the current charge and %s will
 		     hold the status of the battery, (High, Low, Critical, Charging. */
@@ -676,21 +690,80 @@
 		    batt_life,
 		    _(status[batt_state]));
 	 } else {
-	    snprintf(new_string, sizeof(new_string), 
+	    snprintf(new_label, sizeof(new_label), 
 		     /* Displayed as a tooltip over the battery meter when no
 		      battery is present. */
 		     (_("Battery: Not present")));
 	 }
       }
+
+      strncat(new_label, time_label, sizeof(new_label));
       
       gtk_tooltips_set_tip(battery->progress_tip,
 			   battery->eventbattery,
-			   gettext(new_string),
+			   gettext(new_label),
 			   NULL);
       gtk_tooltips_set_tip(battery->progressy_tip,
 			   battery->eventybattery,
-			   gettext(new_string),
+			   gettext(new_label),
 			   NULL);
+
+      /* Update the AC tooltip */
+
+      if(battery->showbattery == 0) {
+	 if (batterypresent) {
+	    if(acline_status == 0) {
+	       snprintf(new_label, sizeof(new_label), 
+			/* This string will display as a tooltip over the battery frame
+			 when the computer is using battery power.*/
+			_("System is running on battery power\nBattery: %d%% (%s)"),
+			batt_life,
+			_(status[batt_state]));
+	    } else {
+	       snprintf(new_label, sizeof(new_label), 
+			/* This string will display as a tooltip over the battery frame
+			 when the computer is using AC power.*/
+			_("System is running on AC power\nBattery: %d%% (%s)"),
+			batt_life,
+			_(status[batt_state]));
+	    }
+	 } else {
+	    if(acline_status == 0) {
+	       snprintf(new_label, sizeof(new_label), 
+			/* This string will display as a tooltip over the
+			 battery frame when the computer is using battery
+			 power and the battery isn't present. Not a
+			 possible combination, I guess... :)*/
+			_("System is running on battery power\nBattery: Not present"));
+	    } else {
+	       snprintf(new_label, sizeof(new_label), 
+			/* This string will display as a tooltip over the
+			 battery frame when the computer is using AC
+			 power and the battery isn't present.*/
+			_("System is running on AC power\nBattery: Not present"));
+	    }
+	 }
+         strncat(new_label, time_label, sizeof(new_label));
+      } else {
+	 if(acline_status == 0) {
+	    /* 0 = Battery power */
+	    snprintf(new_label, sizeof(new_label),
+		     /* This string will display as a tooltip over the status frame
+		      when the computer is using battery power.*/
+		     _("System is running on battery power"));
+	 } else {
+	    /* 1 = AC power. I should really test it explicitly here. */
+	    snprintf(new_label, sizeof(new_label),
+		     /* This string will display as a tooltip over the status frame
+		      when the computer is using AC power.*/
+		     _("System is running on AC power"));
+	 }
+      }
+
+      gtk_tooltips_set_tip (battery->ac_tip,
+			    battery->eventstatus,
+			    new_label,
+			    NULL);
       
       if (DEBUG) printf("Percent: %d, Status: %s\n", batt_life, status[batt_state]);
    }
@@ -698,9 +771,10 @@
    battery->last_charging = charging;
    battery->last_batt_state = batt_state;
    battery->last_batt_life = batt_life;
+   battery->last_batt_life = batt_time;
    battery->last_acline_status = acline_status;
    battery->last_pixmap_index = pixmap_index;
-
+   battery->conf_changed = 0;
    
    return TRUE;
 }
@@ -927,47 +1001,10 @@
 	       PanelAppletOrient  orient,
 	       ProgressData      *battstat)
 {
-   gchar new_label[80];
-   guint acline_status;
-   guint batt_state;
-   guint batt_life;
-   gchar *status[]={
-      /* The following four messages will be displayed as tooltips over
-       the battery meter.  
-       High = The APM BIOS thinks that the battery charge is High.*/
-      gettext_noop ("High"),
-      /* Low = The APM BIOS thinks that the battery charge is Low.*/
-      gettext_noop ("Low"),
-      /* Critical = The APM BIOS thinks that the battery charge is Critical.*/
-      gettext_noop ("Critical"),
-      /* Charging = The APM BIOS thinks that the battery is recharging.*/
-      gettext_noop ("Charging")};
-
    battstat->orienttype = orient;
    
    if (DEBUG) g_print("change_orient()\n");
 
-   apm_readinfo(PANEL_APPLET (applet), battstat);
-#ifdef __FreeBSD__
-   acline_status = apminfo.ai_acline ? 1 : 0;
-   batt_state = apminfo.ai_batt_stat;
-   batt_life = apminfo.ai_batt_life;
-#elif __OpenBSD__
-   acline_status = apminfo.ac_state ? 1 : 0;
-   batt_state = apminfo.battery_state;
-   batt_life = apminfo.battery_life;
-#elif __linux__
-   acline_status = apminfo.ac_line_status ? 1 : 0;
-   batt_state = apminfo.battery_status;
-   batt_life = apminfo.battery_percentage;
-#else
-   acline_status = 1;
-   batt_state = 0;
-   batt_life = 100;
-#endif
-   if(batt_state > 3) batt_state = 0;
-   if(batt_life > 100) batt_life = 100;
-
    switch(battstat->orienttype) {
     case PANEL_APPLET_ORIENT_UP:
       if(battstat->panelsize<40)
@@ -992,6 +1029,7 @@
    if (battstat->horizont) {
       /* Horizontal mode */
       gtk_widget_hide (battstat->statuspercent);
+      gtk_widget_hide (battstat->statustime);
       gtk_widget_hide (battstat->frameybattery);
       gtk_widget_show (battstat->framebattery);
       
@@ -1000,62 +1038,24 @@
 	gtk_widget_hide (battstat->statuspixmapwid);
       battstat->showpercent ?
 	gtk_widget_show (battstat->percent):gtk_widget_hide (battstat->percent);
+      battstat->showtime ?
+	gtk_widget_show (battstat->time):gtk_widget_hide (battstat->time);
       battstat->showbattery ?
 	gtk_widget_show (battstat->pixmapwid):gtk_widget_hide (battstat->pixmapwid);
-      (battstat->showbattery || battstat->showpercent) ?
+      (battstat->showbattery || battstat->showpercent || battstat->showtime) ?
 	gtk_widget_show (battstat->framebattery):gtk_widget_hide (battstat->framebattery);
-      
-      if (battstat->showbattery == 0 && battstat->showpercent == 0) {
-	 if(acline_status == 0) {
-	    snprintf(new_label, sizeof(new_label),
-		     /* This string will display as a tooltip over the status frame
-		      when the computer is using battery power and the battery meter
-		      and percent meter is hidden by the user.*/
-		     _("System is running on battery power. Battery: %d%% (%s)"),
-		     batt_life, _(status[batt_state]));
-	 } else {
-	    snprintf(new_label, sizeof(new_label),
-		     /* This string will display as a tooltip over the status frame
-		      when the computer is using AC power and the battery meter
-		      and percent meter is hidden by the user.*/
-		     _("System is running on AC power. Battery: %d%% (%s)"),
-		     batt_life, _(status[batt_state]));      
-	 }
-	 gtk_tooltips_set_tip (battstat->ac_tip,
-			       battstat->eventstatus,
-			       new_label,
-			       NULL);
-      } else {
-	 if(acline_status == 0) {
-	    /* 0 = Battery power */
-	    snprintf(new_label, sizeof(new_label),
-		     /* This string will display as a tooltip over the status frame
-		      when the computer is using battery power.*/
-		     _("System is running on battery power"));
-	 } else {
-	    /* 1 = AC power. I should really test it explicitly here. */
-	    snprintf(new_label, sizeof(new_label),
-		     /* This string will display as a tooltip over the status frame
-		      when the computer is using AC power.*/
-		     _("System is running on AC power"));
-	 }
-	 gtk_tooltips_set_tip (battstat->ac_tip,
-			       battstat->eventstatus,
-			       new_label,
-			       NULL);
 #ifdef FIXME
 	 gtk_widget_set_usize(battstat->framestatus, 20, 24);
-	 if(battstat->showbattery == 1 && battstat->showpercent == 1) {
+	 if(battstat->showbattery == 1 && (battstat->showpercent == 1 || battstat->showtime == 1)) {
 	   /*	    width=gdk_string_width((battstat->percentstyle)->font,"100%")+46+3;*/
 	    gtk_widget_set_usize(battstat->framebattery, width, 24);
-	 } else if(battstat->showbattery == 0 && battstat->showpercent == 1) {
+	 } else if(battstat->showbattery == 0 && (battstat->showpercent == 1 || battstat->showtime == 1)) {
 	   /*	    width=gdk_string_width((battstat->percentstyle)->font,"100%")+6;*/
 	    gtk_widget_set_usize(battstat->framebattery, width, 24);
-	 } else if(battstat->showbattery == 1 && battstat->showpercent == 0) {
+	 } else if(battstat->showbattery == 1 && (battstat->showpercent == 0 && battstat->showtime == 0)) {
 	    gtk_widget_set_usize(battstat->framebattery, 46, 24);	
 	 }
 #endif
-      }
    } else {
       /* Square mode */
      /*      width=gdk_string_width((battstat->percentstyle)->font,"100%")+6;*/
@@ -1067,14 +1067,16 @@
 	gtk_widget_hide (battstat->statuspixmapwid);
       battstat->showpercent ?
 	gtk_widget_show (battstat->statuspercent):gtk_widget_hide (battstat->statuspercent);
+      battstat->showtime ?
+	gtk_widget_show (battstat->statustime):gtk_widget_hide (battstat->statustime);
       battstat->showbattery ?
 	gtk_widget_show (battstat->frameybattery):gtk_widget_hide (battstat->frameybattery);
 #ifdef FIXME
-      battstat->showpercent ?
+      battstat->showpercent || battstat->showtime ?
 	gtk_widget_set_usize(battstat->framestatus,width,24):
       gtk_widget_set_usize(battstat->framestatus, 20, 24);
 #endif      
-      if(battstat->showstatus == 0 && battstat->showpercent == 1) {
+      if(battstat->showstatus == 0 && (battstat->showpercent == 1 || battstat->showtime == 1)) {
 	 gtk_widget_show (battstat->framestatus);
 	 gtk_widget_hide (battstat->statuspixmapwid);
 #ifdef FIXME
@@ -1082,59 +1084,18 @@
 #endif
       }
 #ifdef FIXME
-      if(battstat->showstatus == 1 && battstat->showpercent == 0) {
+      if(battstat->showstatus == 1 && (battstat->showpercent == 0 && battstat->showtime == 0)) {
 	 gtk_widget_set_usize(battstat->framestatus, 20, 24);
       }
-      if(battstat->showstatus == 1 && battstat->showpercent == 1) {
+      if(battstat->showstatus == 1 && (battstat->showpercent == 1 || battstat->showtime == 1)) {
 	 gtk_widget_set_usize(battstat->framestatus, width, 46);
       }
       if(battstat->showstatus == 1) {
 	 gtk_widget_show (battstat->statuspixmapwid);      
       }
 #endif
-      if(battstat->showbattery == 0 && battstat->showpercent == 0) {
-	 if(acline_status == 0) {
-	    /* 0 = Battery power */
-	    snprintf(new_label, sizeof(new_label),
-		     /* This string will display as a tooltip over the status frame
-		      when the computer is using battery power and the battery meter
-		      and percent meter is hidden by the user.*/
-		     _("System is running on battery power\nBattery: %d%% (%s)"),
-		     batt_life, _(status[batt_state]));
-	 } else {
-	    /* 1 = AC power. I should really test it explicitly here. */
-	    snprintf(new_label, sizeof(new_label),
-		     /* This string will display as a tooltip over the status frame
-		      when the computer is using AC power and the battery meter
-		      and percent meter is hidden by the user.*/
-		     _("System is running on AC power\nBattery: %d%% (%s)"),
-		     batt_life, _(status[batt_state]));
-	 }
-	 gtk_tooltips_set_tip (battstat->ac_tip,
-			       battstat->eventstatus,
-			       new_label,
-			       NULL);
-      } else {
-	 if(acline_status == 0) {
-	    /* 0 = Battery power */
-	    snprintf(new_label, sizeof(new_label),
-		     /* This string will display as a tooltip over the status frame
-		      when the computer is using battery power.*/
-		     _("System is running on battery power"));
-	 } else {
-	    /* 1 = AC power. I should really test it explicitly here. */
-	    snprintf(new_label, sizeof(new_label),
-		     /* This string will display as a tooltip over the status frame
-		      when the computer is using AC power.*/
-		     _("System is running on AC power"));
-	 }
-	 gtk_tooltips_set_tip (battstat->ac_tip,
-			       battstat->eventstatus,
-			       new_label,
-			       NULL);
-      }
    }
-   
+
    return;
 }
 
@@ -1326,6 +1287,7 @@
   battstat->showstatus = panel_applet_gconf_get_bool (applet, GCONF_PATH "show_status", NULL);
   battstat->showbattery = panel_applet_gconf_get_bool (applet, GCONF_PATH "show_battery", NULL);
   battstat->showpercent = panel_applet_gconf_get_bool (applet, GCONF_PATH "show_percent", NULL);
+  battstat->showtime = panel_applet_gconf_get_bool (applet, GCONF_PATH "show_time", NULL);
   battstat->suspend_cmd = panel_applet_gconf_get_string (applet, GCONF_PATH "suspend_command", NULL);
   
 }
@@ -1420,6 +1382,10 @@
    gtk_widget_show(battstat->percent);
    gtk_box_pack_start (GTK_BOX(battstat->hbox), battstat->percent, FALSE, TRUE, 0);
    
+   battstat->time = gtk_label_new ("0:01");
+   gtk_widget_show(battstat->time);
+   gtk_box_pack_start (GTK_BOX(battstat->hbox), battstat->time, FALSE, TRUE, 0);
+
    statusimage[BATTERY] = gdk_pixmap_create_from_xpm_d( battstat->applet->window,
 							&statusmask[BATTERY],
 							&battstat->style->bg[GTK_STATE_NORMAL],
@@ -1446,6 +1412,10 @@
    battstat->statuspercent = gtk_label_new("100%");
    gtk_box_pack_start (GTK_BOX (battstat->statusvbox), battstat->statuspercent, FALSE, TRUE, 0);
    gtk_widget_show (battstat->statuspercent);
+
+   battstat->statustime = gtk_label_new("1:23");
+   gtk_box_pack_start (GTK_BOX (battstat->statusvbox), battstat->statustime, FALSE, TRUE, 0);
+   gtk_widget_show (battstat->statustime);
  
    /* Alloc battery colors */
    for(i=0; orange[i].pixel!=-1; i++) {
@@ -1564,6 +1534,7 @@
 
   battstat->flash = FALSE;
   battstat->last_batt_life = 1000;
+  battstat->last_batt_time = -1000;
   battstat->last_acline_status = 1000;
   battstat->last_batt_state = 1000;
   battstat->last_pixmap_index = 1000;
Index: battstat_applet.glade
===================================================================
RCS file: /cvs/gnome/gnome-applets/battstat/battstat_applet.glade,v
retrieving revision 1.11
diff -u -r1.11 battstat_applet.glade
--- battstat_applet.glade	21 Jul 2003 23:19:07 -0000	1.11
+++ battstat_applet.glade	27 Oct 2003 11:45:15 -0000
@@ -785,7 +785,25 @@
 			      </child>
 
 			      <child>
-				<widget class="GtkCheckButton" id="show_percent_toggle">
+				<widget class="GtkRadioButton" id="show_time_radio">
+				  <property name="visible">True</property>
+				  <property name="can_focus">True</property>
+				  <property name="label" translatable="yes">Show _remaining battery or charge time</property>
+				  <property name="use_underline">True</property>
+				  <property name="relief">GTK_RELIEF_NORMAL</property>
+				  <property name="active">False</property>
+				  <property name="inconsistent">False</property>
+				  <property name="draw_indicator">True</property>
+				</widget>
+				<packing>
+				  <property name="padding">0</property>
+				  <property name="expand">False</property>
+				  <property name="fill">False</property>
+				</packing>
+			      </child>
+
+			      <child>
+				<widget class="GtkRadioButton" id="show_percent_radio">
 				  <property name="visible">True</property>
 				  <property name="can_focus">True</property>
 				  <property name="label" translatable="yes">Sho_w battery charge percentages</property>
@@ -794,6 +812,26 @@
 				  <property name="active">False</property>
 				  <property name="inconsistent">False</property>
 				  <property name="draw_indicator">True</property>
+				  <property name="group">show_time_radio</property>
+				</widget>
+				<packing>
+				  <property name="padding">0</property>
+				  <property name="expand">False</property>
+				  <property name="fill">False</property>
+				</packing>
+			      </child>
+
+			      <child>
+				<widget class="GtkRadioButton" id="no_text_label_radio">
+				  <property name="visible">True</property>
+				  <property name="can_focus">True</property>
+				  <property name="label" translatable="yes">_No text label</property>
+				  <property name="use_underline">True</property>
+				  <property name="relief">GTK_RELIEF_NORMAL</property>
+				  <property name="active">False</property>
+				  <property name="inconsistent">False</property>
+				  <property name="draw_indicator">True</property>
+				  <property name="group">show_time_radio</property>
 				</widget>
 				<packing>
 				  <property name="padding">0</property>
@@ -801,6 +839,7 @@
 				  <property name="fill">False</property>
 				</packing>
 			      </child>
+
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
Index: properties.c
===================================================================
RCS file: /cvs/gnome/gnome-applets/battstat/properties.c,v
retrieving revision 1.30
diff -u -r1.30 properties.c
--- properties.c	22 Oct 2003 22:01:18 -0000	1.30
+++ properties.c	27 Oct 2003 11:45:15 -0000
@@ -118,10 +118,12 @@
   ProgressData   *battstat = data;
   PanelApplet *applet = PANEL_APPLET (battstat->applet);
   gboolean toggled;
+
+  battstat->conf_changed = 1;
   
   toggled = gtk_toggle_button_get_active (button);
  
-  if (!( toggled || battstat->showpercent || battstat->showstatus)) {
+  if (!( toggled || battstat->showpercent || battstat->showtime || battstat->showstatus)) {
     gtk_toggle_button_set_active (button, !toggled);
     return;
   }
@@ -145,9 +147,11 @@
   PanelApplet *applet = PANEL_APPLET (battstat->applet);
   gboolean toggled;
   
+  battstat->conf_changed = 1;
+  
   toggled = gtk_toggle_button_get_active (button);
   
-  if (!( toggled || battstat->showpercent || battstat->showbattery)) {
+  if (!( toggled || battstat->showpercent || battstat->showtime || battstat->showbattery)) {
     gtk_toggle_button_set_active (button, !toggled);
     return;
   }
@@ -169,9 +173,11 @@
   PanelApplet *applet = PANEL_APPLET (battstat->applet);
   gboolean toggled;
   
+  battstat->conf_changed = 1;
+  
   toggled = gtk_toggle_button_get_active (button);
   
-  if (!( toggled || battstat->showstatus || battstat->showbattery)) {
+  if (!( toggled || battstat->showtime || battstat->showstatus || battstat->showbattery)) {
     gtk_toggle_button_set_active (button, !toggled);
     return;
   }
@@ -189,12 +195,55 @@
 }
 
 static void
+show_time_toggled (GtkToggleButton *button, gpointer data)
+{
+  ProgressData   *battstat = data;
+  PanelApplet *applet = PANEL_APPLET (battstat->applet);
+  gboolean toggled;
+  
+  battstat->conf_changed = 1;
+  
+  toggled = gtk_toggle_button_get_active (button);
+  
+  if (!( toggled || battstat->showtime || battstat->showstatus || battstat->showbattery)) {
+    gtk_toggle_button_set_active (button, !toggled);
+    return;
+  }
+  
+  battstat->showtime = toggled;
+  if (battstat->horizont) 
+    battstat->showtime ?
+	gtk_widget_show (battstat->time):gtk_widget_hide (battstat->time);
+  else
+    battstat->showtime ?
+	gtk_widget_show (battstat->statustime):gtk_widget_hide (battstat->statustime);
+  panel_applet_gconf_set_bool   (applet, "show_time", 
+  				 battstat->showtime, NULL);
+  				 
+}
+
+static void
+no_text_label_toggled (GtkToggleButton *button, gpointer data)
+{
+  ProgressData   *battstat = data;
+  PanelApplet *applet = PANEL_APPLET (battstat->applet);
+
+  battstat->conf_changed = 1;
+  
+  panel_applet_gconf_set_bool   (applet, "no_text_label", 
+  				 battstat->showtime, NULL);
+  				 
+}
+
+static void
 suspend_changed (GtkEditable *editable, gpointer data)
 {
   ProgressData   *battstat = data;
   PanelApplet *applet = PANEL_APPLET (battstat->applet);
   gchar *cmd;
   
+  battstat->conf_changed = 1;
+  
   cmd = gtk_editable_get_chars (editable, 0, -1);
   if (!cmd)
   	return;
@@ -215,6 +264,8 @@
   ProgressData   *battstat = data;
   PanelApplet *applet = PANEL_APPLET (battstat->applet);
   
+  battstat->conf_changed = 1;
+  
   battstat->lowbattnotification = gtk_toggle_button_get_active (button);
   panel_applet_gconf_set_bool   (applet,"low_battery_notification", 
   				 battstat->lowbattnotification, NULL);  
@@ -230,6 +281,8 @@
   ProgressData   *battstat = data;
   PanelApplet *applet = PANEL_APPLET (battstat->applet);
   
+  battstat->conf_changed = 1;
+  
   battstat->fullbattnot = gtk_toggle_button_get_active (button);
   panel_applet_gconf_set_bool   (applet,"full_battery_notification", 
   				 battstat->fullbattnot, NULL);  
@@ -246,6 +299,8 @@
   ProgressData   *battstat = data;
   PanelApplet *applet = PANEL_APPLET (battstat->applet);
   
+  battstat->conf_changed = 1;
+  
   battstat->beep = gtk_toggle_button_get_active (button);
   panel_applet_gconf_set_bool   (applet,"beep", 
   				 battstat->beep, NULL);  
@@ -257,6 +312,8 @@
   ProgressData   *battstat = data;
   PanelApplet *applet = PANEL_APPLET (battstat->applet);
   
+  battstat->conf_changed = 1;
+  
   battstat->draintop = gtk_toggle_button_get_active (button); 
   panel_applet_gconf_set_bool (applet,"drain_from_top", 
   			       battstat->draintop, NULL); 
@@ -332,6 +389,7 @@
   GtkWidget *preview_hbox;
   GtkWidget *widget;
   guint      percentage;
+  guint      time;
   gboolean   writable;
   GConfClient *client;
   gboolean   inhibit_command_line;
@@ -353,6 +411,7 @@
 #else
   percentage = 100;
 #endif
+  time = apminfo.battery_time;
 
   if (DEBUG) g_print("prop_cb()\n");
 
@@ -528,14 +587,26 @@
     gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (battstat->radio_lay_status_on), TRUE);
   }
 
-  battstat->radio_lay_percent_on = glade_xml_get_widget (glade_xml, "show_percent_toggle");
+  battstat->radio_lay_percent_on = glade_xml_get_widget (glade_xml, "show_percent_radio");
+  battstat->radio_lay_time_on = glade_xml_get_widget (glade_xml, "show_time_radio");
+  battstat->radio_lay_no_label_on = glade_xml_get_widget (glade_xml, "no_text_label_radio");
   g_signal_connect (G_OBJECT (battstat->radio_lay_percent_on), "toggled",
   		    G_CALLBACK (show_percent_toggled), battstat);
+  g_signal_connect (G_OBJECT (battstat->radio_lay_time_on), "toggled",
+  		    G_CALLBACK (show_time_toggled), battstat);
+  g_signal_connect (G_OBJECT (battstat->radio_lay_no_label_on), "toggled",
+  		    G_CALLBACK (no_text_label_toggled), battstat);
   if ( ! key_writable (PANEL_APPLET (battstat->applet), "show_percent"))
 	  hard_set_sensitive (battstat->radio_lay_percent_on, FALSE);
+  if ( ! key_writable (PANEL_APPLET (battstat->applet), "show_time"))
+	  hard_set_sensitive (battstat->radio_lay_time_on, FALSE);
 
   if(battstat->showpercent) {
     gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (battstat->radio_lay_percent_on), TRUE);
+  } else if(battstat->showtime) {
+    gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (battstat->radio_lay_time_on), TRUE);
+  } else {
+    gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (battstat->radio_lay_no_label_on), TRUE);
   }
 
    gtk_dialog_set_default_response (GTK_DIALOG (battstat->prop_win), GTK_RESPONSE_CLOSE);
