Fix notifications when adding package link dir

When adding a new package link directory, the volume would only be
notified about the addition of the directory itself, not of the addition
of its contents. Add a new PackageLinkDirectory::NotifyDirectoryAdded()
which does the whole job and use it in
PackageLinksDirectory::AddPackage().
This commit is contained in:
Ingo Weinhold 2011-07-15 13:06:28 +02:00
parent a70f4da47e
commit 166412ff77
3 changed files with 25 additions and 4 deletions

View File

@ -149,6 +149,26 @@ PackageLinkDirectory::UpdatePackageDependencies(Package* package,
}
void
PackageLinkDirectory::NotifyDirectoryAdded(PackageLinksListener* listener)
{
NodeWriteLocker writeLocker(this);
listener->PackageLinkNodeAdded(this);
if (fSelfLink != NULL) {
NodeWriteLocker selfLinkLocker(fSelfLink);
listener->PackageLinkNodeAdded(fSelfLink);
}
for (FamilyDependencyList::Iterator it = fDependencyLinks.GetIterator();
DependencyLink* link = it.Next();) {
NodeWriteLocker linkLocker(link);
listener->PackageLinkNodeAdded(link);
}
}
status_t
PackageLinkDirectory::_Update(PackageLinksListener* listener)
{

View File

@ -32,6 +32,9 @@ public:
void UpdatePackageDependencies(Package* package,
PackageLinksListener* listener);
void NotifyDirectoryAdded(
PackageLinksListener* listener);
bool IsEmpty() const
{ return fPackages.IsEmpty(); }

View File

@ -70,10 +70,8 @@ PackageLinksDirectory::AddPackage(Package* package)
// No entry is in the way, so just add the link directory.
AddChild(linkDirectory);
if (fListener != NULL) {
NodeWriteLocker linkDirectoryWriteLocker(linkDirectory);
fListener->PackageLinkNodeAdded(linkDirectory);
}
if (fListener != NULL)
linkDirectory->NotifyDirectoryAdded(fListener);
}
return B_OK;