Poll for PS readiness rather than a hard wait time

This commit is contained in:
Dan Williams 2006-07-24 11:27:52 -05:00
parent 3798f29a6b
commit bfab84acc9

View File

@ -2,6 +2,9 @@ import os
import gtk import gtk
import gobject import gobject
import time import time
import dbus
import dbus.dbus_bindings
from sugar.presence import PresenceService
from Shell import Shell from Shell import Shell
from Process import Process from Process import Process
@ -47,15 +50,19 @@ class MatchboxProcess(Process):
class PresenceServiceProcess(Process): class PresenceServiceProcess(Process):
def __init__(self): def __init__(self):
Process.__init__(self, "sugar-presence-service",) Process.__init__(self, "sugar-presence-service")
def get_name(self): def get_name(self):
return "PresenceService" return "PresenceService"
def start(self): def start(self):
Process.start(self) Process.start(self)
# FIXME we really need something better bus = dbus.Bus()
time.sleep(3) ret = False
# Wait for the presence service to start up
while not ret:
ret = dbus.dbus_bindings.bus_name_has_owner(bus._connection, PresenceService.DBUS_SERVICE)
time.sleep(0.2)
class Session: class Session:
"""Takes care of running the shell and all the sugar processes""" """Takes care of running the shell and all the sugar processes"""