Author: anevilyak Date: 2010-01-31 22:27:14 +0100 (Sun, 31 Jan 2010) New Revision: 35368 Changeset: http://dev.haiku-os.org/changeset/35368/haiku Modified: haiku/trunk/src/kits/tracker/CountView.cpp haiku/trunk/src/kits/tracker/CountView.h haiku/trunk/src/kits/tracker/DesktopPoseView.cpp haiku/trunk/src/kits/tracker/DesktopPoseView.h haiku/trunk/src/kits/tracker/FilePanelPriv.cpp haiku/trunk/src/kits/tracker/FilePanelPriv.h haiku/trunk/src/kits/tracker/NavMenu.cpp haiku/trunk/src/kits/tracker/PoseView.cpp haiku/trunk/src/kits/tracker/PoseView.h haiku/trunk/src/kits/tracker/SlowContextPopup.cpp Log: More cleanups: - remove some more leftover desktop integration-related code. - remove special case that would hide the Desktop folder in file panels. - fixed BFilePanel to correctly filter out the trash from the volume root and show it on the desktop like everywhere else. - renamed CountView::Add/RemoveFilter so they don't hide BHandler::Add/RemoveFilter (gcc4 warning). Modified: haiku/trunk/src/kits/tracker/CountView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/CountView.cpp 2010-01-31 21:22:25 UTC (rev 35367) +++ haiku/trunk/src/kits/tracker/CountView.cpp 2010-01-31 21:27:14 UTC (rev 35368) @@ -355,7 +355,7 @@ void -BCountView::AddFilter(const char *string) +BCountView::AddFilterString(const char *string) { fFilterString += string; Invalidate(); @@ -363,7 +363,7 @@ void -BCountView::RemoveFilter() +BCountView::RemoveFilterString() { fFilterString.Truncate(fFilterString.Length() - 1); Invalidate(); Modified: haiku/trunk/src/kits/tracker/CountView.h =================================================================== --- haiku/trunk/src/kits/tracker/CountView.h 2010-01-31 21:22:25 UTC (rev 35367) +++ haiku/trunk/src/kits/tracker/CountView.h 2010-01-31 21:27:14 UTC (rev 35368) @@ -63,8 +63,8 @@ const char *TypeAhead() const; bool IsTypingAhead() const; - void AddFilter(const char *string); - void RemoveFilter(); + void AddFilterString(const char *string); + void RemoveFilterString(); void CancelFilter(); const char *Filter() const; bool IsFiltering() const; Modified: haiku/trunk/src/kits/tracker/DesktopPoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/DesktopPoseView.cpp 2010-01-31 21:22:25 UTC (rev 35367) +++ haiku/trunk/src/kits/tracker/DesktopPoseView.cpp 2010-01-31 21:27:14 UTC (rev 35368) @@ -52,27 +52,6 @@ #include "TrackerString.h" -namespace BPrivate { - -bool -ShouldShowDesktopPose(dev_t device, const Model *model, const PoseInfo *) -{ - if (model->NodeRef()->device != device) { - // avoid having more than one Trash - BDirectory remoteTrash; - if (FSGetTrashDir(&remoteTrash, model->NodeRef()->device) == B_OK) { - node_ref remoteTrashNodeRef; - remoteTrash.GetNodeRef(&remoteTrashNodeRef); - if (remoteTrashNodeRef == *model->NodeRef()) - return false; - } - } - return true; -} - -} // namespace BPrivate - - // #pragma mark - @@ -175,22 +154,11 @@ DesktopPoseView::AddPosesCompleted() { _inherited::AddPosesCompleted(); - AddTrashPose(); + CreateTrashPose(); } bool -DesktopPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo) -{ - ASSERT(TargetModel()); - if (!ShouldShowDesktopPose(TargetModel()->NodeRef()->device, model, poseInfo)) - return false; - - return _inherited::ShouldShowPose(model, poseInfo); -} - - -bool DesktopPoseView::Represents(const node_ref *ref) const { // When the Tracker is set up to integrate non-boot beos volumes, @@ -225,26 +193,6 @@ void -DesktopPoseView::AddTrashPose() -{ - BVolume volume; - if (BVolumeRoster().GetBootVolume(&volume) == B_OK) { - BDirectory trash; - BEntry entry; - node_ref ref; - if (FSGetTrashDir(&trash, volume.Device()) == B_OK - && trash.GetEntry(&entry) == B_OK && entry.GetNodeRef(&ref) == B_OK) { - WatchNewNode(&ref); - Model *model = new Model(&entry); - PoseInfo info; - ReadPoseInfo(model, &info); - CreatePose(model, &info, false, NULL, NULL, true); - } - } -} - - -void DesktopPoseView::StartSettingsWatch() { be_app->LockLooper(); Modified: haiku/trunk/src/kits/tracker/DesktopPoseView.h =================================================================== --- haiku/trunk/src/kits/tracker/DesktopPoseView.h 2010-01-31 21:22:25 UTC (rev 35367) +++ haiku/trunk/src/kits/tracker/DesktopPoseView.h 2010-01-31 21:27:14 UTC (rev 35368) @@ -43,8 +43,6 @@ namespace BPrivate { -bool ShouldShowDesktopPose(dev_t device, const Model *model, const PoseInfo *); - class DesktopPoseView : public BPoseView { // overrides BPoseView to add desktop-view specific code public: @@ -65,7 +63,6 @@ virtual bool FSNotification(const BMessage *); virtual bool IsDesktopView() const; - virtual bool ShouldShowPose(const Model *, const PoseInfo *); virtual bool Represents(const node_ref *) const; virtual bool Represents(const entry_ref *) const; @@ -76,10 +73,6 @@ private: typedef BPoseView _inherited; - friend bool ShouldShowDesktopPose(dev_t device, const Model *, - const PoseInfo *); - - void AddTrashPose(); }; Modified: haiku/trunk/src/kits/tracker/FilePanelPriv.cpp =================================================================== --- haiku/trunk/src/kits/tracker/FilePanelPriv.cpp 2010-01-31 21:22:25 UTC (rev 35367) +++ haiku/trunk/src/kits/tracker/FilePanelPriv.cpp 2010-01-31 21:27:14 UTC (rev 35368) @@ -1595,14 +1595,12 @@ } -bool -BFilePanelPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo) +void +BFilePanelPoseView::AddPosesCompleted() { - if (IsDesktopView() && !ShouldShowDesktopPose(TargetModel()->NodeRef()->device, - model, poseInfo)) - return false; - - return _inherited::ShouldShowPose(model, poseInfo); + _inherited::AddPosesCompleted(); + if (IsDesktopView()) + CreateTrashPose(); } Modified: haiku/trunk/src/kits/tracker/FilePanelPriv.h =================================================================== --- haiku/trunk/src/kits/tracker/FilePanelPriv.h 2010-01-31 21:22:25 UTC (rev 35367) +++ haiku/trunk/src/kits/tracker/FilePanelPriv.h 2010-01-31 21:27:14 UTC (rev 35368) @@ -174,7 +174,7 @@ virtual void SavePoseLocations(BRect * = NULL); virtual EntryListBase *InitDirentIterator(const entry_ref *); - virtual bool ShouldShowPose(const Model *, const PoseInfo *); + virtual void AddPosesCompleted(); virtual bool IsDesktopView() const; void ShowVolumes(bool visible, bool showShared); Modified: haiku/trunk/src/kits/tracker/NavMenu.cpp =================================================================== --- haiku/trunk/src/kits/tracker/NavMenu.cpp 2010-01-31 21:22:25 UTC (rev 35367) +++ haiku/trunk/src/kits/tracker/NavMenu.cpp 2010-01-31 21:27:14 UTC (rev 35368) @@ -521,15 +521,9 @@ model.CloseNode(); // item might be in invisible - // ToDo: - // use more of PoseView's filtering here - if ((size == sizeof(poseInfo) - && !BPoseView::PoseVisible(&model, &poseInfo, false)) - || fIteratingDesktop && !ShouldShowDesktopPose(fNavDir.device, - &model, &poseInfo)) { -// PRINT(("not showing hidden item %s\n", model.Name())); + if (size == sizeof(poseInfo) + && !BPoseView::PoseVisible(&model, &poseInfo)) return true; - } AddOneItem(&model); return true; @@ -588,7 +582,7 @@ result->CloseNode(); if (size == sizeof(poseInfo) && !BPoseView::PoseVisible(result, - &poseInfo, false)) { + &poseInfo)) { // link target does not want to be visible delete newResolvedModel; return NULL; Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2010-01-31 21:22:25 UTC (rev 35367) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2010-01-31 21:27:14 UTC (rev 35368) @@ -1592,6 +1592,26 @@ } +void +BPoseView::CreateTrashPose() +{ + BVolume volume; + if (BVolumeRoster().GetBootVolume(&volume) == B_OK) { + BDirectory trash; + BEntry entry; + node_ref ref; + if (FSGetTrashDir(&trash, volume.Device()) == B_OK + && trash.GetEntry(&entry) == B_OK && entry.GetNodeRef(&ref) == B_OK) { + WatchNewNode(&ref); + Model *model = new Model(&entry); + PoseInfo info; + ReadPoseInfo(model, &info); + CreatePose(model, &info, false, NULL, NULL, true); + } + } +} + + BPose * BPoseView::CreatePose(Model *model, PoseInfo *poseInfo, bool insertionSort, int32 *indexPtr, BRect *boundsPtr, bool forceDraw) @@ -1847,18 +1867,16 @@ bool -BPoseView::PoseVisible(const Model *model, const PoseInfo *poseInfo, - bool inFilePanel) +BPoseView::PoseVisible(const Model *model, const PoseInfo *poseInfo) { - return (!poseInfo->fInvisible - || (inFilePanel && strcmp(model->Name(), B_DESKTOP_DIR_NAME))); + return !poseInfo->fInvisible; } bool BPoseView::ShouldShowPose(const Model *model, const PoseInfo *poseInfo) { - if (!PoseVisible(model, poseInfo, IsFilePanel())) + if (!PoseVisible(model, poseInfo)) return false; // check filter before adding item @@ -6147,7 +6165,7 @@ } else lastString->Truncate(lastString->Length() - 1); - fCountView->RemoveFilter(); + fCountView->RemoveFilterString(); FilterChanged(); break; } @@ -6185,12 +6203,12 @@ break; fFilterStrings.AddItem(new BString()); - fCountView->AddFilter("|"); + fCountView->AddFilterString("|"); break; } fFilterStrings.LastItem()->Append(searchChar); - fCountView->AddFilter(searchChar); + fCountView->AddFilterString(searchChar); FilterChanged(); break; } Modified: haiku/trunk/src/kits/tracker/PoseView.h =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.h 2010-01-31 21:22:25 UTC (rev 35367) +++ haiku/trunk/src/kits/tracker/PoseView.h 2010-01-31 21:27:14 UTC (rev 35368) @@ -323,7 +323,8 @@ void SetActivePose(BPose *); BPose *ActivePose() const; void CommitActivePose(bool saveChanges = true); - static bool PoseVisible(const Model *, const PoseInfo *, bool inFilePanel);bool FrameForPose(BPose *targetpose, bool convert, BRect *poseRect); + static bool PoseVisible(const Model *, const PoseInfo *); + bool FrameForPose(BPose *targetpose, bool convert, BRect *poseRect); bool CreateSymlinkPoseTarget(Model *symlink); // used to complete a symlink pose; returns true if // target symlink should not be shown @@ -456,6 +457,8 @@ // subclasses should always call inherited void CreateVolumePose(BVolume *, bool watchIndividually); + void CreateTrashPose(); + virtual bool AddPosesThreadValid(const entry_ref *) const; // verifies whether or not the current set of AddPoses threads // are valid and allowed to be adding poses -- returns false Modified: haiku/trunk/src/kits/tracker/SlowContextPopup.cpp =================================================================== --- haiku/trunk/src/kits/tracker/SlowContextPopup.cpp 2010-01-31 21:22:25 UTC (rev 35367) +++ haiku/trunk/src/kits/tracker/SlowContextPopup.cpp 2010-01-31 21:27:14 UTC (rev 35368) @@ -344,12 +344,7 @@ model.CloseNode(); - // item might be in invisible - // ToDo: - // use more of PoseView's filtering here - if (fIteratingDesktop && !ShouldShowDesktopPose(fNavDir.device, - &model, &poseInfo)) { -// PRINT(("not showing hidden item %s\n", model.Name())); + if (!BPoseView::PoseVisible(&model, &poseInfo)) { return true; }