Turn off after locking
authorEnrico Zini <enrico@enricozini.org>
Sun, 16 Aug 2009 18:30:10 +0000 (19:30 +0100)
committerEnrico Zini <enrico@enricozini.org>
Sun, 16 Aug 2009 18:30:10 +0000 (19:30 +0100)
src/app_power.vala

index 0854f9c772dcccb4072f39d48551deee405f12f9..007a13bfe67cb1431d5aa4e83a0737b8dfd61e80 100644 (file)
@@ -106,6 +106,8 @@ public class Power : zavai.Resource, Object
                screen_locked = locked;
                if (!locked)
                        backlight.wiggle();
+               else
+                       backlight.turn_off();
 
                screen_lock_changed(locked);
        }
@@ -329,8 +331,21 @@ public class Backlight: zavai.Service
        public void wiggle()
        {
                // There must be a better method
-               usage.RequestResource("Display");
-               usage.ReleaseResource("Display");
+               //usage.RequestResource("Display");
+               //usage.ReleaseResource("Display");
+               turn_on();
+       }
+
+       public void turn_on()
+       {
+               usage.SetResourcePolicy("Display", "enabled");
+               usage.SetResourcePolicy("Display", "auto");
+       }
+
+       public void turn_off()
+       {
+               usage.SetResourcePolicy("Display", "disabled");
+               usage.SetResourcePolicy("Display", "auto");
        }
 
        /// Request GPS resource