Overlooked this with my previous Trash-related changes: updated NavMenu to be

behaviorally in sync - it now hides the root volume Trash dir like PoseView,
and adds the Trash entry as needed when navigating down the Desktop.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35125 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent 2010-01-17 17:35:06 +00:00
parent eb30e0668a
commit 782fbf00a7
2 changed files with 24 additions and 1 deletions

View File

@ -128,6 +128,7 @@ class BNavMenu : public BSlowMenu {
void AddOneItem(Model *);
void AddRootItemsIfNeeded();
void AddTrashItem();
static void SetTrackingHookDeep(BMenu *, bool (*)(BMenu *, void *), void *);
entry_ref fNavDir;

View File

@ -412,6 +412,7 @@ BNavMenu::StartBuildingItemList()
fIteratingDesktop = true;
fContainer = DesktopPoseView::InitDesktopDirentIterator(0, startModel.EntryRef());
AddRootItemsIfNeeded();
AddTrashItem();
} else if (FSIsTrashDir(&entry)) {
// the trash window needs to display a union of all the
// trash folders from all the mounted volumes
@ -464,6 +465,18 @@ BNavMenu::AddRootItemsIfNeeded()
}
void
BNavMenu::AddTrashItem()
{
BPath path;
if (find_directory(B_TRASH_DIRECTORY, &path) == B_OK) {
BEntry entry(path.Path());
Model model(&entry);
AddOneItem(&model);
}
}
bool
BNavMenu::AddNextItem()
{
@ -510,7 +523,9 @@ BNavMenu::AddNextItem()
// item might be in invisible
// ToDo:
// use more of PoseView's filtering here
if (fIteratingDesktop && !ShouldShowDesktopPose(fNavDir.device,
if ((size == sizeof(poseInfo)
&& !BPoseView::PoseVisible(&model, &poseInfo, false))
|| fIteratingDesktop && !ShouldShowDesktopPose(fNavDir.device,
&model, &poseInfo)) {
// PRINT(("not showing hidden item %s\n", model.Name()));
return true;
@ -572,6 +587,13 @@ BNavMenu::NewModelItem(Model *model, const BMessage *invokeMessage,
result->CloseNode();
if (size == sizeof(poseInfo) && !BPoseView::PoseVisible(result,
&poseInfo, false)) {
// link target does not want to be visible
delete newResolvedModel;
return NULL;
}
ref = *result->EntryRef();
container = result->IsContainer();
}