return false;
}
-- (NSArray *) _reloadPackages:(NSArray *)packages {
-// XXX: maybe move @synchronized() to _reloadData?
+- (NSArray *) _reloadPackages {
@synchronized (database_) {
+ era_ = [database_ era];
+ NSArray *packages([database_ packages]);
+
return [NSArray arrayWithArray:packages];
} }
return;
}
- era_ = [database_ era];
- NSArray *packages = [database_ packages];
-
if ([self shouldYield]) {
do {
UIProgressHUD *hud;
}
reloading_ = 1;
- packages_ = [self yieldToSelector:@selector(_reloadPackages:) withObject:packages];
+ packages_ = [self yieldToSelector:@selector(_reloadPackages)];
if (hud != nil)
[delegate_ removeProgressHUD:hud];
reloading_ = 0;
} else {
- packages_ = [self _reloadPackages:packages];
+ packages_ = [self _reloadPackages];
}
[indices_ removeAllObjects];
[self setObject:object];
}
-- (NSArray *) _reloadPackages:(NSArray *)packages {
-// XXX: maybe move @synchronized() to _reloadData?
+- (NSArray *) _reloadPackages {
@synchronized (database_) {
+ era_ = [database_ era];
+ NSArray *packages([database_ packages]);
+
NSMutableArray *filtered([NSMutableArray arrayWithCapacity:[packages count]]);
IMP imp;
} return self;
}
-- (NSArray *) _reloadPackages:(NSArray *)packages {
+- (NSArray *) _reloadPackages {
+@synchronized (database_) {
+ era_ = [database_ era];
+ NSArray *packages([database_ packages]);
+
NSMutableArray *filtered([NSMutableArray arrayWithCapacity:[packages count]]);
_trace();
_trace();
return filtered;
-}
+} }
- (void) _reloadData {
-@synchronized (database_) {
- era_ = [database_ era];
- NSArray *packages = [database_ packages];
+ reload:
+ if (true) {
+ UIProgressHUD *hud([delegate_ addProgressHUD]);
+ [hud setText:UCLocalize("LOADING")];
+ //NSLog(@"HUD:%@::%@", delegate_, hud);
+ packages_ = [self yieldToSelector:@selector(_reloadPackages)];
+ [delegate_ removeProgressHUD:hud];
+ } else {
+ packages_ = [self _reloadPackages];
+ }
-#if 1
- UIProgressHUD *hud([delegate_ addProgressHUD]);
- [hud setText:UCLocalize("LOADING")];
- //NSLog(@"HUD:%@::%@", delegate_, hud);
- packages_ = [self yieldToSelector:@selector(_reloadPackages:) withObject:packages];
- [delegate_ removeProgressHUD:hud];
-#else
- packages_ = [self _reloadPackages:packages];
-#endif
+@synchronized (database_) {
+ if (era_ != [database_ era])
+ goto reload;
[sections_ removeAllObjects];