Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 184877 Details for
Bug 247614
>=gnome-extra/gnome-power-manager-2.24 cpufreq scaling regression
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch which add gpm-cpufreq module and other features
gpm-cpufreq.patch (text/plain), 20.33 KB, created by
Romain Perier (RETIRED)
on 2009-03-13 16:03:10 UTC
(
hide
)
Description:
patch which add gpm-cpufreq module and other features
Filename:
MIME Type:
Creator:
Romain Perier (RETIRED)
Created:
2009-03-13 16:03:10 UTC
Size:
20.33 KB
patch
obsolete
>diff -ruN ../gnome-power-manager-2.24.4_orig/src/gpm-conf.h src/gpm-conf.h >--- ../gnome-power-manager-2.24.4_orig/src/gpm-conf.h 2008-09-04 12:05:15.000000000 +0200 >+++ src/gpm-conf.h 2009-03-10 20:58:49.402302556 +0100 >@@ -72,6 +72,13 @@ > #define GPM_CONF_BUTTON_HIBERNATE GPM_CONF_DIR "/buttons/hibernate" > #define GPM_CONF_BUTTON_POWER GPM_CONF_DIR "/buttons/power" > >+/* cpufreq */ >+#define GPM_CONF_CPUFREQ_POLICY_AC GPM_CONF_DIR "/cpufreq/policy_ac" >+#define GPM_CONF_CPUFREQ_POLICY_BATT GPM_CONF_DIR "/cpufreq/policy_battery" >+#define GPM_CONF_CPUFREQ_PERFORMANCE_AC GPM_CONF_DIR "/cpufreq/performance_ac" >+#define GPM_CONF_CPUFREQ_PERFORMANCE_BATT GPM_CONF_DIR "/cpufreq/performance_battery" >+#define GPM_CONF_CPUFREQ_USE_NICE GPM_CONF_DIR "/cpufreq/consider_nice" >+ > /* general */ > #define GPM_CONF_DEBUG GPM_CONF_DIR "/general/debug" > #define GPM_CONF_SCHEMA_VERSION GPM_CONF_DIR "/general/installed_schema" >diff -ruN ../gnome-power-manager-2.24.4_orig/src/gpm-cpufreq.c src/gpm-cpufreq.c >--- ../gnome-power-manager-2.24.4_orig/src/gpm-cpufreq.c 1970-01-01 01:00:00.000000000 +0100 >+++ src/gpm-cpufreq.c 2009-03-13 08:45:45.048327978 +0100 >@@ -0,0 +1,210 @@ >+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- >+ * >+ * Copyright (C) 2006-2007 Richard Hughes <richard@hughsie.com> >+ * >+ * Licensed under the GNU General Public License Version 2 >+ * >+ * This program 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 program 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 program; if not, write to the Free Software >+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. >+ */ >+ >+#ifdef HAVE_CONFIG_H >+# include <config.h> >+#endif >+ >+#include <string.h> >+#include <glib.h> >+#include <dbus/dbus-glib.h> >+#include <glib/gi18n.h> >+ >+#include <libhal-gcpufreq.h> >+ >+#include "gpm-ac-adapter.h" >+#include "gpm-conf.h" >+#include "egg-debug.h" >+#include "gpm-cpufreq.h" >+ >+static void gpm_cpufreq_class_init (GpmCpufreqClass *klass); >+static void gpm_cpufreq_init (GpmCpufreq *hal); >+static void gpm_cpufreq_finalize (GObject *object); >+ >+#define GPM_CPUFREQ_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_CPUFREQ, GpmCpufreqPrivate)) >+ >+struct GpmCpufreqPrivate >+{ >+ HalGCpufreq *hal_cpufreq; >+ GpmConf *conf; >+ GpmAcAdapter *ac_adapter; >+}; >+ >+G_DEFINE_TYPE (GpmCpufreq, gpm_cpufreq, G_TYPE_OBJECT) >+ >+/** >+ * gpm_cpufreq_sync_policy: >+ * @cpufreq: This class instance >+ * @on_ac: If we are on AC power >+ * >+ * Changes the cpufreq policy if required >+ **/ >+static gboolean >+gpm_cpufreq_sync_policy (GpmCpufreq *cpufreq) >+{ >+ gboolean cpufreq_consider_nice; >+ gboolean on_ac; >+ guint cpufreq_performance; >+ gchar *cpufreq_policy; >+ HalGCpufreqType cpufreq_type; >+ >+ on_ac = gpm_ac_adapter_is_present (cpufreq->priv->ac_adapter); >+ >+ if (on_ac == TRUE) { >+ gpm_conf_get_bool (cpufreq->priv->conf, GPM_CONF_CPUFREQ_USE_NICE, &cpufreq_consider_nice); >+ gpm_conf_get_string (cpufreq->priv->conf, GPM_CONF_CPUFREQ_POLICY_AC, &cpufreq_policy); >+ gpm_conf_get_uint (cpufreq->priv->conf, GPM_CONF_CPUFREQ_PERFORMANCE_AC, &cpufreq_performance); >+ } else { >+ gpm_conf_get_bool (cpufreq->priv->conf, GPM_CONF_CPUFREQ_USE_NICE, &cpufreq_consider_nice); >+ gpm_conf_get_string (cpufreq->priv->conf, GPM_CONF_CPUFREQ_POLICY_BATT, &cpufreq_policy); >+ gpm_conf_get_uint (cpufreq->priv->conf, GPM_CONF_CPUFREQ_PERFORMANCE_BATT, &cpufreq_performance); >+ } >+ >+ /* use enumerated value */ >+ cpufreq_type = hal_gcpufreq_string_to_enum (cpufreq_policy); >+ g_free (cpufreq_policy); >+ >+ /* change to the right governer and settings */ >+ hal_gcpufreq_set_governor (cpufreq->priv->hal_cpufreq, cpufreq_type); >+ hal_gcpufreq_set_consider_nice (cpufreq->priv->hal_cpufreq, cpufreq_consider_nice); >+ hal_gcpufreq_set_performance (cpufreq->priv->hal_cpufreq, cpufreq_performance); >+ return TRUE; >+} >+ >+/** >+ * conf_key_changed_cb: >+ * >+ * We might have to do things when the gconf keys change; do them here. >+ **/ >+static void >+conf_key_changed_cb (GpmConf *conf, >+ const gchar *key, >+ GpmCpufreq *cpufreq) >+{ >+ /* if any change, just resync the whole lot */ >+ if (strcmp (key, GPM_CONF_CPUFREQ_POLICY_AC) == 0 || >+ strcmp (key, GPM_CONF_CPUFREQ_PERFORMANCE_AC) == 0 || >+ strcmp (key, GPM_CONF_CPUFREQ_POLICY_BATT) == 0 || >+ strcmp (key, GPM_CONF_CPUFREQ_PERFORMANCE_BATT) == 0 || >+ strcmp (key, GPM_CONF_CPUFREQ_USE_NICE) == 0) { >+ >+ gpm_cpufreq_sync_policy (cpufreq); >+ } >+} >+ >+/** >+ * ac_adapter_changed_cb: >+ * @ac_adapter: The ac_adapter class instance >+ * @on_ac: if we are on AC power >+ * @cpufreq: This class instance >+ * >+ * Does the actions when the ac power source is inserted/removed. >+ **/ >+static void >+ac_adapter_changed_cb (GpmAcAdapter *ac_adapter, >+ gboolean on_ac, >+ GpmCpufreq *cpufreq) >+{ >+ gpm_cpufreq_sync_policy (cpufreq); >+} >+ >+/** >+ * gpm_cpufreq_class_init: >+ * @klass: This class instance >+ **/ >+static void >+gpm_cpufreq_class_init (GpmCpufreqClass *klass) >+{ >+ GObjectClass *object_class = G_OBJECT_CLASS (klass); >+ object_class->finalize = gpm_cpufreq_finalize; >+ g_type_class_add_private (klass, sizeof (GpmCpufreqPrivate)); >+} >+ >+/** >+ * gpm_cpufreq_init: >+ * >+ * @cpufreq: This class instance >+ **/ >+static void >+gpm_cpufreq_init (GpmCpufreq *cpufreq) >+{ >+ cpufreq->priv = GPM_CPUFREQ_GET_PRIVATE (cpufreq); >+ >+ /* we use cpufreq as the master class */ >+ cpufreq->priv->hal_cpufreq = hal_gcpufreq_new (); >+ >+ /* get changes from gconf */ >+ cpufreq->priv->conf = gpm_conf_new (); >+ g_signal_connect (cpufreq->priv->conf, "value-changed", >+ G_CALLBACK (conf_key_changed_cb), cpufreq); >+ >+ /* we use ac_adapter for the ac-adapter-changed signal */ >+ cpufreq->priv->ac_adapter = gpm_ac_adapter_new (); >+ g_signal_connect (cpufreq->priv->ac_adapter, "ac-adapter-changed", >+ G_CALLBACK (ac_adapter_changed_cb), cpufreq); >+ >+ /* sync policy */ >+ gpm_cpufreq_sync_policy (cpufreq); >+} >+ >+/** >+ * gpm_cpufreq_finalize: >+ * @object: This class instance >+ **/ >+static void >+gpm_cpufreq_finalize (GObject *object) >+{ >+ GpmCpufreq *cpufreq; >+ g_return_if_fail (object != NULL); >+ g_return_if_fail (GPM_IS_CPUFREQ (object)); >+ >+ cpufreq = GPM_CPUFREQ (object); >+ cpufreq->priv = GPM_CPUFREQ_GET_PRIVATE (cpufreq); >+ >+ if (cpufreq->priv->hal_cpufreq != NULL) { >+ g_object_unref (cpufreq->priv->hal_cpufreq); >+ } >+ if (cpufreq->priv->conf != NULL) { >+ g_object_unref (cpufreq->priv->conf); >+ } >+ if (cpufreq->priv->ac_adapter != NULL) { >+ g_object_unref (cpufreq->priv->ac_adapter); >+ } >+ G_OBJECT_CLASS (gpm_cpufreq_parent_class)->finalize (object); >+} >+ >+/** >+ * gpm_cpufreq_new: >+ * Return value: new GpmCpufreq instance. >+ **/ >+GpmCpufreq * >+gpm_cpufreq_new (void) >+{ >+ GpmCpufreq *cpufreq = NULL; >+ >+ /* only load if we have the hardware */ >+ if (hal_gcpufreq_has_hw() == TRUE) { >+ cpufreq = g_object_new (GPM_TYPE_CPUFREQ, NULL); >+ } >+ >+ return cpufreq; >+} >+ >diff -ruN ../gnome-power-manager-2.24.4_orig/src/gpm-cpufreq.h src/gpm-cpufreq.h >--- ../gnome-power-manager-2.24.4_orig/src/gpm-cpufreq.h 1970-01-01 01:00:00.000000000 +0100 >+++ src/gpm-cpufreq.h 2009-03-10 20:46:58.144620478 +0100 >@@ -0,0 +1,55 @@ >+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- >+ * >+ * Copyright (C) 2006-2007 Richard Hughes <richard@hughsie.com> >+ * >+ * Licensed under the GNU General Public License Version 2 >+ * >+ * This program 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 program 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 program; if not, write to the Free Software >+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. >+ */ >+ >+#ifndef __GPMCPUFREQ_H >+#define __GPMCPUFREQ_H >+ >+#include <glib-object.h> >+ >+G_BEGIN_DECLS >+ >+#define GPM_TYPE_CPUFREQ (gpm_cpufreq_get_type ()) >+#define GPM_CPUFREQ(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GPM_TYPE_CPUFREQ, GpmCpufreq)) >+#define GPM_CPUFREQ_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GPM_TYPE_CPUFREQ, GpmCpufreqClass)) >+#define GPM_IS_CPUFREQ(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GPM_TYPE_CPUFREQ)) >+#define GPM_IS_CPUFREQ_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GPM_TYPE_CPUFREQ)) >+#define GPM_CPUFREQ_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GPM_TYPE_CPUFREQ, GpmCpufreqClass)) >+ >+typedef struct GpmCpufreqPrivate GpmCpufreqPrivate; >+ >+typedef struct >+{ >+ GObject parent; >+ GpmCpufreqPrivate *priv; >+} GpmCpufreq; >+ >+typedef struct >+{ >+ GObjectClass parent_class; >+} GpmCpufreqClass; >+ >+GType gpm_cpufreq_get_type (void); >+GpmCpufreq *gpm_cpufreq_new (void); >+ >+G_END_DECLS >+ >+#endif /* __GPMCPUFREQ_H */ >+ >diff -ruN ../gnome-power-manager-2.24.4_orig/src/gpm-manager.c src/gpm-manager.c >--- ../gnome-power-manager-2.24.4_orig/src/gpm-manager.c 2008-12-02 16:24:51.000000000 +0100 >+++ src/gpm-manager.c 2009-03-13 08:33:21.348379662 +0100 >@@ -45,6 +45,7 @@ > > #include "egg-console-kit.h" > >+#include "gpm-cpufreq.h" > #include "gpm-ac-adapter.h" > #include "gpm-button.h" > #include "gpm-conf.h" >@@ -103,6 +104,7 @@ > EggConsoleKit *console; > GpmSrvBrightnessKbd *srv_brightness_kbd; > GpmSrvScreensaver *srv_screensaver; >+ GpmCpufreq *gpm_cpufreq; > }; > > enum { >@@ -1748,6 +1750,8 @@ > g_signal_connect (manager->priv->screensaver, "auth-request", > G_CALLBACK (screensaver_auth_request_cb), manager); > manager->priv->srv_screensaver = gpm_srv_screensaver_new (); >+ >+ manager->priv->gpm_cpufreq = gpm_cpufreq_new(); > > /* try an start an interactive service */ > manager->priv->backlight = gpm_backlight_new (); >@@ -1870,6 +1874,7 @@ > g_object_unref (manager->priv->prefs_server); > g_object_unref (manager->priv->control); > g_object_unref (manager->priv->console); >+ g_object_unref (manager->priv->gpm_cpufreq); > > /* optional gobjects */ > if (manager->priv->button) { >diff -ruN ../gnome-power-manager-2.24.4_orig/src/gpm-prefs-core.c src/gpm-prefs-core.c >--- ../gnome-power-manager-2.24.4_orig/src/gpm-prefs-core.c 2008-11-04 14:42:39.000000000 +0100 >+++ src/gpm-prefs-core.c 2009-03-12 20:53:46.721030591 +0100 >@@ -34,6 +34,7 @@ > #include <gconf/gconf-client.h> > > #include <libhal-gmanager.h> >+#include <libhal-gcpufreq.h> > > #include "gpm-tray-icon.h" > #include "gpm-common.h" >@@ -69,6 +70,8 @@ > gboolean can_hibernate; > GpmConf *conf; > GpmScreensaver *screensaver; >+ HalGCpufreq *hal_cpufreq; >+ HalGCpufreqType cpufreq_types; > #ifdef HAVE_GCONF_DEFAULTS > PolKitGnomeAction *default_action; > #endif >@@ -92,6 +95,13 @@ > #define ACTION_BLANK_TEXT _("Blank screen") > #define ACTION_NOTHING_TEXT _("Do nothing") > >+/* The text that should appear in the processor combo box */ >+#define CPUFREQ_NOTHING_TEXT _("Do nothing") >+#define CPUFREQ_ONDEMAND_TEXT _("Based on processor load") >+#define CPUFREQ_CONSERVATIVE_TEXT _("Automatic power saving") >+#define CPUFREQ_POWERSAVE_TEXT _("Maximum power saving") >+#define CPUFREQ_PERFORMANCE_TEXT _("Always maximum speed") >+ > /* If sleep time in a slider is set to 61 it is considered as never */ > const int NEVER_TIME_ON_SLIDER = 61; > >@@ -697,6 +707,134 @@ > } > } > >+/** >+ * gpm_prefs_processor_combo_changed_cb: >+ * @widget: The GtkWidget object >+ * @gpm_pref_key: The GConf key for this preference setting. >+ **/ >+static void >+gpm_prefs_processor_combo_changed_cb (GtkWidget *widget, >+ GpmPrefs *prefs) >+{ >+ gchar *value; >+ const gchar *policy; >+ gchar *gpm_pref_key; >+ >+ value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget)); >+ if (value == NULL) { >+ egg_warning ("active text failed"); >+ return; >+ } >+ if (strcmp (value, CPUFREQ_ONDEMAND_TEXT) == 0) { >+ policy = CODE_CPUFREQ_ONDEMAND; >+ } else if (strcmp (value, CPUFREQ_CONSERVATIVE_TEXT) == 0) { >+ policy = CODE_CPUFREQ_CONSERVATIVE; >+ } else if (strcmp (value, CPUFREQ_POWERSAVE_TEXT) == 0) { >+ policy = CODE_CPUFREQ_POWERSAVE; >+ } else if (strcmp (value, CPUFREQ_PERFORMANCE_TEXT) == 0) { >+ policy = CODE_CPUFREQ_PERFORMANCE; >+ } else if (strcmp (value, CPUFREQ_NOTHING_TEXT) == 0) { >+ policy = CODE_CPUFREQ_NOTHING; >+ } else { >+ g_assert (FALSE); >+ } >+ >+ g_free (value); >+ gpm_pref_key = (char *) g_object_get_data (G_OBJECT (widget), "conf_key"); >+ egg_debug ("Changing %s to %s", gpm_pref_key, policy); >+ gpm_conf_set_string (prefs->priv->conf, gpm_pref_key, policy); >+} >+ >+/** >+ * gpm_prefs_setup_action_combo: >+ * @prefs: This prefs class instance >+ * @widget_name: The GtkWidget name >+ * @gpm_pref_key: The GConf key for this preference setting. >+ * @actions: The actions to associate in an array. >+ **/ >+static void >+gpm_prefs_setup_processor_combo (GpmPrefs *prefs, >+ const gchar *widget_name, >+ const gchar *gpm_pref_key, >+ HalGCpufreqType cpufreq_types) >+{ >+ gchar *value; >+ guint n_added = 0; >+ gboolean has_option = FALSE; >+ gboolean is_writable; >+ GtkWidget *widget; >+ HalGCpufreqType cpufreq_type; >+ >+ widget = glade_xml_get_widget (prefs->priv->glade_xml, widget_name); >+ gpm_conf_get_string (prefs->priv->conf, gpm_pref_key, &value); >+ gpm_conf_is_writable (prefs->priv->conf, gpm_pref_key, &is_writable); >+ >+ gtk_widget_set_sensitive (widget, is_writable); >+ >+ if (value == NULL) { >+ egg_warning ("invalid schema, please re-install"); >+ value = g_strdup ("nothing"); >+ } >+ >+ g_object_set_data (G_OBJECT (widget), "conf_key", (gpointer) gpm_pref_key); >+ g_signal_connect (G_OBJECT (widget), "changed", >+ G_CALLBACK (gpm_prefs_processor_combo_changed_cb), >+ prefs); >+ >+ cpufreq_type = hal_gcpufreq_string_to_enum (value); >+ >+ if (cpufreq_types & LIBHAL_CPUFREQ_ONDEMAND) { >+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), >+ CPUFREQ_ONDEMAND_TEXT); >+ if (cpufreq_type == LIBHAL_CPUFREQ_ONDEMAND) { >+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), n_added); >+ has_option = TRUE; >+ } >+ n_added++; >+ } >+ if (cpufreq_types & LIBHAL_CPUFREQ_NOTHING) { >+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), >+ CPUFREQ_NOTHING_TEXT); >+ if (cpufreq_type == LIBHAL_CPUFREQ_ONDEMAND) { >+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), n_added); >+ has_option = TRUE; >+ } >+ n_added++; >+ } >+ if (cpufreq_types & LIBHAL_CPUFREQ_CONSERVATIVE) { >+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), >+ CPUFREQ_CONSERVATIVE_TEXT); >+ if (cpufreq_type == LIBHAL_CPUFREQ_CONSERVATIVE) { >+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), n_added); >+ has_option = TRUE; >+ } >+ n_added++; >+ } >+ if (cpufreq_types & LIBHAL_CPUFREQ_POWERSAVE) { >+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), >+ CPUFREQ_POWERSAVE_TEXT); >+ if (cpufreq_type == LIBHAL_CPUFREQ_POWERSAVE) { >+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), n_added); >+ has_option = TRUE; >+ } >+ n_added++; >+ } >+ if (cpufreq_types & LIBHAL_CPUFREQ_PERFORMANCE) { >+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), >+ CPUFREQ_PERFORMANCE_TEXT); >+ if (cpufreq_type == LIBHAL_CPUFREQ_PERFORMANCE) { >+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), n_added); >+ has_option = TRUE; >+ } >+ n_added++; >+ } >+ >+ if (has_option == FALSE || cpufreq_type == LIBHAL_CPUFREQ_NOTHING) { >+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), n_added); >+ } >+ g_free (value); >+} >+ > /** setup the notification page */ > static void > prefs_setup_notification (GpmPrefs *prefs) >@@ -791,6 +929,7 @@ > { > GtkWidget *widget; > gint delay; >+ gboolean show_cpufreq; > const gchar *button_lid_actions[] = > {ACTION_NOTHING, > ACTION_BLANK, >@@ -802,6 +941,9 @@ > gpm_prefs_setup_action_combo (prefs, "combobox_ac_lid", > GPM_CONF_BUTTON_LID_AC, > button_lid_actions); >+ gpm_prefs_setup_processor_combo (prefs, "combobox_ac_cpu", >+ GPM_CONF_CPUFREQ_POLICY_AC, >+ prefs->priv->cpufreq_types); > gpm_prefs_setup_sleep_slider (prefs, "hscale_ac_computer", > GPM_CONF_TIMEOUT_SLEEP_COMPUTER_AC); > gpm_prefs_setup_sleep_slider (prefs, "hscale_ac_display", >@@ -820,12 +962,22 @@ > widget = glade_xml_get_widget (prefs->priv->glade_xml, "hbox_ac_lid"); > gtk_widget_hide_all (widget); > } >+ if (prefs->priv->hal_cpufreq == NULL) { >+ widget = glade_xml_get_widget (prefs->priv->glade_xml, "hbox_ac_cpu"); >+ gtk_widget_hide_all (widget); >+ } > if (prefs->priv->has_lcd == FALSE) { > widget = glade_xml_get_widget (prefs->priv->glade_xml, "hbox_ac_brightness"); > gtk_widget_hide_all (widget); > widget = glade_xml_get_widget (prefs->priv->glade_xml, "checkbutton_ac_display_dim"); > gtk_widget_hide_all (widget); > } >+ >+ gpm_conf_get_bool (prefs->priv->conf, GPM_CONF_UI_SHOW_CPUFREQ, &show_cpufreq); >+ if (show_cpufreq == FALSE) { >+ widget = glade_xml_get_widget (prefs->priv->glade_xml, "hbox_ac_cpu"); >+ gtk_widget_hide_all (widget); >+ } > } > > static void >@@ -835,6 +987,7 @@ > GtkWidget *notebook; > gint delay; > gint page; >+ gboolean show_cpufreq; > > const gchar *button_lid_actions[] = > {ACTION_NOTHING, >@@ -864,6 +1017,8 @@ > gpm_prefs_setup_action_combo (prefs, "combobox_battery_critical", > GPM_CONF_ACTIONS_CRITICAL_BATT, > battery_critical_actions); >+ gpm_prefs_setup_processor_combo (prefs, "combobox_battery_cpu", >+ GPM_CONF_CPUFREQ_POLICY_BATT, prefs->priv->cpufreq_types); > gpm_prefs_setup_sleep_slider (prefs, "hscale_battery_computer", > GPM_CONF_TIMEOUT_SLEEP_COMPUTER_BATT); > gpm_prefs_setup_sleep_slider (prefs, "hscale_battery_display", >@@ -889,10 +1044,20 @@ > widget = glade_xml_get_widget (prefs->priv->glade_xml, "hbox_battery_lid"); > gtk_widget_hide_all (widget); > } >+ if (prefs->priv->hal_cpufreq == NULL) { >+ widget = glade_xml_get_widget (prefs->priv->glade_xml, "hbox_battery_cpu"); >+ gtk_widget_hide_all (widget); >+ } > if (prefs->priv->has_lcd == FALSE) { > widget = glade_xml_get_widget (prefs->priv->glade_xml, "checkbutton_battery_display_dim"); > gtk_widget_hide_all (widget); > } >+ >+ gpm_conf_get_bool (prefs->priv->conf, GPM_CONF_UI_SHOW_CPUFREQ, &show_cpufreq); >+ if (show_cpufreq == FALSE) { >+ widget = glade_xml_get_widget (prefs->priv->glade_xml, "hbox_battery_cpu"); >+ gtk_widget_hide_all (widget); >+ } > } > > static void >@@ -1068,6 +1233,8 @@ > > prefs->priv = GPM_PREFS_GET_PRIVATE (prefs); > >+ prefs->priv->hal_cpufreq = hal_gcpufreq_new (); >+ > prefs->priv->screensaver = gpm_screensaver_new (); > g_signal_connect (prefs->priv->screensaver, "gs-delay-changed", > G_CALLBACK (gs_delay_changed_cb), prefs); >@@ -1096,6 +1263,14 @@ > gpk_prefs_setup_policykit (prefs); > #endif > >+ /* only enable cpufreq stuff if we have the hardware */ >+ if (prefs->priv->hal_cpufreq) { >+ hal_gcpufreq_get_governors (prefs->priv->hal_cpufreq, >+ &prefs->priv->cpufreq_types); >+ } else { >+ prefs->priv->cpufreq_types = LIBHAL_CPUFREQ_NOTHING; >+ } >+ > prefs->priv->glade_xml = glade_xml_new (GPM_DATA "/gpm-prefs.glade", NULL, NULL); > if (prefs->priv->glade_xml == NULL) { > g_error ("Cannot find 'gpm-prefs.glade'"); >@@ -1152,6 +1327,9 @@ > if (prefs->priv->screensaver) { > g_object_unref (prefs->priv->screensaver); > } >+ if (prefs->priv->hal_cpufreq) { >+ g_object_unref (prefs->priv->hal_cpufreq); >+ } > > G_OBJECT_CLASS (gpm_prefs_parent_class)->finalize (object); > } >diff -ruN ../gnome-power-manager-2.24.4_orig/src/Makefile.am src/Makefile.am >--- ../gnome-power-manager-2.24.4_orig/src/Makefile.am 2008-11-17 11:06:02.000000000 +0100 >+++ src/Makefile.am 2009-03-12 19:30:56.137891885 +0100 >@@ -39,7 +39,8 @@ > $(top_builddir)/libhal-glib/libhal-gdevice.la \ > $(top_builddir)/libhal-glib/libhal-gdevicestore.la \ > $(top_builddir)/libhal-glib/libhal-gmanager.la \ >- $(top_builddir)/libhal-glib/libhal-gpower.la >+ $(top_builddir)/libhal-glib/libhal-gpower.la \ >+ $(top_builddir)/libhal-glib/libhal-gcpufreq.la > > LOCAL_LIBDBUS_LIBS = \ > $(top_builddir)/libdbus-glib/libdbus-monitor-session.la \ >@@ -194,6 +195,8 @@ > gpm-manager.c \ > gpm-ac-adapter.h \ > gpm-ac-adapter.c \ >+ gpm-cpufreq.h \ >+ gpm-cpufreq.c \ > gpm-tray-icon.h \ > gpm-tray-icon.c \ > gpm-marshal.h \
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 247614
:
184875
| 184877 |
184878
|
184879