diff options
author | chopps <chopps> | 1999-07-15 17:53:56 +0000 |
---|---|---|
committer | chopps <chopps> | 1999-07-15 17:53:56 +0000 |
commit | ab046cc114bf23d7545ced6744eac8a83c3bf82f (patch) | |
tree | a7b2921116ddbc8be77dd2e94b0861df9de2b933 /x11 | |
parent | 0cd0c9d2c24f90b3a643850dc5256c4a05c8b287 (diff) | |
download | pkgsrc-ab046cc114bf23d7545ced6744eac8a83c3bf82f.tar.gz |
add patches for battery applet
Diffstat (limited to 'x11')
-rw-r--r-- | x11/gnome-core/patches/patch-ag | 48 | ||||
-rw-r--r-- | x11/gnome-core/patches/patch-ah | 14 |
2 files changed, 62 insertions, 0 deletions
diff --git a/x11/gnome-core/patches/patch-ag b/x11/gnome-core/patches/patch-ag new file mode 100644 index 00000000000..58cdd092eea --- /dev/null +++ b/x11/gnome-core/patches/patch-ag @@ -0,0 +1,48 @@ +--- applets/battery/read-battery.c.orig Thu Jul 15 13:59:20 1999 ++++ applets/battery/read-battery.c Thu Jul 15 14:41:09 1999 +@@ -185,7 +185,44 @@ + close(fd); + return TRUE; + +-#else /* ! ( __linux__ || __FreeBSD__) */ ++#elif defined(__NetBSD__) ++ ++ struct apm_power_info aip; ++ int fd; ++ ++ fd = open(APMDEV, O_RDONLY); ++ if (fd == -1) ++ { ++ g_error (_("Cannot open /dev/apm; can't get data.")); ++ return FALSE; ++ } ++ ++ if (ioctl(fd, APM_IOC_GETPOWER, &aip) == -1) { ++ g_error(_("ioctl failed on /dev/apm.")); ++ return FALSE; ++ } ++ ++ *hours_remaining = aip.minutes_left / 60; ++ aip.minutes_left %= 60; ++ *minutes_remaining = aip.minutes_left; ++ ++ /* if APM is not turned on */ ++ if (aip.battery_state == APM_BATT_UNKNOWN) ++ { ++ g_error(_("APM battery state unknown! Cannot read battery charge information.")); ++ } ++ if (aip.ac_state == APM_AC_UNKNOWN) ++ { ++ g_error(_("APM ac state is unknown! Cannot read battery charge information.")); ++ } ++ ++ *ac_online = aip.ac_state == APM_AC_ON; ++ *percentage = aip.battery_life; ++ ++ close(fd); ++ return TRUE; ++ ++#else /* ! ( __linux__ || __FreeBSD__ || __NetBSD__ ) */ + + /* Assume always connected to power. */ + *ac_online = 1; diff --git a/x11/gnome-core/patches/patch-ah b/x11/gnome-core/patches/patch-ah new file mode 100644 index 00000000000..7570dc67ed6 --- /dev/null +++ b/x11/gnome-core/patches/patch-ah @@ -0,0 +1,14 @@ +--- applets/battery/read-battery.h.orig Thu Jul 15 13:59:25 1999 ++++ applets/battery/read-battery.h Thu Jul 15 14:41:22 1999 +@@ -18,6 +18,11 @@ + #include <fcntl.h> + #include <machine/apm_bios.h> + #define APMDEV "/dev/apm" ++#elif defined(__NetBSD__) ++#include <sys/ioctl.h> ++#include <machine/apmvar.h> ++#include <fcntl.h> ++#define APMDEV "/dev/apm" + #endif + + /* Prototypes */ |