} return self;
}
-- (void)_updateFrameForDisplay {
+- (void) _updateFrameForDisplay {
[super _updateFrameForDisplay];
if ([self cancelButtonIndex] == -1) {
NSArray *buttons = [self buttons];
@end
/* }}} */
-NSUInteger WebScriptObject$countByEnumeratingWithState$objects$count$(WebScriptObject *self, SEL sel, NSFastEnumerationState *state, id *objects, NSUInteger count) {
+@implementation WebScriptObject (NSFastEnumeration)
+
+- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)objects count:(NSUInteger)count {
size_t length([self count] - state->state);
if (length <= 0)
return 0;
return length;
}
+@end
+
NSUInteger DOMNodeList$countByEnumeratingWithState$objects$count$(DOMNodeList *self, SEL sel, NSFastEnumerationState *state, id *objects, NSUInteger count) {
size_t length([self length] - state->state);
if (length <= 0)
void Set(CGColorSpaceRef space, float red, float green, float blue, float alpha) {
Clear();
float color[] = {red, green, blue, alpha};
- color_ = CGColorCreate(space, color);
+ color_ = CGColorCreate(space, (CGFloat *) color);
}
operator CGColorRef() {
static UIFont *Font22Bold_;
static const char *Machine_ = NULL;
-static const NSString *System_ = NULL;
-static const NSString *SerialNumber_ = nil;
-static const NSString *ChipID_ = nil;
-static const NSString *Token_ = nil;
-static const NSString *UniqueID_ = nil;
-static const NSString *Build_ = nil;
-static const NSString *Product_ = nil;
-static const NSString *Safari_ = nil;
+static NSString *System_ = nil;
+static NSString *SerialNumber_ = nil;
+static NSString *ChipID_ = nil;
+static NSString *Token_ = nil;
+static NSString *UniqueID_ = nil;
+static NSString *Build_ = nil;
+static NSString *Product_ = nil;
+static NSString *Safari_ = nil;
static CFLocaleRef Locale_;
static NSArray *Languages_;
- (void) setProgressError:(NSString *)error forPackage:(NSString *)id {
Package *package = id == nil ? nil : [[Database sharedInstance] packageWithName:id];
- // XXX: holy typecast batman!
- [(id<ProgressDelegate>)self setProgressError:error withTitle:(package == nil ? id : [package name])];
+
+ [self performSelector:@selector(setProgressError:withTitle:)
+ withObject:error
+ withObject:(package == nil ? id : [package name])
+ ];
}
@end
return iterator.end() ? nil : [Package packageWithIterator:iterator withZone:NULL inPool:pool_ database:self];
} }
-- (Database *) init {
+- (id) init {
if ((self = [super init]) != nil) {
policy_ = NULL;
records_ = NULL;
return;
if ([self popErrorWithTitle:title forOperation:ListUpdate(status, list, PulseInterval_)])
- /* XXX: ignore this because users suck and don't understand why refreshing is important: return */;
+ /* XXX: ignore this because users suck and don't understand why refreshing is important: return */
+ /* XXX: why the hell is an empty if statement a clang error? */ (void) 0;
[Metadata_ setObject:[NSDate date] forKey:@"LastUpdate"];
Changed_ = true;
id values[count];
for (unsigned i(0); i != count; ++i)
values[i] = [arguments objectAtIndex:i];
- return [[[NSString alloc] initWithFormat:format arguments:reinterpret_cast<va_list>(values)] autorelease];
+ return [[[NSString alloc] initWithFormat:format arguments:*(reinterpret_cast<va_list *>(&values))] autorelease];
}
- (NSString *) localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)table {
[super dealloc];
}
-- (int) tableView:(UITableView *)tableView numberOfRowsInSection:(int)section {
+- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return files_ == nil ? 0 : [files_ count];
}
[[self navigationController] pushViewController:view animated:YES];
}
-- (id) title { return title_; }
+- (NSString *) title { return title_; }
- (id) initWithDatabase:(Database *)database title:(NSString *)title filter:(SEL)filter with:(id)object {
if ((self = [super init]) != nil) {
[list_ deselectRowAtIndexPath:[list_ indexPathForSelectedRow] animated:animated];
}
-- (int) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
return offset_ == 0 ? 1 : 2;
}
-- (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(int)section {
+- (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
switch (section + (offset_ == 0 ? 1 : 0)) {
case 0: return UCLocalize("ENTERED_BY_USER");
case 1: return UCLocalize("INSTALLED_BY_PACKAGE");
}
}
-- (int) tableView:(UITableView *)tableView numberOfRowsInSection:(int)section {
+- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
int count = [sources_ count];
switch (section) {
case 0: return (offset_ == 0 ? count : offset_);
[self _endConnection:connection];
}
-- (id)title { return UCLocalize("SOURCES"); }
+- (NSString *) title { return UCLocalize("SOURCES"); }
- (NSURLConnection *) _requestHRef:(NSString *)href method:(NSString *)method {
NSMutableURLRequest *request = [NSMutableURLRequest
[super dealloc];
}
-- (id) title { return UCLocalize("INSTALLED"); }
+- (NSString *) title { return UCLocalize("INSTALLED"); }
- (id) initWithDatabase:(Database *)database {
if ((self = [super initWithDatabase:database title:UCLocalize("INSTALLED") filter:@selector(isInstalledAndVisible:) with:[NSNumber numberWithBool:YES]]) != nil) {
/* Cydia Navigation Controller {{{ */
@interface CYNavigationController : UINavigationController {
_transient Database *database_;
- id delegate_;
+ id<UINavigationControllerDelegate> delegate_;
}
- (id) initWithDatabase:(Database *)database;
}
}
-- (void) setDelegate:(id)delegate {
+- (void) setDelegate:(id<UINavigationControllerDelegate>)delegate {
delegate_ = delegate;
}
return section;
}
-- (int) tableView:(UITableView *)tableView numberOfRowsInSection:(int)section {
+- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return editing_ ? [sections_ count] : [filtered_ count] + 1;
}
[[self navigationController] pushViewController:table animated:YES];
}
-- (id) title { return UCLocalize("SECTIONS"); }
+- (NSString *) title { return UCLocalize("SECTIONS"); }
- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
[delegate_ distUpgrade];
}
-- (id) title { return UCLocalize("CHANGES"); }
+- (NSString *) title { return UCLocalize("CHANGES"); }
- (id) initWithDatabase:(Database *)database delegate:(id)delegate {
if ((self = [super init]) != nil) {
[super dealloc];
}
-- (void) searchBarSearchButtonClicked:(id)searchBar {
+- (void) searchBarSearchButtonClicked:(UISearchBar *)searchBar {
[packages_ setObject:[search_ text] forFilter:@selector(isUnfilteredAndSearchedForBy:)];
[search_ resignFirstResponder];
[self reloadData];
}
-- (void) searchBar:(id)searchBar textDidChange:(NSString *)text {
+- (void) searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)text {
[packages_ setObject:text forFilter:@selector(isUnfilteredAndSelectedForBy:)];
[self reloadData];
}
-- (id) title { return nil; }
+- (NSString *) title { return nil; }
- (id) initWithDatabase:(Database *)database {
return [super initWithDatabase:database title:UCLocalize("SEARCH") filter:@selector(isUnfilteredAndSearchedForBy:) with:nil];
return nil;
}
-- (id) title { return UCLocalize("SETTINGS"); }
+- (NSString *) title { return UCLocalize("SETTINGS"); }
- (id) initWithDatabase:(Database *)database package:(NSString *)package {
if ((self = [super init])) {
[super dealloc];
}
-- (id) initWithDatabase: (Database *)database {
+- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
database_ = database;
@interface Cydia : UIApplication <
ConfirmationControllerDelegate,
ProgressControllerDelegate,
- CydiaDelegate
+ CydiaDelegate,
+ UINavigationControllerDelegate
> {
UIWindow *window_;
CYContainer *container_;
[self _saveConfig];
ProgressController *progress = [[[ProgressController alloc] initWithDatabase:database_ delegate:self] autorelease];
- UINavigationController *navigation = [[[CYNavigationController alloc] initWithRootViewController:progress] autorelease];
+ CYNavigationController *navigation = [[[CYNavigationController alloc] initWithRootViewController:progress] autorelease];
if (IsWildcat_) [navigation setModalPresentationStyle:UIModalPresentationFormSheet];
[container_ presentModalViewController:navigation animated:YES];
ConfirmationController *page([[[ConfirmationController alloc] initWithDatabase:database_] autorelease]);
[page setDelegate:self];
- id confirm_ = [[CYNavigationController alloc] initWithRootViewController:page];
+ CYNavigationController *confirm_ = [[CYNavigationController alloc] initWithRootViewController:page];
[confirm_ setDelegate:self];
if (IsWildcat_) [confirm_ setModalPresentationStyle:UIModalPresentationFormSheet];
- (void) cancelAndClear:(bool)clear {
@synchronized (self) {
if (clear) {
- /* XXX: clear marks instead of reloading data */
- /*pkgCacheFile &cache([database_ cache]);
+ // Clear all marks.
+ pkgCacheFile &cache([database_ cache]);
for (pkgCache::PkgIterator iterator = cache->PkgBegin(); !iterator.end(); ++iterator) {
- if (!cache[iterator].Keep()) cache->MarkKeep(iterator, false, false);
+ // Unmark method taken from Synaptic Package Manager.
+ // Thanks for being sane, unlike Aptitude.
+ if (!cache[iterator].Keep()) {
+ cache->MarkKeep(iterator, false);
+ cache->SetReInstall(iterator, false);
+ }
}
- [self updateData];
-
+ // Stop queuing, and let the appropriate controller know it.
Queuing_ = false;
[[[[tabbar_ viewControllers] objectAtIndex:[self indexOfTabWithTag:kManageTag] != -1 ? [self indexOfTabWithTag:kManageTag] : [self indexOfTabWithTag:kInstalledTag]] tabBarItem] setBadgeValue:nil];
- [queueDelegate_ queueStatusDidChange];*/
- [self reloadData];
+ [queueDelegate_ queueStatusDidChange];
} else {
+ // Start queuing, and let the controllers know.
Queuing_ = true;
[[[[tabbar_ viewControllers] objectAtIndex:[self indexOfTabWithTag:kManageTag] != -1 ? [self indexOfTabWithTag:kManageTag] : [self indexOfTabWithTag:kInstalledTag]] tabBarItem] setBadgeValue:UCLocalize("Q_D")];
PackageName = reinterpret_cast<CYString &(*)(Package *, SEL)>(method_getImplementation(class_getInstanceMethod([Package class], @selector(cyname))));
/* Library Hacks {{{ */
- class_addMethod(objc_getClass("WebScriptObject"), @selector(countByEnumeratingWithState:objects:count:), (IMP) &WebScriptObject$countByEnumeratingWithState$objects$count$, "I20@0:4^{NSFastEnumerationState}8^@12I16");
class_addMethod(objc_getClass("DOMNodeList"), @selector(countByEnumeratingWithState:objects:count:), (IMP) &DOMNodeList$countByEnumeratingWithState$objects$count$, "I20@0:4^{NSFastEnumerationState}8^@12I16");
$WebDefaultUIKitDelegate = objc_getClass("WebDefaultUIKitDelegate");