summaryrefslogtreecommitdiff
path: root/plugins/DbEditorPP/src/icons.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-07-15 21:00:11 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-07-15 21:00:11 +0000
commitde98f325061f64cc3be923aa8bb8f5a619711549 (patch)
tree471f8e992f8e2c13b6e951b62a344b12225c8178 /plugins/DbEditorPP/src/icons.cpp
parent66e8bca7ae6dd7936ebc23ddc49d3e3fef9522b4 (diff)
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@14575 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/DbEditorPP/src/icons.cpp')
-rw-r--r--plugins/DbEditorPP/src/icons.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/plugins/DbEditorPP/src/icons.cpp b/plugins/DbEditorPP/src/icons.cpp
index 1e3d755ff0..3e388b7244 100644
--- a/plugins/DbEditorPP/src/icons.cpp
+++ b/plugins/DbEditorPP/src/icons.cpp
@@ -62,26 +62,24 @@ HICON LoadSkinnedDBEIcon(int icon)
return LoadIcon(hInst, MAKEINTRESOURCE(icon));
}
-static PROTOACCOUNT **protocols = NULL;
-static int protoCount = 0;
-
HIMAGELIST LoadIcons()
{
HICON hIcon;
HIMAGELIST hil = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, _countof(dbeIcons), 5);
-
- if (!hil) return NULL;
+ if (!hil)
+ return NULL;
for(int i = 0; i < _countof(dbeIcons); i++)
ImageList_AddIcon(hil, LoadSkinnedDBEIcon(dbeIcons[i]));
+ int protoCount = 0;
+ PROTOACCOUNT **protocols = NULL;
Proto_EnumAccounts(&protoCount, &protocols);
for (int i = 0; i < protoCount; i++) {
- if (!Proto_IsProtocolLoaded(protocols[i]->szModuleName))
+ if (!Proto_GetAccount(protocols[i]->szModuleName))
ImageList_AddIcon(hil, LoadSkinnedDBEIcon(ICO_OFFLINE));
- else
- if (hIcon = Skin_LoadProtoIcon(protocols[i]->szModuleName, ID_STATUS_ONLINE))
+ else if (hIcon = Skin_LoadProtoIcon(protocols[i]->szModuleName, ID_STATUS_ONLINE))
ImageList_AddIcon(hil, hIcon);
else
ImageList_AddIcon(hil, LoadSkinnedDBEIcon(ICO_ONLINE));
@@ -90,18 +88,19 @@ HIMAGELIST LoadIcons()
return hil;
}
-
int GetProtoIconIndex(const char *szProto)
{
if (szProto && szProto[0]) {
- if (protoCount && protocols) {
- for (int i = 0; i < protoCount; i++) {
- if (!mir_strcmp(protocols[i]->szModuleName, szProto))
- return i + _countof(dbeIcons);
- }
- if (Proto_IsProtocolLoaded(szProto))
- return _countof(dbeIcons) - 2; // ICO_ONLINE;
- }
+ int protoCount = 0;
+ PROTOACCOUNT **protocols = NULL;
+ Proto_EnumAccounts(&protoCount, &protocols);
+
+ for (int i = 0; i < protoCount; i++)
+ if (!mir_strcmp(protocols[i]->szModuleName, szProto))
+ return i + _countof(dbeIcons);
+
+ if (Proto_GetAccount(szProto))
+ return _countof(dbeIcons) - 2; // ICO_ONLINE;
}
return _countof(dbeIcons) - 1; // ICO_OFFLINE;
}