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> --tags/v1.8.90
@@ -110,7 +110,8 @@ CConn::CConn(const char* vncServerName, network::Socket* socket=NULL) | |||
vlog.info(_("connected to host %s port %d"), serverHost, serverPort); | |||
} catch (rdr::Exception& e) { | |||
vlog.error("%s", e.str()); | |||
fl_alert("%s", e.str()); | |||
if (alertOnFatalError) | |||
fl_alert("%s", e.str()); | |||
exit_vncviewer(); | |||
return; | |||
} |
@@ -59,6 +59,10 @@ BoolParameter dotWhenNoCursor("DotWhenNoCursor", | |||
"Show the dot cursor when the server sends an " | |||
"invisible cursor", false); | |||
BoolParameter alertOnFatalError("AlertOnFatalError", | |||
"Give a dialog on connection problems rather " | |||
"than exiting immediately", true); | |||
StringParameter passwordFile("PasswordFile", | |||
"Password file for VNC authentication", ""); | |||
AliasParameter passwd("passwd", "Alias for PasswordFile", &passwordFile); | |||
@@ -174,7 +178,8 @@ static VoidParameter* parameterArray[] = { | |||
&sendPrimary, | |||
#endif | |||
&menuKey, | |||
&fullscreenSystemKeys | |||
&fullscreenSystemKeys, | |||
&alertOnFatalError | |||
}; | |||
// Encoding Table |
@@ -60,6 +60,7 @@ extern rfb::BoolParameter sendPrimary; | |||
extern rfb::StringParameter menuKey; | |||
extern rfb::BoolParameter fullscreenSystemKeys; | |||
extern rfb::BoolParameter alertOnFatalError; | |||
#ifndef WIN32 | |||
extern rfb::StringParameter via; |
@@ -494,7 +494,9 @@ int main(int argc, char** argv) | |||
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 @@ int main(int argc, char** argv) | |||
// 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 @@ int main(int argc, char** argv) | |||
} | |||
} 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 @@ int main(int argc, char** argv) | |||
delete cc; | |||
if (exitError != NULL) | |||
if (exitError != NULL && alertOnFatalError) | |||
fl_alert("%s", exitError); | |||
return 0; |
@@ -275,6 +275,10 @@ command is executed with the environment variables \fIL\fR, \fIH\fR, | |||
\fIR\fR, and \fIG\fR taken the values of the local port number, the remote | |||
host, the port number on the remote host, and the gateway machine | |||
respectively. | |||
. | |||
.TP | |||
.B \-AlertOnFatalError | |||
Display a dialog with any fatal error before exiting. Default is on. | |||
.SH FILES | |||
.TP |