diff options
author | George Hazan <george.hazan@gmail.com> | 2015-12-07 11:42:40 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-12-07 11:42:40 +0000 |
commit | fcb800cc6b9c2bf47a65750fa99065cb2a935b87 (patch) | |
tree | 779e721dd5e141d298899b244365a327dabeccea /src | |
parent | c9a044045fb57da188f8fe15912a795c87e9e3ed (diff) |
menu converter now scheduled to be executed after all plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@15825 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/clistmod.cpp | 3 | ||||
-rw-r--r-- | src/mir_app/src/menu_utils.cpp | 52 |
2 files changed, 43 insertions, 12 deletions
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index e99ea438df..535e33f27d 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -38,6 +38,7 @@ void LoadCluiServices(); INT_PTR Docking_IsDocked(WPARAM wParam, LPARAM lParam);
int LoadCLUIModule(void);
int InitClistHotKeys(void);
+void ScheduleMenuUpdate(void);
HANDLE hContactDoubleClicked, hContactIconChangedEvent;
HIMAGELIST hCListImages;
@@ -192,6 +193,8 @@ static void RemoveProtoIconIndex(PROTOACCOUNT *pa) static int ContactListModulesLoaded(WPARAM, LPARAM)
{
+ ScheduleMenuUpdate();
+
RebuildMenuOrder();
for (int i = 0; i < accounts.getCount(); i++)
AddProtoIconIndex(accounts[i]);
diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp index f0bd1dcd82..b3430d527f 100644 --- a/src/mir_app/src/menu_utils.cpp +++ b/src/mir_app/src/menu_utils.cpp @@ -845,10 +845,6 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l /////////////////////////////////////////////////////////////////////////////////////////
-#ifdef _DEBUG
-#define PUTPOSITIONSONMENU
-#endif
-
static int sttDumpItem(TMO_IntMenuItem *pmi, void *szModule)
{
if (!equalUUID(pmi->mi.uid, miid_last)) {
@@ -866,6 +862,46 @@ static int sttDumpItem(TMO_IntMenuItem *pmi, void *szModule) return 0;
}
+#define MS_MENU_UPDATE "System/Genmenu/Update"
+
+static INT_PTR sttUpdateMenuService(WPARAM wParam, LPARAM)
+{
+ CallService(MS_SYSTEM_REMOVEWAIT, wParam, 0);
+ CloseHandle((HANDLE)wParam);
+
+ for (int i = 0; i < g_menus.getCount(); i++) {
+ TIntMenuObject *pmo = g_menus[i];
+ if (!pmo->m_bUseUserDefinedItems)
+ continue;
+
+ char szModule[256];
+ mir_snprintf(szModule, "%s_Items", pmo->pszName);
+
+ // wipe out old trash, write new data & compatibility flag
+ CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szModule);
+ db_set_b(NULL, szModule, "MenuFormat", true);
+
+ MO_RecursiveWalkMenu(pmo->m_items.first, sttDumpItem, szModule);
+ }
+ return 0;
+}
+
+void ScheduleMenuUpdate()
+{
+ // already converted
+ if (db_get_b(NULL, "MainMenu_Items", "MenuFormat", 0) == 0) {
+ HANDLE hEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
+ CreateServiceFunction(MS_MENU_UPDATE, sttUpdateMenuService);
+ CallService(MS_SYSTEM_WAITONHANDLE, (WPARAM)hEvent, (LPARAM)MS_MENU_UPDATE);
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+#ifdef _DEBUG
+#define PUTPOSITIONSONMENU
+#endif
+
static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM wParam, LPARAM lParam)
{
if (pRootMenu == NULL)
@@ -1004,14 +1040,6 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM }
}
- if (bOldMenuFormat && pRootMenu->mi.root == NULL && pmo->m_bUseUserDefinedItems) {
- // wipe out old trash, write new data & compatibility flag
- CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szModule);
- db_set_b(NULL, szModule, "MenuFormat", true);
-
- MO_RecursiveWalkMenu(pmo->m_items.first, sttDumpItem, szModule);
- }
-
return hMenu;
}
|