diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2007-01-12 07:49:32 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2007-01-12 07:49:32 +0800 |
commit | 192bd79a3cfe2efb32cc19444f3e43a713c54488 (patch) | |
tree | deda6d81a2b6598bfaa8dae6a45e7dd2c20202f5 /x11/gnome-applets | |
parent | bf98a4ac43300fa4ec3f4a24601f46219348a178 (diff) | |
download | marcuscom-ports-192bd79a3cfe2efb32cc19444f3e43a713c54488.tar marcuscom-ports-192bd79a3cfe2efb32cc19444f3e43a713c54488.tar.gz marcuscom-ports-192bd79a3cfe2efb32cc19444f3e43a713c54488.tar.bz2 marcuscom-ports-192bd79a3cfe2efb32cc19444f3e43a713c54488.tar.lz marcuscom-ports-192bd79a3cfe2efb32cc19444f3e43a713c54488.tar.xz marcuscom-ports-192bd79a3cfe2efb32cc19444f3e43a713c54488.tar.zst marcuscom-ports-192bd79a3cfe2efb32cc19444f3e43a713c54488.zip |
Fix the cpufreq menu.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@8189 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'x11/gnome-applets')
-rw-r--r-- | x11/gnome-applets/Makefile | 3 | ||||
-rw-r--r-- | x11/gnome-applets/files/patch-cpufreq-freebsd | 216 |
2 files changed, 117 insertions, 102 deletions
diff --git a/x11/gnome-applets/Makefile b/x11/gnome-applets/Makefile index ebd1b1327..2fa59ce42 100644 --- a/x11/gnome-applets/Makefile +++ b/x11/gnome-applets/Makefile @@ -3,11 +3,12 @@ # Whom: Joe Marcus Clarke <marcus@FreeBSD.org> # # $FreeBSD$ -# $MCom: ports/x11/gnome-applets/Makefile,v 1.146 2006/12/06 12:49:54 ahze Exp $ +# $MCom: ports/x11/gnome-applets/Makefile,v 1.147 2007/01/02 19:31:01 marcus Exp $ # PORTNAME= gnome-applets PORTVERSION= 2.17.1 +PORTREVISION= 1 CATEGORIES= x11 gnome MASTER_SITES= ${MASTER_SITE_GNOME} MASTER_SITE_SUBDIR= sources/${PORTNAME}/${PORTVERSION:C/^([0-9]+\.[0-9]+).*/\1/} diff --git a/x11/gnome-applets/files/patch-cpufreq-freebsd b/x11/gnome-applets/files/patch-cpufreq-freebsd index 53841b6d7..663a9a5d5 100644 --- a/x11/gnome-applets/files/patch-cpufreq-freebsd +++ b/x11/gnome-applets/files/patch-cpufreq-freebsd @@ -161,9 +161,111 @@ +CPUFreqMonitor *cpufreq_monitor_sysctl_new (guint cpu); + +#endif /* __CPUFREQ_MONITOR_SYSCTL_H__ */ ---- cpufreq/src/cpufreq-monitor-sysctl.c.orig Sat Jun 17 14:15:55 2006 -+++ cpufreq/src/cpufreq-monitor-sysctl.c Sat Jun 24 01:45:23 2006 -@@ -0,0 +1,161 @@ +--- cpufreq/src/cpufreq-monitor-factory.c.orig Sat Jun 17 06:28:02 2006 ++++ cpufreq/src/cpufreq-monitor-factory.c Sat Jun 24 01:45:54 2006 +@@ -17,6 +17,7 @@ + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Authors : Carlos García Campos <carlosgc@gnome.org> ++ * Joe Marcus Clarke <marcus@FreeBSD.org> + */ + + #ifdef HAVE_CONFIG_H +@@ -25,11 +26,18 @@ + + #include <glib.h> + #include <glib/gi18n.h> ++#ifdef __FreeBSD__ ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#endif /* __FreeBSD__ */ + + #include "cpufreq-applet.h" + #include "cpufreq-utils.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" + #ifdef HAVE_LIBCPUFREQ + #include "cpufreq-monitor-libcpufreq.h" +@@ -40,6 +48,7 @@ CPUFreqMonitor * + cpufreq_monitor_factory_create_monitor (guint cpu) + { + CPUFreqMonitor *monitor = NULL; ++#ifndef __FreeBSD__ + + #ifdef HAVE_LIBCPUFREQ + monitor = cpufreq_monitor_libcpufreq_new (cpu); +@@ -63,6 +72,19 @@ cpufreq_monitor_factory_create_monitor ( + + monitor = cpufreq_monitor_cpuinfo_new (cpu); + } ++#else ++ size_t len; ++ ++ if (sysctlbyname ("dev.cpu.0.freq", NULL, &len, NULL, 0) == 0) { ++ monitor = cpufreq_monitor_sysctl_new (cpu); ++ } else { ++ cpufreq_utils_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-utils.c.orig Sat Aug 12 21:26:50 2006 ++++ cpufreq/src/cpufreq-utils.c Tue Aug 22 11:07:32 2006 +@@ -22,6 +22,9 @@ + #include <glib.h> + #include <gtk/gtkmessagedialog.h> + #include <sys/types.h> ++#ifdef __FreeBSD__ ++#include <sys/sysctl.h> ++#endif + #include <sys/stat.h> + #include <fcntl.h> + #include <unistd.h> +@@ -30,6 +33,24 @@ + + #include "cpufreq-utils.h" + ++#ifdef __FreeBSD__ ++guint ++cpufreq_utils_get_n_cpus (void) ++{ ++ size_t len; ++ static guint n_cpus = 0; ++ ++ if (n_cpus > 0) ++ return n_cpus; ++ ++ len = sizeof (n_cpus); ++ if (sysctlbyname ("hw.ncpu", &n_cpus, &len, NULL, 0) == -1) { ++ return 1; ++ } ++ ++ return n_cpus; ++} ++#else + guint + cpufreq_utils_get_n_cpus (void) + { +@@ -72,6 +93,7 @@ cpufreq_utils_get_n_cpus (void) + + return 1; + } ++#endif /* __FreeBSD__ */ + + void + cpufreq_utils_display_error (const gchar *message, +--- cpufreq/src/cpufreq-monitor-sysctl.c.orig Thu Jan 11 15:57:34 2007 ++++ cpufreq/src/cpufreq-monitor-sysctl.c Thu Jan 11 17:43:24 2007 +@@ -0,0 +1,175 @@ +/* + * Copyright (C) 2001, 2002 Free Software Foundation + * @@ -203,6 +305,7 @@ + +static gboolean cpufreq_monitor_sysctl_run (CPUFreqMonitor *monitor); +static GList *cpufreq_monitor_sysctl_get_available_frequencies (CPUFreqMonitor *monitor); ++static GList *cpufreq_monitor_sysctl_get_available_governors (CPUFreqMonitor *monitor); + +static gboolean cpufreq_monitor_sysctl_get (gpointer gdata); + @@ -220,6 +323,7 @@ + + monitor_class->run = cpufreq_monitor_sysctl_run; + monitor_class->get_available_frequencies = cpufreq_monitor_sysctl_get_available_frequencies; ++ monitor_class->get_available_governors = cpufreq_monitor_sysctl_get_available_governors; +} + +CPUFreqMonitor * @@ -263,7 +367,7 @@ + else if (ifreq == fmin) + governor = g_strdup ("economy"); + else -+ governor = g_strdup ("other"); ++ governor = g_strdup ("userspace"); + + g_object_set (G_OBJECT (monitor), + "governor", governor, @@ -324,106 +428,16 @@ + + return (list); +} -+#endif /* __FreeBSD__ */ ---- cpufreq/src/cpufreq-monitor-factory.c.orig Sat Jun 17 06:28:02 2006 -+++ cpufreq/src/cpufreq-monitor-factory.c Sat Jun 24 01:45:54 2006 -@@ -17,6 +17,7 @@ - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Authors : Carlos García Campos <carlosgc@gnome.org> -+ * Joe Marcus Clarke <marcus@FreeBSD.org> - */ - - #ifdef HAVE_CONFIG_H -@@ -25,11 +26,18 @@ - - #include <glib.h> - #include <glib/gi18n.h> -+#ifdef __FreeBSD__ -+#include <sys/types.h> -+#include <sys/sysctl.h> -+#endif /* __FreeBSD__ */ - - #include "cpufreq-applet.h" - #include "cpufreq-utils.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" - #ifdef HAVE_LIBCPUFREQ - #include "cpufreq-monitor-libcpufreq.h" -@@ -40,6 +48,7 @@ CPUFreqMonitor * - cpufreq_monitor_factory_create_monitor (guint cpu) - { - CPUFreqMonitor *monitor = NULL; -+#ifndef __FreeBSD__ - - #ifdef HAVE_LIBCPUFREQ - monitor = cpufreq_monitor_libcpufreq_new (cpu); -@@ -63,6 +72,19 @@ cpufreq_monitor_factory_create_monitor ( - - monitor = cpufreq_monitor_cpuinfo_new (cpu); - } -+#else -+ size_t len; + -+ if (sysctlbyname ("dev.cpu.0.freq", NULL, &len, NULL, 0) == 0) { -+ monitor = cpufreq_monitor_sysctl_new (cpu); -+ } else { -+ cpufreq_utils_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-utils.c.orig Sat Aug 12 21:26:50 2006 -+++ cpufreq/src/cpufreq-utils.c Tue Aug 22 11:07:32 2006 -@@ -22,6 +22,9 @@ - #include <glib.h> - #include <gtk/gtkmessagedialog.h> - #include <sys/types.h> -+#ifdef __FreeBSD__ -+#include <sys/sysctl.h> -+#endif - #include <sys/stat.h> - #include <fcntl.h> - #include <unistd.h> -@@ -30,6 +33,24 @@ - - #include "cpufreq-utils.h" - -+#ifdef __FreeBSD__ -+guint -+cpufreq_utils_get_n_cpus (void) ++static GList * ++cpufreq_monitor_sysctl_get_available_governors (CPUFreqMonitor *monitor) +{ -+ size_t len; -+ static guint n_cpus = 0; ++ GList *list = NULL; + -+ if (n_cpus > 0) -+ return n_cpus; -+ -+ len = sizeof (n_cpus); -+ if (sysctlbyname ("hw.ncpu", &n_cpus, &len, NULL, 0) == -1) { -+ return 1; -+ } ++ list = g_list_prepend (list, g_strdup ("performance")); ++ list = g_list_prepend (list, g_strdup ("userspace")); ++ list = g_list_prepend (list, g_strdup ("economy")); + -+ return n_cpus; ++ return list; +} -+#else - guint - cpufreq_utils_get_n_cpus (void) - { -@@ -72,6 +93,7 @@ cpufreq_utils_get_n_cpus (void) - - return 1; - } +#endif /* __FreeBSD__ */ - - void - cpufreq_utils_display_error (const gchar *message, |