HaikuDepot: Fix #10000.

- When switching selected packages, compare the new and old package action
  list. If they're the same, don't bother rebuilding the button bar.
This commit is contained in:
Rene Gollent 2013-09-22 16:46:33 -04:00
parent d68208fa16
commit 34f4c3ec4f

View File

@ -537,14 +537,31 @@ public:
void SetPackage(const PackageInfo& package)
{
Clear();
PackageManager manager(
BPackageKit::B_PACKAGE_INSTALLATION_LOCATION_HOME);
fPackageActions = manager.GetPackageActions(
PackageActionList actions = manager.GetPackageActions(
const_cast<PackageInfo*>(&package));
bool clearNeeded = false;
if (actions.CountItems() != fPackageActions.CountItems())
clearNeeded = true;
else {
for (int32 i = 0; i < actions.CountItems(); i++) {
if (strcasecmp(actions.ItemAtFast(i)->Label(),
fPackageActions.ItemAtFast(i)->Label()) != 0) {
clearNeeded = true;
break;
}
}
}
fPackageActions = actions;
if (!clearNeeded)
return;
Clear();
// Add Buttons in reverse action order
for (int32 i = fPackageActions.CountItems() - 1; i >= 0; i--) {
const PackageActionRef& action = fPackageActions.ItemAtFast(i);