[gnome-settings-daemon] power: Use session's idle-delay to blank the screen



commit 3fd78264129f4778352fe8c91d88c783079e7721
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Jan 16 15:44:53 2013 +0100

    power: Use session's idle-delay to blank the screen
    
    The blanking will only work as designed if:
    session.idle-delay ==
    	power.sleep-display-ac ==
    	power.sleep-display-battery
    
    So nuke the sleep-display* configuration keys, and rely solely
    on the idle-delay to blank the screen.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=691002

 ...settings-daemon.plugins.power.gschema.xml.in.in |   10 ----------
 plugins/power/gsd-power-manager.c                  |   18 +++++++++---------
 2 files changed, 9 insertions(+), 19 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 d10f6c1..b16194d 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
@@ -30,16 +30,6 @@
       <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-display-ac" type="i">
-      <default>600</default>
-      <summary>Sleep timeout display when on AC</summary>
-      <description>The amount of time in seconds before the display turns off when the computer is on AC power.</description>
-    </key>
-    <key name="sleep-display-battery" type="i">
-      <default>600</default>
-      <summary>Sleep timeout display when on battery</summary>
-      <description>The amount of time in seconds before the display turns off when the computer is on battery power.</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 76efbfa..6cd0611 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -141,6 +141,7 @@ struct GsdPowerManagerPrivate
         guint                    name_id;
         gboolean                 lid_is_closed;
         GSettings               *settings;
+        GSettings               *settings_session;
         GSettings               *settings_screensaver;
         GSettings               *settings_xrandr;
         UpClient                *up_client;
@@ -2695,14 +2696,9 @@ idle_configure (GsdPowerManager *manager)
         on_battery = up_client_get_on_battery (manager->priv->up_client);
         if (manager->priv->screensaver_active) {
                 timeout_blank = 30;
-        } else if (on_battery) {
-                timeout_blank = g_settings_get_int (manager->priv->settings,
-                                                    "sleep-display-battery");
-                if (timeout_blank != 0)
-                        timeout_blank += SCREENSAVER_FADE_TIME;
         } else {
-                timeout_blank = g_settings_get_int (manager->priv->settings,
-                                                    "sleep-display-ac");
+                timeout_blank = g_settings_get_int (manager->priv->settings_session,
+                                                    "idle-delay");
                 if (timeout_blank != 0)
                         timeout_blank += SCREENSAVER_FADE_TIME;
         }
@@ -3097,8 +3093,8 @@ engine_settings_key_changed_cb (GSettings *settings,
                 return;
         }
         if (g_str_has_prefix (key, "sleep-inactive") ||
-            g_str_has_prefix (key, "sleep-display") ||
-            g_strcmp0 (key, "idle-dim-time") == 0) {
+            g_strcmp0 (key, "idle-dim-time") == 0 ||
+            g_str_equal (key, "idle-delay")) {
                 idle_configure (manager);
                 return;
         }
@@ -3431,6 +3427,9 @@ gsd_power_manager_start (GsdPowerManager *manager,
         g_signal_connect (manager->priv->settings, "changed",
                           G_CALLBACK (engine_settings_key_changed_cb), manager);
         manager->priv->settings_screensaver = g_settings_new ("org.gnome.desktop.screensaver");
+        manager->priv->settings_session = g_settings_new ("org.gnome.desktop.session");
+        g_signal_connect (manager->priv->settings_session, "changed",
+                          G_CALLBACK (engine_settings_key_changed_cb), manager);
         manager->priv->settings_xrandr = g_settings_new (GSD_XRANDR_SETTINGS_SCHEMA);
         manager->priv->up_client = up_client_new ();
         manager->priv->lid_is_closed = up_client_get_lid_is_closed (manager->priv->up_client);
@@ -3590,6 +3589,7 @@ gsd_power_manager_stop (GsdPowerManager *manager)
         g_clear_object (&manager->priv->session);
         g_clear_object (&manager->priv->settings);
         g_clear_object (&manager->priv->settings_screensaver);
+        g_clear_object (&manager->priv->settings_session);
         g_clear_object (&manager->priv->up_client);
 
         if (manager->priv->inhibit_lid_switch_fd != -1) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]