Reconnect to the PS if it goes away and comes back
This commit is contained in:
parent
30a50bd9fc
commit
86ab6ca36b
@ -71,20 +71,27 @@ class PresenceService(gobject.GObject):
|
|||||||
"""
|
"""
|
||||||
gobject.GObject.__init__(self)
|
gobject.GObject.__init__(self)
|
||||||
self._objcache = {}
|
self._objcache = {}
|
||||||
|
|
||||||
|
# Get a connection to the session bus
|
||||||
|
self._bus = dbus.SessionBus()
|
||||||
|
self._bus.add_signal_receiver(self._name_owner_changed_cb,
|
||||||
|
signal_name="NameOwnerChanged",
|
||||||
|
dbus_interface="org.freedesktop.DBus")
|
||||||
|
|
||||||
# attempt to load the interface to the service...
|
# attempt to load the interface to the service...
|
||||||
self._allow_offline_iface = allow_offline_iface
|
self._allow_offline_iface = allow_offline_iface
|
||||||
self._get_ps()
|
self._get_ps()
|
||||||
|
|
||||||
_bus_ = None
|
def _name_owner_changed_cb(self, name, old, new):
|
||||||
def _get_bus(self):
|
if name != DBUS_SERVICE:
|
||||||
"""Retrieve dbus session-bus or create new"""
|
return
|
||||||
if not self._bus_:
|
if (old and len(old)) and (not new and not len(new)):
|
||||||
self._bus_ = dbus.SessionBus()
|
# PS went away, clear out PS dbus service wrapper
|
||||||
return self._bus_
|
self._ps_ = None
|
||||||
_bus = property(
|
elif (not old and not len(old)) and (new and len(new)):
|
||||||
_get_bus, None, None,
|
# PS started up
|
||||||
"""DBUS SessionBus object for user-local communications"""
|
self._get_ps()
|
||||||
)
|
|
||||||
_ps_ = None
|
_ps_ = None
|
||||||
def _get_ps(self):
|
def _get_ps(self):
|
||||||
"""Retrieve dbus interface to PresenceService
|
"""Retrieve dbus interface to PresenceService
|
||||||
|
Loading…
Reference in New Issue
Block a user