1 /* 2 * Copyright 2015, TigerKid001. 3 * Copyright 2020, Andrew Lindesay <apl@lindesay.co.nz> 4 * All rights reserved. Distributed under the terms of the MIT License. 5 */ 6 #ifndef PACKAGE_CONTENTS_VIEW_H 7 #define PACKAGE_CONTENTS_VIEW_H 8 9 #include <Locker.h> 10 #include <View.h> 11 12 #include "PackageInfo.h" 13 14 class BOutlineListView; 15 16 17 class PackageContentsView : public BView { 18 public: 19 PackageContentsView(const char* name); 20 virtual ~PackageContentsView(); 21 22 virtual void AttachedToWindow(); 23 virtual void AllAttached(); 24 25 void SetPackage(const PackageInfoRef& package); 26 void Clear(); 27 28 private: 29 void _InitContentPopulator(); 30 static int32 _ContentPopulatorThread(void* arg); 31 bool _PopulatePackageContents( 32 const PackageInfo& package); 33 int32 _InstallLocation( 34 const PackageInfo& package) const; 35 36 private: 37 BOutlineListView* fContentListView; 38 39 thread_id fContentPopulator; 40 sem_id fContentPopulatorSem; 41 BLocker fPackageLock; 42 PackageInfoRef fPackage; 43 PackageState fLastPackageState; 44 }; 45 46 #endif // PACKAGE_CONTENTS_VIEW_H 47