[nanny: 2/11] Detecting user sessions using ConsoleKit
- From: Roberto Majadas <telemaco src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nanny: 2/11] Detecting user sessions using ConsoleKit
- Date: Tue, 11 May 2010 17:45:00 +0000 (UTC)
commit d3ebb6a1058f022f76712f01b3121332e40c237a
Author: Roberto Majadas <roberto majadas openshine com>
Date: Wed Mar 31 16:56:20 2010 +0200
Detecting user sessions using ConsoleKit
daemon/src/LinuxSessionCKFiltering.py | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/daemon/src/LinuxSessionCKFiltering.py b/daemon/src/LinuxSessionCKFiltering.py
index 80aceed..7df007d 100644
--- a/daemon/src/LinuxSessionCKFiltering.py
+++ b/daemon/src/LinuxSessionCKFiltering.py
@@ -22,6 +22,7 @@
import gobject
import os
+import dbus
from twisted.internet import reactor
from time import localtime, strftime
@@ -113,4 +114,22 @@ class LinuxSessionCKFiltering(gobject.GObject) :
return
def __logout_session_if_is_running(self, user_id):
- pass
+ try:
+ d = dbus.SystemBus()
+ manager = dbus.Interface(d.get_object("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager"),
+ "org.freedesktop.ConsoleKit.Manager")
+ sessions = manager.GetSessionsForUnixUser(int(user_id))
+ for session_name in sessions :
+ session = dbus.Interface(d.get_object("org.freedesktop.ConsoleKit", session_name),
+ "org.freedesktop.ConsoleKit.Session")
+ x11_display = session.GetX11Display()
+ print "session: %s , display: '%s'" % (session_name, x11_display)
+ if x11_display == "":
+ continue
+
+ os.system("DISPLAY=%s zenity --info" % x11_display)
+
+ except:
+ print "Crash __logout_session_if_is_running()"
+
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]