summaryrefslogtreecommitdiff
path: root/plugins/AddContactPlus
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-12-02 18:19:49 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-12-02 18:19:49 +0000
commitc4582dd65b444e5dae29ada7cc3f6c9a9c20edf3 (patch)
tree17a8627550b202d62df8e1df76d2585d3d0cdeaa /plugins/AddContactPlus
parent5ea5feb7e052ca45af7bc9ed76e4a252bd71950d (diff)
new easy standard way of registering icons: Icon_Register
git-svn-id: http://svn.miranda-ng.org/main/trunk@2601 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AddContactPlus')
-rw-r--r--plugins/AddContactPlus/src/main.cpp33
1 files changed, 10 insertions, 23 deletions
diff --git a/plugins/AddContactPlus/src/main.cpp b/plugins/AddContactPlus/src/main.cpp
index 61f3c1ed38..71d711bde8 100644
--- a/plugins/AddContactPlus/src/main.cpp
+++ b/plugins/AddContactPlus/src/main.cpp
@@ -22,8 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
HINSTANCE hInst;
int hLangpack;
-static HANDLE hModulesLoaded = 0, hChangedIcons = 0, hAccListChanged = 0,
- hMainMenuItem = 0, hToolBarItem = 0, hService = 0;
+static HANDLE hMainMenuItem = 0, hToolBarItem = 0;
HANDLE hIconLibItem;
HWND hAddDlg;
@@ -134,20 +133,13 @@ static int CreateButton(WPARAM, LPARAM)
return 0;
}
+static IconItem icon = { LPGEN("Add Contact"), ICON_ADD, IDI_ADDCONTACT };
+
static int OnModulesLoaded(WPARAM, LPARAM)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszDefaultFile = szFile;
- sid.ptszSection = LPGENT("AddContact+");
- sid.iDefaultIndex = -IDI_ADDCONTACT;
- sid.ptszDescription = LPGENT("Add Contact");
- sid.pszName = ICON_ADD;
- hIconLibItem = Skin_AddIcon(&sid);
- hChangedIcons = HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged);
+ Icon_Register(hInst, LPGEN("AddContact+"), &icon, 1);
+
+ HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged);
HOTKEYDESC hkd = {0};
hkd.cbSize = sizeof(hkd);
@@ -174,19 +166,14 @@ extern "C" int __declspec(dllexport) Load(void)
icex.dwICC = ICC_USEREX_CLASSES;
InitCommonControlsEx(&icex);
- hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- hAccListChanged = HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccListChanged);
- hService = CreateServiceFunction(MS_ADDCONTACTPLUS_SHOW, AddContactPlusDialog);
-
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccListChanged);
+
+ CreateServiceFunction(MS_ADDCONTACTPLUS_SHOW, AddContactPlusDialog);
return 0;
}
extern "C" int __declspec(dllexport) Unload(void)
{
- UnhookEvent(hModulesLoaded);
- UnhookEvent(hChangedIcons);
- UnhookEvent(hAccListChanged);
- DestroyServiceFunction(hService);
-
return 0;
}