[gnome-settings-daemon] power: Remove idle-dim-time
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: Remove idle-dim-time
- Date: Thu, 17 Jan 2013 10:07:52 +0000 (UTC)
commit bd3b8beeae9a3d88483aa0d33fd10042593735a6
Author: Bastien Nocera <hadess hadess net>
Date: Wed Jan 16 20:01:37 2013 +0100
power: Remove idle-dim-time
And make the default time for the dimming be based upon the idle timeout.
If there is no idle timeout, dim at one minute of idle.
If there is an idle timeout, ensure that the dim time is at least 10
seconds, otherwise a third of the idle-delay.
...settings-daemon.plugins.power.gschema.xml.in.in | 5 ----
plugins/power/gsd-power-manager.c | 25 ++++++++++++++++----
2 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
index 24c97bf..e717949 100644
--- a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
+++ b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
@@ -20,11 +20,6 @@
<summary>Dim the screen after a period of inactivity</summary>
<description>If the screen should be dimmed to save power when the computer is idle.</description>
</key>
- <key name="idle-dim-time" type="i">
- <default>90</default>
- <summary>The default amount of time to dim the screen after idle</summary>
- <description>The default amount of time to dim the screen after idle.</description>
- </key>
<key name="sleep-inactive-ac-timeout" type="i">
<default>0</default>
<summary>Sleep timeout computer when on AC</summary>
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 4972394..103f78e 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -84,6 +84,7 @@
#define SCREENSAVER_FADE_TIME 10 /* seconds */
#define SCREENSAVER_TIMEOUT_BLANK 20 /* seconds */
+#define IDLE_DIM_BLANK_DISABLED_MIN 60 /* seconds */
static const gchar introspection_xml[] =
"<node>"
@@ -2640,10 +2641,25 @@ idle_configure (GsdPowerManager *manager)
/* set up dim callback for when the screen lock is not active,
* but only if we actually want to dim. */
timeout_dim = 0;
- if (!manager->priv->screensaver_active) {
- if (g_settings_get_boolean (manager->priv->settings, "idle-dim"))
- timeout_dim = g_settings_get_int (manager->priv->settings,
- "idle-dim-time");
+ if (manager->priv->screensaver_active) {
+ /* Don't dim when the screen lock is active */
+ } else if (!on_battery) {
+ /* Don't dim when charging */
+ } else if (manager->priv->battery_is_low) {
+ /* Aggressively blank when battery is low */
+ timeout_dim = SCREENSAVER_TIMEOUT_BLANK;
+ } else {
+ if (g_settings_get_boolean (manager->priv->settings, "idle-dim")) {
+ timeout_dim = g_settings_get_int (manager->priv->settings_session,
+ "idle-delay");
+ if (timeout_dim == 0) {
+ timeout_dim = IDLE_DIM_BLANK_DISABLED_MIN;
+ } else {
+ timeout_dim /= 3;
+ if (timeout_dim < 10)
+ timeout_dim = 0;
+ }
+ }
}
if (timeout_dim != 0) {
g_debug ("setting up dim callback for %is", timeout_blank);
@@ -2980,7 +2996,6 @@ engine_settings_key_changed_cb (GSettings *settings,
return;
}
if (g_str_has_prefix (key, "sleep-inactive") ||
- g_strcmp0 (key, "idle-dim-time") == 0 ||
g_str_equal (key, "idle-delay")) {
idle_configure (manager);
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]