diff options
| author | Nagappan <nagapan@gmail.com> | 2010-04-28 23:41:56 -0700 |
|---|---|---|
| committer | Nagappan <nagapan@gmail.com> | 2010-04-28 23:41:56 -0700 |
| commit | 4d402ab8b98837e718d887827d3d5e283cd599e1 (patch) | |
| tree | ae3f7cec6b6e07a86982d1c423189a4ab5d011dd | |
| parent | cf2e02423468fa357e6a31e57029b41a1d02a248 (diff) | |
Fix specific to SLED11
| -rw-r--r-- | ldtpd/waiters.py | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/ldtpd/waiters.py b/ldtpd/waiters.py index 12b52cc..3a2e6e8 100644 --- a/ldtpd/waiters.py +++ b/ldtpd/waiters.py @@ -27,6 +27,12 @@ import gobject import pyatspi import traceback +_main_loop = None +_gtk_vers = gtk.ver +if _gtk_vers[0] <= 2 and _gtk_vers[1] <= 15: + # Required for SLED11 + _main_loop = gobject.MainLoop() + class Waiter(Utils): events = [] def __init__(self, timeout): @@ -49,7 +55,10 @@ class Waiter(Utils): if self.events: pyatspi.Registry.registerEventListener( self._event_cb, *self.events) - gtk.main() + if _main_loop: + _main_loop.run() + else: + gtk.main() if self.events: pyatspi.Registry.deregisterEventListener( self._event_cb, *self.events) @@ -62,8 +71,11 @@ class Waiter(Utils): self.poll() if self._timeout_count >= self.timeout or self.success: try: - if gtk.main_level(): - gtk.main_quit() + if _main_loop: + _main_loop.quit() + else: + if gtk.main_level(): + gtk.main_quit() except RuntimeError: # In Mandriva RuntimeError exception is thrown # If, gtk.main was already quit @@ -78,8 +90,11 @@ class Waiter(Utils): self.event_cb(event) if self.success: try: - if gtk.main_level(): - gtk.main_quit() + if _main_loop: + _main_loop.quit() + else: + if gtk.main_level(): + gtk.main_quit() except RuntimeError: # In Mandriva RuntimeError exception is thrown # If, gtk.main was already quit |
