diff options
author | George Hazan <ghazan@miranda.im> | 2022-03-09 16:01:24 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-03-09 16:01:32 +0300 |
commit | d387ed11456e40f36f359cb3aa9f74a54b8f369b (patch) | |
tree | 58b3c950a6f00ee6664e794ec4a385cc3b10cb34 /plugins/WhoUsesMyFiles/src | |
parent | b5c43418ddb50192686929bac0a6b3190aa6b600 (diff) |
popup control moved from main menu to Options - Popups - Enabled items
Diffstat (limited to 'plugins/WhoUsesMyFiles/src')
-rw-r--r-- | plugins/WhoUsesMyFiles/src/stdafx.h | 4 | ||||
-rw-r--r-- | plugins/WhoUsesMyFiles/src/wumf.cpp | 2 | ||||
-rw-r--r-- | plugins/WhoUsesMyFiles/src/wumfplug.cpp | 39 |
3 files changed, 9 insertions, 36 deletions
diff --git a/plugins/WhoUsesMyFiles/src/stdafx.h b/plugins/WhoUsesMyFiles/src/stdafx.h index db434fd83b..e6e88d1f8f 100644 --- a/plugins/WhoUsesMyFiles/src/stdafx.h +++ b/plugins/WhoUsesMyFiles/src/stdafx.h @@ -49,7 +49,6 @@ struct WUMF_OPTIONS
{
- BOOL PopupsEnabled;
BOOL UseWinColor;
BOOL UseDefColor;
BOOL SelectColor;
@@ -109,6 +108,8 @@ struct CMPlugin : public PLUGIN<CMPlugin> {
CMPlugin();
+ CMOption<bool> bPopups;
+
int Load() override;
int Unload() override;
};
@@ -132,5 +133,4 @@ void process_file(SESSION_INFO_1 s_info, FILE_INFO_3 f_info); void printError(uint32_t res);
#define msg(X) MessageBox(NULL, X, L"WUMF", MB_OK|MB_ICONSTOP)
-#define MS_WUMF_SWITCHPOPUP "WUMF/SwitchPopup"
#define MS_WUMF_CONNECTIONSSHOW "WUMF/ShowConnections"
diff --git a/plugins/WhoUsesMyFiles/src/wumf.cpp b/plugins/WhoUsesMyFiles/src/wumf.cpp index c2d037e673..500dea74a2 100644 --- a/plugins/WhoUsesMyFiles/src/wumf.cpp +++ b/plugins/WhoUsesMyFiles/src/wumf.cpp @@ -200,7 +200,7 @@ void process_file(SESSION_INFO_1 s_info, FILE_INFO_3 f_info) if (!add_cell(&list, w))
msg(TranslateT("Error memory allocation"));
- if (WumfOptions.PopupsEnabled) ShowWumfPopup(w);
+ if (g_plugin.bPopups) ShowWumfPopup(w);
if (WumfOptions.LogToFile) LogWumf(w);
}
else w->mark = FALSE;
diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp index f5ae72ebb6..0ef373eac5 100644 --- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp +++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp @@ -23,8 +23,10 @@ static PLUGININFOEX pluginInfoEx = };
CMPlugin::CMPlugin() :
- PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
-{}
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx),
+ bPopups(MODULENAME, POPUPS_ENABLED, true)
+{
+}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -39,10 +41,7 @@ void LoadOptions() wcsncpy(WumfOptions.LogFile, dbv.pwszVal, 255);
db_free(&dbv);
}
- else
- WumfOptions.LogFile[0] = '\0';
-
- WumfOptions.PopupsEnabled = g_plugin.getByte(POPUPS_ENABLED, TRUE);
+ else WumfOptions.LogFile[0] = '\0';
WumfOptions.UseDefColor = g_plugin.getByte(COLOR_DEF, TRUE);
WumfOptions.UseWinColor = g_plugin.getByte(COLOR_WIN, FALSE);
@@ -179,21 +178,6 @@ static INT_PTR WumfShowConnections(WPARAM, LPARAM) return 0;
}
-static INT_PTR WumfMenuCommand(WPARAM, LPARAM)
-{
- if (WumfOptions.PopupsEnabled == TRUE) {
- WumfOptions.PopupsEnabled = FALSE;
- Menu_ModifyItem(hMenuItem, LPGENW("Enable WUMF popups"), Skin_GetIconHandle(SKINICON_OTHER_NOPOPUP));
- }
- else {
- WumfOptions.PopupsEnabled = TRUE;
- Menu_ModifyItem(hMenuItem, LPGENW("Disable WUMF popups"), Skin_GetIconHandle(SKINICON_OTHER_POPUP));
- }
-
- g_plugin.setByte(POPUPS_ENABLED, (uint8_t)WumfOptions.PopupsEnabled);
- return 0;
-}
-
int InitTopToolbar(WPARAM, LPARAM)
{
TTBButton ttb = {};
@@ -211,22 +195,11 @@ int CMPlugin::Load() {
LoadOptions();
- CreateServiceFunction(MS_WUMF_SWITCHPOPUP, WumfMenuCommand);
CreateServiceFunction(MS_WUMF_CONNECTIONSSHOW, WumfShowConnections);
CMenuItem mi(&g_plugin);
- SET_UID(mi, 0xcfce6487, 0x907b, 0x4822, 0xb0, 0x49, 0x18, 0x4e, 0x47, 0x17, 0x0, 0x69);
- mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 1999990000);
- if (WumfOptions.PopupsEnabled == FALSE) {
- mi.name.a = LPGEN("Enable WUMF popups");
- mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_NOPOPUP);
- }
- else {
- mi.name.a = LPGEN("Disable WUMF popups");
- mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_POPUP);
- }
- mi.pszService = MS_WUMF_SWITCHPOPUP;
+ addPopupOption(LPGEN("WUMF popups"), bPopups);
hMenuItem = Menu_AddMainMenuItem(&mi);
SET_UID(mi, 0xbf93984c, 0xaa05, 0x447c, 0xbd, 0x5c, 0x5f, 0x43, 0x60, 0x92, 0x6a, 0x12);
|