summaryrefslogtreecommitdiff
path: root/plugins/ProxySwitch/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-05 21:10:22 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-05 21:10:22 +0300
commitd9fddc0cfa9066eb1b5ad3f4807b37426ae6ca88 (patch)
treef09baaf9b91477d009cedc5bd77449b0fa3e3af7 /plugins/ProxySwitch/src
parent8a1ff32e54b39ceef22df61bda17bbfda94918fc (diff)
Popup:
- wiping out checks for service presence; - code cleaning
Diffstat (limited to 'plugins/ProxySwitch/src')
-rw-r--r--plugins/ProxySwitch/src/main.cpp38
-rw-r--r--plugins/ProxySwitch/src/opt.cpp11
-rw-r--r--plugins/ProxySwitch/src/stdafx.h2
3 files changed, 17 insertions, 34 deletions
diff --git a/plugins/ProxySwitch/src/main.cpp b/plugins/ProxySwitch/src/main.cpp
index b5c8f01d3e..30a452c6a6 100644
--- a/plugins/ProxySwitch/src/main.cpp
+++ b/plugins/ProxySwitch/src/main.cpp
@@ -53,8 +53,6 @@ UINT opt_not_restarted;
COLORREF opt_bgColor;
COLORREF opt_txtColor;
-UINT opt_popupPluginInstalled;
-
static HANDLE hEventConnect = NULL;
static HANDLE hEventDisconnect = NULL;
static HANDLE hSvcPopupSwitch = NULL;
@@ -77,17 +75,12 @@ void PopupMyIPAddrs(const wchar_t *msg)
POPUPDATAW ppd = {};
wcsncpy_s(ppd.lpwzText, Print_NIF_List(list, msg), _TRUNCATE);
- if (opt_popupPluginInstalled) {
- LoadSettings();
- ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_PROXY));
- wcsncpy_s(ppd.lpwzContactName, TranslateT("Current IP address"), _TRUNCATE);
- ppd.colorBack = opt_defaultColors ? 0 : opt_bgColor;
- ppd.colorText = opt_defaultColors ? 0 : opt_txtColor;
- PUAddPopupW(&ppd);
- }
- else {
- MessageBox(NULL, ppd.lpwzText, _A2T(MODULENAME), MB_OK | MB_ICONINFORMATION);
- }
+ LoadSettings();
+ ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_PROXY));
+ wcsncpy_s(ppd.lpwzContactName, TranslateT("Current IP address"), _TRUNCATE);
+ ppd.colorBack = opt_defaultColors ? 0 : opt_bgColor;
+ ppd.colorText = opt_defaultColors ? 0 : opt_txtColor;
+ PUAddPopupW(&ppd);
}
}
@@ -248,8 +241,6 @@ int CMPlugin::Load()
int Init(WPARAM, LPARAM)
{
- opt_popupPluginInstalled = ServiceExists(MS_POPUP_ADDPOPUP);
-
hEventRebound = CreateEvent(NULL, TRUE, FALSE, NULL);
mir_forkthread(IP_WatchDog, 0);
@@ -295,17 +286,14 @@ int Init(WPARAM, LPARAM)
UpdateInterfacesMenu();
- if (opt_popupPluginInstalled) {
- mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0xC0000000);
- mi.name.w = LPGENW("IP change notification");
- mi.hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_LOGO));
- mi.pszService = MS_PROXYSWITCH_POPUPSWITCH;
- hEnableDisablePopupMenu = Menu_AddMainMenuItem(&mi);
- hSvcPopupSwitch = CreateServiceFunction(mi.pszService, PopupSwitch);
-
- UpdatePopupMenu(opt_popups);
- }
+ mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0xC0000000);
+ mi.name.w = LPGENW("IP change notification");
+ mi.hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_LOGO));
+ mi.pszService = MS_PROXYSWITCH_POPUPSWITCH;
+ hEnableDisablePopupMenu = Menu_AddMainMenuItem(&mi);
+ hSvcPopupSwitch = CreateServiceFunction(mi.pszService, PopupSwitch);
+ UpdatePopupMenu(opt_popups);
return 0;
}
diff --git a/plugins/ProxySwitch/src/opt.cpp b/plugins/ProxySwitch/src/opt.cpp
index e78de5e9b7..4f2b5927f0 100644
--- a/plugins/ProxySwitch/src/opt.cpp
+++ b/plugins/ProxySwitch/src/opt.cpp
@@ -49,11 +49,10 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
CheckDlgButton(hdlg, IDC_CHECK_DEFAULTCOLORS, opt_defaultColors ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hdlg, IDC_CHECK_SHOWPROXYSTATUS, opt_showProxyState ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hdlg, IDC_CHECK_FIREFOX), Firefox_Installed());
- EnableWindow(GetDlgItem(hdlg, IDC_CHECK_POPUPS), opt_popupPluginInstalled);
- EnableWindow(GetDlgItem(hdlg, IDC_BGCOLOR), opt_popupPluginInstalled && opt_popups && !opt_defaultColors);
- EnableWindow(GetDlgItem(hdlg, IDC_TEXTCOLOR), opt_popupPluginInstalled && opt_popups && !opt_defaultColors);
- EnableWindow(GetDlgItem(hdlg, IDC_CHECK_DEFAULTCOLORS), opt_popupPluginInstalled && opt_popups);
- EnableWindow(GetDlgItem(hdlg, IDC_CHECK_SHOWPROXYSTATUS), opt_popupPluginInstalled && opt_popups);
+ EnableWindow(GetDlgItem(hdlg, IDC_BGCOLOR), opt_popups && !opt_defaultColors);
+ EnableWindow(GetDlgItem(hdlg, IDC_TEXTCOLOR), opt_popups && !opt_defaultColors);
+ EnableWindow(GetDlgItem(hdlg, IDC_CHECK_DEFAULTCOLORS), opt_popups);
+ EnableWindow(GetDlgItem(hdlg, IDC_CHECK_SHOWPROXYSTATUS), opt_popups);
ShowWindow(GetDlgItem(hdlg, IDC_RESTARTREQUIRED), opt_not_restarted ? SW_SHOW : SW_HIDE);
TranslateDialogDefault(hdlg);
opt_startup = FALSE;
@@ -108,8 +107,6 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
case IDC_CHECK_DEFAULTCOLORS:
case IDC_CHECK_POPUPS:
- if (!opt_popupPluginInstalled)
- break;
EnableWindow(GetDlgItem(hdlg, IDC_BGCOLOR), IsDlgButtonChecked(hdlg, IDC_CHECK_POPUPS) && !IsDlgButtonChecked(hdlg, IDC_CHECK_DEFAULTCOLORS));
EnableWindow(GetDlgItem(hdlg, IDC_TEXTCOLOR), IsDlgButtonChecked(hdlg, IDC_CHECK_POPUPS) && !IsDlgButtonChecked(hdlg, IDC_CHECK_DEFAULTCOLORS));
EnableWindow(GetDlgItem(hdlg, IDC_CHECK_DEFAULTCOLORS), IsDlgButtonChecked(hdlg, IDC_CHECK_POPUPS));
diff --git a/plugins/ProxySwitch/src/stdafx.h b/plugins/ProxySwitch/src/stdafx.h
index 0afc33e0dd..f9044260f3 100644
--- a/plugins/ProxySwitch/src/stdafx.h
+++ b/plugins/ProxySwitch/src/stdafx.h
@@ -107,8 +107,6 @@ extern UINT opt_not_restarted;
extern COLORREF opt_bgColor;
extern COLORREF opt_txtColor;
-extern UINT opt_popupPluginInstalled;
-
void LoadSettings(void);
void SaveSettings(void);