[orca] Handle attempts to start Orca from the console more gracefully



commit c7d7b22a2ddf67f18063e5645a090c87b33a4149
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Feb 14 20:06:32 2013 -0500

    Handle attempts to start Orca from the console more gracefully

 src/orca/orca_bin.py.in |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/src/orca/orca_bin.py.in b/src/orca/orca_bin.py.in
index 8e490db..f0e4620 100644
--- a/src/orca/orca_bin.py.in
+++ b/src/orca/orca_bin.py.in
@@ -243,11 +243,12 @@ def inGraphicalDesktop():
 
     # TODO - JD: Make this desktop environment agnostic
     try:
-        from gi.repository import Gtk
+        from gi.repository import Gdk
+        display = Gdk.Display.get_default()
     except:
         return False
 
-    return True
+    return display != None
 
 def otherOrcas():
     """Returns the pid of any other instances of Orca owned by this user."""
@@ -286,14 +287,6 @@ def cleanup(sigval):
 def main():
     setProcessName('orca')
 
-    if not inGraphicalDesktop():
-        # Translators: This message is presented to the user who attempts
-        # to launch Orca from some other environment than the graphical
-        # desktop.
-        msg = _('Cannot start Orca because it cannot connect to the Desktop.')
-        print (msg)
-        return 1
-
     parser = Parser()
     args, invalid = parser.parse_known_args()
 
@@ -309,6 +302,14 @@ def main():
     if args.text_setup:
         orca_console_prefs.showPreferencesUI(settingsDict)
 
+    if not inGraphicalDesktop():
+        # Translators: This message is presented to the user who attempts
+        # to launch Orca from some other environment than the graphical
+        # desktop.
+        msg = _('Cannot start Orca because it cannot connect to the Desktop.')
+        print (msg)
+        return 1
+
     manager = orca.getSettingsManager()
     if not manager:
         print("Could not activate the settings manager. Exiting.")


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