14345N/A+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
14345N/A+ * Copyright (C) 2006-2007 Richard Hughes <richard@hughsie.com>
14345N/A+ * Licensed under the GNU General Public License Version 2
14345N/A+ * This program is free software; you can redistribute it
and/or modify
14345N/A+ * it under the terms of the GNU General Public License as published by
14345N/A+ * the Free Software Foundation; either version 2 of the License, or
14345N/A+ * (at your option) any later version.
14345N/A+ * This program is distributed in the hope that it will be useful,
14345N/A+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14345N/A+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14345N/A+ * GNU General Public License for more details.
14345N/A+ * You should have received a copy of the GNU General Public License
14345N/A+ * along with this program; if not, write to the Free Software
14345N/A+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14345N/A+#define LIBHAL_TYPE_CPUFREQ (hal_gcpufreq_get_type ())
14345N/A+#define LIBHAL_CPUFREQ(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), LIBHAL_TYPE_CPUFREQ, HalGCpufreq))
14345N/A+#define LIBHAL_CPUFREQ_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), LIBHAL_TYPE_CPUFREQ, HalGCpufreqClass))
14345N/A+#define LIBHAL_IS_CPUFREQ(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), LIBHAL_TYPE_CPUFREQ))
14345N/A+#define LIBHAL_IS_CPUFREQ_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), LIBHAL_TYPE_CPUFREQ))
14345N/A+#define LIBHAL_CPUFREQ_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LIBHAL_TYPE_CPUFREQ, HalGCpufreqClass))
14345N/A+typedef struct HalGCpufreqPrivate HalGCpufreqPrivate;
14345N/A+ LIBHAL_CPUFREQ_CONSERVATIVE = 2,
14345N/A+ LIBHAL_CPUFREQ_PERFORMANCE = 16,
14345N/A+#define CODE_CPUFREQ_ONDEMAND "ondemand"
14345N/A+#define CODE_CPUFREQ_CONSERVATIVE "conservative"
14345N/A+#define CODE_CPUFREQ_POWERSAVE "powersave"
14345N/A+#define CODE_CPUFREQ_USERSPACE "userspace"
14345N/A+#define CODE_CPUFREQ_PERFORMANCE "performance"
14345N/A+#define CODE_CPUFREQ_NOTHING "nothing"
14345N/A+GType hal_gcpufreq_get_type (void);
14345N/A+HalGCpufreq *hal_gcpufreq_new (void);
14345N/A+gboolean hal_gcpufreq_has_hw (void);
14345N/A+const gchar *hal_gcpufreq_enum_to_string (HalGCpufreqType cpufreq_type);
14345N/A+HalGCpufreqType hal_gcpufreq_string_to_enum (const gchar *governor);
14345N/A+gboolean hal_gcpufreq_get_governors (HalGCpufreq *cpufreq,
14345N/A+ HalGCpufreqType *cpufreq_type);
14345N/A+gboolean hal_gcpufreq_get_governor (HalGCpufreq *cpufreq,
14345N/A+ HalGCpufreqType *cpufreq_type);
14345N/A+gboolean hal_gcpufreq_set_governor (HalGCpufreq *cpufreq,
14345N/A+ HalGCpufreqType governor_enum);
14345N/A+gboolean hal_gcpufreq_get_consider_nice (HalGCpufreq *cpufreq,
14345N/A+gboolean hal_gcpufreq_set_consider_nice (HalGCpufreq *cpufreq,
14345N/A+gboolean hal_gcpufreq_get_performance (HalGCpufreq *cpufreq,
14345N/A+gboolean hal_gcpufreq_set_performance (HalGCpufreq *cpufreq,
14345N/A+guint hal_gcpufreq_get_number_governors (HalGCpufreq *cpufreq,
14345N/A+#endif /* __LIBHAL_GCPUFREQ_H */
14345N/A+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
14345N/A+ * Copyright (C) 2006-2007 Richard Hughes <richard@hughsie.com>
14345N/A+ * Licensed under the GNU General Public License Version 2
14345N/A+ * This program is free software; you can redistribute it
and/or modify
14345N/A+ * it under the terms of the GNU General Public License as published by
14345N/A+ * the Free Software Foundation; either version 2 of the License, or
14345N/A+ * (at your option) any later version.
14345N/A+ * This program is distributed in the hope that it will be useful,
14345N/A+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14345N/A+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14345N/A+ * GNU General Public License for more details.
14345N/A+ * You should have received a copy of the GNU General Public License
14345N/A+ * along with this program; if not, write to the Free Software
14345N/A+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14345N/A+static void hal_gcpufreq_class_init (HalGCpufreqClass *klass);
14345N/A+static void hal_gcpufreq_init (HalGCpufreq *hal);
14345N/A+static void hal_gcpufreq_finalize (GObject *object);
14345N/A+#define LIBHAL_CPUFREQ_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), LIBHAL_TYPE_CPUFREQ, HalGCpufreqPrivate))
14345N/A+ HalGCpufreqType current_governor;
14345N/A+G_DEFINE_TYPE (HalGCpufreq, hal_gcpufreq, G_TYPE_OBJECT)
14345N/A+static gpointer hal_gcpufreq_object = NULL;
14345N/A+ * hal_gcpufreq_string_to_enum:
14345N/A+ * @governor: The cpufreq kernel governor,
e.g. "powersave"
14345N/A+ * Return value: The HalGCpufreqType value,
e.g. LIBHAL_CPUFREQ_POWERSAVE
14345N/A+hal_gcpufreq_string_to_enum (const gchar *governor)
14345N/A+ HalGCpufreqType cpufreq_type = LIBHAL_CPUFREQ_UNKNOWN;
14345N/A+ cpufreq_type = LIBHAL_CPUFREQ_NOTHING;
14345N/A+ } else if (strcmp (governor, CODE_CPUFREQ_ONDEMAND) == 0) {
14345N/A+ cpufreq_type = LIBHAL_CPUFREQ_ONDEMAND;
14345N/A+ } else if (strcmp (governor, CODE_CPUFREQ_CONSERVATIVE) == 0) {
14345N/A+ cpufreq_type = LIBHAL_CPUFREQ_CONSERVATIVE;
14345N/A+ } else if (strcmp (governor, CODE_CPUFREQ_POWERSAVE) == 0) {
14345N/A+ cpufreq_type = LIBHAL_CPUFREQ_POWERSAVE;
14345N/A+ } else if (strcmp (governor, CODE_CPUFREQ_USERSPACE) == 0) {
14345N/A+ cpufreq_type = LIBHAL_CPUFREQ_USERSPACE;
14345N/A+ } else if (strcmp (governor, CODE_CPUFREQ_PERFORMANCE) == 0) {
14345N/A+ cpufreq_type = LIBHAL_CPUFREQ_PERFORMANCE;
14345N/A+ } else if (strcmp (governor, CODE_CPUFREQ_NOTHING) == 0) {
14345N/A+ cpufreq_type = LIBHAL_CPUFREQ_NOTHING;
14345N/A+ * hal_gcpufreq_string_to_enum:
14345N/A+ * @cpufreq_type: The HalGCpufreqType value,
e.g. LIBHAL_CPUFREQ_POWERSAVE
14345N/A+ * Return value: The cpufreq kernel governor,
e.g. "powersave"
14345N/A+hal_gcpufreq_enum_to_string (HalGCpufreqType cpufreq_type)
14345N/A+ if (cpufreq_type == LIBHAL_CPUFREQ_ONDEMAND) {
14345N/A+ governor = CODE_CPUFREQ_ONDEMAND;
14345N/A+ } else if (cpufreq_type == LIBHAL_CPUFREQ_CONSERVATIVE) {
14345N/A+ governor = CODE_CPUFREQ_CONSERVATIVE;
14345N/A+ } else if (cpufreq_type == LIBHAL_CPUFREQ_POWERSAVE) {
14345N/A+ governor = CODE_CPUFREQ_POWERSAVE;
14345N/A+ } else if (cpufreq_type == LIBHAL_CPUFREQ_USERSPACE) {
14345N/A+ governor = CODE_CPUFREQ_USERSPACE;
14345N/A+ } else if (cpufreq_type == LIBHAL_CPUFREQ_PERFORMANCE) {
14345N/A+ governor = CODE_CPUFREQ_PERFORMANCE;
14345N/A+ } else if (cpufreq_type == LIBHAL_CPUFREQ_NOTHING) {
14345N/A+ governor = CODE_CPUFREQ_NOTHING;
14345N/A+ * hal_gcpufreq_set_performance:
14345N/A+ * @cpufreq: This class instance
14345N/A+ * @performance: The percentage perfomance figure
14345N/A+ * Return value: If the method succeeded
14345N/A+hal_gcpufreq_set_performance (HalGCpufreq *cpufreq, guint performance)
14345N/A+ g_return_val_if_fail (cpufreq != NULL, FALSE);
14345N/A+ g_return_val_if_fail (LIBHAL_IS_CPUFREQ (cpufreq), FALSE);
14345N/A+ g_return_val_if_fail (performance >= 0, FALSE);
14345N/A+ g_return_val_if_fail (performance <= 100, FALSE);
14345N/A+ /* we need to find the current governor to see if it's sane */
14345N/A+ if (cpufreq->priv->current_governor == LIBHAL_CPUFREQ_UNKNOWN) {
14345N/A+ hal_gcpufreq_get_governor (cpufreq, &cpufreq_type);
14345N/A+ /* only applies to some governors */
14345N/A+ if (cpufreq->priv->current_governor == LIBHAL_CPUFREQ_PERFORMANCE ||
14345N/A+ cpufreq->priv->current_governor == LIBHAL_CPUFREQ_POWERSAVE) {
14345N/A+ proxy = dbus_proxy_get_proxy (cpufreq->priv->gproxy);
14345N/A+ ret = dbus_g_proxy_call (proxy, "SetCPUFreqPerformance", &error,
14345N/A+ g_warning ("ERROR: %s", error->message);
14345N/A+ /* abort as the DBUS method failed */
14345N/A+ * @cpufreq: This class instance
14345N/A+ * @cpufreq_type: The CPU governor type,
e.g. LIBHAL_CPUFREQ_CONSERVATIVE
14345N/A+ * Return value: If the method succeeded
14345N/A+hal_gcpufreq_set_governor (HalGCpufreq *cpufreq,
14345N/A+ g_return_val_if_fail (cpufreq != NULL, FALSE);
14345N/A+ g_return_val_if_fail (LIBHAL_IS_CPUFREQ (cpufreq), FALSE);
14345N/A+ g_return_val_if_fail (cpufreq_type != LIBHAL_CPUFREQ_UNKNOWN, FALSE);
14345N/A+ governor = hal_gcpufreq_enum_to_string (cpufreq_type);
14345N/A+ g_return_val_if_fail (governor != NULL, FALSE);
14345N/A+ proxy = dbus_proxy_get_proxy (cpufreq->priv->gproxy);
14345N/A+ ret = dbus_g_proxy_call (proxy, "SetCPUFreqGovernor", &error,
14345N/A+ g_warning ("ERROR: %s", error->message);
14345N/A+ /* abort as the DBUS method failed */
14345N/A+ cpufreq->priv->current_governor = cpufreq_type;
14345N/A+ * @cpufreq: This class instance
14345N/A+ * @cpufreq_type: Return variable, The CPU governor type as an combined bitwise type
14345N/A+ * Return value: If the method succeeded
14345N/A+hal_gcpufreq_get_governors (HalGCpufreq *cpufreq,
14345N/A+ HalGCpufreqType *cpufreq_type)
14345N/A+ HalGCpufreqType types = LIBHAL_CPUFREQ_UNKNOWN;
14345N/A+ g_return_val_if_fail (cpufreq != NULL, FALSE);
14345N/A+ g_return_val_if_fail (LIBHAL_IS_CPUFREQ (cpufreq), FALSE);
14345N/A+ g_return_val_if_fail (cpufreq_type != NULL, FALSE);
14345N/A+ proxy = dbus_proxy_get_proxy (cpufreq->priv->gproxy);
14345N/A+ *cpufreq_type = LIBHAL_CPUFREQ_UNKNOWN;
14345N/A+ ret = dbus_g_proxy_call (proxy, "GetCPUFreqAvailableGovernors", &error,
14345N/A+ g_warning ("ERROR: %s", error->message);
14345N/A+ /* abort as the DBUS method failed */
14345N/A+ *cpufreq_type = LIBHAL_CPUFREQ_UNKNOWN;
14345N/A+ while (strlist && strlist[i]) {
14345N/A+ types += hal_gcpufreq_string_to_enum (strlist[i]);
14345N/A+ /* when we have conservative and ondemand available, only expose
14345N/A+ ondemand in the UI. They are too similar and ondemand is better. */
14345N/A+ if (types & LIBHAL_CPUFREQ_ONDEMAND && types & LIBHAL_CPUFREQ_CONSERVATIVE) {
14345N/A+ types -= LIBHAL_CPUFREQ_CONSERVATIVE;
14345N/A+ /* We never allow the user to use userspace. */
14345N/A+ if (types & LIBHAL_CPUFREQ_USERSPACE) {
14345N/A+ types -= LIBHAL_CPUFREQ_USERSPACE;
14345N/A+ cpufreq->priv->available_governors = i;
14345N/A+ * hal_gcpufreq_get_number_governors:
14345N/A+ * @cpufreq: This class instance
14345N/A+ * @use_cache: if we should force a cache update
14345N/A+ * Return value: the number of available governors
14345N/A+hal_gcpufreq_get_number_governors (HalGCpufreq *cpufreq,
14345N/A+ g_return_val_if_fail (cpufreq != NULL, FALSE);
14345N/A+ g_return_val_if_fail (LIBHAL_IS_CPUFREQ (cpufreq), FALSE);
14345N/A+ if (use_cache == FALSE || cpufreq->priv->available_governors == -1) {
14345N/A+ hal_gcpufreq_get_governors (cpufreq, &cpufreq_type);
14345N/A+ return cpufreq->priv->available_governors;
14345N/A+ * hal_gcpufreq_get_consider_nice:
14345N/A+ * @cpufreq: This class instance
14345N/A+ * @consider_nice: Return variable, if consider niced processes
14345N/A+ * Return value: If the method succeeded
14345N/A+hal_gcpufreq_get_consider_nice (HalGCpufreq *cpufreq,
14345N/A+ g_return_val_if_fail (cpufreq != NULL, FALSE);
14345N/A+ g_return_val_if_fail (LIBHAL_IS_CPUFREQ (cpufreq), FALSE);
14345N/A+ g_return_val_if_fail (consider_nice != NULL, FALSE);
14345N/A+ /* we need to find the current governor to see if it's sane */
14345N/A+ if (cpufreq->priv->current_governor == LIBHAL_CPUFREQ_UNKNOWN) {
14345N/A+ hal_gcpufreq_get_governor (cpufreq, &cpufreq_type);
14345N/A+ /* only applies to some governors */
14345N/A+ if (cpufreq->priv->current_governor != LIBHAL_CPUFREQ_ONDEMAND &&
14345N/A+ cpufreq->priv->current_governor != LIBHAL_CPUFREQ_CONSERVATIVE) {
14345N/A+ proxy = dbus_proxy_get_proxy (cpufreq->priv->gproxy);
14345N/A+ ret = dbus_g_proxy_call (proxy, "GetCPUFreqConsiderNice", &error,
14345N/A+ G_TYPE_BOOLEAN, consider_nice,
14345N/A+ g_warning ("ERROR: %s", error->message);
14345N/A+ /* abort as the DBUS method failed */
14345N/A+ * hal_gcpufreq_get_performance:
14345N/A+ * @cpufreq: This class instance
14345N/A+ * @performance: Return variable, the percentage performance
14345N/A+ * Return value: If the method succeeded
14345N/A+hal_gcpufreq_get_performance (HalGCpufreq *cpufreq,
14345N/A+ g_return_val_if_fail (cpufreq != NULL, FALSE);
14345N/A+ g_return_val_if_fail (LIBHAL_IS_CPUFREQ (cpufreq), FALSE);
14345N/A+ g_return_val_if_fail (performance != NULL, FALSE);
14345N/A+ /* we need to find the current governor to see if it's sane */
14345N/A+ if (cpufreq->priv->current_governor == LIBHAL_CPUFREQ_UNKNOWN) {
14345N/A+ hal_gcpufreq_get_governor (cpufreq, &cpufreq_type);
14345N/A+ /* only applies to some governors */
14345N/A+ if (cpufreq->priv->current_governor != LIBHAL_CPUFREQ_USERSPACE) {
14345N/A+ proxy = dbus_proxy_get_proxy (cpufreq->priv->gproxy);
14345N/A+ ret = dbus_g_proxy_call (proxy, "GetCPUFreqPerformance", &error,
14345N/A+ g_warning ("ERROR: %s", error->message);
14345N/A+ /* abort as the DBUS method failed */
14345N/A+ * @cpufreq: This class instance
14345N/A+ * @cpufreq_type: Return variable, the governor type,
e.g. LIBHAL_CPUFREQ_POWERSAVE
14345N/A+ * Return value: If the method succeeded
14345N/A+hal_gcpufreq_get_governor (HalGCpufreq *cpufreq,
14345N/A+ HalGCpufreqType *cpufreq_type)
14345N/A+ g_return_val_if_fail (cpufreq != NULL, FALSE);
14345N/A+ g_return_val_if_fail (LIBHAL_IS_CPUFREQ (cpufreq), FALSE);
14345N/A+ g_return_val_if_fail (cpufreq_type, FALSE);
14345N/A+ *cpufreq_type = LIBHAL_CPUFREQ_UNKNOWN;
14345N/A+ if (cpufreq->priv->current_governor != LIBHAL_CPUFREQ_UNKNOWN) {
14345N/A+ return cpufreq->priv->current_governor;
14345N/A+ proxy = dbus_proxy_get_proxy (cpufreq->priv->gproxy);
14345N/A+ ret = dbus_g_proxy_call (proxy, "GetCPUFreqGovernor", &error,
14345N/A+ g_warning ("ERROR: %s", error->message);
14345N/A+ /* abort as the DBUS method failed */
14345N/A+ /* convert to enumerated type */
14345N/A+ *cpufreq_type = hal_gcpufreq_string_to_enum (governor);
14345N/A+ cpufreq->priv->current_governor = *cpufreq_type;
14345N/A+ * hal_gcpufreq_set_consider_nice:
14345N/A+ * @cpufreq: This class instance
14345N/A+ * @enable: True to consider nice processes
14345N/A+ * Return value: If the method succeeded
14345N/A+hal_gcpufreq_set_consider_nice (HalGCpufreq *cpufreq,
14345N/A+ g_return_val_if_fail (cpufreq != NULL, FALSE);
14345N/A+ g_return_val_if_fail (LIBHAL_IS_CPUFREQ (cpufreq), FALSE);
14345N/A+ /* we need to find the current governor to see if it's sane */
14345N/A+ if (cpufreq->priv->current_governor == LIBHAL_CPUFREQ_UNKNOWN) {
14345N/A+ hal_gcpufreq_get_governor (cpufreq, &cpufreq_type);
14345N/A+ /* only applies to some governors */
14345N/A+ if (cpufreq->priv->current_governor != LIBHAL_CPUFREQ_ONDEMAND &&
14345N/A+ cpufreq->priv->current_governor != LIBHAL_CPUFREQ_CONSERVATIVE) {
14345N/A+ proxy = dbus_proxy_get_proxy (cpufreq->priv->gproxy);
14345N/A+ ret = dbus_g_proxy_call (proxy, "SetCPUFreqConsiderNice", &error,
14345N/A+ G_TYPE_BOOLEAN, consider_nice,
14345N/A+ g_warning ("ERROR: %s", error->message);
14345N/A+ /* abort as the DBUS method failed */
14345N/A+hal_gcpufreq_class_init (HalGCpufreqClass *klass)
14345N/A+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
14345N/A+ object_class->finalize = hal_gcpufreq_finalize;
14345N/A+ g_type_class_add_private (klass, sizeof (HalGCpufreqPrivate));
14345N/A+ * @cpufreq: This class instance
14345N/A+hal_gcpufreq_init (HalGCpufreq *cpufreq)
14345N/A+ cpufreq->priv = LIBHAL_CPUFREQ_GET_PRIVATE (cpufreq);
14345N/A+ cpufreq->priv->gproxy = dbus_proxy_new ();
14345N/A+ dbus_proxy_assign (cpufreq->priv->gproxy,
14345N/A+ cpufreq->priv->available_governors = -1;
14345N/A+ cpufreq->priv->current_governor = LIBHAL_CPUFREQ_UNKNOWN;
14345N/A+ * @object: This class instance
14345N/A+hal_gcpufreq_finalize (GObject *object)
14345N/A+ g_return_if_fail (object != NULL);
14345N/A+ g_return_if_fail (LIBHAL_IS_CPUFREQ (object));
14345N/A+ cpufreq = LIBHAL_CPUFREQ (object);
14345N/A+ cpufreq->priv = LIBHAL_CPUFREQ_GET_PRIVATE (cpufreq);
14345N/A+ if (cpufreq->priv->gproxy != NULL) {
14345N/A+ g_object_unref (cpufreq->priv->gproxy);
14345N/A+ G_OBJECT_CLASS (hal_gcpufreq_parent_class)->finalize (object);
14345N/A+ * Self contained function that works out if we have the hardware.
14345N/A+ * If not, we return FALSE and the module is unloaded.
14345N/A+ hal_manager = hal_gmanager_new ();
14345N/A+ ret = hal_gmanager_find_capability (hal_manager, "cpufreq_control", &names, NULL);
14345N/A+ if (names == NULL || names[0] == NULL) {
14345N/A+ hal_gmanager_free_capability (names);
14345N/A+ * Return value: new HalGCpufreq instance.
14345N/A+ if (hal_gcpufreq_object != NULL) {
14345N/A+ g_object_ref (hal_gcpufreq_object);
14345N/A+ /* only load an instance of this module if we have the hardware */
14345N/A+ if (hal_gcpufreq_has_hw () == FALSE) {
14345N/A+ hal_gcpufreq_object = g_object_new (LIBHAL_TYPE_CPUFREQ, NULL);
14345N/A+ g_object_add_weak_pointer (hal_gcpufreq_object, &hal_gcpufreq_object);
14345N/A+ return LIBHAL_CPUFREQ (hal_gcpufreq_object);
14345N/A+ <owner>gnome-power-manager</owner>
14345N/A+ <short>Whether or not niced processes should be considered on processor load calculation</short>
14345N/A+ <long>If niced processes are considered, they can cause a frequency increment even though their absolute load percentage wouldn't trigger the scaling mechanism to switch up the frequency.</long>
14345N/A+ <owner>gnome-power-manager</owner>
14345N/A+ <short>The cpufreq policy to use when on AC power</short>
14345N/A+ <long>The cpufreq policy used to scale the processor when on AC power. Possible values are ondemand, conservative, powersave, userspace, performance, nothing.</long>
14345N/A+ <owner>gnome-power-manager</owner>
14345N/A+ <short>The cpufreq performance value to use when on AC power</short>
14345N/A+ <long>The cpufreq performance value used to scale the processor when on AC power.</long>
14345N/A+ <owner>gnome-power-manager</owner>
14345N/A+ <short>The cpufreq policy to use when on battery power</short>
14345N/A+ <long>The cpufreq policy used to scale the processor when on battery power. Possible values are ondemand, conservative, powersave, userspace, performance, nothing.</long>
14345N/A+ <owner>gnome-power-manager</owner>
14345N/A+ <short>The cpufreq performance value to use when on battery power</short>
14345N/A+ <long>The cpufreq performance value used to scale the processor when on battery power.</long>
14345N/A <owner>gnome-power-manager</owner>
14345N/A <property name="position">1</property>
14345N/A+ <widget class="GtkHBox" id="hbox_ac_cpu">
14345N/A+ <property name="visible">True</property>
14345N/A+ <property name="homogeneous">True</property>
14345N/A+ <property name="spacing">12</property>
14345N/A+ <widget class="GtkLabel" id="label_ac_cpu">
14345N/A+ <property name="visible">True</property>
14345N/A+ <property name="label" translatable="yes">Computer sp_eed policy:</property>
14345N/A+ <property name="use_underline">True</property>
14345N/A+ <property name="use_markup">False</property>
14345N/A+ <property name="justify">GTK_JUSTIFY_LEFT</property>
14345N/A+ <property name="wrap">False</property>
14345N/A+ <property name="selectable">False</property>
14345N/A+ <property name="xalign">0</property>
14345N/A+ <property name="yalign">0.5</property>
14345N/A+ <property name="xpad">0</property>
14345N/A+ <property name="ypad">0</property>
14345N/A+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
14345N/A+ <property name="width_chars">-1</property>
14345N/A+ <property name="single_line_mode">False</property>
14345N/A+ <property name="angle">0</property>
14345N/A+ <property name="padding">0</property>
14345N/A+ <property name="expand">False</property>
14345N/A+ <property name="fill">True</property>
14345N/A+ <widget class="GtkComboBox" id="combobox_ac_cpu">
14345N/A+ <property name="visible">True</property>
14345N/A+ <property name="items" translatable="yes"></property>
14345N/A+ <property name="add_tearoffs">False</property>
14345N/A+ <property name="focus_on_click">True</property>
14345N/A+ <property name="padding">0</property>
14345N/A+ <property name="expand">True</property>
14345N/A+ <property name="fill">True</property>
14345N/A+ <property name="padding">0</property>
14345N/A+ <property name="expand">True</property>
14345N/A+ <property name="fill">True</property>
14345N/A <property name="position">2</property>
14345N/A+ <widget class="GtkHBox" id="hbox_battery_cpu">
14345N/A+ <property name="visible">True</property>
14345N/A+ <property name="homogeneous">True</property>
14345N/A+ <property name="spacing">12</property>
14345N/A+ <widget class="GtkLabel" id="label_battery_cpu">
14345N/A+ <property name="visible">True</property>
14345N/A+ <property name="label" translatable="yes">Computer sp_eed policy:</property>
14345N/A+ <property name="use_underline">True</property>
14345N/A+ <property name="use_markup">False</property>
14345N/A+ <property name="justify">GTK_JUSTIFY_LEFT</property>
14345N/A+ <property name="wrap">False</property>
14345N/A+ <property name="selectable">False</property>
14345N/A+ <property name="xalign">0</property>
14345N/A+ <property name="yalign">0.5</property>
14345N/A+ <property name="xpad">0</property>
14345N/A+ <property name="ypad">0</property>
14345N/A+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
14345N/A+ <property name="width_chars">-1</property>
14345N/A+ <property name="single_line_mode">False</property>
14345N/A+ <property name="angle">0</property>
14345N/A+ <property name="padding">0</property>
14345N/A+ <property name="expand">False</property>
14345N/A+ <property name="fill">True</property>
14345N/A+ <widget class="GtkComboBox" id="combobox_battery_cpu">
14345N/A+ <property name="visible">True</property>
14345N/A+ <property name="items" translatable="yes"></property>
14345N/A+ <property name="add_tearoffs">False</property>
14345N/A+ <property name="focus_on_click">True</property>
14345N/A+ <property name="padding">0</property>
14345N/A+ <property name="expand">True</property>
14345N/A+ <property name="fill">True</property>
14345N/A+ <property name="padding">0</property>
14345N/A+ <property name="expand">True</property>
14345N/A+ <property name="fill">True</property>
14345N/A+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
14345N/A+ * Copyright (C) 2006-2007 Richard Hughes <richard@hughsie.com>
14345N/A+ * Licensed under the GNU General Public License Version 2
14345N/A+ * This program is free software; you can redistribute it
and/or modify
14345N/A+ * it under the terms of the GNU General Public License as published by
14345N/A+ * the Free Software Foundation; either version 2 of the License, or
14345N/A+ * (at your option) any later version.
14345N/A+ * This program is distributed in the hope that it will be useful,
14345N/A+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14345N/A+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14345N/A+ * GNU General Public License for more details.
14345N/A+ * You should have received a copy of the GNU General Public License
14345N/A+ * along with this program; if not, write to the Free Software
14345N/A+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14345N/A+#define GPM_TYPE_CPUFREQ (gpm_cpufreq_get_type ())
14345N/A+#define GPM_CPUFREQ(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GPM_TYPE_CPUFREQ, GpmCpufreq))
14345N/A+#define GPM_CPUFREQ_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GPM_TYPE_CPUFREQ, GpmCpufreqClass))
14345N/A+#define GPM_IS_CPUFREQ(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GPM_TYPE_CPUFREQ))
14345N/A+#define GPM_IS_CPUFREQ_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GPM_TYPE_CPUFREQ))
14345N/A+#define GPM_CPUFREQ_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GPM_TYPE_CPUFREQ, GpmCpufreqClass))
14345N/A+typedef struct GpmCpufreqPrivate GpmCpufreqPrivate;
14345N/A+GType gpm_cpufreq_get_type (void);
14345N/A+GpmCpufreq *gpm_cpufreq_new (void);
14345N/A+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
14345N/A+ * Copyright (C) 2006-2007 Richard Hughes <richard@hughsie.com>
14345N/A+ * Licensed under the GNU General Public License Version 2
14345N/A+ * This program is free software; you can redistribute it
and/or modify
14345N/A+ * it under the terms of the GNU General Public License as published by
14345N/A+ * the Free Software Foundation; either version 2 of the License, or
14345N/A+ * (at your option) any later version.
14345N/A+ * This program is distributed in the hope that it will be useful,
14345N/A+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14345N/A+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14345N/A+ * GNU General Public License for more details.
14345N/A+ * You should have received a copy of the GNU General Public License
14345N/A+ * along with this program; if not, write to the Free Software
14345N/A+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14345N/A+static void gpm_cpufreq_class_init (GpmCpufreqClass *klass);
14345N/A+static void gpm_cpufreq_init (GpmCpufreq *hal);
14345N/A+static void gpm_cpufreq_finalize (GObject *object);
14345N/A+#define GPM_CPUFREQ_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_CPUFREQ, GpmCpufreqPrivate))
14345N/A+G_DEFINE_TYPE (GpmCpufreq, gpm_cpufreq, G_TYPE_OBJECT)
14345N/A+#if defined(sun) && defined(__SVR4)
14345N/A+ * gpm_cpufreq_sync_policy_from_system_to_gconf:
14345N/A+ * @cpufreq: This class instance
14345N/A+ * Changes the cpufreq policy if AC gconf isn't identical to current system setting.
14345N/A+ * Note: Because Solaris considers server user apart from laptop user, AC gconf key
14345N/A+ * isn't per user preference any more. In other words, AC gconf key always
14345N/A+gpm_cpufreq_sync_policy_from_system_to_gconf (GpmCpufreq *cpufreq)
14345N/A+ on_ac = gpm_ac_adapter_is_present (cpufreq->priv->ac_adapter);
14345N/A+ /* Store current system governor and performance setting into AC gconf key.
14345N/A+ * Solaris CPUfreq don't support nice, do nothing for that.
14345N/A+ hal_gcpufreq_get_governor (cpufreq->priv->hal_cpufreq, &cpufreq_type);
14345N/A+ cpufreq_policy = hal_gcpufreq_enum_to_string (cpufreq_type);
14345N/A+ gpm_conf_set_string (cpufreq->priv->conf, GPM_CONF_CPUFREQ_POLICY_AC, cpufreq_policy);
14345N/A+ if (hal_gcpufreq_get_performance (cpufreq->priv->hal_cpufreq, &cpufreq_performance)) {
14345N/A+ gpm_conf_set_uint (cpufreq->priv->conf, GPM_CONF_CPUFREQ_PERFORMANCE_AC, cpufreq_performance);
14345N/A+ * @cpufreq: This class instance
14345N/A+ * @on_ac: If we are on AC power
14345N/A+ * Changes the cpufreq policy if required
14345N/A+gpm_cpufreq_sync_policy (GpmCpufreq *cpufreq)
14345N/A+ gboolean cpufreq_consider_nice;
14345N/A+ on_ac = gpm_ac_adapter_is_present (cpufreq->priv->ac_adapter);
14345N/A+ gpm_conf_get_bool (cpufreq->priv->conf, GPM_CONF_CPUFREQ_USE_NICE, &cpufreq_consider_nice);
14345N/A+ gpm_conf_get_string (cpufreq->priv->conf, GPM_CONF_CPUFREQ_POLICY_AC, &cpufreq_policy);
14345N/A+ gpm_conf_get_uint (cpufreq->priv->conf, GPM_CONF_CPUFREQ_PERFORMANCE_AC, &cpufreq_performance);
14345N/A+ gpm_conf_get_bool (cpufreq->priv->conf, GPM_CONF_CPUFREQ_USE_NICE, &cpufreq_consider_nice);
14345N/A+ gpm_conf_get_string (cpufreq->priv->conf, GPM_CONF_CPUFREQ_POLICY_BATT, &cpufreq_policy);
14345N/A+ gpm_conf_get_uint (cpufreq->priv->conf, GPM_CONF_CPUFREQ_PERFORMANCE_BATT, &cpufreq_performance);
14345N/A+ cpufreq_type = hal_gcpufreq_string_to_enum (cpufreq_policy);
14345N/A+ /* change to the right governer and settings */
14345N/A+ hal_gcpufreq_set_governor (cpufreq->priv->hal_cpufreq, cpufreq_type);
14345N/A+ hal_gcpufreq_set_consider_nice (cpufreq->priv->hal_cpufreq, cpufreq_consider_nice);
14345N/A+ // Fix for bugster #6727770. hal_gcpufreq_set_performance (cpufreq->priv->hal_cpufreq, cpufreq_performance);
14345N/A+ * We might have to do things when the gconf keys change; do them here.
14345N/A+conf_key_changed_cb (GpmConf *conf,
14345N/A+ /* if any change, just resync the whole lot */
14345N/A+ if (strcmp (key, GPM_CONF_CPUFREQ_POLICY_AC) == 0 ||
14345N/A+ strcmp (key, GPM_CONF_CPUFREQ_PERFORMANCE_AC) == 0 ||
14345N/A+ strcmp (key, GPM_CONF_CPUFREQ_POLICY_BATT) == 0 ||
14345N/A+ strcmp (key, GPM_CONF_CPUFREQ_PERFORMANCE_BATT) == 0 ||
14345N/A+ strcmp (key, GPM_CONF_CPUFREQ_USE_NICE) == 0) {
14345N/A+ gpm_cpufreq_sync_policy (cpufreq);
14345N/A+ * @ac_adapter: The ac_adapter class instance
14345N/A+ * @on_ac: if we are on AC power
14345N/A+ * @cpufreq: This class instance
14345N/A+ac_adapter_changed_cb (GpmAcAdapter *ac_adapter,
14345N/A+ gpm_cpufreq_sync_policy (cpufreq);
14345N/A+gpm_cpufreq_class_init (GpmCpufreqClass *klass)
14345N/A+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
14345N/A+ object_class->finalize = gpm_cpufreq_finalize;
14345N/A+ g_type_class_add_private (klass, sizeof (GpmCpufreqPrivate));
14345N/A+ * @cpufreq: This class instance
14345N/A+gpm_cpufreq_init (GpmCpufreq *cpufreq)
14345N/A+ cpufreq->priv = GPM_CPUFREQ_GET_PRIVATE (cpufreq);
14345N/A+ /* we use cpufreq as the master class */
14345N/A+ cpufreq->priv->hal_cpufreq = hal_gcpufreq_new ();
14345N/A+ cpufreq->priv->conf = gpm_conf_new ();
14345N/A+ g_signal_connect (cpufreq->priv->conf, "value-changed",
14345N/A+ G_CALLBACK (conf_key_changed_cb), cpufreq);
14345N/A+ /* we use ac_adapter for the ac-adapter-changed signal */
14345N/A+ cpufreq->priv->ac_adapter = gpm_ac_adapter_new ();
14345N/A+ g_signal_connect (cpufreq->priv->ac_adapter, "ac-adapter-changed",
14345N/A+ G_CALLBACK (ac_adapter_changed_cb), cpufreq);
14345N/A+#if defined(sun) && defined(__SVR4)
14345N/A+ gpm_cpufreq_sync_policy_from_system_to_gconf (cpufreq);
14345N/A+ gpm_cpufreq_sync_policy (cpufreq);
14345N/A+ * @object: This class instance
14345N/A+gpm_cpufreq_finalize (GObject *object)
14345N/A+ g_return_if_fail (object != NULL);
14345N/A+ g_return_if_fail (GPM_IS_CPUFREQ (object));
14345N/A+ cpufreq = GPM_CPUFREQ (object);
14345N/A+ cpufreq->priv = GPM_CPUFREQ_GET_PRIVATE (cpufreq);
14345N/A+ if (cpufreq->priv->hal_cpufreq != NULL) {
14345N/A+ g_object_unref (cpufreq->priv->hal_cpufreq);
14345N/A+ if (cpufreq->priv->conf != NULL) {
14345N/A+ g_object_unref (cpufreq->priv->conf);
14345N/A+ if (cpufreq->priv->ac_adapter != NULL) {
14345N/A+ g_object_unref (cpufreq->priv->ac_adapter);
14345N/A+ G_OBJECT_CLASS (gpm_cpufreq_parent_class)->finalize (object);
14345N/A+ * Return value: new GpmCpufreq instance.
14345N/A+ /* only load if we have the hardware */
14345N/A+ if (hal_gcpufreq_has_hw() == TRUE) {
14345N/A+ cpufreq = g_object_new (GPM_TYPE_CPUFREQ, NULL);
14345N/A PolKitGnomeAction *default_action;
14345N/A+ HalGCpufreqType cpufreq_types;
14345N/A #define ACTION_BLANK_TEXT _("Blank screen")
14345N/A #define ACTION_NOTHING_TEXT _("Do nothing")
14345N/A+/* The text that should appear in the processor combo box */
14345N/A+#define CPUFREQ_NOTHING_TEXT _("Do nothing")
14345N/A+#define CPUFREQ_ONDEMAND_TEXT _("Based on processor load")
14345N/A+#define CPUFREQ_CONSERVATIVE_TEXT _("Automatic power saving")
14345N/A+#define CPUFREQ_POWERSAVE_TEXT _("Maximum power saving")
14345N/A+#define CPUFREQ_PERFORMANCE_TEXT _("Always maximum speed")
14345N/A /* If sleep time in a slider is set to 61 it is considered as never */
14345N/A const int NEVER_TIME_ON_SLIDER = 61;
14345N/A+ * gpm_prefs_processor_combo_changed_cb:
14345N/A+ * @widget: The GtkWidget object
14345N/A+ * @gpm_pref_key: The GConf key for this preference setting.
14345N/A+gpm_prefs_processor_combo_changed_cb (GtkWidget *widget,
14345N/A+ value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
14345N/A+ gpm_warning ("active text failed");
14345N/A+ if (strcmp (value, CPUFREQ_ONDEMAND_TEXT) == 0) {
14345N/A+ policy = CODE_CPUFREQ_ONDEMAND;
14345N/A+ } else if (strcmp (value, CPUFREQ_CONSERVATIVE_TEXT) == 0) {
14345N/A+ policy = CODE_CPUFREQ_CONSERVATIVE;
14345N/A+ } else if (strcmp (value, CPUFREQ_POWERSAVE_TEXT) == 0) {
14345N/A+ policy = CODE_CPUFREQ_POWERSAVE;
14345N/A+ } else if (strcmp (value, CPUFREQ_PERFORMANCE_TEXT) == 0) {
14345N/A+ policy = CODE_CPUFREQ_PERFORMANCE;
14345N/A+ } else if (strcmp (value, CPUFREQ_NOTHING_TEXT) == 0) {
14345N/A+ policy = CODE_CPUFREQ_NOTHING;
14345N/A+ gpm_pref_key = (char *) g_object_get_data (G_OBJECT (widget), "conf_key");
14345N/A+ gpm_debug ("Changing %s to %s", gpm_pref_key, policy);
14345N/A+ gpm_conf_set_string (prefs->priv->conf, gpm_pref_key, policy);
14345N/A+ * gpm_prefs_setup_action_combo:
14345N/A+ * @prefs: This prefs class instance
14345N/A+ * @widget_name: The GtkWidget name
14345N/A+ * @gpm_pref_key: The GConf key for this preference setting.
14345N/A+ * @actions: The actions to associate in an array.
14345N/A+gpm_prefs_setup_processor_combo (GpmPrefs *prefs,
14345N/A+ HalGCpufreqType cpufreq_types)
14345N/A+ widget = glade_xml_get_widget (prefs->priv->glade_xml, widget_name);
14345N/A+ gpm_conf_get_string (prefs->priv->conf, gpm_pref_key, &value);
14345N/A+ gpm_conf_is_writable (prefs->priv->conf, gpm_pref_key, &is_writable);
14345N/A+ gtk_widget_set_sensitive (widget, is_writable);
14345N/A+ gpm_warning ("invalid schema, please re-install");
14345N/A+ g_object_set_data (G_OBJECT (widget), "conf_key", (gpointer) gpm_pref_key);
14345N/A+ g_signal_connect (G_OBJECT (widget), "changed",
14345N/A+ G_CALLBACK (gpm_prefs_processor_combo_changed_cb),
14345N/A+ cpufreq_type = hal_gcpufreq_string_to_enum (value);
14345N/A+ if (cpufreq_types & LIBHAL_CPUFREQ_ONDEMAND) {
14345N/A+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget),
14345N/A+ if (cpufreq_type == LIBHAL_CPUFREQ_ONDEMAND) {
14345N/A+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), n_added);
14345N/A+ if (cpufreq_types & LIBHAL_CPUFREQ_NOTHING) {
14345N/A+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget),
14345N/A+ if (cpufreq_type == LIBHAL_CPUFREQ_ONDEMAND) {
14345N/A+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), n_added);
14345N/A+ if (cpufreq_types & LIBHAL_CPUFREQ_CONSERVATIVE) {
14345N/A+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget),
14345N/A+ if (cpufreq_type == LIBHAL_CPUFREQ_CONSERVATIVE) {
14345N/A+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), n_added);
14345N/A+ if (cpufreq_types & LIBHAL_CPUFREQ_POWERSAVE) {
14345N/A+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget),
14345N/A+ if (cpufreq_type == LIBHAL_CPUFREQ_POWERSAVE) {
14345N/A+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), n_added);
14345N/A+ if (cpufreq_types & LIBHAL_CPUFREQ_PERFORMANCE) {
14345N/A+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget),
14345N/A+ if (cpufreq_type == LIBHAL_CPUFREQ_PERFORMANCE) {
14345N/A+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), n_added);
14345N/A+ if (has_option == FALSE || cpufreq_type == LIBHAL_CPUFREQ_NOTHING) {
14345N/A+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), n_added);
14345N/A /** setup the notification page */
14345N/A prefs_setup_notification (GpmPrefs *prefs)
14345N/A if ((prefs->priv->has_button_lid == FALSE)
14345N/A+ && (prefs->priv->hal_cpufreq == FALSE)
14345N/A && (prefs->priv->has_lcd == FALSE)) {
14345N/A notebook = glade_xml_get_widget (prefs->priv->glade_xml, "notebook_preferences");
14345N/A widget = glade_xml_get_widget (prefs->priv->glade_xml, "vbox_ac");
14345N/A gpm_prefs_setup_action_combo (prefs, "combobox_ac_lid",
14345N/A+ gpm_prefs_setup_processor_combo (prefs, "combobox_ac_cpu",
14345N/A+ GPM_CONF_CPUFREQ_POLICY_AC, prefs->priv->cpufreq_types);
14345N/A gpm_prefs_setup_sleep_slider (prefs, "hscale_ac_computer",
14345N/A GPM_CONF_TIMEOUT_SLEEP_COMPUTER_AC);
14345N/A gpm_prefs_setup_sleep_slider (prefs, "hscale_ac_display",
14345N/A widget = glade_xml_get_widget (prefs->priv->glade_xml, "hbox_ac_lid");
14345N/A+#if defined(sun) && defined(__SVR4)
14345N/A+ if (prefs->priv->hal_cpufreq == NULL || prefs->priv->can_cpufreq == FALSE ) {
14345N/A+ if (prefs->priv->hal_cpufreq == NULL) {
14345N/A+ widget = glade_xml_get_widget (prefs->priv->glade_xml, "hbox_ac_cpu");
14345N/A #if defined(sun) && defined(__SVR4)
14345N/A if (prefs->priv->has_lcd == FALSE || prefs->priv->can_brightness == FALSE) {
14441N/A gpm_prefs_setup_action_combo (prefs, "combobox_battery_critical",
14441N/A GPM_CONF_ACTIONS_CRITICAL_BATT,
14441N/A+ gpm_prefs_setup_processor_combo (prefs, "combobox_battery_cpu",
14441N/A+ GPM_CONF_CPUFREQ_POLICY_BATT, prefs->priv->cpufreq_types);
14441N/A gpm_prefs_setup_sleep_slider (prefs, "hscale_battery_computer",
14441N/A GPM_CONF_TIMEOUT_SLEEP_COMPUTER_BATT);
14441N/A gpm_prefs_setup_sleep_slider (prefs, "hscale_battery_display",
14345N/A prefs->priv = GPM_PREFS_GET_PRIVATE (prefs);
14345N/A+ prefs->priv->hal_cpufreq = hal_gcpufreq_new ();
14345N/A prefs->priv->screensaver = gpm_screensaver_new ();
14345N/A g_signal_connect (prefs->priv->screensaver, "gs-delay-changed",
14345N/A G_CALLBACK (gs_delay_changed_cb), prefs);
14345N/A GpmControl *control = gpm_control_new ();
14345N/A prefs->priv->can_cpufreq = gpm_control_is_user_privileged (control, "hal-power-cpu");
14345N/A prefs->priv->can_brightness = gpm_control_is_user_privileged (control, "hal-power-brightness");
14345N/A gpk_prefs_setup_policykit (prefs);
14345N/A+ /* only enable cpufreq stuff if we have the hardware */
14345N/A+ if (prefs->priv->hal_cpufreq) {
14345N/A+ hal_gcpufreq_get_governors (prefs->priv->hal_cpufreq,
14345N/A+ prefs->priv->cpufreq_types = LIBHAL_CPUFREQ_NOTHING;
14345N/A if (prefs->priv->glade_xml == NULL) {
14345N/A g_object_unref (prefs->priv->screensaver);
14345N/A+ if (prefs->priv->hal_cpufreq) {
14345N/A+ g_object_unref (prefs->priv->hal_cpufreq);
14345N/A G_OBJECT_CLASS (gpm_prefs_parent_class)->finalize (object);
14345N/A GpmSrvBrightnessKbd *srv_brightness_kbd;
14345N/A GpmSrvScreensaver *srv_screensaver;
14345N/A manager->priv->sound = gpm_sound_new ();
14345N/A /* try and start an interactive service */
14345N/A+ manager->priv->cpufreq = gpm_cpufreq_new ();
14345N/A manager->priv->screensaver = gpm_screensaver_new ();
14345N/A g_signal_connect (manager->priv->screensaver, "auth-request",
14345N/A G_CALLBACK (screensaver_auth_request_cb), manager);