summaryrefslogtreecommitdiff
path: root/plugins/Popup
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2013-04-09 18:56:16 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2013-04-09 18:56:16 +0000
commit8f20a72a0c38afd3a51be0af25fb5a3361ed99e7 (patch)
tree232d18247026ca2c601d883aef2c697129ce622b /plugins/Popup
parent96768a83504505276a811a7de3314cb42f1fa272 (diff)
- remove message window icon on exit
git-svn-id: http://svn.miranda-ng.org/main/trunk@4401 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Popup')
-rw-r--r--plugins/Popup/src/main.cpp26
-rw-r--r--plugins/Popup/src/srmm_menu.cpp49
2 files changed, 38 insertions, 37 deletions
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp
index 711ec72259..e7199dae36 100644
--- a/plugins/Popup/src/main.cpp
+++ b/plugins/Popup/src/main.cpp
@@ -66,7 +66,7 @@ HGENMENU hMenuItemHistory;
HANDLE hTTButton;
//===== Options pages =====
-static int OptionsInitialize(WPARAM wParam, LPARAM lParam)
+static int OptionsInitialize(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.position = 100000000;
@@ -108,13 +108,13 @@ static int OptionsInitialize(WPARAM wParam, LPARAM lParam)
return 0;
}
-static int FontsChanged(WPARAM wParam, LPARAM lParam)
+static int FontsChanged(WPARAM, LPARAM)
{
ReloadFonts();
return 0;
}
-static int IconsChanged(WPARAM wParam, LPARAM lParam)
+static int IconsChanged(WPARAM, LPARAM)
{
LoadActions();
@@ -137,7 +137,7 @@ static int IconsChanged(WPARAM wParam, LPARAM lParam)
return 0;
}
-static int TTBLoaded(WPARAM wParam, LPARAM lParam)
+static int TTBLoaded(WPARAM, LPARAM)
{
TTBButton ttb = { sizeof(ttb) };
ttb.pszService = MENUCOMMAND_SVC;
@@ -155,7 +155,7 @@ static int TTBLoaded(WPARAM wParam, LPARAM lParam)
}
//===== EnableDisableMenuCommand =====
-INT_PTR svcEnableDisableMenuCommand(WPARAM wp, LPARAM lp)
+INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM)
{
CLISTMENUITEM mi = { sizeof(mi) };
if (PopUpOptions.ModuleIsEnabled) {
@@ -224,7 +224,7 @@ void InitMenuItems(void)
}
//===== GetStatus =====
-INT_PTR GetStatus(WPARAM wp, LPARAM lp)
+INT_PTR GetStatus(WPARAM, LPARAM)
{
return PopUpOptions.ModuleIsEnabled;
}
@@ -250,7 +250,7 @@ void LoadHotkey()
//menu
//Function which makes the initializations
-static int ModulesLoaded(WPARAM wParam,LPARAM lParam)
+static int ModulesLoaded(WPARAM,LPARAM)
{
//check if History++ is installed
gbHppInstalled = ServiceExists(MS_HPP_GETVERSION) && ServiceExists(MS_HPP_EG_WINDOW) &&
@@ -317,15 +317,16 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
//Called by Miranda to get the information associated to this plugin.
//It only returns the PLUGININFOEX structure, without any test on the version
//@param mirandaVersion - The version of the application calling this function
-MIRAPI PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+MIRAPI PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
//ME_SYSTEM_PRESHUTDOWN event
//called before the app goes into shutdown routine to make sure everyone is happy to exit
-static int OkToExit(WPARAM wParam, LPARAM lParam)
+static int OkToExit(WPARAM, LPARAM)
{
+ SrmmMenu_Unload();
closing = TRUE;
StopPopupThread();
return 0;
@@ -365,10 +366,7 @@ MIRAPI int Load(void)
RegisterOptPrevBox();
// Register in DBEditor++
- DBVARIANT dbv;
- if (db_get(NULL, "KnownModules", MODULNAME, &dbv))
- db_set_s(NULL, "KnownModules", pluginInfoEx.shortName, MODULNAME);
- db_free(&dbv);
+ db_set_s(NULL, "KnownModules", pluginInfoEx.shortName, MODULNAME);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
@@ -423,8 +421,6 @@ MIRAPI int Load(void)
MIRAPI int Unload(void)
{
- SrmmMenu_Unload();
-
DeleteObject(fonts.title);
DeleteObject(fonts.clock);
DeleteObject(fonts.text);
diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp
index b22785143a..32f207e8c4 100644
--- a/plugins/Popup/src/srmm_menu.cpp
+++ b/plugins/Popup/src/srmm_menu.cpp
@@ -30,7 +30,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*************************************************************************************/
static HANDLE hDialogsList = NULL;
-static HANDLE hIconPressed=0,hWindowEvent=0;
static int SrmmMenu_ProcessEvent(WPARAM wParam, LPARAM lParam);
static int SrmmMenu_ProcessIconClick(WPARAM wParam, LPARAM lParam);
@@ -65,23 +64,30 @@ void SrmmMenu_Load()
sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_OFF,0);
CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid);
- hIconPressed = HookEvent(ME_MSG_ICONPRESSED, SrmmMenu_ProcessIconClick);
- hWindowEvent = HookEvent(ME_MSG_WINDOWEVENT, SrmmMenu_ProcessEvent);
-/*
- HANDLE hContact = db_find_first();
- while (hContact)
- {
- SrmmMenu_UpdateIcon(hContact);
- hContact = db_find_next(hContact);
- }
-*/
+ HookEvent(ME_MSG_ICONPRESSED, SrmmMenu_ProcessIconClick);
+ HookEvent(ME_MSG_WINDOWEVENT, SrmmMenu_ProcessEvent);
}
}
void SrmmMenu_Unload()
{
- UnhookEvent(hIconPressed);
- UnhookEvent(hWindowEvent);
+ if (ServiceExists(MS_MSG_REMOVEICON))
+ {
+ StatusIconData sid = { sizeof(sid) };
+ sid.szModule = MODULNAME;
+
+ sid.dwId = 0;
+ CallService(MS_MSG_REMOVEICON, 0, (LPARAM)&sid);
+
+ sid.dwId = 1;
+ CallService(MS_MSG_REMOVEICON, 0, (LPARAM)&sid);
+
+ sid.dwId = 2;
+ CallService(MS_MSG_REMOVEICON, 0, (LPARAM)&sid);
+
+ sid.dwId = 3;
+ CallService(MS_MSG_REMOVEICON, 0, (LPARAM)&sid);
+ }
}
static void SrmmMenu_UpdateIcon(HANDLE hContact)
@@ -102,22 +108,22 @@ static void SrmmMenu_UpdateIcon(HANDLE hContact)
}
}
-static int SrmmMenu_ProcessEvent(WPARAM wParam, LPARAM lParam)
+static int SrmmMenu_ProcessEvent(WPARAM, LPARAM lParam)
{
- MessageWindowEventData *event = (MessageWindowEventData *)lParam;
+ MessageWindowEventData *mwevent = (MessageWindowEventData *)lParam;
- if ( event->uType == MSG_WINDOW_EVT_OPEN )
+ if ( mwevent->uType == MSG_WINDOW_EVT_OPEN )
{
if (!hDialogsList)
hDialogsList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
- WindowList_Add(hDialogsList, event->hwndWindow, event->hContact);
- SrmmMenu_UpdateIcon(event->hContact);
+ WindowList_Add(hDialogsList, mwevent->hwndWindow, mwevent->hContact);
+ SrmmMenu_UpdateIcon(mwevent->hContact);
}
- else if ( event->uType == MSG_WINDOW_EVT_CLOSING )
+ else if ( mwevent->uType == MSG_WINDOW_EVT_CLOSING )
{
if (hDialogsList)
- WindowList_Remove(hDialogsList, event->hwndWindow);
+ WindowList_Remove(hDialogsList, mwevent->hwndWindow);
}
return 0;
@@ -153,8 +159,7 @@ static int SrmmMenu_ProcessIconClick(WPARAM wParam, LPARAM lParam)
}
} else
{
- db_set_b(hContact, MODULNAME, "ShowMode",
- (mode == PU_SHOWMODE_AUTO) ? PU_SHOWMODE_BLOCK : PU_SHOWMODE_AUTO);
+ db_set_b(hContact, MODULNAME, "ShowMode", (mode == PU_SHOWMODE_AUTO) ? PU_SHOWMODE_BLOCK : PU_SHOWMODE_AUTO);
SrmmMenu_UpdateIcon(hContact);
}