[pulseaudio-commits] src/pavucontrol.cc

Tanu Kaskinen tanuk at kemper.freedesktop.org
Wed Jul 4 02:54:37 PDT 2012


 src/pavucontrol.cc |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

New commits:
commit ba868cc0b064a3c20b5e61e061a53b6efc8a8f5c
Author: Frédéric Dalleau <frederic.dalleau at linux.intel.com>
Date:   Fri Jun 22 11:03:08 2012 +0200

    Add --retry command line option
    
    As a developper, I find it annoying to restart pavucontrol everytime I restart
    pulseaudio, moreover the error dialog sometimes needs an additional click
    before restarting.
    Add it as a command line option so that default behavior is not changed.

diff --git a/src/pavucontrol.cc b/src/pavucontrol.cc
index 4db7d95..72ec980 100644
--- a/src/pavucontrol.cc
+++ b/src/pavucontrol.cc
@@ -46,6 +46,7 @@ static pa_context* context = NULL;
 static pa_mainloop_api* api = NULL;
 static int n_outstanding = 0;
 static int default_tab = 0;
+static bool retry = false;
 static int reconnect_timeout = 1;
 
 void show_error(const char *txt) {
@@ -621,8 +622,14 @@ gboolean connect_to_pulse(gpointer userdata) {
             reconnect_timeout = 5;
         }
         else {
-            reconnect_timeout = -1;
-            Gtk::Main::quit();
+            if(!retry) {
+                reconnect_timeout = -1;
+                Gtk::Main::quit();
+            } else {
+                g_debug(_("Connection failed, attempting reconnect"));
+                reconnect_timeout = 5;
+                g_timeout_add_seconds(reconnect_timeout, connect_to_pulse, w);
+            }
         }
     }
 
@@ -651,6 +658,12 @@ int main(int argc, char *argv[]) {
     entry.set_description(_("Select a specific tab on load."));
     group.add_entry(entry, default_tab);
 
+    Glib::OptionEntry entry2;
+    entry2.set_long_name("retry");
+    entry2.set_short_name('r');
+    entry2.set_description(_("Retry forever if pa quits (every 5 seconds)."));
+    group.add_entry(entry2, retry);
+
     options.set_main_group(group);
 
     try {



More information about the pulseaudio-commits mailing list