diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-10 21:08:51 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-10 21:08:51 +0000 |
commit | 6029165c364f93a84ab7e98ef71d3a711b0f588c (patch) | |
tree | 6149aea694a35781a0d4ed074fbfc64fc09f8875 /plugins/UserInfoEx | |
parent | 6b1fbf4d40fa3b643aca4e9e82a132cc54f36b76 (diff) |
attempt to fix the most crazy pieces of status icons related code
git-svn-id: http://svn.miranda-ng.org/main/trunk@4417 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/UserInfoEx')
-rw-r--r-- | plugins/UserInfoEx/src/Flags/svc_flags.cpp | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index ced26a1b07..75cdf0f5cf 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -336,46 +336,25 @@ MsgWndData::~MsgWndData() { FlagsIconUnset(); //check if realy need
}
-void
-MsgWndData::FlagsIconSet() {
- HICON hIcon = NULL;
- StatusIconData sid = {0};
- sid.cbSize = sizeof(sid);
- sid.szModule = MODNAMEFLAGS;
+void MsgWndData::FlagsIconSet()
+{
/* ensure status icon is registered */
- if ( m_countryID!=0xFFFF || gFlagsOpts.bUseUnknownFlag) {
- /* copy icon as status icon API will call DestroyIcon() on it */
- hIcon = LoadFlagIcon(m_countryID);
- sid.hIcon = (hIcon!=NULL)?CopyIcon(hIcon):NULL;
- Skin_ReleaseIcon(hIcon); /* does NULL check */
- hIcon = sid.hIcon;
- sid.dwId = (DWORD)m_countryID;
- sid.hIconDisabled = sid.hIcon/*NULL*/;
- sid.szTooltip = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,m_countryID,0));
- sid.flags = 0;
+ if (m_countryID != 0xFFFF || gFlagsOpts.bUseUnknownFlag) {
+ StatusIconData sid = { sizeof(sid) };
+ sid.szModule = MODNAMEFLAGS;
+ sid.hIconDisabled = sid.hIcon = LoadFlagIcon(m_countryID);
+ sid.szTooltip = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,m_countryID,0));
if(CallService(MS_MSG_MODIFYICON,(WPARAM)m_hContact,(LPARAM)&sid) !=0) /* not yet registered? */
CallService(MS_MSG_ADDICON,0,(LPARAM)&sid);
}
- sid.hIcon = NULL;
- sid.szTooltip = NULL;
- sid.hIconDisabled = NULL;
- for(int i=0;i<nCountriesCount;++i) {
- sid.dwId = (DWORD)countries[i].id;
- sid.flags = (m_countryID==countries[i].id && hIcon!=NULL)? 0:MBF_HIDDEN;
- CallService(MS_MSG_MODIFYICON,(WPARAM)m_hContact,(LPARAM)&sid);
- }
}
-void
-MsgWndData::FlagsIconUnset() {
- StatusIconData sid = {0};
- sid.cbSize = sizeof(sid);
- sid.szModule = MODNAMEFLAGS;
- sid.dwId = (DWORD)m_countryID;
- sid.flags = MBF_HIDDEN;
+void MsgWndData::FlagsIconUnset()
+{
+ StatusIconData sid = { sizeof(sid) };
+ sid.szModule = MODNAMEFLAGS;
+ sid.flags = MBF_HIDDEN;
CallService(MS_MSG_MODIFYICON,(WPARAM)m_hContact,(LPARAM)&sid);
- /* can't call MS_MSG_REMOVEICON here as the icon might be
- * in use by other contacts simultanously, removing them all at exit */
}
static int CompareMsgWndData(const MsgWndData* p1, const MsgWndData* p2)
|