Add a new set of icons for connection states and notifications
- The notification icons and status window and menu item states can now optionally use icons that resemble the main application icon. New icons for five states (disconnected, connecting, connected, connected_with_errors, idle_error) are loaded though we currently use only the first three. TODO: Indicate connected-with-errors state using the corresponding icon, and improve how states are reported when there are multiple connections with conflicting states. Signed-off-by: Selva Nair <selva.nair@gmail.com>pull/612/head
|
@ -73,8 +73,11 @@ openvpn_gui_RESOURCES = \
|
||||||
res/connected.ico \
|
res/connected.ico \
|
||||||
res/connecting.ico \
|
res/connecting.ico \
|
||||||
res/disconnected.ico \
|
res/disconnected.ico \
|
||||||
|
res/connected_error.ico \
|
||||||
|
res/connected_old.ico \
|
||||||
|
res/connecting_old.ico \
|
||||||
|
res/disconnected_old.ico \
|
||||||
res/openvpn-gui.ico \
|
res/openvpn-gui.ico \
|
||||||
res/reconnecting.ico \
|
|
||||||
res/eye.ico \
|
res/eye.ico \
|
||||||
res/eye-stroke.ico \
|
res/eye-stroke.ico \
|
||||||
res/openvpn-gui.manifest \
|
res/openvpn-gui.manifest \
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "registry.h"
|
#include "registry.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "tray.h"
|
||||||
|
|
||||||
extern options_t o;
|
extern options_t o;
|
||||||
|
|
||||||
|
@ -304,8 +305,26 @@ LoadLocalizedIconEx(const UINT iconId, int cxDesired, int cyDesired)
|
||||||
{
|
{
|
||||||
LANGID langId = GetGUILanguage();
|
LANGID langId = GetGUILanguage();
|
||||||
|
|
||||||
|
UINT iconId_pref = iconId;
|
||||||
|
if (o.use_legacy_icons)
|
||||||
|
{
|
||||||
|
switch(iconId)
|
||||||
|
{
|
||||||
|
case ID_ICO_CONNECTED:
|
||||||
|
iconId_pref = ID_ICO_CONNECTED_LEGACY;
|
||||||
|
break;
|
||||||
|
case ID_ICO_DISCONNECTED:
|
||||||
|
iconId_pref = ID_ICO_DISCONNECTED_LEGACY;
|
||||||
|
break;
|
||||||
|
case ID_ICO_CONNECTING:
|
||||||
|
case ID_ICO_CONNECTED_ERR:
|
||||||
|
iconId_pref = ID_ICO_CONNECTING_LEGACY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HICON hIcon =
|
HICON hIcon =
|
||||||
(HICON) LoadImage (o.hInstance, MAKEINTRESOURCE(iconId),
|
(HICON) LoadImage (o.hInstance, MAKEINTRESOURCE(iconId_pref),
|
||||||
IMAGE_ICON, cxDesired, cyDesired, LR_DEFAULTSIZE|LR_SHARED);
|
IMAGE_ICON, cxDesired, cyDesired, LR_DEFAULTSIZE|LR_SHARED);
|
||||||
if (hIcon)
|
if (hIcon)
|
||||||
return hIcon;
|
return hIcon;
|
||||||
|
@ -316,7 +335,7 @@ LoadLocalizedIconEx(const UINT iconId, int cxDesired, int cyDesired)
|
||||||
* from the first image in the resource
|
* from the first image in the resource
|
||||||
*/
|
*/
|
||||||
/* find group icon resource */
|
/* find group icon resource */
|
||||||
HRSRC res = FindResourceLang(RT_GROUP_ICON, MAKEINTRESOURCE(iconId), langId);
|
HRSRC res = FindResourceLang(RT_GROUP_ICON, MAKEINTRESOURCE(iconId_pref), langId);
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -553,6 +572,8 @@ GeneralSettingsDlgProc(HWND hwndDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lPar
|
||||||
Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_PLAP_REG), BST_CHECKED);
|
Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_PLAP_REG), BST_CHECKED);
|
||||||
if (o.enable_auto_restart)
|
if (o.enable_auto_restart)
|
||||||
Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_AUTO_RESTART), BST_CHECKED);
|
Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_AUTO_RESTART), BST_CHECKED);
|
||||||
|
if (o.use_legacy_icons)
|
||||||
|
Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_LEGACY_ICONS), BST_CHECKED);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -601,7 +622,9 @@ GeneralSettingsDlgProc(HWND hwndDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lPar
|
||||||
(Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_SHOW_SCRIPT_WIN)) == BST_CHECKED);
|
(Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_SHOW_SCRIPT_WIN)) == BST_CHECKED);
|
||||||
o.enable_auto_restart =
|
o.enable_auto_restart =
|
||||||
(Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_AUTO_RESTART)) == BST_CHECKED);
|
(Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_AUTO_RESTART)) == BST_CHECKED);
|
||||||
|
o.use_legacy_icons =
|
||||||
|
(Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_LEGACY_ICONS)) == BST_CHECKED);
|
||||||
|
CheckAndSetTrayIcon(); /* in case icons changed */
|
||||||
|
|
||||||
SaveRegistryKeys();
|
SaveRegistryKeys();
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,10 @@
|
||||||
#define ID_ICO_DISCONNECTED 93
|
#define ID_ICO_DISCONNECTED 93
|
||||||
#define ID_ICO_EYE 94
|
#define ID_ICO_EYE 94
|
||||||
#define ID_ICO_EYESTROKE 95
|
#define ID_ICO_EYESTROKE 95
|
||||||
|
#define ID_ICO_CONNECTED_ERR 96
|
||||||
|
#define ID_ICO_CONNECTED_LEGACY 97
|
||||||
|
#define ID_ICO_CONNECTING_LEGACY 98
|
||||||
|
#define ID_ICO_DISCONNECTED_LEGACY 99
|
||||||
|
|
||||||
/* About Dialog */
|
/* About Dialog */
|
||||||
#define ID_DLG_ABOUT 100
|
#define ID_DLG_ABOUT 100
|
||||||
|
@ -127,6 +131,9 @@
|
||||||
#define ID_EDT_PROXY_USER 251
|
#define ID_EDT_PROXY_USER 251
|
||||||
#define ID_EDT_PROXY_PASS 252
|
#define ID_EDT_PROXY_PASS 252
|
||||||
|
|
||||||
|
/* General Settings continued */
|
||||||
|
#define ID_CHK_LEGACY_ICONS 260
|
||||||
|
|
||||||
/* Advanced dialog */
|
/* Advanced dialog */
|
||||||
#define ID_DLG_ADVANCED 270
|
#define ID_DLG_ADVANCED 270
|
||||||
#define ID_TXT_FOLDER 271
|
#define ID_TXT_FOLDER 271
|
||||||
|
|
|
@ -379,6 +379,7 @@ OnStateChange(connection_t *c, char *data)
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
SetDlgItemText(c->hwndStatus, ID_TXT_STATUS, LoadLocalizedString(IDS_NFO_STATE_ROUTE_ERROR));
|
SetDlgItemText(c->hwndStatus, ID_TXT_STATUS, LoadLocalizedString(IDS_NFO_STATE_ROUTE_ERROR));
|
||||||
|
SetStatusWinIcon(c->hwndStatus, ID_ICO_CONNECTED_ERR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -379,6 +379,7 @@ InitOptions(options_t *opt)
|
||||||
opt->version = MakeVersion (PACKAGE_VERSION_RESOURCE);
|
opt->version = MakeVersion (PACKAGE_VERSION_RESOURCE);
|
||||||
opt->clr_warning = RGB(0xff, 0, 0);
|
opt->clr_warning = RGB(0xff, 0, 0);
|
||||||
opt->clr_error = RGB(0xff, 0, 0);
|
opt->clr_error = RGB(0xff, 0, 0);
|
||||||
|
opt->use_legacy_icons = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -246,6 +246,7 @@ typedef struct {
|
||||||
TCHAR *action_arg;
|
TCHAR *action_arg;
|
||||||
HANDLE session_semaphore;
|
HANDLE session_semaphore;
|
||||||
HANDLE event_log;
|
HANDLE event_log;
|
||||||
|
DWORD use_legacy_icons;
|
||||||
} options_t;
|
} options_t;
|
||||||
|
|
||||||
void InitOptions(options_t *);
|
void InitOptions(options_t *);
|
||||||
|
|
|
@ -65,8 +65,11 @@ libopenvpn_plap_la_RESOURCES = \
|
||||||
$(top_srcdir)/res/connected.ico \
|
$(top_srcdir)/res/connected.ico \
|
||||||
$(top_srcdir)/res/connecting.ico \
|
$(top_srcdir)/res/connecting.ico \
|
||||||
$(top_srcdir)/res/disconnected.ico \
|
$(top_srcdir)/res/disconnected.ico \
|
||||||
|
$(top_srcdir)/res/connected_error.ico \
|
||||||
|
$(top_srcdir)/res/connected_old.ico \
|
||||||
|
$(top_srcdir)/res/connecting_old.ico \
|
||||||
|
$(top_srcdir)/res/disconnected_old.ico \
|
||||||
$(top_srcdir)/res/openvpn-gui.ico \
|
$(top_srcdir)/res/openvpn-gui.ico \
|
||||||
$(top_srcdir)/res/reconnecting.ico \
|
|
||||||
$(top_srcdir)/res/eye.ico \
|
$(top_srcdir)/res/eye.ico \
|
||||||
$(top_srcdir)/res/eye-stroke.ico \
|
$(top_srcdir)/res/eye-stroke.ico \
|
||||||
openvpn-plap-res.rc \
|
openvpn-plap-res.rc \
|
||||||
|
|
|
@ -67,7 +67,8 @@ struct regkey_int {
|
||||||
{L"management_port_offset", &o.mgmt_port_offset, 25340},
|
{L"management_port_offset", &o.mgmt_port_offset, 25340},
|
||||||
{L"enable_peristent_connections", &o.enable_persistent, 2},
|
{L"enable_peristent_connections", &o.enable_persistent, 2},
|
||||||
{L"enable_auto_restart", &o.enable_auto_restart, 1},
|
{L"enable_auto_restart", &o.enable_auto_restart, 1},
|
||||||
{L"ovpn_engine", &o.ovpn_engine, OPENVPN_ENGINE_OVPN2}
|
{L"ovpn_engine", &o.ovpn_engine, OPENVPN_ENGINE_OVPN2},
|
||||||
|
{L"use_legacy_icons", &o.use_legacy_icons, 1},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 4.2 KiB |
|
@ -178,7 +178,7 @@ BEGIN
|
||||||
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
GROUPBOX "Startup", 202, 6, 47, 235, 30
|
||||||
AUTOCHECKBOX "Launch on User &Logon", ID_CHK_STARTUP, 17, 59, 100, 12
|
AUTOCHECKBOX "Launch on User &Logon", ID_CHK_STARTUP, 17, 59, 100, 12
|
||||||
|
|
||||||
GROUPBOX "Preferences", ID_GROUPBOX3, 6, 82, 235, 165
|
GROUPBOX "Preferences", ID_GROUPBOX3, 6, 82, 235, 180
|
||||||
AUTOCHECKBOX "A&ppend to log", ID_CHK_LOG_APPEND, 17, 95, 60, 10
|
AUTOCHECKBOX "A&ppend to log", ID_CHK_LOG_APPEND, 17, 95, 60, 10
|
||||||
AUTOCHECKBOX "Show script &window", ID_CHK_SHOW_SCRIPT_WIN, 17, 110, 200, 10
|
AUTOCHECKBOX "Show script &window", ID_CHK_SHOW_SCRIPT_WIN, 17, 110, 200, 10
|
||||||
AUTOCHECKBOX "S&ilent connection", ID_CHK_SILENT, 17, 125, 200, 10
|
AUTOCHECKBOX "S&ilent connection", ID_CHK_SILENT, 17, 125, 200, 10
|
||||||
|
@ -193,6 +193,7 @@ BEGIN
|
||||||
AUTORADIOBUTTON "&Disable", ID_RB_BALLOON5, 181, 200, 40, 10
|
AUTORADIOBUTTON "&Disable", ID_RB_BALLOON5, 181, 200, 40, 10
|
||||||
AUTOCHECKBOX "Enable Pre-Logon A&ccess Provider (requires admin access)", ID_CHK_PLAP_REG, 17, 215, 200, 10
|
AUTOCHECKBOX "Enable Pre-Logon A&ccess Provider (requires admin access)", ID_CHK_PLAP_REG, 17, 215, 200, 10
|
||||||
AUTOCHECKBOX "Enable auto restart of active connections", ID_CHK_AUTO_RESTART, 17, 230, 200, 10
|
AUTOCHECKBOX "Enable auto restart of active connections", ID_CHK_AUTO_RESTART, 17, 230, 200, 10
|
||||||
|
AUTOCHECKBOX "Use legacy icons", ID_CHK_LEGACY_ICONS, 17, 245, 200, 10
|
||||||
END
|
END
|
||||||
|
|
||||||
/* Advanced Dialog */
|
/* Advanced Dialog */
|
||||||
|
|
|
@ -38,8 +38,12 @@ ID_ICO_APP ICON DISCARDABLE "openvpn-gui.ico"
|
||||||
ID_ICO_CONNECTED ICON DISCARDABLE "connected.ico"
|
ID_ICO_CONNECTED ICON DISCARDABLE "connected.ico"
|
||||||
ID_ICO_CONNECTING ICON DISCARDABLE "connecting.ico"
|
ID_ICO_CONNECTING ICON DISCARDABLE "connecting.ico"
|
||||||
ID_ICO_DISCONNECTED ICON DISCARDABLE "disconnected.ico"
|
ID_ICO_DISCONNECTED ICON DISCARDABLE "disconnected.ico"
|
||||||
|
ID_ICO_CONNECTED_ERR ICON DISCARDABLE "connected_error.ico"
|
||||||
ID_ICO_EYE ICON DISCARDABLE "eye.ico"
|
ID_ICO_EYE ICON DISCARDABLE "eye.ico"
|
||||||
ID_ICO_EYESTROKE ICON DISCARDABLE "eye-stroke.ico"
|
ID_ICO_EYESTROKE ICON DISCARDABLE "eye-stroke.ico"
|
||||||
|
ID_ICO_CONNECTED_LEGACY ICON DISCARDABLE "connected_old.ico"
|
||||||
|
ID_ICO_CONNECTING_LEGACY ICON DISCARDABLE "connecting_old.ico"
|
||||||
|
ID_ICO_DISCONNECTED_LEGACY ICON DISCARDABLE "disconnected_old.ico"
|
||||||
|
|
||||||
#ifdef ENABLE_OVPN3
|
#ifdef ENABLE_OVPN3
|
||||||
#define ADVANCED_DIALOG_HEIGHT 320
|
#define ADVANCED_DIALOG_HEIGHT 320
|
||||||
|
|