mirror of https://github.com/OpenVPN/openvpn-gui
Remove tray icon during exit processing
During the wait for threads to exit, we no longer sleep, but continue pumping messages. Disable the tray icon during this period to not allow user interaction with the main menu. Signed-off-by: Selva Nair <selva.nair@gmail.com>pull/608/head
parent
ecf9998652
commit
f8a243fbe8
7
main.c
7
main.c
|
@ -357,6 +357,8 @@ StopAllOpenVPN()
|
|||
{
|
||||
int i;
|
||||
|
||||
RemoveTrayIcon();
|
||||
|
||||
/* Stop all connections started by us -- we leave persistent ones
|
||||
* at their current state. Use the disconnect menu to put them into
|
||||
* hold state before exit, if desired.
|
||||
|
@ -849,6 +851,8 @@ ShowSettingsDialog()
|
|||
void
|
||||
CloseApplication(HWND hwnd, BOOL ask_user)
|
||||
{
|
||||
/* Do not let user access main menu through tray icon */
|
||||
RemoveTrayIcon();
|
||||
/* Show a message if any non-persistent connections are active */
|
||||
for (connection_t *c = o.chead; c && ask_user; c = c->next)
|
||||
{
|
||||
|
@ -861,6 +865,9 @@ CloseApplication(HWND hwnd, BOOL ask_user)
|
|||
/* Ask for confirmation if still connected */
|
||||
if (ShowLocalizedMsgEx(MB_YESNO|MB_TOPMOST, o.hWnd, _T("Exit OpenVPN"), IDS_NFO_ACTIVE_CONN_EXIT) == IDNO)
|
||||
{
|
||||
/* recreate the tray icon */
|
||||
ShowTrayIcon();
|
||||
CheckAndSetTrayIcon();
|
||||
return;
|
||||
}
|
||||
break; /* show the above message box only once */
|
||||
|
|
12
tray.c
12
tray.c
|
@ -388,15 +388,23 @@ OnNotifyTray(LPARAM lParam)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
RemoveTrayIcon()
|
||||
{
|
||||
if (ni.hWnd)
|
||||
{
|
||||
Shell_NotifyIcon(NIM_DELETE, &ni);
|
||||
CLEAR(ni);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
OnDestroyTray()
|
||||
{
|
||||
DestroyMenu(hMenu);
|
||||
Shell_NotifyIcon(NIM_DELETE, &ni);
|
||||
RemoveTrayIcon();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ShowTrayIcon()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue