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:
@@ -537,14 +537,31 @@ public:
|
|||||||
|
|
||||||
void SetPackage(const PackageInfo& package)
|
void SetPackage(const PackageInfo& package)
|
||||||
{
|
{
|
||||||
Clear();
|
|
||||||
|
|
||||||
PackageManager manager(
|
PackageManager manager(
|
||||||
BPackageKit::B_PACKAGE_INSTALLATION_LOCATION_HOME);
|
BPackageKit::B_PACKAGE_INSTALLATION_LOCATION_HOME);
|
||||||
|
|
||||||
fPackageActions = manager.GetPackageActions(
|
PackageActionList actions = manager.GetPackageActions(
|
||||||
const_cast<PackageInfo*>(&package));
|
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
|
// Add Buttons in reverse action order
|
||||||
for (int32 i = fPackageActions.CountItems() - 1; i >= 0; i--) {
|
for (int32 i = fPackageActions.CountItems() - 1; i >= 0; i--) {
|
||||||
const PackageActionRef& action = fPackageActions.ItemAtFast(i);
|
const PackageActionRef& action = fPackageActions.ItemAtFast(i);
|
||||||
|
|||||||
Reference in New Issue
Block a user