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;
|
int i;
|
||||||
|
|
||||||
|
RemoveTrayIcon();
|
||||||
|
|
||||||
/* Stop all connections started by us -- we leave persistent ones
|
/* Stop all connections started by us -- we leave persistent ones
|
||||||
* at their current state. Use the disconnect menu to put them into
|
* at their current state. Use the disconnect menu to put them into
|
||||||
* hold state before exit, if desired.
|
* hold state before exit, if desired.
|
||||||
|
@ -849,6 +851,8 @@ ShowSettingsDialog()
|
||||||
void
|
void
|
||||||
CloseApplication(HWND hwnd, BOOL ask_user)
|
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 */
|
/* Show a message if any non-persistent connections are active */
|
||||||
for (connection_t *c = o.chead; c && ask_user; c = c->next)
|
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 */
|
/* Ask for confirmation if still connected */
|
||||||
if (ShowLocalizedMsgEx(MB_YESNO|MB_TOPMOST, o.hWnd, _T("Exit OpenVPN"), IDS_NFO_ACTIVE_CONN_EXIT) == IDNO)
|
if (ShowLocalizedMsgEx(MB_YESNO|MB_TOPMOST, o.hWnd, _T("Exit OpenVPN"), IDS_NFO_ACTIVE_CONN_EXIT) == IDNO)
|
||||||
{
|
{
|
||||||
|
/* recreate the tray icon */
|
||||||
|
ShowTrayIcon();
|
||||||
|
CheckAndSetTrayIcon();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break; /* show the above message box only once */
|
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
|
void
|
||||||
OnDestroyTray()
|
OnDestroyTray()
|
||||||
{
|
{
|
||||||
DestroyMenu(hMenu);
|
DestroyMenu(hMenu);
|
||||||
Shell_NotifyIcon(NIM_DELETE, &ni);
|
RemoveTrayIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ShowTrayIcon()
|
ShowTrayIcon()
|
||||||
{
|
{
|
||||||
|
|
1
tray.h
1
tray.h
|
@ -50,6 +50,7 @@ void CreatePopupMenus();
|
||||||
void OnNotifyTray(LPARAM);
|
void OnNotifyTray(LPARAM);
|
||||||
void OnDestroyTray(void);
|
void OnDestroyTray(void);
|
||||||
void ShowTrayIcon();
|
void ShowTrayIcon();
|
||||||
|
void RemoveTrayIcon();
|
||||||
void SetTrayIcon(conn_state_t);
|
void SetTrayIcon(conn_state_t);
|
||||||
void SetMenuStatus(connection_t *, conn_state_t);
|
void SetMenuStatus(connection_t *, conn_state_t);
|
||||||
void SetServiceMenuStatus();
|
void SetServiceMenuStatus();
|
||||||
|
|
Loading…
Reference in New Issue