Allow removal of GUI prompt on fatal errors
Add a new parameter 'alertOnFatalError' which guards
the displaying of the GUI alert on fatal errors, and
thus when false just gives the textual error.
Now I can do:
while true
do
vncviewer alertOnFatalError=false vm:0
sleep 1
done
and it'll reappear when my VM appears without me getting error
dialogs.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
--
diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx
index de2b423..0ca46af 100644
--- a/vncviewer/vncviewer.cxx
+++ b/vncviewer/vncviewer.cxx
@@ -494,7 +494,9 @@
defaultServerName = loadViewerParameters(NULL);
} catch (rfb::Exception& e) {
defaultServerName = "";
- fl_alert("%s", e.str());
+ vlog.error("%s", e.str());
+ if (alertOnFatalError)
+ fl_alert("%s", e.str());
}
int i = 1;
@@ -532,7 +534,8 @@
// TRANSLATORS: "Parameters" are command line arguments, or settings
// from a file or the Windows registry.
vlog.error(_("Parameters -listen and -via are incompatible"));
- fl_alert(_("Parameters -listen and -via are incompatible"));
+ if (alertOnFatalError)
+ fl_alert(_("Parameters -listen and -via are incompatible"));
exit_vncviewer();
return 1;
}
@@ -580,7 +583,8 @@
}
} catch (rdr::Exception& e) {
vlog.error("%s", e.str());
- fl_alert("%s", e.str());
+ if (alertOnFatalError)
+ fl_alert("%s", e.str());
exit_vncviewer();
return 1;
}
@@ -609,7 +613,7 @@
delete cc;
- if (exitError != NULL)
+ if (exitError != NULL && alertOnFatalError)
fl_alert("%s", exitError);
return 0;