Tracker: Fix inconsistent "Open parent" behaviour

1. When in /boot, you couldn't go to the parent (which is fine by itself),
but the menu item wasn't disabled.

2. In Single Window Browsing, doing "Open parent" wasn't respecting that
setting and was opening new windows.

3. In filepanel, when navigating to Desktop folder, the "Go to parent" was
still proposed even though it would do nothing choosing it.

4. Opening a Pose in Single Window Browsing was repopulating the menus and
putting the shortcuts again.  That was an issue if Navigator bar was used
since it conflicts with its shortcuts.

Fixing ticket #6851.
This commit is contained in:
Philippe Saint-Pierre 2012-01-05 21:44:11 -05:00
parent bac3774d59
commit 581a96616a
2 changed files with 30 additions and 3 deletions

View File

@ -1547,6 +1547,7 @@ BContainerWindow::MessageReceived(BMessage *message)
TrackerSettings settings;
if (settings.ShowNavigator() || settings.ShowFullPathInTitleBar())
SetPathWatchingEnabled(true);
SetSingleWindowBrowseShortcuts(settings.SingleWindowBrowse());
// Update draggable folder icon
BView *view = FindView("MenuBar");
@ -1631,6 +1632,7 @@ BContainerWindow::MessageReceived(BMessage *message)
SetPathWatchingEnabled(true);
if (IsPathWatchingEnabled() && !(settings.ShowNavigator() || settings.ShowFullPathInTitleBar()))
SetPathWatchingEnabled(false);
SetSingleWindowBrowseShortcuts(settings.SingleWindowBrowse());
break;
case kDontMoveFilesToTrashChanged:
@ -3069,7 +3071,24 @@ BContainerWindow::UpdateMenu(BMenu *menu, UpdateMenuContext context)
SetArrangeMenu(menu);
SetPasteItem(menu);
EnableNamedMenuItem(menu, kOpenParentDir, !TargetModel()->IsRoot());
BEntry entry(TargetModel()->EntryRef());
BDirectory parent;
entry_ref ref;
BEntry root("/");
bool parentIsRoot = (entry.GetParent(&parent) == B_OK
&& parent.GetEntry(&entry) == B_OK
&& entry.GetRef(&ref) == B_OK
&& entry == root);
EnableNamedMenuItem(menu, kOpenParentDir, !TargetModel()->IsDesktop()
&& !TargetModel()->IsRoot()
&& (!parentIsRoot
|| TrackerSettings().SingleWindowBrowse()
|| TrackerSettings().ShowDisksIcon()
|| (modifiers() & B_CONTROL_KEY) != 0));
EnableNamedMenuItem(menu, kEmptyTrash, count > 0);
EnableNamedMenuItem(menu, B_SELECT_ALL, count > 0);

View File

@ -8051,7 +8051,9 @@ BPoseView::OpenParent()
return;
BEntry root("/");
if (!TrackerSettings().ShowDisksIcon() && entry == root
if (!TrackerSettings().SingleWindowBrowse()
&& !TrackerSettings().ShowNavigator()
&& !TrackerSettings().ShowDisksIcon() && entry == root
&& (modifiers() & B_CONTROL_KEY) == 0)
return;
@ -8072,7 +8074,13 @@ BPoseView::OpenParent()
sizeof (node_ref));
}
be_app->PostMessage(&message);
if (TrackerSettings().SingleWindowBrowse()) {
BMessage msg(kSwitchDirectory);
msg.AddRef("refs", &ref);
Window()->PostMessage(&msg);
} else
be_app->PostMessage(&message);
}