Tracker: Rebuild add-on menus using node monitoring in fewer cases.
Change-Id: I5825a94cab14feb509e96c7d0c85848abf28cb37 Reviewed-on: https://review.haiku-os.org/c/haiku/+/9073 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
22375f018d
commit
7061f99814
@@ -324,14 +324,10 @@ BDeskWindow::InitAddOnsList(bool update)
|
|||||||
}
|
}
|
||||||
|
|
||||||
BStringList addOnPaths;
|
BStringList addOnPaths;
|
||||||
BPathFinder::FindPaths(B_FIND_PATH_ADD_ONS_DIRECTORY, "Tracker",
|
BPathFinder::FindPaths(B_FIND_PATH_ADD_ONS_DIRECTORY, "Tracker", addOnPaths);
|
||||||
addOnPaths);
|
|
||||||
int32 count = addOnPaths.CountStrings();
|
int32 count = addOnPaths.CountStrings();
|
||||||
for (int32 i = 0; i < count; i++)
|
for (int32 i = 0; i < count; i++)
|
||||||
LoadAddOnDir(BDirectory(addOnPaths.StringAt(i)), this, fAddOnsList);
|
LoadAddOnDir(BDirectory(addOnPaths.StringAt(i)), this, fAddOnsList);
|
||||||
|
|
||||||
BMessage message(kRebuildAddOnMenus);
|
|
||||||
dynamic_cast<TTracker*>(be_app)->PostMessageToAllContainerWindows(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -379,8 +375,7 @@ BDeskWindow::ApplyShortcutPreferences(bool update)
|
|||||||
bool isInAddOns = false;
|
bool isInAddOns = false;
|
||||||
|
|
||||||
BStringList addOnPaths;
|
BStringList addOnPaths;
|
||||||
BPathFinder::FindPaths(B_FIND_PATH_ADD_ONS_DIRECTORY,
|
BPathFinder::FindPaths(B_FIND_PATH_ADD_ONS_DIRECTORY, "Tracker/", addOnPaths);
|
||||||
"Tracker/", addOnPaths);
|
|
||||||
for (int32 i = 0; i < addOnPaths.CountStrings(); i++) {
|
for (int32 i = 0; i < addOnPaths.CountStrings(); i++) {
|
||||||
if (command.StartsWith(addOnPaths.StringAt(i))) {
|
if (command.StartsWith(addOnPaths.StringAt(i))) {
|
||||||
isInAddOns = true;
|
isInAddOns = true;
|
||||||
@@ -423,9 +418,6 @@ BDeskWindow::ApplyShortcutPreferences(bool update)
|
|||||||
AddOneShortcut(&model, item->key, item->modifiers, this);
|
AddOneShortcut(&model, item->key, item->modifiers, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
message = BMessage(kRebuildAddOnMenus);
|
|
||||||
dynamic_cast<TTracker*>(be_app)->PostMessageToAllContainerWindows(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -611,10 +603,19 @@ BDeskWindow::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_NODE_MONITOR:
|
case B_NODE_MONITOR:
|
||||||
|
{
|
||||||
PRINT(("will update addon shortcuts\n"));
|
PRINT(("will update addon shortcuts\n"));
|
||||||
InitAddOnsList(true);
|
InitAddOnsList(true);
|
||||||
ApplyShortcutPreferences(true);
|
ApplyShortcutPreferences(true);
|
||||||
|
|
||||||
|
// a Tracker add-on may have loaded/unloaded
|
||||||
|
TTracker* tracker = dynamic_cast<TTracker*>(be_app);
|
||||||
|
if (tracker != NULL) {
|
||||||
|
BMessage message(kRebuildAddOnMenus);
|
||||||
|
tracker->PostMessageToAllContainerWindows(message);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
_inherited::MessageReceived(message);
|
_inherited::MessageReceived(message);
|
||||||
|
|||||||
Reference in New Issue
Block a user