From fa4b3ac481054e39110fcb3d38c64eaf73c18a61 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 30 Sep 2010 09:06:51 +0000 Subject: [PATCH] Hide the GNUTLS options in vncviewer when support isn't present. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4150 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- unix/vncviewer/CConn.cxx | 6 +++++- unix/vncviewer/OptionsDialog.h | 27 ++++++++++++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/unix/vncviewer/CConn.cxx b/unix/vncviewer/CConn.cxx index 455faa28..1a75a11d 100644 --- a/unix/vncviewer/CConn.cxx +++ b/unix/vncviewer/CConn.cxx @@ -616,6 +616,7 @@ void CConn::setOptions() { options.sendPrimary.checked(sendPrimary); if (state() == RFBSTATE_NORMAL) { options.shared.disabled(true); +#ifdef HAVE_GNUTLS options.secVeNCrypt.disabled(true); options.encNone.disabled(true); options.encTLS.disabled(true); @@ -625,9 +626,11 @@ void CConn::setOptions() { options.secNone.disabled(true); options.secVnc.disabled(true); options.secPlain.disabled(true); +#endif } else { options.shared.checked(shared); +#ifdef HAVE_GNUTLS /* Process non-VeNCrypt sectypes */ list secTypes = security->GetEnabledSecTypes(); list::iterator i; @@ -684,6 +687,7 @@ void CConn::setOptions() { } } } +#endif } options.fullScreen.checked(fullScreen); options.useLocalCursor.checked(useLocalCursor); @@ -755,6 +759,7 @@ void CConn::getOptions() { desktop->setNoCursor(); checkEncodings(); +#ifdef HAVE_GNUTLS /* Process security types which don't use encryption */ if (options.encNone.checked()) { if (options.secNone.checked()) @@ -839,7 +844,6 @@ void CConn::getOptions() { security->DisableSecType(secTypeX509Plain); } -#ifdef HAVE_GNUTLS CSecurityTLS::x509ca.setParam(options.ca.getText()); CSecurityTLS::x509crl.setParam(options.crl.getText()); #endif diff --git a/unix/vncviewer/OptionsDialog.h b/unix/vncviewer/OptionsDialog.h index 549372a2..b7603f37 100644 --- a/unix/vncviewer/OptionsDialog.h +++ b/unix/vncviewer/OptionsDialog.h @@ -41,7 +41,7 @@ class OptionsDialog : public TXDialog, public TXButtonCallback, public TXCheckboxCallback, public TXEntryCallback { public: OptionsDialog(Display* dpy, OptionsDialogCallback* cb_) - : TXDialog(dpy, 750, 450, _("VNC Viewer: Connection Options")), cb(cb_), + : TXDialog(dpy, 450, 450, _("VNC Viewer: Connection Options")), cb(cb_), /* Encoding and color level */ formatAndEnc(dpy, _("Encoding and Color Level:"), this), @@ -78,8 +78,10 @@ public: useLocalCursor(dpy, _("Render cursor locally"), this, false, this), dotWhenNoCursor(dpy, _("Show dot when no cursor"), this, false, this), okButton(dpy, _("OK"), this, this, 60), - cancelButton(dpy, _("Cancel"), this, this, 60), + cancelButton(dpy, _("Cancel"), this, this, 60) +#ifdef HAVE_GNUTLS + , /* Security */ security(dpy, _("Security:"), this), secVeNCrypt(dpy, _("Extended encryption and authentication methods (VeNCrypt)"), @@ -102,6 +104,7 @@ public: this, false, this), secPlain(dpy, _("Username and password (insecure without encryption)"), this, false, this) +#endif { /* Render the first collumn */ int y = yPad; @@ -159,16 +162,11 @@ public: dotWhenNoCursor.move(xPad, y); y += dotWhenNoCursor.height(); - - /* Render "OK" and "Cancel" buttons */ - okButton.move(width() - xPad*12 - cancelButton.width() - okButton.width(), - height() - yPad*4 - okButton.height()); - cancelButton.move(width() - xPad*6 - cancelButton.width(), - height() - yPad*4 - cancelButton.height()); - +#ifdef HAVE_GNUTLS /* Render the second collumn */ y = yPad; xPad += SECOND_COL_XPAD; + resize(750, height()); security.move(xPad, y); y += security.height(); @@ -200,6 +198,13 @@ public: y += secVnc.height(); secPlain.move(xPad, y); y += secPlain.height(); +#endif + + /* Render "OK" and "Cancel" buttons */ + okButton.move(width() - xPad*12 - cancelButton.width() - okButton.width(), + height() - yPad*4 - okButton.height()); + cancelButton.move(width() - xPad*6 - cancelButton.width(), + height() - yPad*4 - cancelButton.height()); setBorderWidth(1); } @@ -263,6 +268,7 @@ public: compressLevel.disabled(!customCompressLevel.checked()); } else if (checkbox == &noJpeg) { qualityLevel.disabled(autoSelect.checked() || !noJpeg.checked()); +#ifdef HAVE_GNUTLS } else if (checkbox == &secVeNCrypt) { encTLS.checked(false); encTLS.disabled(!secVeNCrypt.checked()); @@ -270,6 +276,7 @@ public: encX509.disabled(!secVeNCrypt.checked()); secPlain.checked(false); secPlain.disabled(!secVeNCrypt.checked()); +#endif } } @@ -289,6 +296,7 @@ public: TXCheckbox shared, fullScreen, useLocalCursor, dotWhenNoCursor; TXButton okButton, cancelButton; +#ifdef HAVE_GNUTLS TXLabel security; TXCheckbox secVeNCrypt; @@ -298,6 +306,7 @@ public: TXLabel authentication; TXCheckbox secNone, secVnc, secPlain; +#endif }; #endif -- 2.39.5