+@end
+/* }}} */
+/* Sources View {{{ */
+@interface SourcesView : ResetView {
+ UISectionList *list_;
+ Database *database_;
+ id delegate_;
+ NSMutableArray *sources_;
+}
+
+- (void) navigationBar:(UINavigationBar *)navbar buttonClicked:(int)button;
+- (void) dealloc;
+- (id) initWithFrame:(CGRect)frame database:(Database *)database;
+- (void) setDelegate:(id)delegate;
+- (void) reloadData;
+@end
+
+@implementation SourcesView
+
+- (void) navigationBar:(UINavigationBar *)navbar buttonClicked:(int)button {
+ switch (button) {
+ case 0:
+ break;
+
+ case 1:
+ [delegate_ update];
+ break;
+ }
+}
+
+- (void) dealloc {
+ if (sources_ != nil)
+ [sources_ release];
+ [list_ release];
+ [super dealloc];
+}
+
+- (id) initWithFrame:(CGRect)frame database:(Database *)database {
+ if ((self = [super initWithFrame:frame]) != nil) {
+ database_ = database;
+ sources_ = nil;
+
+ CGSize navsize = [UINavigationBar defaultSize];
+ CGRect navrect = {{0, 0}, navsize};
+ CGRect bounds = [self bounds];
+
+ navbar_ = [[UINavigationBar alloc] initWithFrame:navrect];
+ [self addSubview:navbar_];
+
+ [navbar_ setBarStyle:1];
+ [navbar_ setDelegate:self];
+
+ UINavigationItem *navitem = [[[UINavigationItem alloc] initWithTitle:@"Sources"] autorelease];
+ [navbar_ pushNavigationItem:navitem];
+
+ [navbar_ showButtonsWithLeftTitle:@"Refresh All" rightTitle:@"Edit"];
+
+ list_ = [[UISectionList alloc] initWithFrame:CGRectMake(
+ 0, navsize.height, bounds.size.width, bounds.size.height - navsize.height
+ )];
+
+ [list_ setDataSource:self];
+ } return self;
+}
+
+- (void) setDelegate:(id)delegate {
+ delegate_ = delegate;
+}
+
+- (void) reloadData {
+ pkgSourceList list;
+ _assert(list.ReadMainList());
+
+ sources_ = [[NSMutableArray arrayWithCapacity:16] retain];
+
+ for (pkgSourceList::const_iterator source = list.begin(); source != list.end(); ++source) {
+ fprintf(stderr, "\"%s\" \"%s\" \"%s\"\n", (*source)->GetURI().c_str(), (*source)->GetDist().c_str(), (*source)->GetType());
+ }
+}
+