[pyatspi2] Listen for AddAccessible and RemoveAccessible at the DesktopCache level
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pyatspi2] Listen for AddAccessible and RemoveAccessible at the DesktopCache level
- Date: Sat, 5 Jun 2010 01:03:52 +0000 (UTC)
commit e01532b930d09e78f1af403e1306befc728b020c
Author: Mike Gorse <mgorse novell com>
Date: Fri Jun 4 20:41:36 2010 -0400
Listen for AddAccessible and RemoveAccessible at the DesktopCache level
Since we now listen for ChildrenChanged events at the Desktop level, we
should also listen for AddAccessible and RemoveAccessible events there,
since the desktop cache uses a Sync bus where application caches use
async buses, resulting in AddAccessible events previously being queued
where ChildrenChanged events were not, meaning that they could be
processed out of order.
pyatspi/cache.py | 35 ++++++++++++++++++++---------------
1 files changed, 20 insertions(+), 15 deletions(-)
---
diff --git a/pyatspi/cache.py b/pyatspi/cache.py
index 374c2cb..507a657 100644
--- a/pyatspi/cache.py
+++ b/pyatspi/cache.py
@@ -115,6 +115,18 @@ class DesktopCacheManager (object):
sender_keyword="sender",
path_keyword="path")
+ self._cache_add = \
+ bus.add_signal_receiver(self._add_object,
+ path=_ATSPI_CACHE_PATH,
+ dbus_interface=_ATSPI_CACHE_INTERFACE,
+ signal_name="AddAccessible")
+
+ self._cache_remove = \
+ bus.add_signal_receiver(self._remove_object,
+ path=_ATSPI_CACHE_PATH,
+ dbus_interface=_ATSPI_CACHE_INTERFACE,
+ signal_name="RemoveAccessible")
+
obj = bus.get_object(ATSPI_REGISTRY_NAME, ATSPI_ROOT_PATH, introspect=False)
desktop = dbus.Interface(obj, ATSPI_ACCESSIBLE)
apps = desktop.GetChildren()
@@ -180,13 +192,20 @@ class DesktopCacheManager (object):
app = self._application_list[sender]
app._state_changed_handler(minor, detail1, detail2, any_data, app, interface, sender, member, path)
+ def _add_object(self, data):
+ app = self._application_list[data[0][0]]
+ app._add_object(data)
+
+ def _remove_object(self, data):
+ app = self._application_list[data[0]]
+ app._remove_object(data)
+
class ApplicationCacheManager (object):
"""
The application cache manager is responsible for keeping the cache up to date
with cache items from the given application.
"""
-
def __init__(self, cache, bus_name):
"""
Creates a cache.
@@ -208,20 +227,6 @@ class ApplicationCacheManager (object):
except dbus.exceptions.DBusException:
pass
- self._cache_add = \
- bus.add_signal_receiver(self._add_object,
- bus_name=self._bus_name,
- path=_ATSPI_CACHE_PATH,
- dbus_interface=_ATSPI_CACHE_INTERFACE,
- signal_name="AddAccessible")
-
- self._cache_remove = \
- bus.add_signal_receiver(self._remove_object,
- bus_name=self._bus_name,
- path=_ATSPI_CACHE_PATH,
- dbus_interface=_ATSPI_CACHE_INTERFACE,
- signal_name="RemoveAccessible")
-
def _add_object (self, data):
#First element is the object reference
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]