diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2005-02-13 17:02:16 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2005-02-13 17:02:16 +0800 |
commit | 5c5d5736e6677aff43dfb130613cf0863165267e (patch) | |
tree | 3bdb819137e0f3e9ca61d212c7aa7e46d5e09bed /x11/gnomeapplets2 | |
parent | 5b9682fa43f138d5bc48fff712900800e15b78c0 (diff) | |
download | marcuscom-ports-5c5d5736e6677aff43dfb130613cf0863165267e.tar marcuscom-ports-5c5d5736e6677aff43dfb130613cf0863165267e.tar.gz marcuscom-ports-5c5d5736e6677aff43dfb130613cf0863165267e.tar.bz2 marcuscom-ports-5c5d5736e6677aff43dfb130613cf0863165267e.tar.lz marcuscom-ports-5c5d5736e6677aff43dfb130613cf0863165267e.tar.xz marcuscom-ports-5c5d5736e6677aff43dfb130613cf0863165267e.tar.zst marcuscom-ports-5c5d5736e6677aff43dfb130613cf0863165267e.zip |
* Fix a crasher in just about any applet due to corrupted paths
* Add the first round of cpufreq support for i386 and amd64. This only
displays the CPU frequency for now. The ability to set it from the applet
is forthcoming.
Big thanks to sajd on #freebsd-gnome for helping to test cpufreq support.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@3648 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'x11/gnomeapplets2')
-rw-r--r-- | x11/gnomeapplets2/Makefile | 9 | ||||
-rw-r--r-- | x11/gnomeapplets2/files/patch-aa | 102 | ||||
-rw-r--r-- | x11/gnomeapplets2/files/patch-cpufreq-freebsd | 505 | ||||
-rw-r--r-- | x11/gnomeapplets2/pkg-plist | 25 |
4 files changed, 634 insertions, 7 deletions
diff --git a/x11/gnomeapplets2/Makefile b/x11/gnomeapplets2/Makefile index ba8a2a64d..7b54675b6 100644 --- a/x11/gnomeapplets2/Makefile +++ b/x11/gnomeapplets2/Makefile @@ -7,7 +7,7 @@ PORTNAME= gnomeapplets2 PORTVERSION= 2.9.6 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= x11 gnome MASTER_SITES= ${MASTER_SITE_GNOME} MASTER_SITE_SUBDIR= sources/gnome-applets/2.9 @@ -65,4 +65,11 @@ pre-everything:: @${ECHO_MSG} "" .endif +.if ${ARCH} != "i386" && ${ARCH} != "amd64" +PLIST_SUB+= CPUFREQ="@comment " +.else +PLIST_SUB+= CPUFREQ="" +GCONF_SCHEMAS+= cpufreq-applet.schemas +.endif + .include <bsd.port.post.mk> diff --git a/x11/gnomeapplets2/files/patch-aa b/x11/gnomeapplets2/files/patch-aa index 4ac24c595..7388d2325 100644 --- a/x11/gnomeapplets2/files/patch-aa +++ b/x11/gnomeapplets2/files/patch-aa @@ -1,5 +1,5 @@ ---- configure.orig Mon Jan 24 18:14:23 2005 -+++ configure Mon Jan 24 18:17:56 2005 +--- configure.orig Sun Feb 13 03:00:10 2005 ++++ configure Sun Feb 13 03:52:17 2005 @@ -463,7 +463,7 @@ # include <unistd.h> #endif" @@ -9,7 +9,17 @@ ac_subst_files='' # Initialize some variables set by options. -@@ -24835,6 +24835,7 @@ +@@ -23133,8 +23133,7 @@ + + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' +- ac_define_dir=`eval echo $"${prefix}/share/locale"` +- ac_define_dir=`eval echo $ac_define_dir` ++ ac_define_dir=`eval echo "${prefix}/share/locale"` + GNOMELOCALEDIR="$ac_define_dir" + + +@@ -24835,6 +24834,7 @@ HAVE_LIBAPM=no NEED_LIBAPM=no @@ -17,7 +27,7 @@ build_battstat_applet=no if test x$disable_battstat = xno; then -@@ -24986,7 +24987,12 @@ +@@ -24986,7 +24986,12 @@ ;; # list of supported OS cores that do not use libapm @@ -31,7 +41,17 @@ ;; *) echo "warning: ${host} is not supported by battstat_applet, not building" >&2 -@@ -26082,7 +26088,7 @@ +@@ -25792,6 +25797,9 @@ + *linux*) + build_cpufreq_applet=yes + ;; ++ i386-*-freebsd*|amd64-*-freebsd*) ++ build_cpufreq_applet=yes ++ ;; + *) + echo "warning: ${host} is not supported by cpufreq applet, not building" >&2 + build_cpufreq_applet=no +@@ -26082,7 +26090,7 @@ ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}" @@ -40,7 +60,77 @@ pixmapsdir="${datadir}/pixmaps" -@@ -27305,6 +27311,7 @@ +@@ -26096,8 +26104,7 @@ + + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' +- ac_define_dir=`eval echo $"${iconsdir}"` +- ac_define_dir=`eval echo $ac_define_dir` ++ ac_define_dir=`eval echo "${iconsdir}"` + GNOME_ICONDIR="$ac_define_dir" + + +@@ -26109,8 +26116,7 @@ + + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' +- ac_define_dir=`eval echo $"${pixmapsdir}"` +- ac_define_dir=`eval echo $ac_define_dir` ++ ac_define_dir=`eval echo "${pixmapsdir}"` + GNOME_PIXMAPSDIR="$ac_define_dir" + + +@@ -26122,8 +26128,7 @@ + + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' +- ac_define_dir=`eval echo $"${gladedir}"` +- ac_define_dir=`eval echo $ac_define_dir` ++ ac_define_dir=`eval echo "${gladedir}"` + GNOME_GLADEDIR="$ac_define_dir" + + +@@ -26135,8 +26140,7 @@ + + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' +- ac_define_dir=`eval echo $"${datadir}"` +- ac_define_dir=`eval echo $ac_define_dir` ++ ac_define_dir=`eval echo "${datadir}"` + DATADIR="$ac_define_dir" + + +@@ -26148,8 +26152,7 @@ + + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' +- ac_define_dir=`eval echo $"${sysconfdir}"` +- ac_define_dir=`eval echo $ac_define_dir` ++ ac_define_dir=`eval echo "${sysconfdir}"` + SYSCONFDIR="$ac_define_dir" + + +@@ -26161,8 +26164,7 @@ + + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' +- ac_define_dir=`eval echo $"${libdir}"` +- ac_define_dir=`eval echo $ac_define_dir` ++ ac_define_dir=`eval echo "${libdir}"` + LIBDIR="$ac_define_dir" + + +@@ -26174,8 +26176,7 @@ + + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' +- ac_define_dir=`eval echo $"$prefix"` +- ac_define_dir=`eval echo $ac_define_dir` ++ ac_define_dir=`eval echo "$prefix"` + PREFIX="$ac_define_dir" + + +@@ -27305,6 +27306,7 @@ s,@GKB_SUN_FALSE@,$GKB_SUN_FALSE,;t t s,@HAVE_LIBAPM@,$HAVE_LIBAPM,;t t s,@NEED_LIBAPM@,$NEED_LIBAPM,;t t diff --git a/x11/gnomeapplets2/files/patch-cpufreq-freebsd b/x11/gnomeapplets2/files/patch-cpufreq-freebsd new file mode 100644 index 000000000..ac8ba31bb --- /dev/null +++ b/x11/gnomeapplets2/files/patch-cpufreq-freebsd @@ -0,0 +1,505 @@ +--- cpufreq/src/Makefile.in.orig Sun Feb 13 01:00:35 2005 ++++ cpufreq/src/Makefile.in Sun Feb 13 01:01:31 2005 +@@ -55,6 +55,7 @@ + cpufreq-prefs.$(OBJEXT) cpufreq-popup.$(OBJEXT) \ + cpufreq-monitor.$(OBJEXT) cpufreq-monitor-factory.$(OBJEXT) \ + cpufreq-monitor-procfs.$(OBJEXT) \ ++ cpufreq-monitor-sysctl.$(OBJEXT) \ + cpufreq-monitor-sysfs.$(OBJEXT) \ + cpufreq-monitor-cpuinfo.$(OBJEXT) + cpufreq_applet_OBJECTS = $(am_cpufreq_applet_OBJECTS) +@@ -68,6 +69,7 @@ + @AMDEP_TRUE@ ./$(DEPDIR)/cpufreq-monitor-cpuinfo.Po \ + @AMDEP_TRUE@ ./$(DEPDIR)/cpufreq-monitor-factory.Po \ + @AMDEP_TRUE@ ./$(DEPDIR)/cpufreq-monitor-procfs.Po \ ++@AMDEP_TRUE@ ./$(DEPDIR)/cpufreq-monitor-sysctl.Po \ + @AMDEP_TRUE@ ./$(DEPDIR)/cpufreq-monitor-sysfs.Po \ + @AMDEP_TRUE@ ./$(DEPDIR)/cpufreq-monitor.Po \ + @AMDEP_TRUE@ ./$(DEPDIR)/cpufreq-popup.Po \ +@@ -336,6 +338,7 @@ + cpufreq-monitor-protected.h \ + cpufreq-monitor-factory.c cpufreq-monitor-factory.h \ + cpufreq-monitor-procfs.c cpufreq-monitor-procfs.h \ ++ cpufreq-monitor-sysctl.c cpufreq-monitor-sysctl.h \ + cpufreq-monitor-sysfs.c cpufreq-monitor-sysfs.h \ + cpufreq-monitor-cpuinfo.c cpufreq-monitor-cpuinfo.h + +@@ -419,6 +422,7 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpufreq-monitor-cpuinfo.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpufreq-monitor-factory.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpufreq-monitor-procfs.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpufreq-monitor-sysctl.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpufreq-monitor-sysfs.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpufreq-monitor.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpufreq-popup.Po@am__quote@ +--- cpufreq/src/cpufreq-monitor-sysctl.h.orig Sun Feb 13 01:00:25 2005 ++++ cpufreq/src/cpufreq-monitor-sysctl.h Sat Feb 12 20:25:21 2005 +@@ -0,0 +1,48 @@ ++/* ++ * Copyright (C) 2001, 2002 Free Software Foundation ++ * ++ * This library 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 library 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 library; if not, write to the Free ++ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ * ++ * Authors : Joe Marcus Clarke <marcus@FreeBSD.org> ++ */ ++ ++#ifndef __CPUFREQ_MONITOR_SYSCTL_H__ ++#define __CPUFREQ_MONITOR_SYSCTL_H__ ++ ++#include <glib-object.h> ++#include "cpufreq-monitor.h" ++ ++#define TYPE_CPUFREQ_MONITOR_SYSCTL (cpufreq_monitor_sysctl_get_type ()) ++#define CPUFREQ_MONITOR_SYSCTL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CPUFREQ_MONITOR_SYSCTL, CPUFreqMonitorSysctl)) ++#define CPUFREQ_MONITOR_SYSCTL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_CPUFREQ_MONITOR_SYSCTL, CPUFreqMonitorSysctlClass)) ++#define IS_CPUFREQ_MONITOR_SYSCTL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CPUFREQ_MONITOR_SYSCTL)) ++#define IS_CPUFREQ_MONITOR_SYSCTL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CPUFREQ_MONITOR_SYSCTL)) ++#define CPUFREQ_MONITOR_SYSCTL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CPUFREQ_MONITOR_SYSCTL, CPUFreqMonitorSysctlClass)) ++ ++typedef struct _CPUFreqMonitorSysctl CPUFreqMonitorSysctl; ++typedef struct _CPUFreqMonitorSysctlClass CPUFreqMonitorSysctlClass; ++ ++struct _CPUFreqMonitorSysctl { ++ CPUFreqMonitor parent; ++}; ++ ++struct _CPUFreqMonitorSysctlClass { ++ CPUFreqMonitorClass parent_class; ++}; ++ ++GType cpufreq_monitor_sysctl_get_type (); ++CPUFreqMonitor *cpufreq_monitor_sysctl_new (guint cpu); ++ ++#endif /* __CPUFREQ_MONITOR_SYSCTL_H__ */ +--- cpufreq/src/cpufreq-monitor-sysctl.c.orig Sun Feb 13 01:46:05 2005 ++++ cpufreq/src/cpufreq-monitor-sysctl.c Sun Feb 13 02:54:18 2005 +@@ -0,0 +1,265 @@ ++/* ++ * Copyright (C) 2001, 2002 Free Software Foundation ++ * ++ * This library 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 library 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 library; if not, write to the Free ++ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ * ++ * Authors : Joe Marcus Clarke <marcus@FreeBSD.org> ++ */ ++ ++#include <glib.h> ++#include <glib/gi18n.h> ++ ++#include <string.h> ++ ++#ifdef __FreeBSD__ ++#include <sys/types.h> ++#include <sys/sysctl.h> ++ ++#include "cpufreq-monitor-sysctl.h" ++#include "cpufreq-monitor-protected.h" ++ ++#define PARENT_TYPE TYPE_CPUFREQ_MONITOR ++ ++#define CPUFREQ_MONITOR_GET_PROTECTED(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PARENT_TYPE, CPUFreqMonitorProtected)) ++ ++static void cpufreq_monitor_sysctl_class_init (CPUFreqMonitorSysctlClass *klass); ++static void cpufreq_monitor_sysctl_finalize (GObject *object); ++ ++static void cpufreq_monitor_sysctl_run (CPUFreqMonitor *monitor); ++static GList *cpufreq_monitor_sysctl_get_available_frequencies (CPUFreqMonitor *monitor); ++ ++static gboolean cpufreq_monitor_sysctl_get (gpointer gdata); ++ ++ ++static CPUFreqMonitorClass *parent_class = NULL; ++ ++typedef struct _CPUFreqMonitorProtected CPUFreqMonitorProtected; ++ ++GType cpufreq_monitor_sysctl_get_type () ++{ ++ static GType type = 0; ++ ++ if (!type) { ++ static const GTypeInfo info = { ++ sizeof (CPUFreqMonitorSysctlClass), ++ (GBaseInitFunc) NULL, ++ (GBaseFinalizeFunc) NULL, ++ (GClassInitFunc) cpufreq_monitor_sysctl_class_init, ++ NULL, ++ NULL, ++ sizeof (CPUFreqMonitorSysctl), ++ 0, ++ NULL ++ }; ++ ++ type = g_type_register_static (PARENT_TYPE, "CPUFreqMonitorSysctl", ++ &info, 0); ++ } ++ ++ return type; ++} ++ ++static void ++cpufreq_monitor_sysctl_class_init (CPUFreqMonitorSysctlClass *klass) ++{ ++ GObjectClass *object_class = G_OBJECT_CLASS (klass); ++ CPUFreqMonitorClass *monitor_class = CPUFREQ_MONITOR_CLASS (klass); ++ ++ parent_class = g_type_class_peek_parent (klass); ++ ++ monitor_class->run = cpufreq_monitor_sysctl_run; ++ monitor_class->get_available_frequencies = cpufreq_monitor_sysctl_get_available_frequencies; ++ ++ object_class->finalize = cpufreq_monitor_sysctl_finalize; ++} ++ ++static void ++cpufreq_monitor_sysctl_finalize (GObject *object) ++{ ++ g_return_if_fail (IS_CPUFREQ_MONITOR_SYSCTL (object)); ++ ++ if (G_OBJECT_CLASS (parent_class)->finalize) ++ (* G_OBJECT_CLASS (parent_class)->finalize) (object); ++} ++ ++CPUFreqMonitor * ++cpufreq_monitor_sysctl_new (guint cpu) ++{ ++ CPUFreqMonitorSysctl *monitor; ++ ++ monitor = g_object_new (TYPE_CPUFREQ_MONITOR_SYSCTL, "cpu", cpu, NULL); ++ ++ return CPUFREQ_MONITOR (monitor); ++} ++ ++static gboolean ++cpufreq_monitor_sysctl_get (gpointer gdata) ++{ ++ gint fmax, fmin, ifreq; ++ gchar *freq, *perc, *unit, *governor; ++ gboolean changed; ++ size_t len; ++ gint mib[4]; ++ gchar *freq_oid; ++ CPUFreqMonitorSysctl *monitor; ++ CPUFreqMonitorProtected *private; ++ ++ monitor = (CPUFreqMonitorSysctl *) gdata; ++ private = CPUFREQ_MONITOR_GET_PROTECTED (CPUFREQ_MONITOR (monitor)); ++ ++ if (private->available_freqs == NULL) { ++ if (!cpufreq_monitor_sysctl_get_available_frequencies (CPUFREQ_MONITOR (monitor))) ++ return FALSE; ++ } ++ ++ fmax = atoi ((gchar *) private->available_freqs->data); ++ fmin = atoi ((gchar *) g_list_nth_data (private->available_freqs, (g_list_length (private->available_freqs) - 1))); ++ ++ len = sizeof (ifreq); ++ freq_oid = g_strdup_printf ("dev.cpu.%d.freq", private->cpu); ++ ++ if (sysctlbyname (freq_oid, &ifreq, &len, NULL, 0) == -1) { ++ g_free (freq_oid); ++ return FALSE; ++ } ++ ++ ifreq *= 1000; ++ ++ if (ifreq == fmax) ++ governor = g_strdup ("performance"); ++ else if (ifreq == fmin) ++ governor = g_strdup ("economy"); ++ else ++ governor = g_strdup ("other"); ++ ++ freq = parent_class->get_human_readable_freq (ifreq); ++ perc = parent_class->get_human_readable_perc (fmax, ifreq); ++ unit = parent_class->get_human_readable_unit (ifreq); ++ ++ changed = FALSE; ++ ++ if (!private->governor || (g_ascii_strcasecmp (governor, private->governor) != 0)) { ++ changed = TRUE; ++ } ++ ++ if (!private->freq || (g_ascii_strcasecmp (freq, private->freq) != 0)) { ++ changed = TRUE; ++ } ++ ++ if (!private->perc || (g_ascii_strcasecmp (perc, private->perc) != 0)) { ++ changed = TRUE; ++ } ++ ++ if (!private->unit || (g_ascii_strcasecmp (unit, private->unit) != 0)) { ++ changed = TRUE; ++ } ++ ++ parent_class->free_data (CPUFREQ_MONITOR (monitor)); ++ ++ private->governor = governor; ++ private->freq = freq; ++ private->perc = perc; ++ private->unit = unit; ++ ++ if (private->governor == NULL) ++ return FALSE; ++ if (private->freq == NULL) ++ return FALSE; ++ if (private->perc == NULL) ++ return FALSE; ++ if (private->unit == NULL) ++ return FALSE; ++ ++ if (changed) ++ g_signal_emit (CPUFREQ_MONITOR (monitor), parent_class->signals[CHANGED], 0); ++ ++ return TRUE; ++} ++ ++static void ++cpufreq_monitor_sysctl_run (CPUFreqMonitor *monitor) ++{ ++ CPUFreqMonitorProtected *private; ++ ++ g_return_if_fail (IS_CPUFREQ_MONITOR_SYSCTL (monitor)); ++ ++ private = CPUFREQ_MONITOR_GET_PROTECTED (CPUFREQ_MONITOR (monitor)); ++ ++ if (private->timeout_handler > 0) ++ g_source_remove (private->timeout_handler); ++ ++ private->timeout_handler = g_timeout_add (1000, cpufreq_monitor_sysctl_get, (gpointer) monitor); ++} ++ ++static void ++free_string (gpointer str, gpointer gdata) ++{ ++ if (str) g_free (str); ++} ++ ++static GList * ++cpufreq_monitor_sysctl_get_available_frequencies (CPUFreqMonitor *monitor) ++{ ++ CPUFreqMonitorProtected *private; ++ gchar *levels_oid, *levels; ++ gchar **levelsp, **l; ++ gint mib[4]; ++ size_t len; ++ ++ g_return_val_if_fail (IS_CPUFREQ_MONITOR_SYSCTL (monitor), NULL); ++ ++ private = CPUFREQ_MONITOR_GET_PROTECTED (CPUFREQ_MONITOR (monitor)); ++ ++ if (private->available_freqs) { ++ g_list_foreach (private->available_freqs, ++ free_string, NULL); ++ g_list_free (private->available_freqs); ++ private->available_freqs = NULL; ++ } ++ ++ levels_oid = g_strdup_printf ("dev.cpu.%d.freq_levels", ++ private->cpu); ++ len = 4; ++ sysctlnametomib (levels_oid, mib, &len); ++ len = sizeof (levels); ++ g_free (levels_oid); ++ ++ if (sysctl (mib, 4, NULL, &len, NULL, 0) == -1) ++ return NULL; ++ ++ levels = g_malloc (len); ++ if (sysctl (mib, 4, levels, &len, NULL, 0) == -1) ++ return NULL; ++ ++ levelsp = g_strsplit (levels, " ", 0); ++ g_free (levels); ++ ++ for (l = levelsp; l && *l; l++) { ++ gchar **frpr; ++ ++ frpr = g_strsplit (*l, "/", 0); ++ if (frpr[0] != NULL) { ++ int freq = atoi (frpr[0]); ++ private->available_freqs = ++ g_list_append (private->available_freqs, g_strdup_printf ("%d", freq * 1000)); ++ } ++ g_strfreev (frpr); ++ } ++ ++ g_strfreev (levelsp); ++ ++ return private->available_freqs; ++} ++#endif /* __FreeBSD__ */ +--- cpufreq/src/cpufreq-monitor-factory.c.orig Mon Dec 27 12:53:46 2004 ++++ cpufreq/src/cpufreq-monitor-factory.c Sun Feb 13 02:56:39 2005 +@@ -16,13 +16,21 @@ + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Authors : Carlos García Campos <carlosgc@gnome.org> ++ * Joe Marcus Clarke <marcus@FreeBSD.org> + */ + + #include <glib.h> ++#ifdef __FreeBSD__ ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#endif /* __FreeBSD__ */ + + #include "cpufreq-applet.h" + #include "cpufreq-monitor-sysfs.h" + #include "cpufreq-monitor-procfs.h" ++#ifdef __FreeBSD__ ++#include "cpufreq-monitor-sysctl.h" ++#endif /* __FreeBSD__ */ + #include "cpufreq-monitor-cpuinfo.h" + #include "cpufreq-monitor-factory.h" + +@@ -30,6 +38,7 @@ + cpufreq_monitor_factory_create_monitor (guint cpu) + { + CPUFreqMonitor *monitor = NULL; ++#ifndef __FreeBSD__ + + if (g_file_test ("/sys/devices/system/cpu/cpu0/cpufreq", G_FILE_TEST_EXISTS)) { /* 2.6 kernel */ + monitor = cpufreq_monitor_sysfs_new (cpu); +@@ -48,6 +57,21 @@ + + monitor = cpufreq_monitor_cpuinfo_new (cpu); + } ++#else ++ gint mib[4]; ++ size_t len; ++ ++ if (sysctlbyname ("dev.cpu.0.freq", NULL, &len, NULL, 0) == 0) { ++ monitor = cpufreq_monitor_sysctl_new (cpu); ++ } else { ++ cpufreq_applet_display_error (_("CPU frequency scaling unsupported"), ++ _("You will not be able to modify the frequency of your machine. " ++ "Your machine may be misconfigured or not have hardware support " ++ "for CPU frequency scaling.")); ++ ++ monitor = cpufreq_monitor_cpuinfo_new (cpu); ++ } ++#endif /* __FreeBSD__ */ + + return monitor; + } +--- cpufreq/src/cpufreq-monitor-cpuinfo.c.orig Fri Dec 31 14:39:04 2004 ++++ cpufreq/src/cpufreq-monitor-cpuinfo.c Sun Feb 13 02:54:51 2005 +@@ -22,6 +22,10 @@ + #include <glib/gi18n.h> + #include <libgnomevfs/gnome-vfs.h> + ++#ifdef __FreeBSD__ ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#endif /* __FreeBSD__ */ + #include <string.h> + + #include "cpufreq-monitor-cpuinfo.h" +@@ -102,6 +106,7 @@ + static gboolean + cpufreq_monitor_cpuinfo_get (gpointer gdata) + { ++#ifndef __FreeBSD__ + GnomeVFSHandle *handle; + GnomeVFSFileSize bytes_read; + GnomeVFSResult result; +@@ -109,6 +114,10 @@ + gchar **lines; + gchar buffer[256]; + gchar *p; ++#else ++ gint mib[2]; ++ size_t len; ++#endif /* __FreeBSD__ */ + gchar *freq, *perc, *unit, *governor; + gint cpu, i; + CPUFreqMonitorCPUInfo *monitor; +@@ -118,6 +127,7 @@ + + private = CPUFREQ_MONITOR_GET_PROTECTED (CPUFREQ_MONITOR (monitor)); + ++#ifndef __FreeBSD__ + uri = gnome_vfs_get_uri_from_local_path ("/proc/cpuinfo"); + + result = gnome_vfs_open (&handle, uri, GNOME_VFS_OPEN_READ); +@@ -178,6 +188,12 @@ + + g_strfreev (lines); + g_free (file); ++#else ++ len = sizeof (cpu); ++ ++ if (sysctlbyname ("hw.clockrate", &cpu, &len, NULL, 0) == -1) ++ return FALSE; ++#endif /* __FreeBSD__ */ + + governor = g_strdup (_("Frequency Scaling Unsupported")); + freq = parent_class->get_human_readable_freq (cpu * 1000); /* kHz are expected*/ +--- cpufreq/src/cpufreq-applet.c.orig Fri Jan 14 23:38:20 2005 ++++ cpufreq/src/cpufreq-applet.c Sun Feb 13 02:58:28 2005 +@@ -25,6 +25,10 @@ + #include <panel-applet-gconf.h> + #include <glade/glade.h> + #include <glib/gi18n.h> ++#ifdef __FreeBSD__ ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#endif /* __FreeBSD__ */ + #include <string.h> + + #include "cpufreq-applet.h" +@@ -192,6 +196,7 @@ + { + static const gchar *authors[] = { + "Carlos Garcia Campos <carlosgc@gnome.org>", ++ "Joe Marcus Clarke <marcus@FreeBSD.org>", + NULL + }; + static const gchar *documenters[] = { +@@ -231,6 +236,7 @@ + cpufreq_applet_get_max_cpu () + { + gint mcpu = -1; ++#ifndef __FreeBSD__ + gchar *file = NULL; + + do { +@@ -253,6 +259,15 @@ + } while (g_file_test (file, G_FILE_TEST_EXISTS)); + g_free (file); + mcpu --; ++#else ++ gint mib[2]; ++ size_t len; ++ ++ len = sizeof (mcpu); ++ ++ sysctlbyname ("hw.ncpu", &mcpu, &len, NULL, 0); ++ mcpu --; ++#endif /* __FreeBSD__ */ + + if (mcpu >= 0) + return mcpu; diff --git a/x11/gnomeapplets2/pkg-plist b/x11/gnomeapplets2/pkg-plist index 12ecf29da..0f9159106 100644 --- a/x11/gnomeapplets2/pkg-plist +++ b/x11/gnomeapplets2/pkg-plist @@ -1,3 +1,4 @@ +%%CPUFREQ%%bin/cpufreq-selector bin/gswitchit-plugins-capplet %%BATTERY%%etc/sound/events/battstat_applet.soundlist include/libgswitchit/gswitchit_config.h @@ -5,6 +6,7 @@ include/libgswitchit/gswitchit_plugin.h libdata/bonobo/servers/GNOME_AccessxStatusApplet.server %%BATTERY%%libdata/bonobo/servers/GNOME_BattstatApplet.server libdata/bonobo/servers/GNOME_CDPlayerApplet.server +%%CPUFREQ%%libdata/bonobo/servers/GNOME_CPUFreqApplet.server libdata/bonobo/servers/GNOME_CharpickerApplet.server libdata/bonobo/servers/GNOME_DriveMountApplet.server libdata/bonobo/servers/GNOME_GWeatherApplet_Factory.server @@ -24,6 +26,7 @@ libdata/pkgconfig/gswitchit.pc libexec/accessx-status-applet %%BATTERY%%libexec/battstat-applet-2 libexec/charpick_applet2 +%%CPUFREQ%%libexec/cpufreq-applet libexec/drivemount_applet2 libexec/geyes_applet2 libexec/gnome-applets/mc-install-default-macros @@ -40,6 +43,7 @@ libexec/trashapplet share/gnome/gnome-2.0/ui/GNOME_AccessxApplet.xml %%BATTERY%%share/gnome/gnome-2.0/ui/GNOME_BattstatApplet.xml share/gnome/gnome-2.0/ui/GNOME_CharpickerApplet.xml +%%CPUFREQ%%share/gnome/gnome-2.0/ui/GNOME_CPUFreqApplet.xml share/gnome/gnome-2.0/ui/GNOME_DriveMountApplet.xml share/gnome/gnome-2.0/ui/GNOME_GSwitchItApplet.xml share/gnome/gnome-2.0/ui/GNOME_GWeatherApplet.xml @@ -67,6 +71,7 @@ share/gnome/gnome-applets/geyes/Horrid/config share/gnome/gnome-applets/geyes/Horrid/horrid_eye.png share/gnome/gnome-applets/geyes/Horrid/horrid_pupil.png %%BATTERY%%share/gnome/gnome-applets/glade/battstat_applet.glade +%%CPUFREQ%%share/gnome/gnome-applets/glade/cpufreq-preferences.glade share/gnome/gnome-applets/glade/gswitchit-plugins.glade share/gnome/gnome-applets/glade/gswitchit-properties.glade share/gnome/gnome-applets/glade/mini-commander.glade @@ -326,6 +331,15 @@ share/gnome/help/command-line/zh_HK/legal.xml share/gnome/help/command-line/zh_TW/command-line.xml share/gnome/help/command-line/zh_TW/figures/command-line.png share/gnome/help/command-line/zh_TW/legal.xml +%%CPUFREQ%%share/gnome/help/cpufreq-applet/C/cpufreq-applet.xml +%%CPUFREQ%%share/gnome/help/cpufreq-applet/C/figures/cpufreq-applet-performance1.png +%%CPUFREQ%%share/gnome/help/cpufreq-applet/C/figures/cpufreq-applet-performance2.png +%%CPUFREQ%%share/gnome/help/cpufreq-applet/C/figures/cpufreq-applet-powersave1.png +%%CPUFREQ%%share/gnome/help/cpufreq-applet/C/figures/cpufreq-applet-powersave2.png +%%CPUFREQ%%share/gnome/help/cpufreq-applet/C/figures/cpufreq-applet-preferences-smp.png +%%CPUFREQ%%share/gnome/help/cpufreq-applet/C/figures/cpufreq-applet-preferences.png +%%CPUFREQ%%share/gnome/help/cpufreq-applet/C/figures/cpufreq-applet-selector.png +%%CPUFREQ%%share/gnome/help/cpufreq-applet/C/legal.xml share/gnome/help/drivemount/C/drivemount.xml share/gnome/help/drivemount/C/figures/drivemount-applet_window.png share/gnome/help/drivemount/C/figures/drivemount_applet_all.png @@ -711,6 +725,7 @@ share/gnome/omf/gnome-applets/command-line-sv.omf share/gnome/omf/gnome-applets/command-line-zh_CN.omf share/gnome/omf/gnome-applets/command-line-zh_HK.omf share/gnome/omf/gnome-applets/command-line-zh_TW.omf +%%CPUFREQ%%share/gnome/omf/gnome-applets/cpufreq-applet-C.omf share/gnome/omf/gnome-applets/drivemount-C.omf share/gnome/omf/gnome-applets/drivemount-de.omf share/gnome/omf/gnome-applets/drivemount-es.omf @@ -833,6 +848,12 @@ share/gnome/pixmaps/accessx-status-applet/sticky-shift-none.png share/gnome/pixmaps/accessx-status-applet/sticky-super-latched.png share/gnome/pixmaps/accessx-status-applet/sticky-super-locked.png share/gnome/pixmaps/accessx-status-applet/sticky-super-none.png +%%CPUFREQ%%share/gnome/pixmaps/cpufreq-applet/cpufreq-100.png +%%CPUFREQ%%share/gnome/pixmaps/cpufreq-applet/cpufreq-25.png +%%CPUFREQ%%share/gnome/pixmaps/cpufreq-applet/cpufreq-50.png +%%CPUFREQ%%share/gnome/pixmaps/cpufreq-applet/cpufreq-75.png +%%CPUFREQ%%share/gnome/pixmaps/cpufreq-applet/cpufreq-applet.png +%%CPUFREQ%%share/gnome/pixmaps/cpufreq-applet/cpufreq-na.png share/gnome/pixmaps/stickynotes/close.png share/gnome/pixmaps/stickynotes/locked.png share/gnome/pixmaps/stickynotes/resize_se.png @@ -999,6 +1020,7 @@ share/locale/wa/LC_MESSAGES/gnome-applets-2.0.mo share/locale/zh_CN/LC_MESSAGES/gnome-applets-2.0.mo share/locale/zh_TW/LC_MESSAGES/gnome-applets-2.0.mo @dirrm share/gnome/pixmaps/stickynotes +%%CPUFREQ%%@dirrm share/gnome/pixmaps/cpufreq-applet @dirrm share/gnome/pixmaps/accessx-status-applet @dirrm share/gnome/omf/gnome-applets @dirrm share/gnome/help/trashapplet/C @@ -1179,6 +1201,9 @@ share/locale/zh_TW/LC_MESSAGES/gnome-applets-2.0.mo @dirrm share/gnome/help/drivemount/C/figures @dirrm share/gnome/help/drivemount/C @dirrm share/gnome/help/drivemount +%%CPUFREQ%%@dirrm share/gnome/help/cpufreq-applet/C/figures +%%CPUFREQ%%@dirrm share/gnome/help/cpufreq-applet/C +%%CPUFREQ%%@dirrm share/gnome/help/cpufreq-applet @dirrm share/gnome/help/command-line/zh_TW/figures @dirrm share/gnome/help/command-line/zh_TW @dirrm share/gnome/help/command-line/zh_HK/figures |