[kupfer] ui: Check that dbus is available when using appindicator
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer] ui: Check that dbus is available when using appindicator
- Date: Tue, 29 Mar 2011 14:24:24 +0000 (UTC)
commit b669ed8425aa8388e94ec5a3c8f8f6e269c21a25
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Tue Mar 29 16:22:32 2011 +0200
ui: Check that dbus is available when using appindicator
The appindicator module will abort harshly if no D-Bus connection is
found. Because of that, we have to look before we leap.
kupfer/ui/browser.py | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index 8193580..124fd3c 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -1836,8 +1836,18 @@ class WindowController (pretty.OutputMixin):
menu = self._setup_menu()
try:
import appindicator
- return self._setup_appindicator(menu)
except ImportError:
+ appindicator = None
+ else:
+ ## make sure dbus is available, else appindicator crashes
+ import dbus
+ try:
+ dbus.Bus()
+ except dbus.DBusException:
+ appindicator = None
+ if appindicator:
+ return self._setup_appindicator(menu)
+ else:
return self._setup_gtk_status_icon(menu)
def _setup_gtk_status_icon(self, menu):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]