diff options
author | Martin Dengler <martin@martindengler.com> | 2008-08-01 17:39:37 (GMT) |
---|---|---|
committer | Martin Dengler <martin@martindengler.com> | 2008-08-07 01:56:34 (GMT) |
commit | ee7703b3511ea70055425b975da42775f5ccfae6 (patch) | |
tree | 1aa6594206c8634b4c083c4fac3cb1723946788f /src | |
parent | 6e42445a7a3d51f73176cdbfa28eeeb533a17787 (diff) |
#7740 react gracefully to dbus services being restarted
Sugar should react gracefully to dbus services being restarted. Some
daemon restarts - haldaemon, NetworkManager, and espeech - are not
handled as gracefully as they could be. This improves the situation.
|TestCase|
Observe the battery icon in the Frame. Run the following in a terminal:
sudo /etc/init.d/haldaemon restart
The previous behavior was:
After a while (30 seconds?) the battery icon would become empty
and, if sugar shell debugging is enabled in .xsession, a message
in the shell.log will appear to the following effect: ERROR root:
Cannot access battery.charge_level.percentage
The observed behavior should be:
The battery icon updates normally. The quickest way to check this
is to plug/unplug the AC power and confirm the battery icon's
state changes appropriately.
Diffstat (limited to 'src')
-rw-r--r-- | src/hardware/hardwaremanager.py | 3 | ||||
-rw-r--r-- | src/hardware/nmclient.py | 3 | ||||
-rw-r--r-- | src/model/devices/battery.py | 3 | ||||
-rw-r--r-- | src/view/keyhandler.py | 3 |
4 files changed, 8 insertions, 4 deletions
diff --git a/src/hardware/hardwaremanager.py b/src/hardware/hardwaremanager.py index 0192abb..aa73efd 100644 --- a/src/hardware/hardwaremanager.py +++ b/src/hardware/hardwaremanager.py @@ -50,7 +50,8 @@ class HardwareManager(gobject.GObject): try: bus = dbus.SystemBus() proxy = bus.get_object(_HARDWARE_MANAGER_SERVICE, - _HARDWARE_MANAGER_OBJECT_PATH) + _HARDWARE_MANAGER_OBJECT_PATH, + follow_name_owner_changes=True) self._service = dbus.Interface(proxy, _HARDWARE_MANAGER_INTERFACE) except dbus.DBusException, err: self._service = None diff --git a/src/hardware/nmclient.py b/src/hardware/nmclient.py index 5aa6a89..5a92176 100644 --- a/src/hardware/nmclient.py +++ b/src/hardware/nmclient.py @@ -596,7 +596,8 @@ class NMClient(gobject.GObject): } try: - self._nm_proxy = sys_bus.get_object(NM_SERVICE, NM_PATH) + self._nm_proxy = sys_bus.get_object(NM_SERVICE, NM_PATH, + follow_name_owner_changes=True) self._nm_obj = dbus.Interface(self._nm_proxy, NM_IFACE) except dbus.DBusException, e: logging.debug("Could not connect to NetworkManager: %s" % e) diff --git a/src/model/devices/battery.py b/src/model/devices/battery.py index 853d00e..7b52d4c 100644 --- a/src/model/devices/battery.py +++ b/src/model/devices/battery.py @@ -39,7 +39,8 @@ class Device(device.Device): device.Device.__init__(self, udi) bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM) - proxy = bus.get_object('org.freedesktop.Hal', udi) + proxy = bus.get_object('org.freedesktop.Hal', udi, + follow_name_owner_changes=True) self._battery = dbus.Interface(proxy, 'org.freedesktop.Hal.Device') bus.add_signal_receiver(self._battery_changed, 'PropertyModified', diff --git a/src/view/keyhandler.py b/src/view/keyhandler.py index 44ea759..ffed97c 100644 --- a/src/view/keyhandler.py +++ b/src/view/keyhandler.py @@ -123,7 +123,8 @@ class KeyHandler(object): def _get_speech_proxy(self): if self._speech_proxy is None: bus = dbus.SessionBus() - speech_obj = bus.get_object(SPEECH_DBUS_SERVICE, SPEECH_DBUS_PATH) + speech_obj = bus.get_object(SPEECH_DBUS_SERVICE, SPEECH_DBUS_PATH, + follow_name_owner_changes=True) self._speech_proxy = dbus.Interface(speech_obj, SPEECH_DBUS_INTERFACE) return self._speech_proxy |