Alternate way to blank screen on lock
authorEnrico Zini <enrico@enricozini.org>
Sat, 22 Aug 2009 22:23:55 +0000 (23:23 +0100)
committerEnrico Zini <enrico@enricozini.org>
Sat, 22 Aug 2009 22:23:55 +0000 (23:23 +0100)
src/app_power.vala

index bdff61af361a59d5b4d488d8808de8825eccff3b..b32a9fc9e3d47baac3c927269c5b16e0a68cb11d 100644 (file)
@@ -340,7 +340,7 @@ public class RebootButton : Gtk.Button
 public class Backlight: zavai.Service
 {
        public dynamic DBus.Object usage;
-       //public dynamic DBus.Object display;
+       public dynamic DBus.Object display;
 
        public Backlight()
        {
@@ -351,12 +351,10 @@ public class Backlight: zavai.Service
                        "/org/freesmartphone/Usage",
                        "org.freesmartphone.Usage");
 
-               /*
                display = zavai.registry.sbus.get_object(
                        "org.freesmartphone.odeviced",
                        "/org/freesmartphone/Device/Display/0",
                        "org.freesmartphone.Device.Display");
-               */
        }
 
        // Turn the backlight and then let it fade off
@@ -364,7 +362,8 @@ public class Backlight: zavai.Service
        {
                // There must be a better method
                try {
-                       usage.SetResourcePolicy("Display", "auto");
+                       display.SetBacklightPower(true);
+                       //usage.SetResourcePolicy("Display", "auto");
                        usage.RequestResource("Display");
                        usage.ReleaseResource("Display");
                } catch (Error e) {
@@ -377,12 +376,14 @@ public class Backlight: zavai.Service
                if (!started)
                {
                        try {
-                               //display.SetBacklightPower(false);
+                               display.SetBacklightPower(false);
+                               /*
                                string policy = usage.GetResourcePolicy("Display");
                                if (policy == "auto")
                                {
                                        usage.SetResourcePolicy("Display", "disabled");
                                }
+                               */
                        } catch (GLib.Error e) {
                                zavai.log.error(e.message);
                        }
@@ -392,7 +393,8 @@ public class Backlight: zavai.Service
        public void unlock_screen()
        {
                try {
-                       usage.SetResourcePolicy("Display", "auto");
+                       display.SetBacklightPower(true);
+                       //usage.SetResourcePolicy("Display", "auto");
                } catch (GLib.Error e) {
                        zavai.log.error(e.message);
                }