Fix some behavioral regressions introduced by previous commit.

- Some parts of Tracker were basing certain assumptions on whether the
  types list was NULL or not. We now check on list emptiness instead.
This commit is contained in:
Rene Gollent 2012-09-03 16:42:14 -04:00
parent 9335e141ba
commit 139ee87903
2 changed files with 13 additions and 15 deletions

View File

@ -1109,12 +1109,14 @@ Model::SupportsMimeType(const char* type, const BObjectList<BString>* list,
if (type) {
BString typeString(type);
match = MatchMimeTypeString(&typeString, mimeSignature);
} else
match = WhileEachListItem(const_cast<BObjectList<BString>*>(list),
MatchMimeTypeString, mimeSignature);
// const_cast shouldnt be here, have to have it until
// MW cleans up
} else {
if (list != NULL && !list->IsEmpty()) {
match = WhileEachListItem(const_cast<BObjectList<BString>*>(list),
MatchMimeTypeString, mimeSignature);
}
// const_cast shouldnt be here, have to have it until
// MW cleans up
}
if (match == kMatch)
// supports the actual type, it can't get any better
return kModelSupportsType;

View File

@ -130,7 +130,7 @@ void
SpringLoadedFolderSetMenuStates(const BMenu* menu,
const BObjectList<BString>* typeslist)
{
if (!menu || !typeslist)
if (!menu || !typeslist || typeslist->IsEmpty())
return;
// if a types list exists
@ -339,13 +339,6 @@ BNavMenu::AttachedToWindow()
void
BNavMenu::DetachedFromWindow()
{
// does this need to set this to null?
// the parent, handling dnd should set this
// appropriately
//
// if this changes, BeMenu and RecentsMenu
// in Deskbar should also change
fTypesList = NULL;
}
@ -819,7 +812,10 @@ BNavMenu::SetShowParent(bool show)
void
BNavMenu::SetTypesList(const BObjectList<BString>* list)
{
*fTypesList = *list;
if (list != NULL)
*fTypesList = *list;
else
fTypesList->MakeEmpty();
}