|
Revision d1a41d2b9e8293b7310d616fd8ccd24ddf38d9be, 0.9 KB
(checked in by Leo Antunes <leo@…>, 2 years ago)
|
|
- store changed status as pref and restore at startup if it exists:
avoid awayonlock messing with the last-online status if you quit
while idle.
- minor tweaks and fixes to the test script
|
-
Property mode set to
100644
|
| Line | |
|---|
| 1 | #!/usr/bin/env python |
|---|
| 2 | |
|---|
| 3 | """ |
|---|
| 4 | incredibly dirty hack to test away-on-lock |
|---|
| 5 | if gnome-screensaver is already running this wont work (it wont be able |
|---|
| 6 | to pretend to be gnome-screensaver) |
|---|
| 7 | """ |
|---|
| 8 | |
|---|
| 9 | import dbus, dbus.service, gobject |
|---|
| 10 | from dbus.mainloop.glib import DBusGMainLoop |
|---|
| 11 | from dbus.service import BusName |
|---|
| 12 | |
|---|
| 13 | bus = dbus.SessionBus(mainloop=DBusGMainLoop()) |
|---|
| 14 | |
|---|
| 15 | class Test(dbus.service.Object): |
|---|
| 16 | def __init__(self, path): |
|---|
| 17 | dbus.service.Object.__init__(self, bus, path) |
|---|
| 18 | |
|---|
| 19 | x = dbus.Boolean(1); |
|---|
| 20 | |
|---|
| 21 | @dbus.service.signal(dbus_interface='org.gnome.ScreenSaver', signature='b') |
|---|
| 22 | def ActiveChanged(self, y): |
|---|
| 23 | print "emmitting...", repr(y) |
|---|
| 24 | return True |
|---|
| 25 | |
|---|
| 26 | name = BusName(name="org.gnome.ScreenSaver", bus=bus); |
|---|
| 27 | |
|---|
| 28 | app = gobject.MainLoop() |
|---|
| 29 | |
|---|
| 30 | t = Test('/org/gnome/ScreenSaver') |
|---|
| 31 | gobject.timeout_add( 1, t.ActiveChanged, dbus.Boolean(1)) |
|---|
| 32 | gobject.timeout_add(5000, t.ActiveChanged, dbus.Boolean(0)) |
|---|
| 33 | gobject.timeout_add(5001, app.quit) |
|---|
| 34 | |
|---|
| 35 | app.run() |
|---|