Browse Source

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>
--
tags/v1.8.90
Dr. David Alan Gilbert 6 years ago
parent
commit
f4d1d89f58
5 changed files with 21 additions and 6 deletions
  1. 2
    1
      vncviewer/CConn.cxx
  2. 6
    1
      vncviewer/parameters.cxx
  3. 1
    0
      vncviewer/parameters.h
  4. 8
    4
      vncviewer/vncviewer.cxx
  5. 4
    0
      vncviewer/vncviewer.man

+ 2
- 1
vncviewer/CConn.cxx View File

@@ -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;
}

+ 6
- 1
vncviewer/parameters.cxx View File

@@ -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

+ 1
- 0
vncviewer/parameters.h View File

@@ -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;

+ 8
- 4
vncviewer/vncviewer.cxx View File

@@ -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;

+ 4
- 0
vncviewer/vncviewer.man View File

@@ -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

Loading…
Cancel
Save