#define lprintf(args...) fprintf(stderr, args)
-#define ForSaurik 1
+#define ForRelease 0
+#define ForSaurik 1 && !ForRelease
#define RecycleWebViews 0
+#define AlwaysReload 0 && !ForRelease
/* Radix Sort {{{ */
@interface NSMutableArray (Radix)
-- (void) radixUsingSelector:(SEL)selector withObject:(id)object;
+- (void) radixSortUsingSelector:(SEL)selector withObject:(id)object;
@end
@implementation NSMutableArray (Radix)
-- (void) radixUsingSelector:(SEL)selector withObject:(id)object {
+- (void) radixSortUsingSelector:(SEL)selector withObject:(id)object {
NSInvocation *invocation([NSInvocation invocationWithMethodSignature:[NSMethodSignature signatureWithObjCTypes:"L12@0:4@8"]]);
[invocation setSelector:selector];
[invocation setArgument:&object atIndex:2];
}
virtual void Fetch(pkgAcquire::ItemDesc &item) {
+ //NSString *name([NSString stringWithUTF8String:item.ShortDesc.c_str()]);
[delegate_ setProgressTitle:[NSString stringWithUTF8String:("Downloading " + item.ShortDesc).c_str()]];
}
version_ = [database_ policy]->GetCandidateVer(iterator_);
NSString *latest = version_.end() ? nil : [NSString stringWithUTF8String:version_.VerStr()];
- latest_ = [StripVersion(latest) retain];
+ latest_ = latest == nil ? nil : [StripVersion(latest) retain];
pkgCache::VerIterator current = iterator_.CurrentVer();
NSString *installed = current.end() ? nil : [NSString stringWithUTF8String:current.VerStr()];
if (current.end())
return essential && [self essential];
- else {
- pkgCache::VerIterator candidate = [database_ policy]->GetCandidateVer(iterator_);
- return !candidate.end() && candidate != current;
- }
+ else
+ return !version_.end() && version_ != current;
}
- (BOOL) essential {
withObject:[NSArray arrayWithObjects:string, id, nil]
waitUntilDone:YES
];
- else if (type == "pmstatus")
+ else if (type == "pmstatus") {
[delegate_ setProgressTitle:string];
- else if (type == "pmconffile")
+ } else if (type == "pmconffile")
[delegate_ setConfigurationData:string];
else _assert(false);
} else _assert(false);
cache_.Close();
+ _trace();
if (!cache_.Open(progress_, true)) {
std::string error;
if (!_error->PopMessage(error))
return;
}
+ _trace();
now_ = [[NSDate date] retain];
}
[packages_ removeAllObjects];
+ _trace();
for (pkgCache::PkgIterator iterator = cache_->PkgBegin(); !iterator.end(); ++iterator)
if (Package *package = [Package packageWithIterator:iterator database:self])
[packages_ addObject:package];
-
+ _trace();
[packages_ sortUsingSelector:@selector(compareByName:)];
+ _trace();
}
- (void) configure {
[self cancel];
}
+#if !AlwaysReload
- (void) _rightButtonClicked {
if (essential_ != nil)
[essential_ popupAlertAnimated:YES];
[delegate_ confirm];
}
}
+#endif
@end
/* }}} */
}
- (void) _setProgressTitle:(NSString *)title {
- [status_ setText:title];
+ NSMutableArray *words([[title componentsSeparatedByString:@" "] mutableCopy]);
+ for (size_t i(0), e([words count]); i != e; ++i) {
+ NSString *word([words objectAtIndex:i]);
+ if (Package *package = [database_ packageWithName:word])
+ [words replaceObjectAtIndex:i withObject:[package name]];
+ }
+
+ [status_ setText:[words componentsJoinedByString:@" "]];
}
- (void) _setProgressPercent:(NSNumber *)percent {
[super webView:sender didClearWindowObject:window forFrame:frame];
}
+#if !AlwaysReload
- (void) _rightButtonClicked {
/*[super _rightButtonClicked];
return;*/
] autorelease]];
}
}
+#endif
- (NSString *) _rightButtonTitle {
int count = [buttons_ count];
}
_trace();
- [packages_ radixUsingSelector:@selector(compareForChanges) withObject:nil];
+ [packages_ radixSortUsingSelector:@selector(compareForChanges) withObject:nil];
_trace();
Section *upgradable = [[[Section alloc] initWithName:@"Available Upgrades"] autorelease];
case 1: switch (row) {
case 0: {
UIPreferencesControlTableCell *cell([[[UIPreferencesControlTableCell alloc] init] autorelease]);
- [cell setTitle:@"Changes only shows upgrades to installed packages. This minimizes spam from packagers. Activate this to see upgrades to this package even when it is not installed."];
+ [cell setShowSelection:NO];
+ [cell setTitle:@"Changes only shows upgrades to installed packages so as to minimize spam from packagers. Activate this to see upgrades to this package even when it is not installed."];
return cell;
}
[ignoredSwitch_ addTarget:self action:@selector(onIgnored:) forEvents:kUIControlEventMouseUpInside];
subscribedCell_ = [[UIPreferencesControlTableCell alloc] init];
+ [subscribedCell_ setShowSelection:NO];
[subscribedCell_ setTitle:@"Show All Changes"];
[subscribedCell_ setControl:subscribedSwitch_];
ignoredCell_ = [[UIPreferencesControlTableCell alloc] init];
+ [ignoredCell_ setShowSelection:NO];
[ignoredCell_ setTitle:@"Ignore Upgrades"];
[ignoredCell_ setControl:ignoredSwitch_];
initWithTitle:[NSString stringWithFormat:@"%d Essential Upgrade%@", count, (count == 1 ? @"" : @"s")]
buttons:[NSArray arrayWithObjects:
@"Upgrade Essential",
- @"Upgrade Everything",
+ @"Complete Upgrade",
@"Ignore (Temporary)",
nil]
defaultButtonIndex:0
[overlay_ addSubview:hud];
[hud show:YES];*/
- _trace();
[database_ reloadData];
- _trace();
size_t changes(0);
setuid(0);
setgid(0);
+#if 1 /* XXX: this costs 1.4s of startup performance */
if (unlink("/var/cache/apt/pkgcache.bin") == -1)
_assert(errno == ENOENT);
if (unlink("/var/cache/apt/srcpkgcache.bin") == -1)
_assert(errno == ENOENT);
+#endif
/*Method alloc = class_getClassMethod([NSObject class], @selector(alloc));
alloc_ = alloc->method_imp;