Use dbus-launch with the --exit-with-session. dbus not exiting still not fully solved.

This commit is contained in:
Marco Pesenti Gritti
2006-08-12 01:29:55 +02:00
parent c5fb39875c
commit fc1aefc72c
4 changed files with 21 additions and 18 deletions
+5 -4
View File
@@ -212,7 +212,7 @@ class PresenceServiceDBusHelper(dbus.service.Object):
in_signature="o", out_signature="")
def unregisterService(self, service_op):
found_serv = None
serv = self._parent.get_services()
services = self._parent.get_services()
for serv in services:
if serv.object_path() == service_op:
found_serv = serv
@@ -688,12 +688,13 @@ class PresenceService(object):
if stype in self._registered_service_types:
self._registered_service_types.remove(stype)
def main():
loop = gobject.MainLoop()
ps = PresenceService()
loop.run()
try:
loop.run()
except KeyboardInterrupt:
print 'Ctrl+C pressed, exiting...'
if __name__ == "__main__":
main()
+5 -3
View File
@@ -2,6 +2,8 @@ import os
import gtk
import gobject
import time
import re
import dbus
import dbus.dbus_bindings
@@ -13,7 +15,7 @@ import sugar.env
class DbusProcess(Process):
def __init__(self):
config = sugar.env.get_dbus_config()
cmd = "dbus-daemon --print-address --config-file %s" % config
cmd = "dbus-launch --exit-with-session --config-file %s" % config
Process.__init__(self, cmd)
def get_name(self):
@@ -22,8 +24,8 @@ class DbusProcess(Process):
def start(self):
Process.start(self, True)
dbus_file = os.fdopen(self._stdout)
addr = dbus_file.readline()
addr = addr.strip()
regexp = re.compile('DBUS_SESSION_BUS_ADDRESS=\'(.*)\'\;')
addr = regexp.match(dbus_file.readline()).group(1)
dbus_file.close()
os.environ["DBUS_SESSION_BUS_ADDRESS"] = addr
+2 -6
View File
@@ -1,14 +1,10 @@
#!/usr/bin/python
import logging
import sugar.env
from PresenceService import PresenceService
import sugar.logger
# FIXME this looks like duplicated
level = sugar.env.get_logging_level()
if level == 'debug':
logging.basicConfig(level=logging.DEBUG,
format='%(levelname)s %(message)s')
sugar.logger.start('PresenceService')
logging.info('Starting presence service')