From 4ba8f30aea8b6c587ebb4d241a3324630c1496f1 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 18 Feb 2011 17:10:59 -0800 Subject: [PATCH] Allow an invocation during reloading data. --- MobileCydia.mm | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/MobileCydia.mm b/MobileCydia.mm index 4a9ba45a..133fbcf4 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -1156,6 +1156,7 @@ bool isSectionVisible(NSString *section) { - (void) removeProgressHUD:(UIProgressHUD *)hud; - (CYViewController *) pageForPackage:(NSString *)name; - (void) showActionSheet:(UIActionSheet *)sheet fromItem:(UIBarButtonItem *)item; +- (void) reloadDataWithInvocation:(NSInvocation *)invocation; @end static id CydiaApp; @@ -1335,7 +1336,7 @@ typedef std::map< unsigned long, _H > SourceMap; - (NSArray *) packages; - (NSArray *) sources; - (Source *) sourceWithKey:(NSString *)key; -- (void) reloadData; +- (void) reloadDataWithInvocation:(NSInvocation *)invocation; - (void) configure; - (bool) prepare; @@ -3438,7 +3439,7 @@ static NSString *Warning_; return [self popErrorWithTitle:title] || !success; } -- (void) reloadData { CYPoolStart() { +- (void) reloadDataWithInvocation:(NSInvocation *)invocation { CYPoolStart() { @synchronized (self) { ++era_; @@ -3474,6 +3475,9 @@ static NSString *Warning_; if (chk != -1) close(chk); + if (invocation != nil) + [invocation invoke]; + NSString *title(UCLocalize("DATABASE")); _trace(); @@ -8812,11 +8816,11 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [NSThread detachNewThreadSelector:@selector(_refreshIfPossible) toTarget:self withObject:nil]; } -- (void) _reloadData { +- (void) _reloadDataWithInvocation:(NSInvocation *)invocation { UIProgressHUD *hud(loaded_ ? [self addProgressHUD] : nil); [hud setText:UCLocalize("RELOADING_DATA")]; - [database_ yieldToSelector:@selector(reloadData) withObject:nil]; + [database_ yieldToSelector:@selector(reloadDataWithInvocation:) withObject:invocation]; if (hud != nil) [self removeProgressHUD:hud]; @@ -8898,12 +8902,16 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { ]; } -- (void) reloadData { +- (void) reloadDataWithInvocation:(NSInvocation *)invocation { @synchronized (self) { - [self _reloadData]; + [self _reloadDataWithInvocation:invocation]; } } +- (void) reloadData { + [self reloadDataWithInvocation:nil]; +} + - (void) resolve { pkgProblemResolver *resolver = [database_ resolver]; @@ -8984,7 +8992,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (void) complete { @synchronized (self) { - [self _reloadData]; + [self _reloadDataWithInvocation:nil]; } } -- 2.47.2