summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Moskovcak <jmoskovc@redhat.com>2009-06-24 11:26:32 +0200
committerJiri Moskovcak <jmoskovc@redhat.com>2009-06-24 11:26:32 +0200
commit6cd1bd1946b507ce57cf5fb75a163463445c179e (patch)
treeac1ec6b707b61232290035f1af8d33917a01fb1f
parentf4d7e28cb37d9723e6c882640d15c02ce5b1a007 (diff)
downloadabrt-6cd1bd1946b507ce57cf5fb75a163463445c179e.tar.gz
abrt-6cd1bd1946b507ce57cf5fb75a163463445c179e.tar.xz
abrt-6cd1bd1946b507ce57cf5fb75a163463445c179e.zip
GUI: Fixed dbus exception under root
-rw-r--r--src/Gui/CCDBusBackend.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Gui/CCDBusBackend.py b/src/Gui/CCDBusBackend.py
index e966ae3b..40e05956 100644
--- a/src/Gui/CCDBusBackend.py
+++ b/src/Gui/CCDBusBackend.py
@@ -14,9 +14,16 @@ class DBusManager(gobject.GObject):
""" Class to provide communication with daemon over dbus """
# and later with policyKit
def __init__(self):
- session = dbus.SessionBus()
- if session.request_name(APP_NAME, dbus.bus.NAME_FLAG_DO_NOT_QUEUE) != dbus.bus.REQUEST_NAME_REPLY_PRIMARY_OWNER:
- raise Exception("Name %s is taken,\nanother instance is already running." % APP_NAME)
+ session = None
+ try:
+ session = dbus.SessionBus()
+ except:
+ # FIXME: root doesn't have SessionBus
+ pass
+ if session:
+ if session.request_name(APP_NAME, dbus.bus.NAME_FLAG_DO_NOT_QUEUE) != dbus.bus.REQUEST_NAME_REPLY_PRIMARY_OWNER:
+ raise Exception("Name %s is taken,\nanother instance is already running." % APP_NAME)
+
gobject.GObject.__init__(self)
# signal emited when new crash is detected
gobject.signal_new ("crash", self ,gobject.SIGNAL_RUN_FIRST,gobject.TYPE_NONE,())