[orca] Move the handling of multiple Orca instances out of orca.in



commit b216d69b756ceb28838ff67b282e1b669942819e
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu May 10 15:18:04 2012 -0400

    Move the handling of multiple Orca instances out of orca.in

 src/orca/orca.in |   23 -----------------------
 src/orca/orca.py |   22 ++++++++++++++++------
 2 files changed, 16 insertions(+), 29 deletions(-)
---
diff --git a/src/orca/orca.in b/src/orca/orca.in
index 526fb9c..f3d41e1 100644
--- a/src/orca/orca.in
+++ b/src/orca/orca.in
@@ -150,28 +150,5 @@ else
         WONT_EXIT=`echo $ARGS | egrep -c "\-s|\-t|\-n|\-u|\-e|\-d"`
     fi
 
-    # Do not run if another Orca is already running.
-    #
-    if [ "x$DBUS_SESSION_BUS_ADDRESS" != "x" ] && [ $WONT_EXIT -gt 0 ] ; then
-        IFS=:
-        DBUSSENDCMD=
-        for dir in $PATH:/usr/sfw/bin:/usr/local/bin; do
-            test -x "$dir/dbus-send" && {
-                DBUSSENDCMD="$dir/dbus-send"
-                break
-            }
-        done
-        if [ "x$DBUSSENDCMD" != "x" ] ; then
-            $DBUSSENDCMD --reply-timeout=5000 --print-reply \
-                --dest=org.gnome.Orca / org.freedesktop.DBus.Peer.Ping \
-                > /dev/null 2>&1
-            if [ "$?" -eq 0 ] ; then
-                echo "Another Orca process is already running for this session."
-                echo "Run \"orca --replace\" if you want to replace the current"
-                echo "process with a new one."
-                exit
-            fi
-        fi
-    fi
     runOrca
 fi
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 5b9bba3..45f47a3 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -249,7 +249,7 @@ def presentInvalidOptions(invalidOptions):
     return False
 
 parser = argparse.ArgumentParser(
-    description = _("orca - scriptable screen reader and magnifier"),
+    description = _("orca - scriptable screen reader"),
     # Translators: this is text being sent to a terminal and we want to keep
     # the text lines within terminal boundaries.
     #
@@ -1416,8 +1416,17 @@ def main():
     signal.signal(signal.SIGQUIT, shutdownOnSignal)
     signal.signal(signal.SIGSEGV, abortOnSignal)
 
-    if presentInvalidOptions(invalidOpts) and multipleOrcas():
-        die(0)
+    if multipleOrcas():
+        if not options.replace:
+            # Translators: This message is presented to the user when
+            # he/she tries to launch Orca, but Orca is already running.
+            print(_('Another Orca process is already running for this ' \
+                    'session.\n Run "orca --replace" to replace that ' \
+                    'process with a new one.'))
+            return 1
+        if presentInvalidOptions(invalidOpts):
+            die(0)
+
 
     _commandLineSettings.update(options.convertToSettings())
     for profile in options.profiles:
@@ -1454,9 +1463,10 @@ def main():
         _showPreferencesConsole()
 
     if not options.desktopRunning:
-        print("Cannot start Orca because it cannot connect")
-        print("to the Desktop.  Please make sure the DISPLAY")
-        print("environment variable has been set.")
+        # Translators: This message is presented to the user who attempts
+        # to launch Orca from some other environment than the graphical
+        # desktop.
+        print (_('Cannot start Orca because it cannot connect to the Desktop.'))
         return 1
 
     sys.path.insert(0, _settingsManager.getPrefsDir())



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