1 /* 2 * Copyright 2011-2015, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Oliver Tappe <zooey@hirschkaefer.de> 7 */ 8 9 10 #include <package/DropRepositoryRequest.h> 11 12 #include <Directory.h> 13 #include <JobQueue.h> 14 #include <Path.h> 15 16 #include <package/RemoveRepositoryJob.h> 17 18 19 namespace BPackageKit { 20 21 22 using namespace BPrivate; 23 24 DropRepositoryRequest(const BContext & context,const BString & repositoryName)25DropRepositoryRequest::DropRepositoryRequest(const BContext& context, 26 const BString& repositoryName) 27 : 28 inherited(context), 29 fRepositoryName(repositoryName) 30 { 31 } 32 33 ~DropRepositoryRequest()34DropRepositoryRequest::~DropRepositoryRequest() 35 { 36 } 37 38 39 status_t CreateInitialJobs()40DropRepositoryRequest::CreateInitialJobs() 41 { 42 status_t result = InitCheck(); 43 if (result != B_OK) 44 return B_NO_INIT; 45 46 RemoveRepositoryJob* removeRepoJob 47 = new (std::nothrow) RemoveRepositoryJob(fContext, 48 BString("Removing repository ") << fRepositoryName, 49 fRepositoryName); 50 if (removeRepoJob == NULL) 51 return B_NO_MEMORY; 52 if ((result = QueueJob(removeRepoJob)) != B_OK) { 53 delete removeRepoJob; 54 return result; 55 } 56 57 return B_OK; 58 } 59 60 61 } // namespace BPackageKit 62