BPackageManager: Add mandatory constructor parameters
Require the installation interface and the user interaction handle to be passed to the constructor. Formerly, derived classes set them manually in their constructors. This makes using the class without having to subclass it possible.
This commit is contained in:
parent
88706cfaa5
commit
6722e1ae43
@ -57,7 +57,11 @@ public:
|
||||
|
||||
public:
|
||||
BPackageManager(
|
||||
BPackageInstallationLocation location);
|
||||
BPackageInstallationLocation location,
|
||||
InstallationInterface*
|
||||
installationInterface,
|
||||
UserInteractionHandler*
|
||||
userInteractionHandler);
|
||||
virtual ~BPackageManager();
|
||||
|
||||
void Init(uint32 flags);
|
||||
|
@ -273,7 +273,7 @@ private:
|
||||
|
||||
PackageManager::PackageManager(BPackageInstallationLocation location)
|
||||
:
|
||||
BPackageManager(location),
|
||||
BPackageManager(location, &fClientInstallationInterface, this),
|
||||
BPackageManager::UserInteractionHandler(),
|
||||
fDecisionProvider(),
|
||||
fClientInstallationInterface(),
|
||||
@ -281,8 +281,6 @@ PackageManager::PackageManager(BPackageInstallationLocation location)
|
||||
fCurrentInstallPackage(NULL),
|
||||
fCurrentUninstallPackage(NULL)
|
||||
{
|
||||
fInstallationInterface = &fClientInstallationInterface;
|
||||
fUserInteractionHandler = this;
|
||||
}
|
||||
|
||||
|
||||
@ -293,7 +291,6 @@ PackageManager::~PackageManager()
|
||||
}
|
||||
|
||||
|
||||
|
||||
PackageState
|
||||
PackageManager::GetPackageState(const PackageInfo& package)
|
||||
{
|
||||
|
@ -24,14 +24,12 @@ using namespace BPackageKit::BPrivate;
|
||||
|
||||
PackageManager::PackageManager(BPackageInstallationLocation location)
|
||||
:
|
||||
BPackageManager(location),
|
||||
BPackageManager(location, &fClientInstallationInterface, this),
|
||||
BPackageManager::UserInteractionHandler(),
|
||||
fDecisionProvider(),
|
||||
fClientInstallationInterface(),
|
||||
fPreviousDownloadPercentage(0)
|
||||
{
|
||||
fInstallationInterface = &fClientInstallationInterface;
|
||||
fUserInteractionHandler = this;
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,7 +46,9 @@ namespace BPrivate {
|
||||
// #pragma mark - BPackageManager
|
||||
|
||||
|
||||
BPackageManager::BPackageManager(BPackageInstallationLocation location)
|
||||
BPackageManager::BPackageManager(BPackageInstallationLocation location,
|
||||
InstallationInterface* installationInterface,
|
||||
UserInteractionHandler* userInteractionHandler)
|
||||
:
|
||||
fLocation(location),
|
||||
fSolver(NULL),
|
||||
@ -57,8 +59,8 @@ BPackageManager::BPackageManager(BPackageInstallationLocation location)
|
||||
fInstalledRepositories(10),
|
||||
fOtherRepositories(10, true),
|
||||
fTransactions(5, true),
|
||||
fInstallationInterface(NULL),
|
||||
fUserInteractionHandler(NULL)
|
||||
fInstallationInterface(installationInterface),
|
||||
fUserInteractionHandler(userInteractionHandler)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ using BPackageKit::BManager::BPrivate::BRepositoryBuilder;
|
||||
|
||||
PackageManager::PackageManager(Root* root, Volume* volume)
|
||||
:
|
||||
BPackageManager(volume->Location()),
|
||||
BPackageManager(volume->Location(), this, this),
|
||||
BPackageManager::UserInteractionHandler(),
|
||||
fRoot(root),
|
||||
fVolume(volume),
|
||||
@ -41,8 +41,6 @@ PackageManager::PackageManager(Root* root, Volume* volume)
|
||||
fPackagesRemovedByUser(),
|
||||
fProblemWindow(NULL)
|
||||
{
|
||||
fInstallationInterface = this;
|
||||
fUserInteractionHandler = this;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user