summaryrefslogtreecommitdiff
path: root/settings
diff options
context:
space:
mode:
authorAli Abdallah <ali.slackware@gmail.com>2009-04-20 08:24:20 +0000
committerAli Abdallah <ali.slackware@gmail.com>2009-04-20 08:24:20 +0000
commit131ce32a5f790ef444bbb8a232fb99ac616548d8 (patch)
tree6fafd6ef18c2fc7affed5d04e111a87bd2e88360 /settings
parent8dc5885735424fdbc9358c6600781959c2e4f8ba (diff)
downloadixfce4-power-manager-131ce32a5f790ef444bbb8a232fb99ac616548d8.tar.gz
Provide the possibility to disable CPU freq control+don't compile the cpu governor code if we aren't on Linux
(Old svn revision: 7248)
Diffstat (limited to 'settings')
-rw-r--r--settings/xfpm-settings.c34
-rw-r--r--settings/xfpm-settings.glade65
2 files changed, 76 insertions, 23 deletions
diff --git a/settings/xfpm-settings.c b/settings/xfpm-settings.c
index cf69e3b1..f61a3c78 100644
--- a/settings/xfpm-settings.c
+++ b/settings/xfpm-settings.c
@@ -520,6 +520,19 @@ lock_screen_toggled_cb (GtkWidget *w, XfconfChannel *channel)
}
}
+#ifdef SYSTEM_IS_LINUX
+static void
+cpu_freq_control_changed_cb (GtkWidget *w, XfconfChannel *channel)
+{
+ gboolean val = (gint) gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(w));
+
+ if ( !xfconf_channel_set_bool (channel, CPU_FREQ_CONTROL, val) )
+ {
+ g_critical ("Unable to set value for property %s\n", CPU_FREQ_CONTROL);
+ }
+}
+#endif
+
static void
xfpm_settings_on_battery (XfconfChannel *channel, gboolean user_privilege, gboolean can_suspend,
gboolean can_hibernate, gboolean has_lcd_brightness, gboolean has_lid)
@@ -1128,7 +1141,7 @@ xfpm_settings_general (XfconfChannel *channel, gboolean user_privilege,
}
static void
-xfpm_settings_advanced (XfconfChannel *channel, gboolean system_latop, gboolean user_privilege,
+xfpm_settings_advanced (XfconfChannel *channel, gboolean system_laptop, gboolean user_privilege,
gboolean can_suspend, gboolean can_hibernate)
{
guint val;
@@ -1197,7 +1210,7 @@ xfpm_settings_advanced (XfconfChannel *channel, gboolean system_latop, gboolean
* Critical battery level
*/
GtkWidget *critical_level = glade_xml_get_widget (xml, "critical-spin");
- if ( system_latop )
+ if ( system_laptop )
{
gtk_widget_set_tooltip_text (critical_level,
_("When all the power sources of the computer reach this charge level"));
@@ -1240,6 +1253,23 @@ xfpm_settings_advanced (XfconfChannel *channel, gboolean system_latop, gboolean
g_signal_connect (lock, "toggled",
G_CALLBACK(lock_screen_toggled_cb), channel);
+ GtkWidget *cpu;
+ cpu = glade_xml_get_widget (xml, "cpu-freq");
+
+#ifdef SYSTEM_IS_LINUX
+ if ( system_laptop )
+ {
+ val = xfconf_channel_get_bool (channel, CPU_FREQ_CONTROL, TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(cpu), val);
+ g_signal_connect (cpu, "toggled",
+ G_CALLBACK(cpu_freq_control_changed_cb), channel);
+ }
+ else
+ gtk_widget_hide (cpu);
+#else
+ gtk_widget_hide (cpu);
+#endif
+
}
static void
diff --git a/settings/xfpm-settings.glade b/settings/xfpm-settings.glade
index 4c44ae19..12fe04bc 100644
--- a/settings/xfpm-settings.glade
+++ b/settings/xfpm-settings.glade
@@ -907,7 +907,7 @@
<child>
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="row_spacing">8</property>
<child>
@@ -1018,41 +1018,64 @@
<property name="bottom_attach">2</property>
</packing>
</child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="spacing">10</property>
<child>
- <widget class="GtkLabel" id="critical-level-label">
+ <widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
- <property name="label" translatable="yes">Consider the computer on low power at:</property>
+ <child>
+ <widget class="GtkLabel" id="critical-level-label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Consider the computer on low power at:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="position">0</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
</packing>
</child>
<child>
- <widget class="GtkSpinButton" id="critical-spin">
+ <widget class="GtkHBox" id="hbox8">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">&#x25CF;</property>
- <property name="adjustment">5 5 20 1 0 0</property>
+ <child>
+ <widget class="GtkSpinButton" id="critical-spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <property name="adjustment">5 5 20 1 0 0</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="position">1</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="cpu-freq">
+ <property name="label" translatable="yes">Enable CPU frequency control</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>