[X2Go-Commits] [x2goclient] 02/04: src/pulsemanager.cpp: refactor PA binary searching code.

git-admin at x2go.org git-admin at x2go.org
Mon Nov 28 18:11:29 CET 2016


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit 69f58e20a18e9f86986876908fbe762586d78fed
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Mon Nov 28 17:33:36 2016 +0100

    src/pulsemanager.cpp: refactor PA binary searching code.
    
    Less duplication now.
---
 debian/changelog     |    2 ++
 src/pulsemanager.cpp |   48 ++++++++++++++----------------------------------
 2 files changed, 16 insertions(+), 34 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 9bc2f99..ca7a96a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -469,6 +469,8 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
     - src/x2goutils.{cpp,h}: make find_binary () and add_to_path () available
       on all UNIX-based operating systems. We will need it for sftp-server
       discovery.
+    - src/pulsemanager.cpp: refactor PA binary searching code. Less
+      duplication now.
 
   [ Bernard Cafarelli ]
   * New upstream version (4.0.5.3):
diff --git a/src/pulsemanager.cpp b/src/pulsemanager.cpp
index 93c83b3..d7b6d72 100644
--- a/src/pulsemanager.cpp
+++ b/src/pulsemanager.cpp
@@ -79,21 +79,6 @@ PulseManager::PulseManager () : app_dir_ (QApplication::applicationDirPath ()),
 
   if (server_binary_.isEmpty ()) {
     server_binary_ = find_binary (path_val, "pulseaudio");
-
-    if (server_binary_.isEmpty ()) {
-      x2goErrorf (29) << "Unable to find PulseAudio binary. Neither bundled, nor found in $PATH nor additional directories.";
-      show_RichText_ErrorMsgBox (tr ("Unable to find PulseAudio binary. Neither bundled, nor found in $PATH nor additional directories."),
-                                 tr ("If you downloaded the bundled, pre-compiled version from the official home page, "
-                                     "please report a bug on:\n"
-                                     "<center><a href=\"https://wiki.x2go.org/doku.php/wiki:bugs\">"
-                                       "https://wiki.x2go.org/doku.php/wiki:bugs"
-                                     "</a></center>\n"),
-                                 true);
-      abort ();
-    }
-    else {
-      system_pulse_ = true;
-    }
   }
 #else /* QT_VERSION < 0x050000 */
   QStringList search_paths;
@@ -117,30 +102,25 @@ PulseManager::PulseManager () : app_dir_ (QApplication::applicationDirPath ()),
         search_paths << "/usr/local/bin"; /* Homebrew or random stuff. Probably even both intermingled... */
 
         server_binary_ = QStandardPaths::findExecutable ("pulseaudio", search_paths);
-
-        if (server_binary_.isEmpty ()) {
-          x2goErrorf (28) << "Unable to find PulseAudio binary. Neither bundled, nor found in $PATH nor additional directories.";
-          show_RichText_ErrorMsgBox (tr ("Unable to find PulseAudio binary. Neither bundled, nor found in $PATH nor additional directories."),
-                                     tr ("If you downloaded the bundled, pre-compiled version from the official home page, "
-                                         "please report a bug on:\n"
-                                         "<center><a href=\"https://wiki.x2go.org/doku.php/wiki:bugs\">"
-                                           "https://wiki.x2go.org/doku.php/wiki:bugs"
-                                         "</a></center>\n"),
-                                     true);
-          abort ();
-        }
       }
     }
+  }
+#endif /* QT_VERSION < 0x050000 */
 
-    /*
-     * The detection above either failed or succeeded.
-     * Failure means that the program already stopped,
-     * success means that all code reaches this point.
-     * Be careful when refactoring this code.
-     */
+  if (server_binary_.isEmpty ()) {
+    x2goErrorf (29) << "Unable to find the PulseAudio binary. Neither bundled, nor found in $PATH nor additional directories.";
+    show_RichText_ErrorMsgBox (tr ("Unable to find the PulseAudio binary. Neither bundled, nor found in $PATH nor additional directories."),
+                               tr ("If you downloaded the bundled, pre-compiled version from the official home page, "
+                                   "please report a bug on:\n"
+                                   "<center><a href=\"https://wiki.x2go.org/doku.php/wiki:bugs\">"
+                                     "https://wiki.x2go.org/doku.php/wiki:bugs"
+                                   "</a></center>\n"),
+                               true);
+    abort ();
+  }
+  else {
     system_pulse_ = true;
   }
-#endif /* QT_VERSION < 0x050000 */
 
   QFileInfo tmp_file_info = QFileInfo (server_binary_);
   server_working_dir_ = tmp_file_info.canonicalPath ();

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list