@class PackageController;
@protocol CydiaDelegate
+- (void) retainNetworkActivityIndicator;
+- (void) releaseNetworkActivityIndicator;
- (void) setPackageController:(PackageController *)view;
- (void) clearPackage:(Package *)package;
- (void) installPackage:(Package *)package;
- (PackageController *) packageController;
- (void) showActionSheet:(UIActionSheet *)sheet fromItem:(UIBarButtonItem *)item;
@end
+
+static id<CydiaDelegate> CydiaApp;
/* }}} */
/* Status Delegation {{{ */
return;
}
+ [CydiaApp retainNetworkActivityIndicator];
+
bool failed = false;
for (pkgAcquire::ItemIterator item = fetcher_->ItemsBegin(); item != fetcher_->ItemsEnd(); item++) {
if ((*item)->Status == pkgAcquire::Item::StatDone && (*item)->Complete)
];
}
+ [CydiaApp releaseNetworkActivityIndicator];
+
if (failed) {
_trace();
return;
}
- (void) beginUpdate {
- [self dropBar:YES];
[refreshbar_ start];
+ [self dropBar:YES];
+ [updatedelegate_ retainNetworkActivityIndicator];
updating_ = true;
[NSThread
];
}
-- (void) completeUpdate {
- if (!updating_)
- return;
+- (void) stopUpdateWithSelector:(SEL)selector {
updating_ = false;
+ [updatedelegate_ releaseNetworkActivityIndicator];
[self raiseBar:YES];
[refreshbar_ stop];
- [updatedelegate_ performSelector:@selector(reloadData) withObject:nil afterDelay:0];
+
+ [updatedelegate_ performSelector:selector withObject:nil afterDelay:0];
+}
+
+- (void) completeUpdate {
+ if (!updating_)
+ return;
+ [self stopUpdateWithSelector:@selector(reloadData)];
}
- (void) cancelUpdate {
- updating_ = false;
- [self raiseBar:YES];
- [refreshbar_ stop];
- [updatedelegate_ performSelector:@selector(updateData) withObject:nil afterDelay:0];
+ [self stopUpdateWithSelector:@selector(updateData)];
}
- (void) cancelPressed {
Database *database_;
+ NSURL *starturl_;
int tag_;
+
unsigned locked_;
- NSURL *starturl_;
+ unsigned activity_;
SectionsController *sections_;
ChangesController *changes_;
[tabbar_ presentModalViewController:nav animated:YES];
}
+- (void) retainNetworkActivityIndicator {
+ if (activity_++ == 0)
+ [self setNetworkActivityIndicatorVisible:YES];
+}
+
+- (void) releaseNetworkActivityIndicator {
+ if (--activity_ == 0)
+ [self setNetworkActivityIndicatorVisible:NO];
+}
+
- (void) setPackageController:(PackageController *)view {
WebThreadLock();
[view setPackage:nil];
- (void) applicationDidFinishLaunching:(id)unused {
_trace();
+ CydiaApp = self;
+
[NSURLCache setSharedURLCache:[[[SDURLCache alloc]
initWithMemoryCapacity:524288
diskCapacity:10485760
if (title_ != nil)
[title_ release];
+ if ([loading_ count] != 0)
+ [delegate_ releaseNetworkActivityIndicator];
[loading_ release];
[reloaditem_ release];
- (void) _didStartLoading {
[self applyRightButton];
+
+ if ([loading_ count] != 1)
+ return;
+ [delegate_ retainNetworkActivityIndicator];
}
- (void) _didFinishLoading {
if ([loading_ count] != 0)
return;
+ [delegate_ releaseNetworkActivityIndicator];
[self applyRightButton];