From 8dddc97f2b6585d5d156d7072c19c78be499746a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 12 Apr 2019 19:18:13 +0300 Subject: wiping custom icolib functions: GG --- protocols/Gadu-Gadu/src/core.cpp | 4 ++-- protocols/Gadu-Gadu/src/gg.h | 3 --- protocols/Gadu-Gadu/src/groupchat.cpp | 2 +- protocols/Gadu-Gadu/src/icolib.cpp | 24 ------------------------ protocols/Gadu-Gadu/src/image.cpp | 18 +++++++++--------- protocols/Gadu-Gadu/src/popups.cpp | 3 +-- protocols/Gadu-Gadu/src/sessions.cpp | 2 +- protocols/Gadu-Gadu/src/userutils.cpp | 2 +- 8 files changed, 15 insertions(+), 43 deletions(-) (limited to 'protocols') diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 4807733917..7653d48e17 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -993,14 +993,14 @@ retry: CLISTEVENT cle = { 0 }; cle.hContact = hContact; - cle.hIcon = LoadIconEx("image", FALSE); + cle.hIcon = g_plugin.getIcon(IDI_IMAGE); cle.flags = CLEF_URGENT; cle.hDbEvent = -98; cle.lParam = (LPARAM)img; cle.pszService = service; cle.szTooltip.a = Translate("Incoming image"); g_clistApi.pfnAddEvent(&cle); - ReleaseIconEx("image", FALSE); + g_plugin.releaseIcon(IDI_IMAGE); } } break; diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h index 5ffd8c2d0a..5f88e07527 100644 --- a/protocols/Gadu-Gadu/src/gg.h +++ b/protocols/Gadu-Gadu/src/gg.h @@ -283,9 +283,6 @@ char *gg_avatarhash(char *param); /* IcoLib functions */ void gg_icolib_init(); -HICON LoadIconEx(const char* name, bool big); -HANDLE GetIconHandle(int iconId); -void ReleaseIconEx(const char* name, bool big); /* URI parser functions */ void gg_links_instancemenu_init(); diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 648bb662a0..693216babe 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -415,7 +415,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa { SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)lParam); TranslateDialogDefault(hwndDlg); - Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_CONFERENCE)); + Window_SetIcon_IcoLib(hwndDlg, g_plugin.getIconHandle(IDI_CONFERENCE)); gg_gc_resetclistopts(GetDlgItem(hwndDlg, IDC_CLIST)); // Hook MetaContacts event (if available) diff --git a/protocols/Gadu-Gadu/src/icolib.cpp b/protocols/Gadu-Gadu/src/icolib.cpp index 23189ef17c..db210254ed 100644 --- a/protocols/Gadu-Gadu/src/icolib.cpp +++ b/protocols/Gadu-Gadu/src/icolib.cpp @@ -45,27 +45,3 @@ void gg_icolib_init() { g_plugin.registerIcon("Protocols/" GGDEF_PROTO, iconList, GGDEF_PROTO); } - -HICON LoadIconEx(const char* name, bool big) -{ - char szSettingName[100]; - mir_snprintf(szSettingName, "%s_%s", GGDEF_PROTO, name); - - return IcoLib_GetIcon(szSettingName, big); -} - -HANDLE GetIconHandle(int iconId) -{ - for (const auto &icon : iconList) - if (icon.defIconID == iconId) - return icon.hIcolib; - - return nullptr; -} - -void ReleaseIconEx(const char* name, bool big) -{ - char szSettingName[100]; - mir_snprintf(szSettingName, "%s_%s", GGDEF_PROTO, name); - IcoLib_Release(szSettingName, big); -} diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 2585155bcd..787cb69c56 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -405,23 +405,23 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // Making buttons flat SendDlgItemMessage(hwndDlg, IDC_IMG_PREV, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_IMG_PREV, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("previous", FALSE)); + SendDlgItemMessage(hwndDlg, IDC_IMG_PREV, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_PREV)); SendDlgItemMessage(hwndDlg, IDC_IMG_PREV, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Previous image"), BATF_UNICODE); SendDlgItemMessage(hwndDlg, IDC_IMG_NEXT, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_IMG_NEXT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("next", FALSE)); + SendDlgItemMessage(hwndDlg, IDC_IMG_NEXT, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_NEXT)); SendDlgItemMessage(hwndDlg, IDC_IMG_NEXT, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Next image"), BATF_UNICODE); SendDlgItemMessage(hwndDlg, IDC_IMG_SAVE, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_IMG_SAVE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("save", FALSE)); + SendDlgItemMessage(hwndDlg, IDC_IMG_SAVE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_SAVE)); SendDlgItemMessage(hwndDlg, IDC_IMG_SAVE, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Save image to disk"), BATF_UNICODE); SendDlgItemMessage(hwndDlg, IDC_IMG_DELETE, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_IMG_DELETE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("delete", FALSE)); + SendDlgItemMessage(hwndDlg, IDC_IMG_DELETE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_DELETE)); SendDlgItemMessage(hwndDlg, IDC_IMG_DELETE, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Delete image from the list"), BATF_UNICODE); // Set main window image - Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_IMAGE)); + Window_SetIcon_IcoLib(hwndDlg, g_plugin.getIconHandle(IDI_IMAGE)); wchar_t *szName = Clist_GetContactDisplayName(dat->hContact), szTitle[128]; if (dat->bReceiving) @@ -522,10 +522,10 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP img = img->lpNext; gg_img_releasepicture(temp); } - ReleaseIconEx("previous", FALSE); - ReleaseIconEx("next", FALSE); - ReleaseIconEx("delete", FALSE); - ReleaseIconEx("save", FALSE); + g_plugin.releaseIcon(IDI_PREV); + g_plugin.releaseIcon(IDI_NEXT); + g_plugin.releaseIcon(IDI_DELETE); + g_plugin.releaseIcon(IDI_SAVE); Window_FreeIcon_IcoLib(hwndDlg); gg->gg_EnterCriticalSection(&gg->img_mutex, "gg_img_dlgproc", 58, "img_mutex", 1); list_remove(&gg->imagedlgs, dat, 1); diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp index 8fcf1a00ff..8d6d96e7f9 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -86,8 +86,7 @@ void GaduProto::initpopups() mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Notifications")); puc.colorBack = RGB(173, 206, 247); puc.colorText = GetSysColor(COLOR_WINDOWTEXT); - puc.hIcon = CopyIcon(LoadIconEx("main", FALSE)); - ReleaseIconEx("main", FALSE); + puc.hIcon = g_plugin.getIcon(IDI_GG); puc.iSeconds = 4; hPopupNotify = Popup_RegisterClass(&puc); diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index 6d7ae4893e..6c71aeab95 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -169,7 +169,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w GetWindowText(hwndDlg, oldTitle, _countof(oldTitle)); mir_snwprintf(newTitle, oldTitle, gg->m_tszUserName); SetWindowText(hwndDlg, newTitle); - Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_SESSIONS)); + Window_SetIcon_IcoLib(hwndDlg, g_plugin.getIconHandle(IDI_SESSIONS)); if (hHandCursor == nullptr) hHandCursor = LoadCursor(nullptr, IDC_HAND); diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index dd3a8d5d7f..8b51ba24b1 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -213,7 +213,7 @@ INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_SETTINGS)); + Window_SetIcon_IcoLib(hwndDlg, g_plugin.getIconHandle(IDI_SETTINGS)); dat = (GGUSERUTILDLGDATA *)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); if (dat) SetDlgItemTextA(hwndDlg, IDC_EMAIL, dat->email); // Readup email -- cgit v1.2.3