mirror of https://github.com/OpenVPN/openvpn-gui
Rescan configs even when connections are active
Signed-off-by: Selva Nair <selva.nair@gmail.com>pull/47/head
parent
38541f3693
commit
284a4e27e3
|
@ -217,7 +217,13 @@ BuildFileList()
|
||||||
{
|
{
|
||||||
static bool issue_warnings = true;
|
static bool issue_warnings = true;
|
||||||
|
|
||||||
o.num_configs = 0;
|
/*
|
||||||
|
* If no connections are active reset num_configs and rescan
|
||||||
|
* to make a new list. Else we keep all current configs and
|
||||||
|
* rescan to add any new one's found
|
||||||
|
*/
|
||||||
|
if (CountConnState(disconnected) == o.num_configs)
|
||||||
|
o.num_configs = 0;
|
||||||
|
|
||||||
BuildFileList0 (o.config_dir, issue_warnings);
|
BuildFileList0 (o.config_dir, issue_warnings);
|
||||||
|
|
||||||
|
|
16
tray.c
16
tray.c
|
@ -182,8 +182,7 @@ OnNotifyTray(LPARAM lParam)
|
||||||
case WM_RBUTTONUP:
|
case WM_RBUTTONUP:
|
||||||
/* Recreate popup menus */
|
/* Recreate popup menus */
|
||||||
DestroyPopupMenus();
|
DestroyPopupMenus();
|
||||||
if (CountConnState(disconnected) == o.num_configs)
|
BuildFileList();
|
||||||
BuildFileList();
|
|
||||||
CreatePopupMenus();
|
CreatePopupMenus();
|
||||||
|
|
||||||
GetCursorPos(&pt);
|
GetCursorPos(&pt);
|
||||||
|
@ -206,16 +205,13 @@ OnNotifyTray(LPARAM lParam)
|
||||||
else {
|
else {
|
||||||
int disconnected_conns = CountConnState(disconnected);
|
int disconnected_conns = CountConnState(disconnected);
|
||||||
|
|
||||||
if (disconnected_conns == o.num_configs) {
|
DestroyPopupMenus();
|
||||||
/* Reread configs and recreate menus if no connection is running */
|
BuildFileList();
|
||||||
DestroyPopupMenus();
|
CreatePopupMenus();
|
||||||
BuildFileList();
|
|
||||||
CreatePopupMenus();
|
|
||||||
|
|
||||||
/* Start connection if only one config exist */
|
/* Start connection if only one config exist */
|
||||||
if (o.num_configs == 1 && o.conn[0].state == disconnected)
|
if (o.num_configs == 1 && o.conn[0].state == disconnected)
|
||||||
StartOpenVPN(&o.conn[0]);
|
StartOpenVPN(&o.conn[0]);
|
||||||
}
|
|
||||||
else if (disconnected_conns == o.num_configs - 1) {
|
else if (disconnected_conns == o.num_configs - 1) {
|
||||||
/* Show status window if only one connection is running */
|
/* Show status window if only one connection is running */
|
||||||
int i;
|
int i;
|
||||||
|
|
Loading…
Reference in New Issue