diff -u -r gnome-applets-2.17.90/battstat/battstat-hal.c gnome-applets-2.17.90-new/battstat/battstat-hal.c
--- gnome-applets-2.17.90/battstat/battstat-hal.c 2007-02-04 11:09:33.000000000 +0800
+++ gnome-applets-2.17.90-new/battstat/battstat-hal.c 2007-03-07 14:15:17.156270000 +0800
@@ -69,11 +69,11 @@
battery->status.present =
libhal_device_get_property_bool( ctx, battery->udi, key, &error );
- if( !strcmp( key, "battery.charge_level.current" ) )
+ else if( !strcmp( key, "battery.charge_level.current" ) )
battery->status.current_level =
libhal_device_get_property_int( ctx, battery->udi, key, &error );
- if( !strcmp( key, "battery.charge_level.rate" ) )
+ else if( !strcmp( key, "battery.charge_level.rate" ) )
battery->status.rate =
libhal_device_get_property_int( ctx, battery->udi, key, &error );
@@ -86,8 +86,13 @@
libhal_device_get_property_int( ctx, battery->udi, key, &error );
else if( !strcmp( key, "battery.remaining_time" ) )
- battery->status.remaining_time =
- libhal_device_get_property_int( ctx, battery->udi, key, &error );
+ if( libhal_device_property_exists( ctx, battery->udi,
+ "battery.remaining_time", &error ) ) {
+ battery->status.remaining_time =
+ libhal_device_get_property_int( ctx, battery->udi, key, &error );
+ } else {
+ battery->status.remaining_time = -1;
+ }
else if( !strcmp( key, "battery.rechargeable.is_charging" ) )
battery->status.charging =
@@ -190,7 +195,7 @@
/* It is safe to do nothing since the device will have been marked as
* not present and the old information will be ignored.
*/
- if( is_removed )
+ if( is_removed && strcmp( key, "battery.remaining_time" ))
return;
changed = FALSE;
@@ -566,7 +571,7 @@
* unknown time remaining.
*/
- if( remaining_time == 0 )
+ if( remaining_time == -1 )
status->minutes = -1;
else
status->minutes = (remaining_time + 30) / 60;
diff -u -r gnome-applets-2.17.90/battstat/power-management.c gnome-applets-2.17.90-new/battstat/power-management.c
--- gnome-applets-2.17.90/battstat/power-management.c 2007-02-04 11:09:33.000000000 +0800
+++ gnome-applets-2.17.90-new/battstat/power-management.c 2007-03-07 13:12:45.163914000 +0800
@@ -448,10 +448,16 @@
using_hal = TRUE;
return NULL;
}
+#if (defined(sun) && defined(__SVR4)) || defined(__sun__)
+ else
+ /* On Solaris, only HAL is supported */
+ return NULL;
+#else
else
/* fallback to legacy methods */
g_free( err );
#endif
+#endif
#ifdef __linux__
diff -u -r gnome-applets-2.17.90/configure.in gnome-applets-2.17.90-new/configure.in
--- gnome-applets-2.17.90/configure.in 2007-02-26 22:51:32.000000000 +0800
+++ gnome-applets-2.17.90-new/configure.in 2007-03-07 13:12:45.164678000 +0800
@@ -398,6 +398,13 @@
fi
;;
+ *-*-solaris*)
+ if test "x$HAVE_HAL" = "xno"; then
+ echo "warning: ${host} is not supported by battstat_applet, not building" >&2
+ build_battstat_applet=no
+ fi
+ ;;
+
*)
echo "warning: ${host} is not supported by battstat_applet, not building" >&2
build_battstat_applet=no