Index: orca_console_prefs.py
===================================================================
RCS file: /cvs/gnome/orca/src/orca/orca_console_prefs.py,v
retrieving revision 1.9
diff -u -r1.9 orca_console_prefs.py
--- orca_console_prefs.py	10 Jun 2006 00:54:47 -0000	1.9
+++ orca_console_prefs.py	15 Sep 2006 21:07:34 -0000
@@ -31,6 +31,18 @@
 import speech
 import speechserver
 import orca_prefs
+import platform
+import time
+
+desktopRunning = False
+try:
+    import bonobo
+    import gobject
+    import gnome
+    import gnome.ui
+    desktopRunning = True
+except:
+    pass
 
 from orca_i18n import _  # for gettext support
 
@@ -288,6 +300,18 @@
 
     return True
 
+def logoutUser():
+    """Automatically log the user out of the GNOME desktop."""
+
+    program = gnome.init(platform.package, platform.version)
+    client = gnome.ui.master_client()
+
+    client.request_save(gnome.ui.SAVE_GLOBAL,  # Save style
+                        True,                  # Shutdown
+                        gnome.ui.INTERACT_ANY, # Allow user interaction
+                        False,                 # Fast
+                        True)                  # All apps save state
+
 def showPreferencesUI():
     """Uses the console to query the user for Orca preferences."""
 
@@ -326,6 +350,24 @@
                     False,
                     speechServerChoice,
                     speechVoiceChoice)
+
+        if desktopRunning:
+            answer = sayAndPrint(_("Do you want to logout now?  Enter y or n: "),
+                                 False,
+                                 True,
+                                 speechServerChoice,
+                                 speechVoiceChoice)
+            if answer[0:1] == 'Y' or answer[0:1] == 'y':
+                sayAndPrint(_("Setup complete. Logging out now."),
+                            False,
+                            False,
+                            speechServerChoice,
+                            speechVoiceChoice)
+                time.sleep(2)
+
+                gobject.threads_init()
+                gobject.idle_add(logoutUser)
+                bonobo.main()
 
     answer = sayAndPrint(_("Setup complete.  Press Return to continue."),
                          not logoutNeeded,
