summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-09-11 11:14:00 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-09-11 11:14:00 +0000
commit7b6fab706d573bee87ed4df56d4ad42714318e4c (patch)
treea4b3cf44abd3b0e75d554aa8f432d2b5d4174e80 /src
parentc77af32ca5d045a672f97bea69d905646bb7de95 (diff)
flag added to the extra icon creation functions
git-svn-id: http://svn.miranda-ng.org/main/trunk@17281 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/extraicons.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/mir_app/src/extraicons.cpp b/src/mir_app/src/extraicons.cpp
index 10a6bb853b..28579f98b4 100644
--- a/src/mir_app/src/extraicons.cpp
+++ b/src/mir_app/src/extraicons.cpp
@@ -328,18 +328,25 @@ void fnSetAllExtraIcons(MCONTACT hContact)
}
///////////////////////////////////////////////////////////////////////////////
-// Services
+// external functions
-static void EI_PostCreate(BaseExtraIcon *extra, const char *name, int _hLang)
+static void EI_PostCreate(BaseExtraIcon *extra, const char *name, int flags, int _hLang)
{
char setting[512];
mir_snprintf(setting, "Position_%s", name);
extra->setPosition(db_get_w(NULL, MODULE_NAME, setting, 1000));
mir_snprintf(setting, "Slot_%s", name);
- int slot = db_get_w(NULL, MODULE_NAME, setting, 1);
- if (slot == (WORD)-1)
+ int slot = db_get_w(NULL, MODULE_NAME, setting, -100);
+ if (slot == 0xFFFF)
slot = -1;
+ else if (slot == -100) {
+ if (flags & EIF_DISABLED_BY_DEFAULT) {
+ db_set_w(NULL, MODULE_NAME, setting, 0xFFFF);
+ slot = -1;
+ }
+ else slot = 1;
+ }
extra->setSlot(slot);
extra->m_hLangpack = _hLang;
@@ -381,7 +388,7 @@ static void EI_PostCreate(BaseExtraIcon *extra, const char *name, int _hLang)
EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const char *description, const char *descIcon,
MIRANDAHOOK RebuildIcons, MIRANDAHOOK ApplyIcon,
- MIRANDAHOOKPARAM OnClick, LPARAM onClickParam, int _hLang)
+ MIRANDAHOOKPARAM OnClick, LPARAM onClickParam, int flags, int _hLang)
{
// EXTRAICON_TYPE_CALLBACK
if (IsEmpty(name) || IsEmpty(description))
@@ -399,12 +406,12 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const
int id = registeredExtraIcons.getCount() + 1;
BaseExtraIcon *extra = new CallbackExtraIcon(id, name, desc, descIcon == NULL ? "" : descIcon, RebuildIcons, ApplyIcon, OnClick, onClickParam);
- EI_PostCreate(extra, name, _hLang);
+ EI_PostCreate(extra, name, flags, _hLang);
return (HANDLE)id;
}
EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const char *description, const char *descIcon,
- MIRANDAHOOKPARAM OnClick, LPARAM onClickParam, int _hLang)
+ MIRANDAHOOKPARAM OnClick, LPARAM onClickParam, int flags, int _hLang)
{
if (IsEmpty(name) || IsEmpty(description))
return 0;
@@ -443,7 +450,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch
int id = registeredExtraIcons.getCount() + 1;
extra = new IcolibExtraIcon(id, name, desc, descIcon == NULL ? "" : descIcon, OnClick, onClickParam);
- EI_PostCreate(extra, name, _hLang);
+ EI_PostCreate(extra, name, flags, _hLang);
return (HANDLE)id;
}