bool GeneralView::_CanFindServer(entry_ref* ref) { // Try searching with be_roster if (be_roster->FindApp(kNotificationServerSignature, ref) == B_OK) return true; // Try with a query and take the first result BVolumeRoster vroster; BVolume volume; char volName[B_FILE_NAME_LENGTH]; vroster.Rewind(); while (vroster.GetNextVolume(&volume) == B_OK) { if ((volume.InitCheck() != B_OK) || !volume.KnowsQuery()) continue; volume.GetName(volName); BQuery *query = new BQuery(); query->SetPredicate("(BEOS:APP_SIG==\""kNotificationServerSignature"\")"); query->SetVolume(&volume); query->Fetch(); if (query->GetNextRef(ref) == B_OK) return true; } return false; }
/*! \brief Finds a BPartition by mount path. */ status_t BDiskDeviceRoster::FindPartitionByMountPoint(const char* mountPoint, BDiskDevice* device, BPartition** _partition) { BVolume volume(dev_for_path(mountPoint)); if (volume.InitCheck() == B_OK && FindPartitionByVolume(volume, device, _partition)) return B_OK; return B_ENTRY_NOT_FOUND; }
// SymLink handling: // symlink pose uses the resolved model to retrieve the icon, if not broken // everything else, like the attributes, etc. is retrieved directly from the // symlink itself BPose::BPose(Model* model, BPoseView* view, uint32 clipboardMode, bool selected) : fModel(model), fWidgetList(4, true), fClipboardMode(clipboardMode), fPercent(-1), fSelectionTime(0), fIsSelected(selected), fHasLocation(false), fNeedsSaveLocation(false), fListModeInited(false), fWasAutoPlaced(false), fBrokenSymLink(false), fBackgroundClean(false) { CreateWidgets(view); if (model->IsVolume()) { fs_info info; dev_t device = model->NodeRef()->device; BVolume* volume = new BVolume(device); if (volume->InitCheck() == B_OK && fs_stat_dev(device, &info) == B_OK) { // Philosophy here: // Bars go on all read/write volumes // Exceptions: Not on CDDA if (strcmp(info.fsh_name,"cdda") != 0 && !volume->IsReadOnly()) { // The volume is ok and we want space bars on it gPeriodicUpdatePoses.AddPose(this, view, _PeriodicUpdateCallback, volume); if (TrackerSettings().ShowVolumeSpaceBar()) fPercent = CalcFreeSpace(volume); } else delete volume; } else delete volume; } }
/*! \brief Returns whether two BVolume objects are equal. Two volume objects are said to be equal, if they either are both uninitialized, or both are initialized and refer to the same volume. \param volume The object to be compared with. \result \c true, if this object and the supplied one are equal, \c false otherwise. */ bool BVolume::operator==(const BVolume &volume) const { return ((InitCheck() != B_OK && volume.InitCheck() != B_OK) || fDevice == volume.fDevice); }