From 44141ccc8e279bfd390b91f2f0b737b39da6481c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 20 Nov 2012 18:41:56 +0000 Subject: automatic extra icon removal on dynamic plugin unloading git-svn-id: http://svn.miranda-ng.org/main/trunk@2399 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/UserInfoEx/src/svc_email.cpp | 11 ++--------- plugins/UserInfoEx/src/svc_gender.cpp | 10 ++-------- plugins/UserInfoEx/src/svc_homepage.cpp | 10 ++-------- plugins/UserInfoEx/src/svc_phone.cpp | 10 ++-------- plugins/UserInfoEx/src/svc_reminder.cpp | 12 +++--------- 5 files changed, 11 insertions(+), 42 deletions(-) (limited to 'plugins') diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp index f0915e64fe..563d0dabf4 100644 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ b/plugins/UserInfoEx/src/svc_email.cpp @@ -283,15 +283,8 @@ VOID SvcEMailEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB) if (hApplyIconHook == NULL) hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnCListApplyIcons); - if (ghExtraIconSvc == INVALID_HANDLE_VALUE) { - EXTRAICON_INFO ico = { sizeof(ico) }; - ico.type = EXTRAICON_TYPE_ICOLIB; - ico.name = "email"; //must be the same as the group name in extraicon - ico.description= "E-mail (uinfoex)"; - ico.descIcon = ICO_BTN_EMAIL; - ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); - ZeroMemory(&ico,sizeof(ico)); - } + if (ghExtraIconSvc == INVALID_HANDLE_VALUE) + ghExtraIconSvc = ExtraIcon_Register("email", "E-mail (uinfoex)", ICO_BTN_EMAIL); } else { // E-mail uncheckt if (hChangedHook) { diff --git a/plugins/UserInfoEx/src/svc_gender.cpp b/plugins/UserInfoEx/src/svc_gender.cpp index cf820a1ba4..7fe59908bd 100644 --- a/plugins/UserInfoEx/src/svc_gender.cpp +++ b/plugins/UserInfoEx/src/svc_gender.cpp @@ -141,14 +141,8 @@ VOID SvcGenderEnableExtraIcons(BYTE bColumn, BOOLEAN bUpdateDB) DB::Setting::WriteByte(SET_CLIST_EXTRAICON_GENDER2, bColumn); if (bEnable) { // Gender checkt or dropdown select - if (ghExtraIconSvc == INVALID_HANDLE_VALUE) { - EXTRAICON_INFO ico = { sizeof(ico) }; - ico.type = EXTRAICON_TYPE_ICOLIB; - ico.name = "gender"; //must be the same as the group name in extraicon - ico.description="Gender (uinfoex)"; - ico.descIcon = ICO_COMMON_MALE; - ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); - } + if (ghExtraIconSvc == INVALID_HANDLE_VALUE) + ghExtraIconSvc = ExtraIcon_Register("gender", "Gender (uinfoex)", ICO_COMMON_MALE); // hook events if (hChangedHook == NULL) diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp index e5d31746f2..7364653d56 100644 --- a/plugins/UserInfoEx/src/svc_homepage.cpp +++ b/plugins/UserInfoEx/src/svc_homepage.cpp @@ -228,14 +228,8 @@ VOID SvcHomepageEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB) if (hApplyIconHook == NULL) hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons); - if (ghExtraIconSvc == INVALID_HANDLE_VALUE) { - EXTRAICON_INFO ico = { sizeof(ico) }; - ico.type = EXTRAICON_TYPE_ICOLIB; - ico.name = "homepage"; //must be the same as the group name in extraicon - ico.description = "Homepage (uinfoex)"; - ico.descIcon = ICO_BTN_GOTO; - ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); - } + if (ghExtraIconSvc == INVALID_HANDLE_VALUE) + ghExtraIconSvc = ExtraIcon_Register("homepage", "Homepage (uinfoex)", ICO_BTN_GOTO); } else { if (hChangedHook) { diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp index 9490a563e9..303fb37bb6 100644 --- a/plugins/UserInfoEx/src/svc_phone.cpp +++ b/plugins/UserInfoEx/src/svc_phone.cpp @@ -173,14 +173,8 @@ VOID SvcPhoneEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB) if (hApplyIconHook == NULL) hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons); - if (ghExtraIconSvc == INVALID_HANDLE_VALUE) { - EXTRAICON_INFO ico = { sizeof(ico) }; - ico.type = EXTRAICON_TYPE_ICOLIB; - ico.name = "sms"; //must be the same as the group name in extraicon - ico.description = "(uinfoex)"; - ico.descIcon = ICO_BTN_CELLULAR; - ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); - } + if (ghExtraIconSvc == INVALID_HANDLE_VALUE) + ghExtraIconSvc = ExtraIcon_Register("sms", "(uinfoex)", ICO_BTN_CELLULAR); } else { if (hChangedHook) { diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index 660d2de23e..a3cc8e63cd 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -968,15 +968,9 @@ VOID SvcReminderEnable(BOOLEAN bEnable) { if (bEnable) // Reminder is on { - if (ExtraIcon == INVALID_HANDLE_VALUE) { - EXTRAICON_INFO ico = { sizeof(ico) }; - ico.type = EXTRAICON_TYPE_ICOLIB; - ico.name = "Reminder"; - ico.description = "Reminder (uinfoex)"; - ico.descIcon = ICO_COMMON_ANNIVERSARY; - ExtraIcon = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); - ZeroMemory(&ico,sizeof(ico)); - } + if (ExtraIcon == INVALID_HANDLE_VALUE) + ExtraIcon = ExtraIcon_Register("Reminder", "Reminder (uinfoex)", ICO_COMMON_ANNIVERSARY); + // init hooks if (!ghCListIA) ghCListIA = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcon); -- cgit v1.2.3