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:
@@ -57,7 +57,11 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
BPackageManager(
|
BPackageManager(
|
||||||
BPackageInstallationLocation location);
|
BPackageInstallationLocation location,
|
||||||
|
InstallationInterface*
|
||||||
|
installationInterface,
|
||||||
|
UserInteractionHandler*
|
||||||
|
userInteractionHandler);
|
||||||
virtual ~BPackageManager();
|
virtual ~BPackageManager();
|
||||||
|
|
||||||
void Init(uint32 flags);
|
void Init(uint32 flags);
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ private:
|
|||||||
|
|
||||||
PackageManager::PackageManager(BPackageInstallationLocation location)
|
PackageManager::PackageManager(BPackageInstallationLocation location)
|
||||||
:
|
:
|
||||||
BPackageManager(location),
|
BPackageManager(location, &fClientInstallationInterface, this),
|
||||||
BPackageManager::UserInteractionHandler(),
|
BPackageManager::UserInteractionHandler(),
|
||||||
fDecisionProvider(),
|
fDecisionProvider(),
|
||||||
fClientInstallationInterface(),
|
fClientInstallationInterface(),
|
||||||
@@ -281,8 +281,6 @@ PackageManager::PackageManager(BPackageInstallationLocation location)
|
|||||||
fCurrentInstallPackage(NULL),
|
fCurrentInstallPackage(NULL),
|
||||||
fCurrentUninstallPackage(NULL)
|
fCurrentUninstallPackage(NULL)
|
||||||
{
|
{
|
||||||
fInstallationInterface = &fClientInstallationInterface;
|
|
||||||
fUserInteractionHandler = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -293,7 +291,6 @@ PackageManager::~PackageManager()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PackageState
|
PackageState
|
||||||
PackageManager::GetPackageState(const PackageInfo& package)
|
PackageManager::GetPackageState(const PackageInfo& package)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,14 +24,12 @@ using namespace BPackageKit::BPrivate;
|
|||||||
|
|
||||||
PackageManager::PackageManager(BPackageInstallationLocation location)
|
PackageManager::PackageManager(BPackageInstallationLocation location)
|
||||||
:
|
:
|
||||||
BPackageManager(location),
|
BPackageManager(location, &fClientInstallationInterface, this),
|
||||||
BPackageManager::UserInteractionHandler(),
|
BPackageManager::UserInteractionHandler(),
|
||||||
fDecisionProvider(),
|
fDecisionProvider(),
|
||||||
fClientInstallationInterface(),
|
fClientInstallationInterface(),
|
||||||
fPreviousDownloadPercentage(0)
|
fPreviousDownloadPercentage(0)
|
||||||
{
|
{
|
||||||
fInstallationInterface = &fClientInstallationInterface;
|
|
||||||
fUserInteractionHandler = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,9 @@ namespace BPrivate {
|
|||||||
// #pragma mark - BPackageManager
|
// #pragma mark - BPackageManager
|
||||||
|
|
||||||
|
|
||||||
BPackageManager::BPackageManager(BPackageInstallationLocation location)
|
BPackageManager::BPackageManager(BPackageInstallationLocation location,
|
||||||
|
InstallationInterface* installationInterface,
|
||||||
|
UserInteractionHandler* userInteractionHandler)
|
||||||
:
|
:
|
||||||
fLocation(location),
|
fLocation(location),
|
||||||
fSolver(NULL),
|
fSolver(NULL),
|
||||||
@@ -57,8 +59,8 @@ BPackageManager::BPackageManager(BPackageInstallationLocation location)
|
|||||||
fInstalledRepositories(10),
|
fInstalledRepositories(10),
|
||||||
fOtherRepositories(10, true),
|
fOtherRepositories(10, true),
|
||||||
fTransactions(5, true),
|
fTransactions(5, true),
|
||||||
fInstallationInterface(NULL),
|
fInstallationInterface(installationInterface),
|
||||||
fUserInteractionHandler(NULL)
|
fUserInteractionHandler(userInteractionHandler)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ using BPackageKit::BManager::BPrivate::BRepositoryBuilder;
|
|||||||
|
|
||||||
PackageManager::PackageManager(Root* root, Volume* volume)
|
PackageManager::PackageManager(Root* root, Volume* volume)
|
||||||
:
|
:
|
||||||
BPackageManager(volume->Location()),
|
BPackageManager(volume->Location(), this, this),
|
||||||
BPackageManager::UserInteractionHandler(),
|
BPackageManager::UserInteractionHandler(),
|
||||||
fRoot(root),
|
fRoot(root),
|
||||||
fVolume(volume),
|
fVolume(volume),
|
||||||
@@ -41,8 +41,6 @@ PackageManager::PackageManager(Root* root, Volume* volume)
|
|||||||
fPackagesRemovedByUser(),
|
fPackagesRemovedByUser(),
|
||||||
fProblemWindow(NULL)
|
fProblemWindow(NULL)
|
||||||
{
|
{
|
||||||
fInstallationInterface = this;
|
|
||||||
fUserInteractionHandler = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user