diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2004-07-20 07:00:07 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2004-07-20 07:00:07 +0800 |
commit | a03df4987f97705a5fe42f88b51a1bd6ac90e0e9 (patch) | |
tree | 7d0606b50c39568747543b0dd0e30646bdbc572a /x11/gnome-applets/files | |
parent | 0af8a4748ae88023708176766da32651bafefce3 (diff) | |
download | marcuscom-ports-a03df4987f97705a5fe42f88b51a1bd6ac90e0e9.tar marcuscom-ports-a03df4987f97705a5fe42f88b51a1bd6ac90e0e9.tar.gz marcuscom-ports-a03df4987f97705a5fe42f88b51a1bd6ac90e0e9.tar.bz2 marcuscom-ports-a03df4987f97705a5fe42f88b51a1bd6ac90e0e9.tar.lz marcuscom-ports-a03df4987f97705a5fe42f88b51a1bd6ac90e0e9.tar.xz marcuscom-ports-a03df4987f97705a5fe42f88b51a1bd6ac90e0e9.tar.zst marcuscom-ports-a03df4987f97705a5fe42f88b51a1bd6ac90e0e9.zip |
Update to 2.7.0.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@2488 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'x11/gnome-applets/files')
-rw-r--r-- | x11/gnome-applets/files/patch-aa | 36 | ||||
-rw-r--r-- | x11/gnome-applets/files/patch-ad | 354 | ||||
-rw-r--r-- | x11/gnome-applets/files/patch-battstat_battstat_applet.c | 26 | ||||
-rw-r--r-- | x11/gnome-applets/files/patch-gkb-new_presets.c | 11 | ||||
-rw-r--r-- | x11/gnome-applets/files/patch-gweather_gweather-pref.c | 70 | ||||
-rw-r--r-- | x11/gnome-applets/files/patch-gweather_weather.c | 30 | ||||
-rw-r--r-- | x11/gnome-applets/files/patch-wireless_wireless-applet.c | 319 |
7 files changed, 846 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..73b0823ce --- /dev/null +++ b/x11/gnome-applets/files/patch-aa @@ -0,0 +1,36 @@ +--- configure.orig Sun Feb 22 19:22:49 2004 ++++ configure Sun Feb 22 19:24:33 2004 +@@ -22912,6 +22912,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 +@@ -23034,7 +23035,7 @@ + + ;; + # list of supported OS cores that do not use libapm +- *-*-freebsd*|*-*-netbsd*|*-*-openbsd*) ++ i386-*-freebsd*|*-*-netbsd*|*-*-openbsd*) + ;; + *) + echo "warning: ${host} is not supported by battstat_applet, not building" >&2 +@@ -24905,14 +24906,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 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_battstat_applet.c b/x11/gnome-applets/files/patch-battstat_battstat_applet.c new file mode 100644 index 000000000..6368545f0 --- /dev/null +++ b/x11/gnome-applets/files/patch-battstat_battstat_applet.c @@ -0,0 +1,26 @@ +--- battstat/battstat_applet.c.orig Mon Jul 19 18:31:16 2004 ++++ battstat/battstat_applet.c Mon Jul 19 18:34:41 2004 +@@ -474,7 +474,11 @@ + ) { + /* Warn that battery dropped below red_val */ + if(battery->lowbattnotification) { ++#ifdef __FreeBSD__ ++ new_string = get_remaining (apminfo.ai_batt_time); ++#else + new_string = get_remaining (apminfo.battery_time); ++#endif + new_label = g_strdup_printf (_("Your battery is running low (%d%%, %s). You should recharge your battery to avoid losing your work."), batt_life, new_string); + g_free (new_string); + battery->lowbattnotificationdialog = gtk_dialog_new_with_buttons ( +@@ -733,7 +737,11 @@ + } + + if (batt_state != 3) ++#ifdef __FreeBSD__ ++ rem_time = get_remaining(apminfo.ai_batt_time); ++#else + rem_time = get_remaining(apminfo.battery_time); ++#endif + else + rem_time = g_strdup(_(status[batt_state])); + 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-gweather_gweather-pref.c b/x11/gnome-applets/files/patch-gweather_gweather-pref.c new file mode 100644 index 000000000..b28f30663 --- /dev/null +++ b/x11/gnome-applets/files/patch-gweather_gweather-pref.c @@ -0,0 +1,70 @@ +--- gweather/gweather-pref.c.orig Mon Jul 19 18:24:06 2004 ++++ gweather/gweather-pref.c Mon Jul 19 18:28:39 2004 +@@ -411,13 +411,14 @@ + } + } + if (!prefs->temperature_unit || prefs->temperature_unit == TEMP_UNIT_DEFAULT ) { ++#ifdef _NL_MEASUREMENT_MEASUREMENT + imperial = nl_langinfo(_NL_MEASUREMENT_MEASUREMENT); + if ( imperial && imperial[0] == 2 ) { + /* imperial */ + prefs->temperature_unit = TEMP_UNIT_FAHRENHEIT; +- } else { ++ } else ++#endif + prefs->temperature_unit = TEMP_UNIT_CENTIGRADE; +- } + } + } + +@@ -446,13 +447,14 @@ + } + } + if ( (!prefs->speed_unit) || prefs->speed_unit == SPEED_UNIT_DEFAULT ) { ++#ifdef _NL_MEASUREMENT_MEASUREMENT + imperial = nl_langinfo(_NL_MEASUREMENT_MEASUREMENT); + if ( imperial && imperial[0] == 2 ) { + /* imperial */ + prefs->speed_unit = SPEED_UNIT_KNOTS; +- } else { ++ } else ++#endif + prefs->speed_unit = SPEED_UNIT_MS; +- } + } + } + +@@ -483,13 +485,14 @@ + } + } + if ( (!prefs->pressure_unit) || prefs->pressure_unit == PRESSURE_UNIT_DEFAULT ) { ++#ifdef _NL_MEASUREMENT_MEASUREMENT + imperial = nl_langinfo(_NL_MEASUREMENT_MEASUREMENT); + if ( imperial && imperial[0] == 2 ) { + /* imperial */ + prefs->pressure_unit = PRESSURE_UNIT_INCH_HG; +- } else { ++ } else ++#endif + prefs->pressure_unit = PRESSURE_UNIT_HPA; +- } + } + } + +@@ -518,13 +521,14 @@ + } + + if ((!prefs->distance_unit) || prefs->distance_unit == DISTANCE_UNIT_DEFAULT ) { ++#ifdef _NL_MEASUREMENT_MEASUREMENT + imperial = nl_langinfo(_NL_MEASUREMENT_MEASUREMENT); + if ( imperial && imperial[0] == 2 ) { + /* imperial */ + prefs->distance_unit = DISTANCE_UNIT_MILES; +- } else { ++ } else ++#endif + prefs->distance_unit = DISTANCE_UNIT_METERS; +- } + } + + return; diff --git a/x11/gnome-applets/files/patch-gweather_weather.c b/x11/gnome-applets/files/patch-gweather_weather.c new file mode 100644 index 000000000..593e86684 --- /dev/null +++ b/x11/gnome-applets/files/patch-gweather_weather.c @@ -0,0 +1,30 @@ +--- gweather/weather.c.orig Mon Jul 19 18:29:38 2004 ++++ gweather/weather.c Mon Jul 19 18:30:13 2004 +@@ -2264,11 +2264,12 @@ + const gchar *weather_info_get_humidity (WeatherInfo *info) + { + static gchar buf[20]; ++ gdouble humidity; + g_return_val_if_fail(info != NULL, NULL); + if (!info->valid) + return "-"; + +- gdouble humidity = calc_humidity(info->temp, info->dew); ++ humidity = calc_humidity(info->temp, info->dew); + if (humidity < 0.0) + return _("Unknown"); + +@@ -2279,11 +2280,12 @@ + + const gchar *weather_info_get_apparent (WeatherInfo *info) + { ++ gdouble apparent; + g_return_val_if_fail(info != NULL, NULL); + if (!info->valid) + return "-"; + +- gdouble apparent = calc_apparent(info); ++ apparent = calc_apparent(info); + if (apparent < -500.0) + return _("Unknown"); + 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..b7ca26a82 --- /dev/null +++ b/x11/gnome-applets/files/patch-wireless_wireless-applet.c @@ -0,0 +1,319 @@ +--- wireless/wireless-applet.c.orig Tue Apr 13 06:39:46 2004 ++++ wireless/wireless-applet.c Tue Jun 15 01:22:59 2004 +@@ -30,6 +30,15 @@ + #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> +@@ -37,7 +46,11 @@ + + #include <egg-screen-help.h> + ++#ifdef __FreeBSD__ ++#define CFG_DEVICE "an0" ++#else + #define CFG_DEVICE "eth0" ++#endif + #define CFG_UPDATE_INTERVAL 2 + + typedef enum { +@@ -94,6 +107,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 [] = { +@@ -157,9 +176,11 @@ + g_free (tmp); + + /* 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; +@@ -190,6 +211,7 @@ + int percent; + + /* Calculate the percentage based on the link quality */ ++#ifndef __FreeBSD__ + if (level < 0) { + percent = -1; + } else { +@@ -200,6 +222,9 @@ + percent = CLAMP (percent, 0, 100); + } + } ++#else ++ percent = (int)level; ++#endif + + wireless_applet_draw (applet, percent); + } +@@ -242,14 +267,147 @@ + } + } + ++#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]); ++ ++ 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 */ +@@ -257,8 +415,35 @@ + 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) { ++ 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); +@@ -292,6 +477,7 @@ + found = TRUE; + } + } ++#endif + } while (1); + + if (g_list_length (applet->devices)==1) { +@@ -303,17 +489,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); + +@@ -360,6 +552,7 @@ + static void + start_file_read (WirelessApplet *applet) + { ++#ifndef __FreeBSD__ + applet->file = fopen ("/proc/net/wireless", "rt"); + if (applet->file == NULL) { + gtk_tooltips_set_tip (applet->tips, +@@ -368,6 +561,7 @@ + NULL); + show_error_dialog (_("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 +864,10 @@ + applet->prefs = NULL; + } + ++#ifndef __FreeBSD__ + if (applet->file) + fclose (applet->file); ++#endif + if (applet->tips) + g_object_unref (applet->tips); + } |