ScreenShield: implement o.g.ScreenSaver.GetActiveTime

Part of the old gnome-screensaver interface, returns the number of seconds
that the screensaver has been active for.

https://bugzilla.gnome.org/show_bug.cgi?id=686064
This commit is contained in:
Giovanni Campagna
2012-10-16 16:38:32 +02:00
parent d3ba002313
commit 2a8a8065a8
2 changed files with 26 additions and 2 deletions

View File

@ -59,6 +59,9 @@ const ScreenSaverIface = <interface name="org.gnome.ScreenSaver">
<method name="SetActive">
<arg name="value" direction="in" type="b" />
</method>
<method name="GetActiveTime">
<arg name="value" direction="out" type="u" />
</method>
<signal name="ActiveChanged">
<arg name="new_value" type="b" />
</signal>
@ -373,5 +376,13 @@ const ScreenSaverDBus = new Lang.Class({
GetActive: function() {
return this._screenShield.locked;
}
},
GetActiveTime: function() {
let started = this._screenShield.activationTime;
if (started > 0)
return Math.floor((GLib.get_monotonic_time() - started) / 1000000);
else
return 0;
},
});