diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-01 09:09:29 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-07 02:41:33 -0800 |
commit | 43625891adfe8e4034469bdd0ee602600ea9a728 (patch) | |
tree | 9132fd75f4b155acfa027a39d1842c0fe430effd | |
parent | dad158093c049881ba80b0f5af5af7d4e34eef0b (diff) |
Make lazy-loaded SearchController actually lazy.
-rw-r--r-- | MobileCydia.mm | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index acc4e2e..cb646f9 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -7666,8 +7666,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { BOOL searchloaded_; } -- (id) initWithDatabase:(Database *)database; -- (void) setSearchTerm:(NSString *)term; +- (id) initWithDatabase:(Database *)database query:(NSString *)query; - (void) reloadData; @end @@ -7686,12 +7685,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { return [NSURL URLWithString:[NSString stringWithFormat:@"cydia://search/%@", [search_ text]]]; } -- (void) setSearchTerm:(NSString *)searchTerm { - [search_ setText:searchTerm]; - [self setObject:searchTerm]; - [self reloadData]; -} - - (void) searchBarSearchButtonClicked:(UISearchBar *)searchBar { [self setObject:[search_ text] forFilter:@selector(isUnfilteredAndSearchedForBy:)]; [search_ resignFirstResponder]; @@ -7703,10 +7696,13 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [self reloadData]; } -- (id) initWithDatabase:(Database *)database { - if ((self = [super initWithDatabase:database title:UCLocalize("SEARCH") filter:@selector(isUnfilteredAndSearchedForBy:) with:nil])) { +- (id) initWithDatabase:(Database *)database query:(NSString *)query { + if ((self = [super initWithDatabase:database title:UCLocalize("SEARCH") filter:@selector(isUnfilteredAndSearchedForBy:) with:query])) { search_ = [[[UISearchBar alloc] init] autorelease]; [search_ setDelegate:self]; + + if (query != nil) + [search_ setText:query]; } return self; } @@ -9508,7 +9504,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } if ([base isEqualToString:@"search"]) { - controller = [[[SearchController alloc] initWithDatabase:database_] autorelease]; + controller = [[[SearchController alloc] initWithDatabase:database_ query:nil] autorelease]; } if ([base isEqualToString:@"changes"]) { @@ -9526,8 +9522,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } if (!external && [base isEqualToString:@"search"]) { - controller = [[[SearchController alloc] initWithDatabase:database_] autorelease]; - [(SearchController *)controller setSearchTerm:argument]; + controller = [[[SearchController alloc] initWithDatabase:database_ query:argument] autorelease]; } if (!external && [base isEqualToString:@"sections"]) { |