[gnome-control-center] screen: go back to using relative time in the lock ui



commit 93ad1eedf6bdee72f827fcfddd8dfc58d42f01e3
Author: William Jon McCann <jmccann redhat com>
Date:   Thu Mar 17 01:43:22 2011 -0400

    screen: go back to using relative time in the lock ui
    
    This means that lock times are relative to the time the display
    backlight turns off.

 panels/screen/cc-screen-panel.c |   87 ++-------------------------------------
 panels/screen/screen.ui         |    4 ++
 2 files changed, 8 insertions(+), 83 deletions(-)
---
diff --git a/panels/screen/cc-screen-panel.c b/panels/screen/cc-screen-panel.c
index 7d550b0..e7ecc24 100644
--- a/panels/screen/cc-screen-panel.c
+++ b/panels/screen/cc-screen-panel.c
@@ -273,90 +273,18 @@ got_power_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_dat
                      user_data);
 }
 
-static guint
-lock_delay_to_relative (CcScreenPanel *self,
-                        guint          value)
-{
-  guint new;
-  guint idle_delay;
-
-  if (value == 0)
-    return value;
-
-  /* convert to relative units */
-  idle_delay = 0;
-  g_settings_get (self->priv->session_settings, "idle-delay", "u", &idle_delay);
-
-  if (idle_delay > value)
-    new = 0;
-  else
-    new = value - idle_delay;
-
-  return new;
-}
-
-static guint
-lock_delay_to_absolute (CcScreenPanel *self,
-                        guint          value)
-{
-  guint new;
-  guint idle_delay;
-
-  new = value;
-
-  /* convert to absolute units */
-  idle_delay = 0;
-  g_settings_get (self->priv->session_settings, "idle-delay", "u", &idle_delay);
-
-  new += idle_delay;
-
-  return new;
-}
-
 static void
 set_idle_delay_from_dpms (CcScreenPanel *self,
                           int            value)
 {
   guint off_delay;
-  guint lock_delay;
-  guint idle_delay;
 
   off_delay = 1;
-  lock_delay = 0;
 
   if (value > 0)
     off_delay = (guint) value;
 
-  g_settings_get (self->priv->lock_settings, "lock-delay", "u", &lock_delay);
-
-  if (lock_delay > 0)
-    {
-      lock_delay = lock_delay_to_absolute (self, lock_delay);
-
-      idle_delay = MIN (lock_delay, off_delay);
-    }
-  else
-    idle_delay = off_delay;
-
-  g_settings_set (self->priv->session_settings, "idle-delay", "u", idle_delay);
-}
-
-static void
-set_idle_delay_from_lock (CcScreenPanel *self,
-                          guint          value)
-{
-  guint off_delay;
-  guint idle_delay;
-
-  off_delay = (guint) g_settings_get_int (self->priv->gsd_settings, "sleep-display-ac");
-
-  /* special value of zero means use dpms value */
-  if (value != 0)
-    idle_delay = MIN (value, off_delay);
-  else
-    idle_delay = off_delay;
-
-  g_settings_set (self->priv->session_settings, "idle-delay", "u", idle_delay);
+  g_settings_set (self->priv->session_settings, "idle-delay", "u", off_delay);
 }
 
 static void
@@ -390,8 +318,7 @@ lock_combo_changed_cb (GtkWidget *widget, CcScreenPanel *self)
 {
   GtkTreeIter iter;
   GtkTreeModel *model;
-  guint relative;
-  guint absolute;
+  guint delay;
   gboolean ret;
 
   /* no selection */
@@ -402,13 +329,9 @@ lock_combo_changed_cb (GtkWidget *widget, CcScreenPanel *self)
   /* get entry */
   model = gtk_combo_box_get_model (GTK_COMBO_BOX(widget));
   gtk_tree_model_get (model, &iter,
-                      1, &absolute,
+                      1, &delay,
                       -1);
-  relative = lock_delay_to_relative (self, absolute);
-
-  g_settings_set (self->priv->lock_settings, "lock-delay", "u", relative);
-
-  set_idle_delay_from_lock (self, absolute);
+  g_settings_set (self->priv->lock_settings, "lock-delay", "u", delay);
 }
 
 static void
@@ -473,8 +396,6 @@ set_lock_value_for_combo (GtkComboBox *combo_box, CcScreenPanel *self)
   /* try to make the UI match the lock setting */
   g_settings_get (self->priv->lock_settings, "lock-delay", "u", &value);
 
-  if (value > 0)
-    value = lock_delay_to_absolute (self, value);
   do
     {
       gtk_tree_model_get (model, &iter,
diff --git a/panels/screen/screen.ui b/panels/screen/screen.ui
index cf17223..266448b 100644
--- a/panels/screen/screen.ui
+++ b/panels/screen/screen.ui
@@ -15,6 +15,10 @@
         <col id="1">0</col>
       </row>
       <row>
+        <col id="0" translatable="yes">30 seconds</col>
+        <col id="1">30</col>
+      </row>
+      <row>
         <col id="0" translatable="yes">1 minute</col>
         <col id="1">60</col>
       </row>



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