diff -ruN gnome-cpufreq-applet-0.3.1/src/cpufreq-applet.c gnome-cpufreq-applet-0.3.1-libcpufreq/src/cpufreq-applet.c
--- gnome-cpufreq-applet-0.3.1/src/cpufreq-applet.c	2004-11-16 22:02:20.000000000 +0100
+++ gnome-cpufreq-applet-0.3.1-libcpufreq/src/cpufreq-applet.c	2004-11-22 21:19:55.194188056 +0100
@@ -29,7 +29,12 @@
 #include "cpufreq-applet.h"
 #include "cpufreq-prefs.h"
 #include "cpufreq-popup.h"
-#include "cpufreq.h"
+#include "cpufreq_local.h"
+
+#define WITH_LIBCPUFREQ
+#ifdef WITH_LIBCPUFREQ
+#include <cpufreq.h>
+#endif
 
 static void       cpufreq_applet_preferences_dialog (BonoboUIComponent *uic, CPUFreqApplet *applet);
 static void       cpufreq_applet_help_cb            (BonoboUIComponent *uic, CPUFreqApplet *applet);
@@ -185,6 +190,18 @@
 	   gint   mcpu = -1;
 	   gchar *file = NULL;
 
+#ifdef WITH_LIBCPUFREQ
+	   gint   tmp;
+
+	   for (tmp = 0; tmp < MAX_CPUS; tmp++) {
+		   if (!cpufreq_cpu_exists(tmp)) 
+			   mcpu = tmp;
+	   }
+
+	   if (mcpu >= 0)
+			 return mcpu;
+#endif
+
 	   do {
 			 if (file) g_free (file);
 			 mcpu ++;
@@ -665,6 +682,12 @@
 									 NULL);
 	   }
 
+#ifdef WITH_LIBCPUFREQ
+	   if (1) {
+		   applet->iface = IFACE_LIBCPUFREQ;
+		   applet->timeout_handler = g_timeout_add (1000, cpufreq_get_from_libcpufreq, (gpointer) applet);
+	   } else 
+#endif
 	   if (g_file_test ("/sys/devices/system/cpu/cpu0/cpufreq", G_FILE_TEST_EXISTS)) { /* 2.6 kernel */
 			 applet->iface = IFACE_SYSFS;
 			 applet->timeout_handler = g_timeout_add (1000, cpufreq_get_from_sysfs, (gpointer) applet);
diff -ruN gnome-cpufreq-applet-0.3.1/src/cpufreq-applet.h gnome-cpufreq-applet-0.3.1-libcpufreq/src/cpufreq-applet.h
--- gnome-cpufreq-applet-0.3.1/src/cpufreq-applet.h	2004-11-16 22:02:20.000000000 +0100
+++ gnome-cpufreq-applet-0.3.1-libcpufreq/src/cpufreq-applet.h	2004-11-22 20:39:59.598373976 +0100
@@ -35,6 +35,7 @@
 } CPUFreqShowTextMode;
 
 typedef enum {
+	   IFACE_LIBCPUFREQ,
 	   IFACE_SYSFS,
 	   IFACE_PROCFS,
 	   IFACE_CPUINFO
diff -ruN gnome-cpufreq-applet-0.3.1/src/cpufreq.c gnome-cpufreq-applet-0.3.1-libcpufreq/src/cpufreq.c
--- gnome-cpufreq-applet-0.3.1/src/cpufreq.c	2004-11-16 22:02:19.000000000 +0100
+++ gnome-cpufreq-applet-0.3.1-libcpufreq/src/cpufreq.c	2004-11-22 21:22:16.921642208 +0100
@@ -23,8 +23,13 @@
 #include <gnome.h>
 #include <string.h>
 
+#define WITH_LIBCPUFREQ
+#ifdef WITH_LIBCPUFREQ
+#include <cpufreq.h>
+#endif
+
 #include "cpufreq-applet.h"
-#include "cpufreq.h"
+#include "cpufreq_local.h"
 
 static gboolean cpufreq_parse_procfs   (CPUFreqApplet *applet, gint *cpu, gint *fmax,
 								gint *pmin, gint *pmax, gint *fmin, gchar *mode);
@@ -489,6 +494,66 @@
 	   return list;
 }
 
