From 34f4c3ec4f135fee3ff025ab530b0df11f267452 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 22 Sep 2013 16:46:33 -0400 Subject: [PATCH] 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. --- src/apps/haiku-depot/PackageInfoView.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/apps/haiku-depot/PackageInfoView.cpp b/src/apps/haiku-depot/PackageInfoView.cpp index 859ddf334e..11d24a8356 100644 --- a/src/apps/haiku-depot/PackageInfoView.cpp +++ b/src/apps/haiku-depot/PackageInfoView.cpp @@ -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(&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);