orca r4109 - in trunk: . src/orca



Author: wwalker
Date: Mon Aug 18 16:24:49 2008
New Revision: 4109
URL: http://svn.gnome.org/viewvc/orca?rev=4109&view=rev

Log:
Use DBus only if DBUS_SESSION_BUS_ADDRESS is defined.


Modified:
   trunk/ChangeLog
   trunk/src/orca/orca.py
   trunk/src/orca/settings.py

Modified: trunk/src/orca/orca.py
==============================================================================
--- trunk/src/orca/orca.py	(original)
+++ trunk/src/orca/orca.py	Mon Aug 18 16:24:49 2008
@@ -60,7 +60,6 @@
 import pyatspi
 import braille
 import debug
-import dbusserver
 import httpserver
 import keynames
 import keybindings
@@ -75,6 +74,9 @@
 from input_event import MouseButtonEvent
 from input_event import keyEventToString
 
+if settings.useDBus:
+    import dbusserver
+
 from orca_i18n import _           # for gettext support
 
 if settings.debugMemoryUsage:
@@ -879,8 +881,14 @@
     global _userSettings
 
     # Shutdown the output drivers and give them a chance to die.
+
+    # Only exit the D-Bus server if we're in an environment where there 
+    # is a D-Bus session bus already running.  This helps prevent nastiness
+    # on the login screen.
     #
-    dbusserver.shutdown()
+    if settings.useDBus:
+        dbusserver.shutdown()
+
     httpserver.shutdown()
     speech.shutdown()
     braille.shutdown()
@@ -991,7 +999,12 @@
 
     showMainWindowGUI()
 
-    dbusserver.init()
+    # Only start the D-Bus server if we're in an environment where there 
+    # is a D-Bus session bus already running.  This helps prevent nastiness
+    # on the login screen.
+    #
+    if settings.useDBus:
+        dbusserver.init()
     httpserver.init()
 
     return True

Modified: trunk/src/orca/settings.py
==============================================================================
--- trunk/src/orca/settings.py	(original)
+++ trunk/src/orca/settings.py	Mon Aug 18 16:24:49 2008
@@ -296,6 +296,13 @@
 #
 maxHttpServerRetries    = 20
 
+# Whether or not to use DBUS.
+#
+if os.getenv("DBUS_SESSION_BUS_ADDRESS"):
+    useDBus = True
+else:
+    useDBus = False
+
 # Whether or not recording is enabled via the HTTP server. 
 #
 enableRemoteLogging     = False



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]