From ae36105686d41c335ea64835d2117aa1fce1b7c4 Mon Sep 17 00:00:00 2001 From: Heiko Hund Date: Wed, 9 May 2012 11:13:19 +0200 Subject: [PATCH] don't show status window on openvpn exit if silent --- openvpn.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/openvpn.c b/openvpn.c index db382a4..a63d872 100644 --- a/openvpn.c +++ b/openvpn.c @@ -331,8 +331,11 @@ OnStop(connection_t *c, UNUSED char *msg) SetStatusWinIcon(c->hwndStatus, ID_ICO_DISCONNECTED); EnableWindow(GetDlgItem(c->hwndStatus, ID_DISCONNECT), FALSE); EnableWindow(GetDlgItem(c->hwndStatus, ID_RESTART), FALSE); - SetForegroundWindow(c->hwndStatus); - ShowWindow(c->hwndStatus, SW_SHOW); + if (o.silent_connection[0] == '0') + { + SetForegroundWindow(c->hwndStatus); + ShowWindow(c->hwndStatus, SW_SHOW); + } ShowLocalizedMsg(IDS_NFO_CONN_TERMINATED, c->config_name); SendMessage(c->hwndStatus, WM_CLOSE, 0, 0); break; @@ -349,9 +352,12 @@ OnStop(connection_t *c, UNUSED char *msg) EnableWindow(GetDlgItem(c->hwndStatus, ID_DISCONNECT), FALSE); EnableWindow(GetDlgItem(c->hwndStatus, ID_RESTART), FALSE); SetStatusWinIcon(c->hwndStatus, ID_ICO_DISCONNECTED); - SetForegroundWindow(c->hwndStatus); SetDlgItemText(c->hwndStatus, ID_TXT_STATUS, LoadLocalizedString(txt_id)); - ShowWindow(c->hwndStatus, SW_SHOW); + if (o.silent_connection[0] == '0') + { + SetForegroundWindow(c->hwndStatus); + ShowWindow(c->hwndStatus, SW_SHOW); + } ShowLocalizedMsg(msg_id, c->config_name); SendMessage(c->hwndStatus, WM_CLOSE, 0, 0); break; @@ -465,7 +471,6 @@ StatusDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { case ID_DISCONNECT: SetFocus(GetDlgItem(c->hwndStatus, ID_EDT_LOG)); - c->state = disconnecting; StopOpenVPN(c); return TRUE;