- (pkgSourceList &) list;
- (NSArray *) packages;
- (NSArray *) sources;
+- (Source *) sourceWithKey:(NSString *)key;
- (void) reloadData;
- (void) configure;
return sources;
}
+- (Source *) sourceWithKey:(NSString *)key {
+ for (Source *source in [self sources]) {
+ if ([[source key] isEqualToString:key])
+ return source;
+ } return nil;
+}
+
- (bool) popErrorWithTitle:(NSString *)title {
bool fatal(false);
std::string message;
}
- (void) reloadData {
- NSArray *sources = [database_ sources];
- for (Source *source in sources) {
- if ([[source key] isEqual:key_]) {
- source_ = source;
- [key_ release];
- key_ = [[source key] retain];
- break;
- }
- }
-
+ source_ = [database_ sourceWithKey:key_];
+ [key_ release];
+ key_ = [[source_ key] retain];
[self setObject:source_];
[super reloadData];
controller = [[[SourcesController alloc] initWithDatabase:database_] autorelease];
[(SourcesController *)controller showAddSourcePrompt];
} else {
- NSArray *sources = [database_ sources];
- for (Source *source in sources) {
- if ([[source key] isEqual:argument]) {
- controller = [[[SourceController alloc] initWithDatabase:database_ source:source] autorelease];
- break;
- }
- }
+ Source *source = [database_ sourceWithKey:argument];
+ controller = [[[SourceController alloc] initWithDatabase:database_ source:source] autorelease];
}
}