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
+8 -6
View File
@@ -1109,12 +1109,14 @@ Model::SupportsMimeType(const char* type, const BObjectList<BString>* list,
if (type) { if (type) {
BString typeString(type); BString typeString(type);
match = MatchMimeTypeString(&typeString, mimeSignature); match = MatchMimeTypeString(&typeString, mimeSignature);
} else } else {
match = WhileEachListItem(const_cast<BObjectList<BString>*>(list), if (list != NULL && !list->IsEmpty()) {
MatchMimeTypeString, mimeSignature); match = WhileEachListItem(const_cast<BObjectList<BString>*>(list),
// const_cast shouldnt be here, have to have it until MatchMimeTypeString, mimeSignature);
// MW cleans up }
// const_cast shouldnt be here, have to have it until
// MW cleans up
}
if (match == kMatch) if (match == kMatch)
// supports the actual type, it can't get any better // supports the actual type, it can't get any better
return kModelSupportsType; return kModelSupportsType;
+5 -9
View File
@@ -130,7 +130,7 @@ void
SpringLoadedFolderSetMenuStates(const BMenu* menu, SpringLoadedFolderSetMenuStates(const BMenu* menu,
const BObjectList<BString>* typeslist) const BObjectList<BString>* typeslist)
{ {
if (!menu || !typeslist) if (!menu || !typeslist || typeslist->IsEmpty())
return; return;
// if a types list exists // if a types list exists
@@ -339,13 +339,6 @@ BNavMenu::AttachedToWindow()
void void
BNavMenu::DetachedFromWindow() 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 void
BNavMenu::SetTypesList(const BObjectList<BString>* list) BNavMenu::SetTypesList(const BObjectList<BString>* list)
{ {
*fTypesList = *list; if (list != NULL)
*fTypesList = *list;
else
fTypesList->MakeEmpty();
} }