diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2004-11-24 08:21:38 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2004-11-24 08:21:38 +0800 |
commit | e661bfd408557ab56b973dccfa8e90213b4516f3 (patch) | |
tree | ae945675a0f01a7fe4533a0384577ac11a2b5ab3 /x11/gnome-applets/files | |
parent | 4f9327ffd8208ce3eba37e6769579977fce62dd5 (diff) | |
download | marcuscom-ports-e661bfd408557ab56b973dccfa8e90213b4516f3.tar.gz marcuscom-ports-e661bfd408557ab56b973dccfa8e90213b4516f3.tar.zst marcuscom-ports-e661bfd408557ab56b973dccfa8e90213b4516f3.zip |
Update to 2.9.1.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@3112 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'x11/gnome-applets/files')
-rw-r--r-- | x11/gnome-applets/files/patch-aa | 66 | ||||
-rw-r--r-- | x11/gnome-applets/files/patch-ad | 354 | ||||
-rw-r--r-- | x11/gnome-applets/files/patch-battstat-acpi | 473 | ||||
-rw-r--r-- | x11/gnome-applets/files/patch-battstat_battstat.schemas.in | 11 | ||||
-rw-r--r-- | x11/gnome-applets/files/patch-gkb-new_presets.c | 11 | ||||
-rw-r--r-- | x11/gnome-applets/files/patch-null_applet_null_applet.c | 19 | ||||
-rw-r--r-- | x11/gnome-applets/files/patch-wireless_wireless-applet.c | 348 |
7 files changed, 1282 insertions, 0 deletions
diff --git a/x11/gnome-applets/files/patch-aa b/x11/gnome-applets/files/patch-aa new file mode 100644 index 000000000..83d702416 --- /dev/null +++ b/x11/gnome-applets/files/patch-aa @@ -0,0 +1,66 @@ +--- configure.orig Tue Nov 23 18:07:14 2004 ++++ configure Tue Nov 23 18:08:11 2004 +@@ -463,7 +463,7 @@ + # include <unistd.h> + #endif" + +-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT INTLTOOL_DESKTOP_RULE INTLTOOL_DIRECTORY_RULE INTLTOOL_KEYS_RULE INTLTOOL_PROP_RULE INTLTOOL_OAF_RULE INTLTOOL_PONG_RULE INTLTOOL_SERVER_RULE INTLTOOL_SHEET_RULE INTLTOOL_SOUNDLIST_RULE INTLTOOL_UI_RULE INTLTOOL_XAM_RULE INTLTOOL_KBD_RULE INTLTOOL_XML_RULE INTLTOOL_CAVES_RULE INTLTOOL_SCHEMAS_RULE INTLTOOL_THEME_RULE INTLTOOL_EXTRACT INTLTOOL_MERGE INTLTOOL_UPDATE INTLTOOL_PERL ICONV MSGFMT MSGMERGE XGETTEXT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE CPP EGREP build build_cpu build_vendor build_os host host_cpu host_vendor host_os LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PATH_TO_XRDB X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS WARN_CFLAGS PKG_CONFIG GAILUTIL_CFLAGS GAILUTIL_LIBS GNOME_APPLETS_CFLAGS GNOME_APPLETS_LIBS GNOME_LIBS2_CFLAGS GNOME_LIBS2_LIBS GNOME_VFS_APPLETS_CFLAGS GNOME_VFS_APPLETS_LIBS BUILD_GNOME_VFS_APPLETS_TRUE BUILD_GNOME_VFS_APPLETS_FALSE LIBGLADE_CFLAGS LIBGLADE_LIBS GDK_PIXBUF_CSOURCE GCONFTOOL GCONF_SCHEMA_CONFIG_SOURCE GCONF_SCHEMA_FILE_DIR GCONF_SCHEMAS_INSTALL_TRUE GCONF_SCHEMAS_INSTALL_FALSE GTOP_APPLETS_CFLAGS GTOP_APPLETS_LIBS BUILD_GTOP_APPLETS_TRUE BUILD_GTOP_APPLETS_FALSE LIBXKLAVIER_CFLAGS LIBXKLAVIER_LIBS ENABLE_FLAGS_TRUE ENABLE_FLAGS_FALSE INCLUDE_GSWITCHIT_DEVEL_TRUE INCLUDE_GSWITCHIT_DEVEL_FALSE GETTEXT_PACKAGE USE_NLS GMSGFMT CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLLIBS PO_IN_DATADIR_TRUE PO_IN_DATADIR_FALSE POFILES POSUB MKINSTALLDIRS gnomelocaledir SCROLLKEEPER_CONFIG SCROLLKEEPER_REQUIRED JW HAVE_JW_TRUE HAVE_JW_FALSE HAVE_JW GKB_SUN_TRUE GKB_SUN_FALSE CDDA_SOLARIS_TRUE CDDA_SOLARIS_FALSE APPLET_CDPLAYER_TRUE APPLET_CDPLAYER_FALSE CDROM_HOST CDROM_LIBS HAVE_LIBAPM NEED_LIBAPM HAVE_LIBAPM_TRUE HAVE_LIBAPM_FALSE NEED_LIBAPM_TRUE NEED_LIBAPM_FALSE BUILD_BATTSTAT_APPLET_TRUE BUILD_BATTSTAT_APPLET_FALSE MIXER_CFLAGS MIXER_LIBS APPLET_MIXER_TRUE APPLET_MIXER_FALSE GUCHARMAP_CFLAGS GUCHARMAP_LIBS APPLET_CHARPICK_TRUE APPLET_CHARPICK_FALSE APPLET_ACCESSX_TRUE APPLET_ACCESSX_FALSE APPLET_GSWITCHIT_TRUE APPLET_GSWITCHIT_FALSE APPLET_MODEMLIGHTS_TRUE APPLET_MODEMLIGHTS_FALSE LIBOBJS LTLIBOBJS' ++ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT INTLTOOL_DESKTOP_RULE INTLTOOL_DIRECTORY_RULE INTLTOOL_KEYS_RULE INTLTOOL_PROP_RULE INTLTOOL_OAF_RULE INTLTOOL_PONG_RULE INTLTOOL_SERVER_RULE INTLTOOL_SHEET_RULE INTLTOOL_SOUNDLIST_RULE INTLTOOL_UI_RULE INTLTOOL_XAM_RULE INTLTOOL_KBD_RULE INTLTOOL_XML_RULE INTLTOOL_CAVES_RULE INTLTOOL_SCHEMAS_RULE INTLTOOL_THEME_RULE INTLTOOL_EXTRACT INTLTOOL_MERGE INTLTOOL_UPDATE INTLTOOL_PERL ICONV MSGFMT MSGMERGE XGETTEXT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE CPP EGREP build build_cpu build_vendor build_os host host_cpu host_vendor host_os LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PATH_TO_XRDB X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS WARN_CFLAGS PKG_CONFIG GAILUTIL_CFLAGS GAILUTIL_LIBS GNOME_APPLETS_CFLAGS GNOME_APPLETS_LIBS GNOME_LIBS2_CFLAGS GNOME_LIBS2_LIBS GNOME_VFS_APPLETS_CFLAGS GNOME_VFS_APPLETS_LIBS BUILD_GNOME_VFS_APPLETS_TRUE BUILD_GNOME_VFS_APPLETS_FALSE LIBGLADE_CFLAGS LIBGLADE_LIBS GDK_PIXBUF_CSOURCE GCONFTOOL GCONF_SCHEMA_CONFIG_SOURCE GCONF_SCHEMA_FILE_DIR GCONF_SCHEMAS_INSTALL_TRUE GCONF_SCHEMAS_INSTALL_FALSE GTOP_APPLETS_CFLAGS GTOP_APPLETS_LIBS BUILD_GTOP_APPLETS_TRUE BUILD_GTOP_APPLETS_FALSE LIBXKLAVIER_CFLAGS LIBXKLAVIER_LIBS ENABLE_FLAGS_TRUE ENABLE_FLAGS_FALSE INCLUDE_GSWITCHIT_DEVEL_TRUE INCLUDE_GSWITCHIT_DEVEL_FALSE GETTEXT_PACKAGE USE_NLS GMSGFMT CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLLIBS PO_IN_DATADIR_TRUE PO_IN_DATADIR_FALSE POFILES POSUB MKINSTALLDIRS gnomelocaledir SCROLLKEEPER_CONFIG SCROLLKEEPER_REQUIRED JW HAVE_JW_TRUE HAVE_JW_FALSE HAVE_JW GKB_SUN_TRUE GKB_SUN_FALSE CDDA_SOLARIS_TRUE CDDA_SOLARIS_FALSE APPLET_CDPLAYER_TRUE APPLET_CDPLAYER_FALSE CDROM_HOST CDROM_LIBS HAVE_LIBAPM NEED_LIBAPM HAVE_LIBAPM_TRUE HAVE_LIBAPM_FALSE NEED_LIBAPM_TRUE NEED_LIBAPM_FALSE ACPIINC BUILD_BATTSTAT_APPLET_TRUE BUILD_BATTSTAT_APPLET_FALSE MIXER_CFLAGS MIXER_LIBS APPLET_MIXER_TRUE APPLET_MIXER_FALSE GUCHARMAP_CFLAGS GUCHARMAP_LIBS APPLET_CHARPICK_TRUE APPLET_CHARPICK_FALSE APPLET_ACCESSX_TRUE APPLET_ACCESSX_FALSE APPLET_GSWITCHIT_TRUE APPLET_GSWITCHIT_FALSE APPLET_MODEMLIGHTS_TRUE APPLET_MODEMLIGHTS_FALSE LIBOBJS LTLIBOBJS' + ac_subst_files='' + + # Initialize some variables set by options. +@@ -24309,6 +24309,7 @@ + *irix*) CDROM_HOST=irix; CDROM_LIBS="-lcdaudio -lmediad -lds";cd_device_path="/dev/cdrom";; + *linux*) CDROM_HOST=linux;cd_device_path="/dev/cdrom";; + *netbsd*) CDROM_HOST=netbsd;cd_device_path="/dev/rcd0";; ++*freebsd*) CDROM_HOST=freebsd;cd_device_path="/dev/acd0c";; + *solaris*) CDROM_HOST=solaris;cd_device_path="/vol/dev/aliases/cdrom0";cdplayer_type_sun=true;; + esac + case "$host" in +@@ -24370,6 +24371,7 @@ + + HAVE_LIBAPM=no + NEED_LIBAPM=no ++ACPIINC= + build_battstat_applet=no + + if test x$disable_battstat = xno; then +@@ -24521,7 +24523,12 @@ + + ;; + # list of supported OS cores that do not use libapm +- *-*-freebsd*|*-*-netbsd*|*-*-openbsd*) ++ i386-*-freebsd*|*-*-netbsd*|*-*-openbsd*) ++ if [ -n "${FREEBSD_SYS}" ]; then ++ ACPIINC="-I${FREEBSD_SYS}" ++ else ++ ACPIINC="-I/usr/src/sys" ++ fi + ;; + *) + echo "warning: ${host} is not supported by battstat_applet, not building" >&2 +@@ -25413,14 +25420,14 @@ + ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + + cat >>confdefs.h <<_ACEOF +-#define GNOME_ICONDIR "${prefix}/share/pixmaps" ++#define GNOME_ICONDIR "${datadir}/pixmaps" + _ACEOF + + + #defined the below to enable help to work for applets + + cat >>confdefs.h <<_ACEOF +-#define DATADIR "${prefix}/share" ++#define DATADIR "${datadir}" + _ACEOF + + cat >>confdefs.h <<_ACEOF +@@ -26569,6 +26576,7 @@ + s,@APPLET_CDPLAYER_FALSE@,$APPLET_CDPLAYER_FALSE,;t t + s,@CDROM_HOST@,$CDROM_HOST,;t t + s,@CDROM_LIBS@,$CDROM_LIBS,;t t ++s,@ACPIINC@,$ACPIINC,;t t + s,@HAVE_LIBAPM@,$HAVE_LIBAPM,;t t + s,@NEED_LIBAPM@,$NEED_LIBAPM,;t t + s,@HAVE_LIBAPM_TRUE@,$HAVE_LIBAPM_TRUE,;t t diff --git a/x11/gnome-applets/files/patch-ad b/x11/gnome-applets/files/patch-ad new file mode 100644 index 000000000..5a06416a0 --- /dev/null +++ b/x11/gnome-applets/files/patch-ad @@ -0,0 +1,354 @@ +--- cdplayer/cdplayer.c.orig Tue Apr 16 16:42:54 2002 ++++ cdplayer/cdplayer.c Tue Apr 30 17:31:41 2002 +@@ -671,6 +671,12 @@ + description = TRUE; + break; + case DISC_COMPLETED: ++ led_time(cd->panel.time, ++ stat.relative_address.minute, ++ stat.relative_address.second, ++ cd->panel.track_control.display, ++ stat.track); ++ break; + case DISC_STOP: + case DISC_ERROR: + led_stop(cd->panel.time, cd->panel.track_control.display); +--- /dev/null Mon May 29 02:15:42 2000 ++++ cdplayer/cdrom-freebsd.c Mon May 29 10:37:28 2000 +@@ -0,0 +1,336 @@ ++#include <stdlib.h> ++#include <string.h> ++#include <fcntl.h> ++#include <glib.h> ++#include <sys/ioctl.h> ++#include <unistd.h> ++ ++#include <sys/types.h> ++#include <sys/cdio.h> ++#include "cdrom-interface.h" ++ ++ ++#define ASSIGN_MSF(dest, src) \ ++{ \ ++ (dest).minute = (src).minute; \ ++ (dest).second = (src).second; \ ++ (dest).frame = (src).frame; \ ++} ++ ++int ++cdrom_play(cdrom_device_t cdp, int start, int stop) ++{ ++ struct ioc_play_track ti; ++ ++ ti.start_track = start; ++ ti.start_index = 1; ++ ti.end_track = stop; ++ ti.end_index = 1; ++ ++ if ((ioctl(cdp->device, CDIOCPREVENT) == -1) || ++ (ioctl(cdp->device, CDIOCPLAYTRACKS, &ti) == -1)) { ++ cdp->my_errno = errno; ++ ioctl(cdp->device, CDIOCALLOW); ++ return DISC_IO_ERROR; ++ } ++ return DISC_NO_ERROR; ++} ++ ++int ++cdrom_play_msf(cdrom_device_t cdp, cdrom_msf_t * start) ++{ ++ struct ioc_play_msf msf; ++ ++ if (cdrom_read_track_info(cdp) == DISC_IO_ERROR) ++ return DISC_IO_ERROR; ++ msf.start_m = start->minute; ++ msf.start_s = start->second; ++ msf.start_f = start->frame; ++ ++ msf.end_m = cdp->track_info[cdp->nr_track].address.minute; ++ msf.end_s = cdp->track_info[cdp->nr_track].address.second; ++ msf.end_f = cdp->track_info[cdp->nr_track].address.frame; ++ ++ if ((ioctl(cdp->device, CDIOCPREVENT) == -1) || ++ (ioctl(cdp->device, CDIOCPLAYMSF, &msf) == -1)) { ++ cdp->my_errno = errno; ++ ioctl(cdp->device, CDIOCALLOW); ++ return DISC_IO_ERROR; ++ } ++ return DISC_NO_ERROR; ++} ++ ++int ++cdrom_pause(cdrom_device_t cdp) ++{ ++ if (ioctl(cdp->device, CDIOCPAUSE) == -1) { ++ cdp->my_errno = errno; ++ ioctl(cdp->device, CDIOCALLOW); ++ return DISC_IO_ERROR; ++ } ++ return DISC_IO_ERROR; ++} ++ ++int ++cdrom_resume(cdrom_device_t cdp) ++{ ++ if (ioctl(cdp->device, CDIOCRESUME) == -1) { ++ cdp->my_errno = errno; ++ ioctl(cdp->device, CDIOCALLOW); ++ return DISC_IO_ERROR; ++ } ++ return DISC_NO_ERROR; ++} ++ ++ ++int ++cdrom_stop(cdrom_device_t cdp) ++{ ++ if ((ioctl(cdp->device, CDIOCSTOP) == -1) || ++ (ioctl(cdp->device, CDIOCALLOW) == -1)) { ++ cdp->my_errno = errno; ++ return DISC_IO_ERROR; ++ } ++ return DISC_NO_ERROR; ++} ++ ++int ++cdrom_read_track_info(cdrom_device_t cdp) ++{ ++ struct ioc_toc_header toc; ++ struct ioc_read_toc_single_entry tocentry; ++ ++ int i, j, nr_track; ++ ++ if (ioctl(cdp->device, CDIOREADTOCHEADER, &toc) == -1) { ++ cdp->my_errno = errno; ++ ioctl(cdp->device, CDIOCALLOW); ++ return DISC_IO_ERROR; ++ } ++ cdp->track0 = toc.starting_track; ++ cdp->track1 = toc.ending_track; ++ nr_track = cdp->track1 - cdp->track0 + 1; ++ if (nr_track <= 0) ++ return DISC_IO_ERROR; ++ ++ if (nr_track != cdp->nr_track) { ++ if (cdp->track_info) ++ g_free(cdp->track_info); ++ cdp->nr_track = nr_track; ++ cdp->track_info = g_malloc((cdp->nr_track + 1) * sizeof(track_info_t)); ++ } ++ for (i = 0, j = cdp->track0; i < cdp->nr_track; i++, j++) { ++ tocentry.track = j; ++ tocentry.address_format = CD_MSF_FORMAT; ++ ++ if (ioctl(cdp->device, CDIOREADTOCENTRY, &tocentry) == -1) { ++ cdp->my_errno = errno; ++ ioctl(cdp->device, CDIOCALLOW); ++ return DISC_IO_ERROR; ++ } ++ /* fill the trackinfo field */ ++ cdp->track_info[i].track = j; ++ cdp->track_info[i].audio_track = tocentry.entry.control != ++ 0x04 ? 1 : 0; ++ ASSIGN_MSF(cdp->track_info[i].address, tocentry.entry.addr.msf); ++ } ++ ++ tocentry.track = 0xAA; ++ tocentry.address_format = CD_MSF_FORMAT; ++ if (ioctl(cdp->device, CDIOREADTOCENTRY, &tocentry) == -1) { ++ cdp->my_errno = errno; ++ ioctl(cdp->device, CDIOCALLOW); ++ return DISC_IO_ERROR; ++ } ++ cdp->track_info[i].track = j; ++ cdp->track_info[i].audio_track = 0; ++ ASSIGN_MSF(cdp->track_info[i].address, tocentry.entry.addr.msf); ++ ++ return DISC_NO_ERROR; ++} ++ ++int ++cdrom_get_status(cdrom_device_t cdp, cdrom_device_status_t * stat) ++{ ++ struct ioc_read_subchannel subchnl; ++ struct cd_sub_channel_info subchnlinfo; ++ ++ subchnl.address_format = CD_MSF_FORMAT; ++ subchnl.data_format = CD_CURRENT_POSITION; ++ subchnl.track = 0; ++ subchnl.data_len = sizeof(subchnlinfo); ++ subchnl.data = &subchnlinfo; ++ if (ioctl(cdp->device, CDIOCREADSUBCHANNEL, &subchnl) == -1) { ++ cdp->my_errno = errno; ++ ioctl(cdp->device, CDIOCALLOW); ++ return DISC_IO_ERROR; ++ } ++ stat->track = subchnlinfo.what.position.track_number; ++ ASSIGN_MSF(stat->relative_address, subchnlinfo.what.position.reladdr.msf); ++ ASSIGN_MSF(stat->absolute_address, subchnlinfo.what.position.absaddr.msf); ++ switch (subchnlinfo.header.audio_status) { ++ case CD_AS_PLAY_IN_PROGRESS: ++ ioctl(cdp->device, CDIOCPREVENT); ++ stat->audio_status = DISC_PLAY; ++ break; ++ case CD_AS_PLAY_PAUSED: ++ ioctl(cdp->device, CDIOCPREVENT); ++ stat->audio_status = DISC_PAUSED; ++ break; ++ case CD_AS_PLAY_COMPLETED: ++ if (cdrom_read_track_info(cdp) == DISC_IO_ERROR) ++ return DISC_IO_ERROR; ++ stat->track = cdp->nr_track; ++ ASSIGN_MSF(stat->relative_address, ++ cdp->track_info[cdp->nr_track].address); ++ ASSIGN_MSF(stat->absolute_address, ++ cdp->track_info[cdp->nr_track].address); ++ ioctl(cdp->device, CDIOCALLOW); ++ stat->audio_status = DISC_COMPLETED; ++ break; ++ case CD_AS_AUDIO_INVALID: ++ case CD_AS_NO_STATUS: ++ case CD_AS_PLAY_ERROR: ++ ioctl(cdp->device, CDIOCALLOW); ++ stat->audio_status = DISC_STOP; ++ break; ++ default: ++ ioctl(cdp->device, CDIOCALLOW); ++ stat->audio_status = DISC_ERROR; ++ } ++ return (stat->audio_status == DISC_ERROR ? ++ DISC_IO_ERROR : DISC_NO_ERROR); ++} ++ ++cdrom_device_t ++cdrom_open(char *device, int *errcode) ++{ ++ cdrom_device_t cdp; ++ ++ cdp = g_malloc(sizeof(struct cdrom_device)); ++ ++ cdp->device = open(device, O_RDONLY); ++ if (cdp->device == -1) { ++ *errcode = errno; ++ g_free(cdp); ++ return NULL; ++ } ++ cdp->nr_track = 0; ++ cdp->track_info = NULL; ++ return cdp; ++} ++ ++void ++cdrom_close(cdrom_device_t cdp) ++{ ++ if (cdp->nr_track) ++ g_free(cdp->track_info); ++ close(cdp->device); ++ g_free(cdp); ++} ++ ++int ++cdrom_load(cdrom_device_t cdp) ++{ ++ if ((ioctl(cdp->device, CDIOCCLOSE) == -1) || ++ (ioctl(cdp->device, CDIOCALLOW) == -1)) { ++ cdp->my_errno = errno; ++ return DISC_IO_ERROR; ++ } ++ return DISC_NO_ERROR; ++} ++ ++int ++cdrom_eject(cdrom_device_t cdp) ++{ ++ if ((ioctl(cdp->device, CDIOCEJECT) == -1) || ++ (ioctl(cdp->device, CDIOCALLOW) == -1)) { ++ cdp->my_errno = errno; ++ return DISC_IO_ERROR; ++ } ++ return DISC_NO_ERROR; ++} ++ ++int ++cdrom_next(cdrom_device_t cdp) ++{ ++ cdrom_device_status_t stat; ++ ++ if ((cdrom_read_track_info(cdp) == DISC_IO_ERROR) || ++ (cdrom_get_status(cdp, &stat) == DISC_IO_ERROR)) ++ return DISC_IO_ERROR; ++ return cdrom_play(cdp, stat.track + 1, cdp->track1); ++} ++ ++int ++cdrom_prev(cdrom_device_t cdp) ++{ ++ cdrom_device_status_t stat; ++ ++ if ((cdrom_read_track_info(cdp) == DISC_IO_ERROR) || ++ (cdrom_get_status(cdp, &stat) == DISC_IO_ERROR)) ++ return DISC_IO_ERROR; ++ return cdrom_play(cdp, stat.track - 1, cdp->track1); ++} ++ ++int ++cdrom_rewind(cdrom_device_t cdp) ++{ ++ cdrom_device_status_t stat; ++ int track; ++ ++ if ((cdrom_read_track_info(cdp) == DISC_IO_ERROR) || ++ (cdrom_get_status(cdp, &stat) == DISC_IO_ERROR)) ++ return DISC_IO_ERROR; ++ if (stat.absolute_address.second != 0) ++ stat.absolute_address.second--; ++ else { ++ stat.absolute_address.second = 0; ++ if (stat.absolute_address.minute > 0) ++ stat.absolute_address.minute--; ++ } ++ stat.absolute_address.frame = 0; ++ return cdrom_play_msf(cdp, &stat.absolute_address); ++} ++ ++int ++cdrom_ff(cdrom_device_t cdp) ++{ ++ cdrom_device_status_t stat; ++ int track; ++ ++ if ((cdrom_read_track_info(cdp) == DISC_IO_ERROR) || ++ (cdrom_get_status(cdp, &stat) == DISC_IO_ERROR)) ++ return DISC_IO_ERROR; ++ stat.absolute_address.second++; ++ if (stat.absolute_address.second >= 60) { ++ stat.absolute_address.minute++; ++ stat.absolute_address.second = 0; ++ } ++ stat.absolute_address.frame = 0; ++ return cdrom_play_msf(cdp, &stat.absolute_address); ++} ++ ++int ++cdrom_track_length(cdrom_device_t cdp, int track, cdrom_msf_t * length) ++{ ++ int index, s1, s2, i; ++ ++ if ((track < cdp->track0) || (track > cdp->track1)) ++ return DISC_INDEX_OUT_OF_RANGE; ++ index = track - cdp->track0; ++ ++ s1 = cdp->track_info[index + 1].address.second; ++ s2 = cdp->track_info[index].address.second; ++ length->second = s1 = s1 - s2; ++ if (s1 < 0) { ++ i = 1; ++ length->second = s1 + 60; ++ } else ++ i = 0; ++ ++ length->minute = cdp->track_info[index + 1].address.minute - ++ cdp->track_info[index].address.minute - i; ++ ++ return 0; ++} diff --git a/x11/gnome-applets/files/patch-battstat-acpi b/x11/gnome-applets/files/patch-battstat-acpi new file mode 100644 index 000000000..584c57855 --- /dev/null +++ b/x11/gnome-applets/files/patch-battstat-acpi @@ -0,0 +1,473 @@ +--- battstat/Makefile.in.orig Mon Sep 27 18:39:44 2004 ++++ battstat/Makefile.in Mon Sep 27 18:40:56 2004 +@@ -173,6 +173,8 @@ + pixmapsdir = $(datadir)/pixmaps + pixmaps_DATA = battstat.png + ++ACPIINC = @ACPIINC@ ++ + @HAVE_LIBAPM_FALSE@@NEED_LIBAPM_TRUE@APMLIB = apmlib/libapm.a + @HAVE_LIBAPM_TRUE@@NEED_LIBAPM_TRUE@APMLIB = -lapm + @NEED_LIBAPM_FALSE@APMLIB = +@@ -191,6 +193,7 @@ + $(GNOME_APPLETS_CFLAGS) \ + $(LIBGLADE_CFLAGS) \ + $(APMINC) \ ++ $(ACPIINC) \ + -DDATA_DIR=\"$(datadir)\" \ + -DGLADE_DIR=\"$(gladedir)\" \ + -DG_LOG_DOMAIN=\"battstat_applet\" \ +@@ -205,7 +208,9 @@ + properties.c \ + battstat_applet.c \ + acpi-linux.c \ +- acpi-linux.h ++ acpi-linux.h \ ++ acpi-freebsd.c \ ++ acpi-freebsd.h + + + battstat_applet_2_LDADD = \ +@@ -242,7 +247,7 @@ + PROGRAMS = $(libexec_PROGRAMS) + + am_battstat_applet_2_OBJECTS = properties.$(OBJEXT) \ +- battstat_applet.$(OBJEXT) acpi-linux.$(OBJEXT) ++ battstat_applet.$(OBJEXT) acpi-freebsd.$(OBJEXT) acpi-linux.$(OBJEXT) + battstat_applet_2_OBJECTS = $(am_battstat_applet_2_OBJECTS) + @HAVE_LIBAPM_FALSE@@NEED_LIBAPM_TRUE@battstat_applet_2_DEPENDENCIES = \ + @HAVE_LIBAPM_FALSE@@NEED_LIBAPM_TRUE@ apmlib/libapm.a +@@ -259,6 +264,7 @@ + depcomp = $(SHELL) $(top_srcdir)/depcomp + am__depfiles_maybe = depfiles + @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/acpi-linux.Po \ ++@AMDEP_TRUE@ ./$(DEPDIR)/acpi-freebsd.Po \ + @AMDEP_TRUE@ ./$(DEPDIR)/battstat_applet.Po \ + @AMDEP_TRUE@ ./$(DEPDIR)/properties.Po + COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ +@@ -330,6 +336,7 @@ + -rm -f *.tab.c + + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acpi-linux.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acpi-freebsd.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/battstat_applet.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/properties.Po@am__quote@ + +--- battstat/acpi-freebsd.h.orig Mon Sep 27 18:39:30 2004 ++++ battstat/acpi-freebsd.h Mon Sep 27 18:39:30 2004 +@@ -0,0 +1,45 @@ ++/* ++ * Copyright (C) 2004 by Joe Marcus Clarke <marcus@FreeBSD.org> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. ++ */ ++ ++#ifndef __ACPI_FREEBSD_H__ ++#define __ACPI_FREEBSD_H__ ++ ++#define ACPIDEV "/dev/acpi" ++ ++#define BATT_MIN 0 ++#define BATT_MAX 64 ++ ++#define ACPI_ACLINE "hw.acpi.acline" ++#define ACPI_TIME "hw.acpi.battery.time" ++#define ACPI_LIFE "hw.acpi.battery.life" ++#define ACPI_STATE "hw.acpi.battery.state" ++ ++struct acpi_info { ++ gboolean ac_online; ++ int acpifd; ++ int max_capacity; ++ int low_capacity; ++ int critical_capacity; ++}; ++ ++gboolean acpi_freebsd_read(struct apm_info *apminfo, struct acpi_info * acpiinfo); ++gboolean acpi_process_event(struct acpi_info * acpiinfo); ++gboolean acpi_freebsd_init(struct acpi_info * acpiinfo); ++void acpi_freebsd_cleanup(struct acpi_info * acpiinfo); ++ ++#endif /* __ACPI_FREEBSD_H__ */ +--- battstat/acpi-freebsd.c.orig Tue Sep 28 16:55:52 2004 ++++ battstat/acpi-freebsd.c Tue Sep 28 17:00:32 2004 +@@ -0,0 +1,213 @@ ++/* battstat A GNOME battery meter for laptops. ++ * Copyright (C) 2000 by Jörgen Pehrson <jp@spektr.eu.org> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. ++ * ++ $Id: patch-battstat-acpi,v 1.5 2004-11-24 00:21:38 marcus Exp $ ++ */ ++ ++/* ++ * ACPI battery functions for FreeBSD >= 5.2. ++ * September 2004 by Joe Marcus Clarke <marcus@FreeBSD.org> ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include <config.h> ++#endif ++ ++#ifdef __FreeBSD__ ++ ++#include <stdio.h> ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#include <sys/ioctl.h> ++#include <machine/apm_bios.h> ++#include <stdlib.h> ++#include <errno.h> ++#include <unistd.h> ++#include <fcntl.h> ++#include <glib.h> ++ ++#include <dev/acpica/acpiio.h> ++#include <contrib/dev/acpica/acpi.h> ++ ++#include "acpi-freebsd.h" ++ ++static gboolean ++update_ac_info(struct acpi_info * acpiinfo) ++{ ++ int acline; ++ size_t len = sizeof(acline); ++ ++ acpiinfo->ac_online = FALSE; ++ ++ if (sysctlbyname(ACPI_ACLINE, &acline, &len, NULL, 0) == -1) { ++ return FALSE; ++ } ++ ++ acpiinfo->ac_online = acline ? TRUE : FALSE; ++ ++ return TRUE; ++} ++ ++static gboolean ++update_battery_info(struct acpi_info * acpiinfo) ++{ ++ union acpi_battery_ioctl_arg battio; ++ int i; ++ ++ /* We really don't have to do this here. All of the relevant battery ++ * info can be obtained through sysctl. However, one day, the rate ++ * may be useful to get time left to full charge. ++ */ ++ ++ for(i = BATT_MIN; i < BATT_MAX; i++) { ++ battio.unit = i; ++ if (ioctl(acpiinfo->acpifd, ACPIIO_CMBAT_GET_BIF, &battio) == -1) { ++ continue; ++ } ++ ++ acpiinfo->max_capacity += battio.bif.lfcap; ++ acpiinfo->low_capacity += battio.bif.wcap; ++ acpiinfo->critical_capacity += battio.bif.lcap; ++ } ++ ++ return TRUE; ++} ++ ++gboolean ++acpi_freebsd_init(struct acpi_info * acpiinfo) ++{ ++ int acpi_fd; ++ ++ g_assert(acpiinfo); ++ ++ acpi_fd = open(ACPIDEV, O_RDONLY); ++ if (acpi_fd >= 0) { ++ acpiinfo->acpifd = acpi_fd; ++ } ++ else { ++ acpiinfo->acpifd = -1; ++ return FALSE; ++ } ++ ++ update_battery_info(acpiinfo); ++ update_ac_info(acpiinfo); ++ ++ return TRUE; ++} ++ ++void ++acpi_freebsd_cleanup(struct acpi_info * acpiinfo) ++{ ++ g_assert(acpiinfo); ++ ++ if (acpiinfo->acpifd >= 0) { ++ close(acpiinfo->acpifd); ++ acpiinfo->acpifd = -1; ++ } ++} ++ ++/* XXX This is a hack since user-land applications can't get ACPI events yet. ++ * Devd provides this (or supposedly provides this), but you need to be ++ * root to access devd. ++ */ ++gboolean ++acpi_process_event(struct acpi_info * acpiinfo) ++{ ++ g_assert(acpiinfo); ++ ++ update_ac_info(acpiinfo); ++ update_battery_info(acpiinfo); ++ ++ return TRUE; ++} ++ ++gboolean ++acpi_freebsd_read(struct apm_info *apminfo, struct acpi_info * acpiinfo) ++{ ++ int time; ++ int life; ++ int acline; ++ int state; ++ size_t len; ++ int rate; ++ int remain; ++ union acpi_battery_ioctl_arg battio; ++ gboolean charging; ++ int i; ++ ++ g_assert(acpiinfo); ++ ++ charging = FALSE; ++ ++ for(i = BATT_MIN; i < BATT_MAX; i++) { ++ battio.unit = i; ++ if (ioctl(acpiinfo->acpifd, ACPIIO_CMBAT_GET_BST, &battio) == -1) { ++ continue; ++ } ++ ++ remain += battio.bst.cap; ++ rate += battio.bst.rate; ++ } ++ ++ len = sizeof(time); ++ if (sysctlbyname(ACPI_TIME, &time, &len, NULL, 0) == -1) { ++ return FALSE; ++ } ++ ++ len = sizeof(life); ++ if (sysctlbyname(ACPI_LIFE, &life, &len, NULL, 0) == -1) { ++ return FALSE; ++ } ++ ++ len = sizeof(state); ++ if (sysctlbyname(ACPI_STATE, &state, &len, NULL, 0) == -1) { ++ return FALSE; ++ } ++ ++ apminfo->ai_acline = acpiinfo->ac_online ? 1 : 0; ++ if (state & ACPI_BATT_STAT_CHARGING) { ++ apminfo->ai_batt_stat = 3; ++ charging = TRUE; ++ } ++ else if (state & ACPI_BATT_STAT_CRITICAL) { ++ /* Add a special check here since FreeBSD's ACPI interface will tell us ++ * when the battery is critical. ++ */ ++ apminfo->ai_batt_stat = 2; ++ } ++ else { ++ apminfo->ai_batt_stat = remain < acpiinfo->low_capacity ? 1 : remain < acpiinfo->critical_capacity ? 2 : 0; ++ } ++ apminfo->ai_batt_life = life; ++ if (!charging) { ++ apminfo->ai_batt_time = time * 60; ++ } ++ else if (charging && rate > 0) { ++ apminfo->ai_batt_time = (int) ((acpiinfo->max_capacity-remain)/(float)rate * 60); ++ } ++ else ++ /* This multiplication is a hack to make sure the -1 survives so the applet ++ * can process it. Battstat wants the remaining time in minutes, but ++ * ai_batt_time is in seconds. In order to make both ACPI and APM work ++ * with the fewest amount of hacks, we will just assume everything is ++ * in seconds. ++ */ ++ apminfo->ai_batt_time = -1 * 60; ++ ++ return TRUE; ++} ++#endif +--- battstat/battstat_applet.c.orig Mon Oct 25 02:11:38 2004 ++++ battstat/battstat_applet.c Tue Nov 23 18:27:14 2004 +@@ -62,6 +62,9 @@ + #ifdef __linux__ + #include "acpi-linux.h" + #endif ++#ifdef __FreeBSD__ ++#include "acpi-freebsd.h" ++#endif + + #ifndef gettext_noop + #define gettext_noop(String) (String) +@@ -237,6 +240,24 @@ + #endif + + #ifdef __FreeBSD__ ++struct acpi_info acpiinfo; ++gboolean using_acpi; ++int acpi_count; ++ ++gboolean acpi_freebsd_read(struct apm_info *apminfo, struct acpi_info *acpiinfo); ++ ++gboolean acpi_callback (gpointer data) ++{ ++ ProgressData * battstat = (ProgressData *) data; ++ ++ if (acpi_process_event(&acpiinfo)) { ++ acpi_freebsd_read(&apminfo, &acpiinfo); ++ pixmap_timeout(data); ++ } ++ ++ return TRUE; ++} ++ + void + apm_readinfo (PanelApplet *applet, ProgressData * battstat) + { +@@ -247,13 +268,22 @@ + int fd; + if (DEBUG) g_print("apm_readinfo() (FreeBSD)\n"); + +- fd = open(APMDEVICE, O_RDONLY); +- if (fd == -1) cleanup (applet, 1); ++ if (using_acpi) { ++ if (acpi_count <= 0) { ++ acpi_count = 30; ++ acpi_freebsd_read(&apminfo, &acpiinfo); ++ } ++ acpi_count--; ++ } ++ else { ++ fd = open(APMDEVICE, O_RDONLY); ++ if (fd == -1) cleanup (applet, 1); + +- if (ioctl(fd, APMIO_GETINFO, &apminfo) == -1) +- err(1, "ioctl(APMIO_GETINFO)"); ++ if (ioctl(fd, APMIO_GETINFO, &apminfo) == -1) ++ err(1, "ioctl(APMIO_GETINFO)"); + +- close(fd); ++ close(fd); ++ } + } + #elif defined(__NetBSD__) || defined(__OpenBSD__) + void +@@ -361,7 +391,7 @@ + + #ifdef __FreeBSD__ + acline_status = apminfo.ai_acline ? 1 : 0; +- time = apminfo.ai_batt_time; ++ time = (int) (apminfo.ai_batt_time / 60); + batt_life = apminfo.ai_batt_life; + #elif defined (__NetBSD__) || defined(__OpenBSD__) + acline_status = apminfo.ac_state ? 1 : 0; +@@ -375,8 +405,10 @@ + + if (batt_life > 100) batt_life = 100; + +- hours = time / 60; +- mins = time % 60; ++ if (time >= 0) { ++ hours = time / 60; ++ mins = time % 60; ++ } + + if (acline_status && batt_life == 100) + return g_strdup_printf (_("Battery charged (%d%%)"), batt_life); +@@ -695,7 +727,13 @@ + else + { + int time; ++#ifdef __FreeBSD__ ++ time = (int) (apminfo.ai_batt_time / 60); ++#elif defined (__NetBSD__) || defined(__OpenBSD__) ++ time = apminfo.minutes_left; ++#elif __linux__ + time = apminfo.battery_time; ++#endif + new_label = g_strdup_printf ("%d:%02d", time/60, time%60); + } + } +@@ -920,6 +958,13 @@ + pdata->acpiwatch = 0; + acpi_linux_cleanup(&acpiinfo); + } ++#elif defined(__FreeBSD__) ++ if (using_acpi) { ++ if (pdata->acpiwatch != 0) ++ g_source_remove(pdata->acpiwatch); ++ pdata->acpiwatch = 0; ++ acpi_freebsd_cleanup(&acpiinfo); ++ } + #endif + + if (pdata->suspend_cmd) +@@ -1058,6 +1103,7 @@ + "Lennart Poettering <lennart@poettering.de> (Linux ACPI support)", + "Seth Nickell <snickell@stanford.edu> (GNOME2 port)", + "Davyd Madeley <davyd@madeley.id.au>", ++ "Joe Marcus Clarke <marcus@FreeBSD.org> (FreeBSD ACPI support)", + NULL + }; + +@@ -1653,11 +1699,18 @@ + using_acpi = TRUE; + acpi_count = 0; + } ++#elif defined(__FreeBSD__) ++ if (acpi_freebsd_init(&acpiinfo)) { ++ using_acpi = TRUE; ++ acpi_count = 0; ++ } ++ else ++ using_acpi = FALSE; + #endif + apm_readinfo (applet, NULL); + + #ifdef __FreeBSD__ +- if(apminfo.ai_status == 0) cleanup (applet, 2); ++ if(!using_acpi && apminfo.ai_status == 0) cleanup (applet, 2); + #endif + + battstat = g_new0 (ProgressData, 1); +@@ -1696,6 +1749,10 @@ + battstat->acpiwatch = g_io_add_watch (acpiinfo.channel, + G_IO_IN | G_IO_ERR | G_IO_HUP, + acpi_callback, battstat); ++ } ++#elif defined(__FreeBSD__) ++ if (using_acpi) { ++ battstat->acpiwatch = g_timeout_add (2000, acpi_callback, battstat); + } + #endif + diff --git a/x11/gnome-applets/files/patch-battstat_battstat.schemas.in b/x11/gnome-applets/files/patch-battstat_battstat.schemas.in new file mode 100644 index 000000000..ecaea9dab --- /dev/null +++ b/x11/gnome-applets/files/patch-battstat_battstat.schemas.in @@ -0,0 +1,11 @@ +--- battstat/battstat.schemas.in.orig Fri Oct 1 16:22:39 2004 ++++ battstat/battstat.schemas.in Fri Oct 1 16:22:46 2004 +@@ -115,7 +115,7 @@ + <key>/schemas/apps/battstat-applet/prefs/suspend_command</key> + <owner>battstat-applet</owner> + <type>string</type> +- <default>/usr/bin/apm -s</default> ++ <default>/usr/sbin/apm -s</default> + <locale name="C"> + <short>Suspend Command</short> + <long>Command to send to suspend the computer</long> diff --git a/x11/gnome-applets/files/patch-gkb-new_presets.c b/x11/gnome-applets/files/patch-gkb-new_presets.c new file mode 100644 index 000000000..f90708170 --- /dev/null +++ b/x11/gnome-applets/files/patch-gkb-new_presets.c @@ -0,0 +1,11 @@ +--- gkb-new/preset.c.orig Fri Mar 14 09:13:44 2003 ++++ gkb-new/preset.c Fri Mar 14 09:13:54 2003 +@@ -42,7 +42,7 @@ + + /* TODO: user's local presets */ + +- text = gnome_unconditional_datadir_file ("gnome/gkb/"); ++ text = gnome_unconditional_datadir_file ("gkb/"); + if (!text) + return NULL; + dir = opendir (text); diff --git a/x11/gnome-applets/files/patch-null_applet_null_applet.c b/x11/gnome-applets/files/patch-null_applet_null_applet.c new file mode 100644 index 000000000..c4f90b1e7 --- /dev/null +++ b/x11/gnome-applets/files/patch-null_applet_null_applet.c @@ -0,0 +1,19 @@ +--- null_applet/null_applet.c.orig Tue Nov 23 18:17:07 2004 ++++ null_applet/null_applet.c Tue Nov 23 18:17:21 2004 +@@ -126,6 +126,7 @@ + gpointer user_data) + { + char *applet_list; ++ GtkWidget *dialog; + + if (already_running) + { +@@ -136,8 +137,6 @@ + g_warning ("was given applet to handle\n"); + + applet_list = get_all_applets (); +- +- GtkWidget *dialog; + + dialog = gtk_message_dialog_new_with_markup (NULL, + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, diff --git a/x11/gnome-applets/files/patch-wireless_wireless-applet.c b/x11/gnome-applets/files/patch-wireless_wireless-applet.c new file mode 100644 index 000000000..f104fd819 --- /dev/null +++ b/x11/gnome-applets/files/patch-wireless_wireless-applet.c @@ -0,0 +1,348 @@ +--- wireless/wireless-applet.c.orig Sat Oct 30 09:41:14 2004 ++++ wireless/wireless-applet.c Tue Nov 23 18:13:26 2004 +@@ -30,12 +30,25 @@ + #include <math.h> + #include <dirent.h> + ++#ifdef __FreeBSD__ ++#include <sys/socket.h> ++#include <sys/ioctl.h> ++#include <net/if.h> ++#include <net/if_var.h> ++#include <dev/an/if_aironet_ieee.h> ++#include <dev/wi/if_wavelan_ieee.h> ++#endif ++ + #include <gnome.h> + #include <panel-applet.h> + #include <panel-applet-gconf.h> + #include <glade/glade.h> + ++#ifdef __FreeBSD__ ++#define CFG_DEVICE "an0" ++#else + #define CFG_DEVICE "eth0" ++#endif + #define CFG_UPDATE_INTERVAL 2 + + typedef enum { +@@ -92,6 +105,12 @@ + WirelessApplet *applet); + static void wireless_applet_about_cb (BonoboUIComponent *uic, + WirelessApplet *applet); ++#ifdef __FreeBSD__ ++static int an_getval(WirelessApplet *applet, char *device, struct an_req *areq); ++static void get_an_data(WirelessApplet *applet, char *device, long int *level); ++static int wi_getval(WirelessApplet *applet, char *device, struct wi_req *areq); ++static void get_wi_data(WirelessApplet *applet, char *device, long int *level); ++#endif + static void prefs_response_cb (GtkDialog *dialog, gint response, gpointer data); + + static const BonoboUIVerb wireless_menu_verbs [] = { +@@ -159,9 +178,11 @@ + g_free (tltp); + + /* Update the image */ ++#ifndef __FreeBSD__ + percent = CLAMP (percent, -1, 100); ++#endif + +- if (percent < 0) ++ if (percent < 0 || percent > 100) + state = PIX_BROKEN; + else if (percent == 0) + state = PIX_NO_LINK; +@@ -192,6 +213,7 @@ + int percent; + + /* Calculate the percentage based on the link quality */ ++#ifndef __FreeBSD__ + if (level < 0) { + percent = -1; + } else { +@@ -202,6 +224,9 @@ + percent = CLAMP (percent, 0, 100); + } + } ++#else ++ percent = (int)level; ++#endif + + wireless_applet_draw (applet, percent); + } +@@ -244,14 +269,179 @@ + } + } + ++#ifdef __FreeBSD__ ++static int ++wi_getval(WirelessApplet *applet, char *device, struct wi_req *wreq) ++{ ++ struct ifreq ifr; ++ int s; ++ ++ bzero((char *)&ifr, sizeof(ifr)); ++ ++ strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)); ++ ifr.ifr_data = (caddr_t)wreq; ++ ++ s = socket(AF_INET, SOCK_DGRAM, 0); ++ ++ if (s == -1) ++ { ++ gtk_tooltips_set_tip (applet->tips, ++ GTK_WIDGET (applet), ++ "Socket Error", ++ NULL); ++ return 0; ++ } ++ ++ if (ioctl(s, SIOCGWAVELAN, &ifr) == -1) ++ { ++ gtk_tooltips_set_tip (applet->tips, ++ GTK_WIDGET (applet), ++ "ioctl Error", ++ NULL); ++ close (s); ++ return 0; ++ } ++ ++ close(s); ++ ++ return 1; ++} ++ ++static void ++get_wi_data (WirelessApplet *applet, char *device, long int *level) ++{ ++ struct wi_req wreq; ++ long int signal_strength; ++ ++ bzero((char *)&wreq, sizeof(wreq)); ++ ++ wreq.wi_len = WI_MAX_DATALEN; ++ wreq.wi_type = WI_RID_COMMS_QUALITY; ++ ++ (void)wi_getval(applet, device, &wreq); ++ ++ signal_strength = (long int) (wreq.wi_val[1]); ++ ++#ifdef WI_RID_READ_APS ++ if (signal_strength <= 0) { ++ /* we fail to get signal strength by usual means, try another way */ ++ static time_t last_scan; ++ static long int cached; ++ time_t now = time(NULL); ++ ++ /* XXX: this is long operation, and we will scan station not often then one in 5 secs */ ++ if (now > last_scan + 5) { ++ struct wi_apinfo *w; ++ int nstations; ++ ++ bzero((char *)&wreq, sizeof(wreq)); ++ wreq.wi_len = WI_MAX_DATALEN; ++ wreq.wi_type = WI_RID_READ_APS; ++ ++ (void)wi_getval(applet, device, &wreq); ++ ++ nstations = *(int *)wreq.wi_val; ++ if (nstations > 0) { ++ w = (struct wi_apinfo *)(((char *)&wreq.wi_val) + sizeof(int)); ++ signal_strength = (long int)w->signal; ++ } ++ ++ cached = signal_strength; ++ last_scan = now; ++ } else { ++ signal_strength = cached; ++ } ++ } ++#endif ++ ++ memcpy(level, &signal_strength, sizeof( *level )); ++ ++ return; ++} ++ ++static int ++an_getval(WirelessApplet *applet, char *device, struct an_req *areq) ++{ ++ struct ifreq ifr; ++ int s; ++ ++ bzero((char *)&ifr, sizeof(ifr)); ++ ++ strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)); ++ ifr.ifr_data = (caddr_t)areq; ++ ++ s = socket(AF_INET, SOCK_DGRAM, 0); ++ ++ if (s == -1) { ++ gtk_tooltips_set_tip (applet->tips, ++ GTK_WIDGET (applet), ++ "Socket Error", ++ NULL); ++ return 0; ++ } ++ ++ if (ioctl(s, SIOCGAIRONET, &ifr) == -1) { ++ gtk_tooltips_set_tip (applet->tips, ++ GTK_WIDGET (applet), ++ "ioctl Error", ++ NULL); ++ close (s); ++ return 0; ++ } ++ ++ close(s); ++ return 1; ++} ++ ++static void ++get_an_data (WirelessApplet *applet, char *device, long int *level) ++{ ++ struct an_req areq; ++ struct an_ltv_status *sts; ++#ifdef AN_RID_RSSI_MAP ++ struct an_ltv_rssi_map an_rssimap; ++#endif ++ long int signal_strength; ++ int rssimap_valid = 0; ++ ++#ifdef AN_RID_RSSI_MAP ++ an_rssimap.an_len = sizeof(an_rssimap); ++ an_rssimap.an_type = AN_RID_RSSI_MAP; ++ rssimap_valid = an_getval(applet, device, (struct an_req*)&an_rssimap); ++#endif ++ ++ areq.an_len = sizeof(areq); ++ areq.an_type = AN_RID_STATUS; ++ ++ (void)an_getval(applet, device, &areq); ++ ++ sts = (struct an_ltv_status *)&areq; ++#ifdef AN_RID_RSSI_MAP ++ if (rssimap_valid) ++ signal_strength = (long int)(an_rssimap.an_entries[ ++ sts->an_normalized_strength].an_rss_pct); ++ else ++ signal_strength = (long int)(sts->an_normalized_strength); ++#else ++ signal_strength = (long int)(sts->an_normalized_rssi); ++#endif ++ memcpy(level, &signal_strength, sizeof(level)); ++} ++#endif ++ + /* check stats, modify the state attribute */ + static void + wireless_applet_read_device_state (WirelessApplet *applet) + { +- long int level, noise; +- double link; ++ long int level; + char device[256]; ++#ifdef __FreeBSD__ ++ struct if_nameindex *ifstart, *ifs; ++#else ++ long int noise; ++ double link; + char line[256]; ++#endif + gboolean found = FALSE; + + /* resest list of available wireless devices */ +@@ -259,8 +449,37 @@ + g_list_free (applet->devices); + applet->devices = NULL; + ++#ifdef __FreeBSD__ ++ ifs = ifstart = if_nameindex (); ++#endif ++ + /* Here we begin to suck... */ + do { ++#ifdef __FreeBSD__ ++ if (ifs == NULL || ifs->if_name == NULL) { ++ break; ++ } ++ strlcpy (device, ifs->if_name, 6); ++ if (g_strncasecmp (device, "an", 2)==0) { ++ applet->devices = g_list_prepend (applet->devices, g_strdup (device)); ++ if (g_strcasecmp (applet->device, device)==0) { ++ get_an_data (applet, device, &level); ++ wireless_applet_update_state (applet, device, 0, level, 0); ++ found = TRUE; ++ } ++ } ++ else if (g_strncasecmp (device, "wi", 2)==0 || ++ g_strncasecmp (device, "ath", 3)==0 || ++ g_strncasecmp (device, "ndis", 4)==0) { ++ applet->devices = g_list_prepend (applet->devices, g_strdup (device)); ++ if (g_strcasecmp (applet->device, device)==0) { ++ get_wi_data (applet, device, &level); ++ wireless_applet_update_state (applet, device, 0, level, 0); ++ found = TRUE; ++ } ++ } ++ ifs++; ++#else + char *ptr; + + fgets (line, 256, applet->file); +@@ -294,6 +513,7 @@ + found = TRUE; + } + } ++#endif + } while (1); + + if (g_list_length (applet->devices)==1) { +@@ -305,17 +525,23 @@ + } + + /* rewind the /proc/net/wireless file */ ++#ifdef __FreeBSD__ ++ if_freenameindex(ifstart); ++#else + rewind (applet->file); ++#endif + } + + static int + wireless_applet_timeout_handler (WirelessApplet *applet) + { ++#ifndef __FreeBSD__ + if (applet->file == NULL) { + wireless_applet_update_state (applet, + applet->device, -1, -1, -1); + return FALSE; + } ++#endif + + wireless_applet_read_device_state (applet); + +@@ -364,10 +590,12 @@ + static void + start_file_read (WirelessApplet *applet) + { ++#ifndef __FreeBSD__ + applet->file = fopen ("/proc/net/wireless", "rt"); + if (applet->file == NULL) { + show_error_dialog (applet, _("There doesn't seem to be any wireless devices configured on your system.\nPlease verify your configuration if you think this is incorrect.")); + } ++#endif + } + + static void +@@ -670,8 +898,10 @@ + applet->prefs = NULL; + } + ++#ifndef __FreeBSD__ + if (applet->file) + fclose (applet->file); ++#endif + if (applet->tips) + g_object_unref (applet->tips); + } |