]> git.saurik.com Git - cydia.git/commitdiff
Make lazy-loaded SearchController actually lazy.
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 1 Mar 2011 17:09:29 +0000 (09:09 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 7 Mar 2011 10:41:33 +0000 (02:41 -0800)
MobileCydia.mm

index acc4e2e2df62a11cbd6d23649a4cefe11188e39e..cb646f98cbfeb190ebcdbdebc1b8680e9f20307b 100644 (file)
@@ -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"]) {