+#ifdef WITH_LIBCPUFREQ
+gboolean
+cpufreq_get_from_libcpufreq (gpointer gdata)
+{
+	   struct cpufreq_policy   *current_policy;
+	   CPUFreqApplet           *applet;
+	   unsigned long           tmp1, tmp2;
+
+	   applet = (CPUFreqApplet *) gdata;
+	   g_return_val_if_fail (PANEL_IS_APPLET (PANEL_APPLET (applet)), FALSE);
+
+	   current_policy = cpufreq_get_policy(applet->cpu);
+	   if (!current_policy)
+		   return FALSE;
+
+	   cpufreq_applet_prepare (applet);
+
+	   applet->governor = g_strdup (current_policy->governor);
+
+	   cpufreq_get_hardware_limits(applet->cpu, &tmp1, &tmp2);
+
+	   tmp1 = cpufreq_get_freq_kernel(applet->cpu);
+
+	   applet->freq = cpufreq_get_human_readble_freq (tmp1);
+
+	   applet->unit = cpufreq_get_human_readble_unit (tmp1);
+
+	   applet->perc = cpufreq_get_human_readble_perc (tmp2, tmp1);
+
+	   cpufreq_put_policy(current_policy);
+
+	   cpufreq_applet_update (applet);
+
+	   return TRUE;
+}
+
+GList *
+cpufreq_get_frequencies_from_libcpufreq (CPUFreqApplet *applet)
+{
+	   GList            *list = NULL;
+	   struct cpufreq_available_frequencies *freqs, *temp;
+
+	   freqs = cpufreq_get_available_frequencies(applet->cpu);
+	   if (!freqs)
+		   return FALSE;
+
+	   temp = freqs;
+	   while (temp) {
+		   gchar *fr = g_strdup_printf ("%lu", temp->frequency);
+		   if (!g_list_find_custom (list, fr, compare))
+			   list = g_list_append (list, g_strdup (fr));
+		   g_free(fr);
+		   temp = temp->next;
+	   }
+
+	   cpufreq_put_available_frequencies(freqs);
+	   return list;
+}
+#endif
+
 gboolean
 cpufreq_get_from_procfs_cpuinfo (CPUFreqApplet *applet)
 {
diff -ruN gnome-cpufreq-applet-0.3.1/src/cpufreq.h gnome-cpufreq-applet-0.3.1-libcpufreq/src/cpufreq.h
--- gnome-cpufreq-applet-0.3.1/src/cpufreq.h	2004-11-16 22:02:19.000000000 +0100
+++ gnome-cpufreq-applet-0.3.1-libcpufreq/src/cpufreq.h	1970-01-01 01:00:00.000000000 +0100
@@ -1,29 +0,0 @@
-/*
- * 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 : Carlos García Campos <carlosgc@gnome.org>
- */
-
-gchar   *cpufreq_get_human_readble_freq      (gint freq);
-gchar   *cpufreq_get_human_readble_unit      (gint freq);
-gchar   *cpufreq_get_human_readble_perc      (gint fmax, gint fmin);
-
-gboolean cpufreq_get_from_procfs             (gpointer gdata);
-gboolean cpufreq_get_from_sysfs              (gpointer gdata);
-GList   *cpufreq_get_frequencies_from_procfs (CPUFreqApplet *applet);
-GList   *cpufreq_get_frequencies_from_sysfs  (CPUFreqApplet *applet);
-gboolean cpufreq_get_from_procfs_cpuinfo     (CPUFreqApplet *applet);
diff -ruN gnome-cpufreq-applet-0.3.1/src/cpufreq_local.h gnome-cpufreq-applet-0.3.1-libcpufreq/src/cpufreq_local.h
--- gnome-cpufreq-applet-0.3.1/src/cpufreq_local.h	1970-01-01 01:00:00.000000000 +0100
+++ gnome-cpufreq-applet-0.3.1-libcpufreq/src/cpufreq_local.h	2004-11-22 21:21:54.830000648 +0100
@@ -0,0 +1,36 @@
+/*
+ * 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 : Carlos García Campos <carlosgc@gnome.org>
+ */
+
+gchar   *cpufreq_get_human_readble_freq      (gint freq);
+gchar   *cpufreq_get_human_readble_unit      (gint freq);
+gchar   *cpufreq_get_human_readble_perc      (gint fmax, gint fmin);
+
+gboolean cpufreq_get_from_procfs             (gpointer gdata);
+gboolean cpufreq_get_from_sysfs              (gpointer gdata);
+GList   *cpufreq_get_frequencies_from_procfs (CPUFreqApplet *applet);
+GList   *cpufreq_get_frequencies_from_sysfs  (CPUFreqApplet *applet);
+gboolean cpufreq_get_from_procfs_cpuinfo     (CPUFreqApplet *applet);
+
+#define WITH_LIBCPUFREQ
+#ifdef WITH_LIBCPUFREQ
+gboolean cpufreq_get_from_libcpufreq         (gpointer gdata);
+GList   *cpufreq_get_frequencies_from_libcpufreq (CPUFreqApplet *applet);
+#define MAX_CPUS 16
+#endif
diff -ruN gnome-cpufreq-applet-0.3.1/src/cpufreq-popup.c gnome-cpufreq-applet-0.3.1-libcpufreq/src/cpufreq-popup.c
--- gnome-cpufreq-applet-0.3.1/src/cpufreq-popup.c	2004-11-16 22:02:19.000000000 +0100
+++ gnome-cpufreq-applet-0.3.1-libcpufreq/src/cpufreq-popup.c	2004-11-22 21:19:39.652550744 +0100
@@ -20,10 +20,15 @@
 
 #include <config.h>
 
+#define WITH_LIBCPUFREQ
+#ifdef WITH_LIBCPUFREQ
+#include <cpufreq.h>
+#endif
+
 #include <gnome.h>
 #include "cpufreq-applet.h"
 #include "cpufreq-popup.h"
-#include "cpufreq.h"
+#include "cpufreq_local.h"
 
 static gboolean   cpufreq_popup_selector_is_available (void);
 static void       cpufreq_popup_position_menu         (GtkMenu *menu, int *x, int *y,
@@ -131,6 +136,11 @@
 			 }
 			 
 			 switch (applet->iface) {
+#ifdef WITH_LIBCPUFREQ
+			 case IFACE_LIBCPUFREQ:
+				    if (!applet->available_freqs)
+						  applet->available_freqs = cpufreq_get_frequencies_from_libcpufreq (applet);
+#endif
 			 case IFACE_SYSFS:
 				    if (!applet->available_freqs)
 						  applet->available_freqs = cpufreq_get_frequencies_from_sysfs (applet);
@@ -173,12 +183,21 @@
 
 	   freq = GPOINTER_TO_INT (gdata);
 
+#ifdef WITH_LIBCPUFREQ
+	   path = g_find_program_in_path ("cpufreq-set");
+
+	   if (!path)
+			 return;
+	   
+	   command = g_strdup_printf ("%s -f %d", path, freq);
+#else
 	   path = g_find_program_in_path ("cpufreq-selector");
 
 	   if (!path)
 			 return;
 	   
 	   command = g_strdup_printf ("%s -f %d", path, freq);
+#endif
 
 	   g_spawn_command_line_async (command, NULL); /* TODO: error */
 
diff -ruN gnome-cpufreq-applet-0.3.1/src/Makefile.am gnome-cpufreq-applet-0.3.1-libcpufreq/src/Makefile.am
--- gnome-cpufreq-applet-0.3.1/src/Makefile.am	2004-11-16 22:02:20.000000000 +0100
+++ gnome-cpufreq-applet-0.3.1-libcpufreq/src/Makefile.am	2004-11-22 21:15:50.495387928 +0100
@@ -9,6 +9,7 @@
 
 INCLUDES = 							\
 	-I$(top_srcdir)/intl                                   	\
+	-I/usr/include                                   	\
 	$(GNOME_APPLETS_CFLAGS)					\
 	$(LIBGLADE_CFLAGS)					\
 	-DICONDIR=\""$(datadir)/pixmaps"\"			\
@@ -27,6 +28,7 @@
 	$(NULL)
 
 gnome_cpufreq_applet_LDADD = 	\
+	-lcpufreq		\
 	$(GNOME_APPLETS_LIBS) 	\
 	$(LIBGLADE_LIBS)	\
 	$(NULL)
