]> git.saurik.com Git - cydia.git/commitdiff
Major modifications to ready for stability.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 7 Sep 2009 12:38:10 +0000 (12:38 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 30 Sep 2010 07:13:58 +0000 (07:13 +0000)
13 files changed:
Cydia.app/English.lproj/Localizable.strings
Cydia.app/French.lproj/Localizable.strings
Cydia.app/German.lproj/Localizable.strings
Cydia.app/install-dn.png
Cydia.app/install-up.png
Cydia.app/installed.png [new file with mode: 0644]
Cydia.app/package.html
Cydia.app/package.js
Cydia.app/storage.js
Cydia.app/unknown.html [new file with mode: 0644]
Cydia.mm
UICaboodle/BrowserView.mm
UICaboodle/UCPlatform.h

index 3cadf3effe28130dcdfd0715eebef9bd3d8957e5..a786bf3b5e59e790faffc03639fa5a4afdbeec61 100644 (file)
@@ -19,6 +19,7 @@
 "CANNOT_LOCATE_PACKAGE" = "Cannot Locate Package";
 "CHANGE_PACKAGE_SETTINGS" = "Change Package Settings";
 "CHANGES" = "Changes";
+"CLEAN_ARCHIVES" = "Clean Archives";
 "CLEAR" = "Clear";
 "CLOSE" = "Close";
 "CLOSE_CYDIA" = "Close Cydia (Restart)";
 "CONSOLE_PACKAGE" = "This is a console package!";
 "CONSOLE_UTILITIES_DAEMONS" = "Console Utilities & Daemons";
 "CONTINUE_QUEUING" = "Continue Queuing";
+"COUNTS_NONZERO_EX" = "So, I just counted some important-looking values, and they didn't sum to zero. This is scary. I don't know why I don't like this anymore, but I think APT was adamant this should not occur.";
 "CREDITS" = "Credits";
 "CYDIA_STORE" = "Cydia Store";
+"DATABASE" = "Database";
 "DETAILS" = "Details";
 "DEVELOPER" = "Developer";
 "DEVELOPER_EX" = "No Filters";
@@ -47,7 +50,8 @@
 "DONE" = "Done";
 "DOUBLE_QUOTED" = "“%@”";
 "DOWNGRADE" = "Downgrade";
-"DOWNLOADING" = "Downloading %@";
+"DOWNLOADING" = "Downloading";
+"DOWNLOADING_" = "Downloading %@";
 "EDIT" = "Edit";
 "ENTER_APT_URL" = "Enter Cydia/APT URL";
 "ENTERED_BY_USER" = "Entered by User";
@@ -83,7 +87,6 @@
 "IGNORED_UPGRADES" = "Ignored Upgrades";
 "ILLEGAL_PACKAGE_IDENTIFIER" = "Illegal Package Identifier";
 "INSTALL" = "Install";
-"INSTALL_BY_SECTION" = "Install by Section";
 "INSTALLED" = "Installed";
 "INSTALLED_BY_PACKAGE" = "Installed by Package";
 "INSTALLED_DETAILS" = "Installed Package";
 "OK" = "OK";
 "OKAY" = "Okay";
 "PACKAGE_CANNOT_BE_FOUND" = "The package %@ cannot be found in your current sources. I might recommend installing more sources.";
+"PACKAGE_CANNOT_BE_FOUND_EX" = "This issue may also be caused by a number of other factors. The most common one is that your package catalog is out of date. To manually refresh, click the Refresh button on the Changes tab. This package may simply no longer exist. It is also possible you are using an old firmware version: users should attempt to remain reasonably up to date with Apple's firmware releases.";
 "PACKAGE_DAMAGED" = "Package Damaged";
 "PACKAGE_DETAILS" = "Package Details";
 "PACKAGE_QUEUE" = "Package Queue";
 "PACKAGES_EX" = "View or remove packages you previously installed.";
 "PARENTHETICAL" = "%@ (%@)";
 "PASSWORD" = "password";
+"PERFORM_SELECTIONS" = "Perform Selections";
+"PREPARE_ARCHIVES" = "Prepare Archives";
 "PRODUCTS" = "Products";
 "PURGE" = "Purge";
 "Q_D" = "Q'd";
 "RECENT_CHANGES_UPDATES" = "Recent Changes/Updates";
 "RECOMMENDED_BOOKS" = "Recommended Books";
 "REFRESH" = "Refresh";
+"REFRESHING_DATA" = "Refreshing Data";
 "REINSTALL" = "Reinstall";
 "RELOAD" = "Reload";
 "RELOAD_SPRINGBOARD" = "Reload SpringBoard";
 "SPONSOR" = "Sponsor";
 "SPONSORING_PRODUCTS" = "Sponsoring Products";
 "STATISTICS" = "Statistics";
+"STILL_BROKEN_EX" = "Trying to fix the broken selections did not seem to help.";
 "STORAGE" = "Storage";
 "STORAGE_EX" = "See how much room you have left for new packages.";
 "SUBMIT" = "Submit";
 "VERIFICATION_ERROR" = "Verification Error";
 "VERIFYING_URL" = "Verifying URL";
 "VERSION" = "Version";
+"WARNING" = "Warning";
 "WELCOME_TO_CYDIA" = "Welcome to Cydia™";
 "WHO_ARE_YOU" = "Who Are You?";
 "YES" = "Yes";
index d29630bdffde79dc4e78b783b81869f8318470aa..6c989da98b1020b02bce47346fac1dbde9487f1c 100644 (file)
@@ -47,7 +47,8 @@
 "DONE" = "OK";
 "DOUBLE_QUOTED" = "« $@ »";
 "DOWNGRADE" = "Rétrograder";
-"DOWNLOADING" = "Téléchargement %@";
+"DOWNLOADING" = "Téléchargement";
+"DOWNLOADING_" = "Téléchargement %@";
 "EDIT" = "Éditer";
 "ENTER_APT_URL" = "Entrez une adresse Cydia/APT";
 "ENTERED_BY_USER" = "Entré par l'Utilisateur";
@@ -83,7 +84,6 @@
 "IGNORED_UPGRADES" = "Mises à Jour Ignorées";
 "ILLEGAL_PACKAGE_IDENTIFIER" = "Indentifiant du Paquet Illégal";
 "INSTALL" = "Installer";
-"INSTALL_BY_SECTION" = "Installer par Catégorie";
 "INSTALLED" = "Installé";
 "INSTALLED_BY_PACKAGE" = "Installer par Paquet";
 "INSTALLED_DETAILS" = "Paquet Installé";
index 7f046eea904f7944046d5f5f56e760b3a876462b..3a24cc841a64bca64813d8ab4feb2fa6b42b741e 100644 (file)
@@ -47,7 +47,8 @@
 "DONE" = "Fertig";
 "DOUBLE_QUOTED" = "„%@“";
 "DOWNGRADE" = "Downgrade";
-"DOWNLOADING" = "Lädt %@ herunter";
+"DOWNLOADING" = "Lädt";
+"DOWNLOADING_" = "Lädt %@ herunter";
 "EDIT" = "Bearbeiten";
 "ENTER_APT_URL" = "Cydia/APT URL eingeben";
 "ENTERED_BY_USER" = "Vom Benutzer eingegeben";
@@ -83,7 +84,6 @@
 "IGNORED_UPGRADES" = "Ignorierte Aktualisierungen";
 "ILLEGAL_PACKAGE_IDENTIFIER" = "Unerlaubte Paket-Kennung";
 "INSTALL" = "Installieren";
-"INSTALL_BY_SECTION" = "Installieren nach Kategorie";
 "INSTALLED" = "Installiert";
 "INSTALLED_BY_PACKAGE" = "Installiert nach Paket";
 "INSTALLED_DETAILS" = "Installiertes Paket";
index 7e11a95f0770d1bbb6980facb5934cfdacff1822..c8ab0f4c64c7297b0f15a90333e5d261e86e8ecf 100644 (file)
Binary files a/Cydia.app/install-dn.png and b/Cydia.app/install-dn.png differ
index 1b7b1d97e820b7f4d184009c89010de6fb2edbc3..9e308988eed57f1dab8a1e1b65eb205ed241f352 100644 (file)
Binary files a/Cydia.app/install-up.png and b/Cydia.app/install-up.png differ
diff --git a/Cydia.app/installed.png b/Cydia.app/installed.png
new file mode 100644 (file)
index 0000000..2f86f0a
Binary files /dev/null and b/Cydia.app/installed.png differ
index 56de1e574c33f361937b29a20d619ab97423ce26..317f41b2459ec0c2114f1bddd88879d3b51fec5e 100644 (file)
     </div></div>
 </fieldset>
 
-<!--iframe
+<iframe
     class="notice"
     id="notice-src"
     frameborder="0"
     width="320"
     height="0"
     target="_top"
-></iframe-->
+></iframe>
 
 <!--iframe
     class="activation"
index 0e2a94184bd47ece7cabd74f965454200b789c77..104bd8c6826273a52b57ccdf33142ec648152d3a 100644 (file)
@@ -75,6 +75,11 @@ var special_ = function () {
         success: function (value) {
             value = eval(value);
 
+            if (typeof value.notice == "undefined")
+                $(".notice").addClass("deleted");
+            else
+                $("#notice-src").src(value.notice);
+
             if (typeof value.rating == "undefined")
                 $(".rating").addClass("deleted");
             else {
@@ -183,8 +188,6 @@ var special_ = function () {
             $("#author-href").href(support);
     }
 
-    //$("#notice-src").src("http://saurik.cachefly.net/notice/" + idc + ".html");
-
     /*var store = commercial;
     if (!store)
         $(".activation").addClass("deleted");
@@ -296,6 +299,17 @@ var special = function () {
     $("#rating-none").css("display", "none");
     $("#rating-done").css("display", "none");
 
+    var notice = $("#notice-src");
+
+    notice[0].outerHTML = '<iframe' +
+        ' class="notice"' +
+        ' id="notice-src"' +
+        ' frameborder="0"' +
+        ' width="320"' +
+        ' height="0"' +
+        ' target="_top"' +
+    '></iframe>';
+
     var depiction = $("#depiction-src");
 
     depiction[0].outerHTML = '<iframe' +
index 73d5de7b7d195c0659ebcf18ac7c9815c977afe8..ae8cb85007ec4442bbaae7559525974a8a382038 100644 (file)
@@ -83,6 +83,6 @@ $(function () {
         ["Themes", "/Library/Themes/"],
         ["iTunes", "/var/mobile/Media/iTunes_Control/"],
         ["App Store", "/var/mobile/Applications/"],
-        ["Photos", "/var/mobile/Media/DCIM/"]
+        ["Camera", "/var/mobile/Media/DCIM/"]
     ]);
 });
diff --git a/Cydia.app/unknown.html b/Cydia.app/unknown.html
new file mode 100644 (file)
index 0000000..900a86f
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-16"?>
+<html><head>
+    <title localize="UNKNOWN"></title>
+    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"/>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+    <link rel="stylesheet" type="text/css" href="menes/style.css"/>
+    <script type="text/javascript" src="menes/menes.js"></script>
+    <script type="text/javascript" src="localize.js"></script>
+    <base target="_blank"/>
+    <script type="text/javascript">
+    $(function () {
+        $("#body").html($.xml(cydia.format(cydia.localize("PACKAGE_CANNOT_BE_FOUND"), [location.search.substring(1)])));
+    });
+    </script>
+</head><body class="pinstripe">
+<panel>
+
+<fieldset>
+    <div><p style="font-weight: bold"><span style="color: red" localize="NOTE"></span>: <span localize="CANNOT_LOCATE_PACKAGE"></span></p></div>
+</fieldset>
+
+<block>
+    <p id="body"></p>
+    <p localize="PACKAGE_CANNOT_BE_FOUND_EX"></p>
+</block>
+
+</panel>
+</body></html>
index 21f126419c3c4358c2df9cc3608c99303717b29f..225173a6ea5cf65d08c45ead112bd17870ab16ad 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -250,6 +250,16 @@ void NSLogRect(const char *fix, const CGRect &rect) {
     NSLog(@"%s(%g,%g)+(%g,%g)", fix, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
 }
 
+static _finline NSString *CydiaURL(NSString *path) {
+    char page[25];
+    page[0] = 'h'; page[1] = 't'; page[2] = 't'; page[3] = 'p'; page[4] = ':';
+    page[5] = '/'; page[6] = '/'; page[7] = 'c'; page[8] = 'y'; page[9] = 'd';
+    page[10] = 'i'; page[11] = 'a'; page[12] = '.'; page[13] = 's'; page[14] = 'a';
+    page[15] = 'u'; page[16] = 'r'; page[17] = 'i'; page[18] = 'k'; page[19] = '.';
+    page[20] = 'c'; page[21] = 'o'; page[22] = 'm'; page[23] = '/'; page[24] = '\0';
+    return [[NSString stringWithUTF8String:page] stringByAppendingString:path];
+}
+
 /* [NSObject yieldToSelector:(withObject:)] {{{*/
 @interface NSObject (Cydia)
 - (id) yieldToSelector:(SEL)selector withObject:(id)object;
@@ -317,6 +327,35 @@ void NSLogRect(const char *fix, const CGRect &rect) {
 @end
 /* }}} */
 
+@interface CYActionSheet : UIActionSheet {
+    unsigned button_;
+}
+
+- (int) yieldToPopupAlertAnimated:(BOOL)animated;
+@end
+
+@implementation CYActionSheet
+
+- (id) initWithTitle:(NSString *)title buttons:(NSArray *)buttons defaultButtonIndex:(int)index {
+    if ((self = [super initWithTitle:title buttons:buttons defaultButtonIndex:index delegate:self context:nil]) != nil) {
+    } return self;
+}
+
+- (void) alertSheet:(UIActionSheet *)sheet buttonClicked:(int)button {
+    button_ = button;
+}
+
+- (int) yieldToPopupAlertAnimated:(BOOL)animated {
+    button_ = 0;
+    [self popupAlertAnimated:animated];
+    NSRunLoop *loop([NSRunLoop currentRunLoop]);
+    NSDate *future([NSDate distantFuture]);
+    while (button_ == 0 && [loop runMode:NSDefaultRunLoopMode beforeDate:future]);
+    return button_;
+}
+
+@end
+
 /* NSForcedOrderingSearch doesn't work on the iPhone */
 static const NSStringCompareOptions MatchCompareOptions_ = NSLiteralSearch | NSCaseInsensitiveSearch;
 static const NSStringCompareOptions LaxCompareOptions_ = NSNumericSearch | NSDiacriticInsensitiveSearch | NSWidthInsensitiveSearch | NSCaseInsensitiveSearch;
@@ -388,9 +427,9 @@ static const CFStringCompareFlags LaxCompareFlags_ = kCFCompareCaseInsensitive |
 #define HistogramInsertionSort (0 && !ForRelease)
 #define ProfileTimes (0 && !ForRelease)
 #define ForSaurik (0 && !ForRelease)
-#define LogBrowser (1 && !ForRelease)
+#define LogBrowser (0 && !ForRelease)
 #define TrackResize (0 && !ForRelease)
-#define ManualRefresh (1 && !ForRelease)
+#define ManualRefresh (0 && !ForRelease)
 #define ShowInternals (0 && !ForRelease)
 #define IgnoreInstall (0 && !ForRelease)
 #define RecycleWebViews 0
@@ -1038,7 +1077,6 @@ static NSString *App_;
 static NSString *Home_;
 
 static BOOL Advanced_;
-static BOOL Loaded_;
 static BOOL Ignored_;
 
 static UIFont *Font12_;
@@ -1181,19 +1219,8 @@ bool isSectionVisible(NSString *section) {
 @interface NSObject (ProgressDelegate)
 @end
 
-@implementation NSObject(ProgressDelegate)
-
-- (void) _setProgressError:(NSArray *)args {
-    [self performSelector:@selector(setProgressError:forPackage:)
-        withObject:[args objectAtIndex:0]
-        withObject:([args count] == 1 ? nil : [args objectAtIndex:1])
-    ];
-}
-
-@end
-
 @protocol ProgressDelegate
-- (void) setProgressError:(NSString *)error forPackage:(NSString *)id;
+- (void) setProgressError:(NSString *)error withTitle:(NSString *)id;
 - (void) setProgressTitle:(NSString *)title;
 - (void) setProgressPercent:(float)percent;
 - (void) startProgress;
@@ -1242,6 +1269,10 @@ class Status :
         delegate_ = delegate;
     }
 
+    NSObject<ProgressDelegate> *getDelegate() const {
+        return delegate_;
+    }
+
     virtual bool MediaChange(std::string media, std::string drive) {
         return false;
     }
@@ -1251,7 +1282,7 @@ class Status :
 
     virtual void Fetch(pkgAcquire::ItemDesc &item) {
         //NSString *name([NSString stringWithUTF8String:item.ShortDesc.c_str()]);
-        [delegate_ setProgressTitle:[NSString stringWithFormat:UCLocalize("DOWNLOADING"), [NSString stringWithUTF8String:item.ShortDesc.c_str()]]];
+        [delegate_ setProgressTitle:[NSString stringWithFormat:UCLocalize("DOWNLOADING_"), [NSString stringWithUTF8String:item.ShortDesc.c_str()]]];
     }
 
     virtual void Done(pkgAcquire::ItemDesc &item) {
@@ -1272,7 +1303,7 @@ class Status :
         NSArray *fields([description componentsSeparatedByString:@" "]);
         NSString *source([fields count] == 0 ? nil : [fields objectAtIndex:0]);
 
-        [delegate_ performSelectorOnMainThread:@selector(_setProgressError:)
+        [delegate_ performSelectorOnMainThread:@selector(_setProgressErrorPackage:)
             withObject:[NSArray arrayWithObjects:
                 [NSString stringWithUTF8String:error.c_str()],
                 source,
@@ -1311,10 +1342,10 @@ class Progress :
 
   protected:
     virtual void Update() {
-        if (abs(Percent - percent_) > 2) {
-            NSLog(@"%s:%s:%f", Op.c_str(), SubOp.c_str(), Percent);
+        /*if (abs(Percent - percent_) > 2)
+            //NSLog(@"%s:%s:%f", Op.c_str(), SubOp.c_str(), Percent);
             percent_ = Percent;
-        }
+        }*/
 
         /*[delegate_ setProgressTitle:[NSString stringWithUTF8String:Op.c_str()]];
         [delegate_ setProgressPercent:(Percent / 100)];*/
@@ -1331,8 +1362,12 @@ class Progress :
         delegate_ = delegate;
     }
 
+    id getDelegate() const {
+        return delegate_;
+    }
+
     virtual void Done() {
-        NSLog(@"DONE");
+        //NSLog(@"DONE");
         //[delegate_ setProgressPercent:1];
     }
 };
@@ -1390,17 +1425,49 @@ typedef std::map< unsigned long, _H<Source> > SourceMap;
 - (void) reloadData;
 
 - (void) configure;
-- (void) prepare;
+- (bool) prepare;
 - (void) perform;
-- (void) upgrade;
+- (bool) upgrade;
 - (void) update;
 
 - (void) setVisible;
 
-- (NSString *) updateWithStatus:(Status &)status;
+- (void) updateWithStatus:(Status &)status;
 
 - (void) setDelegate:(id)delegate;
 - (Source *) getSource:(pkgCache::PkgFileIterator)file;
+@end
+/* }}} */
+/* Delegate Helpers {{{ */
+@implementation NSObject(ProgressDelegate)
+
+- (void) _setProgressErrorPackage:(NSArray *)args {
+    [self performSelector:@selector(setProgressError:forPackage:)
+        withObject:[args objectAtIndex:0]
+        withObject:([args count] == 1 ? nil : [args objectAtIndex:1])
+    ];
+}
+
+- (void) _setProgressErrorTitle:(NSArray *)args {
+    [self performSelector:@selector(setProgressError:withTitle:)
+        withObject:[args objectAtIndex:0]
+        withObject:([args count] == 1 ? nil : [args objectAtIndex:1])
+    ];
+}
+
+- (void) _setProgressError:(NSString *)error withTitle:(NSString *)title {
+    [self performSelectorOnMainThread:@selector(_setProgressErrorTitle:)
+        withObject:[NSArray arrayWithObjects:error, title, nil]
+        waitUntilDone:YES
+    ];
+}
+
+- (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])];
+}
+
 @end
 /* }}} */
 
@@ -1815,7 +1882,7 @@ typedef std::map< unsigned long, _H<Source> > SourceMap;
 
 - (bool) isUnfilteredAndSearchedForBy:(NSString *)search;
 - (bool) isInstalledAndVisible:(NSNumber *)number;
-- (bool) isVisiblyUninstalledInSection:(NSString *)section;
+- (bool) isVisibleInSection:(NSString *)section;
 - (bool) isVisibleInSource:(Source *)source;
 
 @end
@@ -2416,11 +2483,9 @@ struct PackageNameOrdering :
                     return @"UPGRADE";
                 case 2:
                     return @"NEW_INSTALL";
-                default:
-                    _assert(false);
+                _nodefault
             }
-        default:
-            _assert(false);
+        _nodefault
     }
 }
 
@@ -2751,12 +2816,11 @@ struct PackageNameOrdering :
     return (![number boolValue] || [self visible]) && ![self uninstalled];
 }
 
-- (bool) isVisiblyUninstalledInSection:(NSString *)name {
+- (bool) isVisibleInSection:(NSString *)name {
     NSString *section = [self section];
 
     return
-        [self visible] &&
-        [self uninstalled] && (
+        [self visible] && (
             name == nil ||
             section == nil && [name length] == 0 ||
             [name isEqualToString:section]
@@ -2888,6 +2952,10 @@ struct PackageNameOrdering :
 @end
 /* }}} */
 
+static NSString *Colon_;
+static NSString *Error_;
+static NSString *Warning_;
+
 /* Database Implementation {{{ */
 @implementation Database
 
@@ -2930,7 +2998,7 @@ struct PackageNameOrdering :
         }
     }
 
-    _assert(false);
+    _assume(false);
 }
 
 - (void) _readStatus:(NSNumber *)fd { _pooled
@@ -2943,7 +3011,7 @@ struct PackageNameOrdering :
 
     while (std::getline(is, line)) {
         const char *data(line.c_str());
-        size_t size = line.size();
+        size_t size(line.size());
         lprintf("S:%s\n", data);
 
         if (conffile_r(data, size)) {
@@ -2961,7 +3029,7 @@ struct PackageNameOrdering :
             NSString *string = pmstatus_r[4];
 
             if (type == "pmerror")
-                [delegate_ performSelectorOnMainThread:@selector(_setProgressError:)
+                [delegate_ performSelectorOnMainThread:@selector(_setProgressErrorPackage:)
                     withObject:[NSArray arrayWithObjects:string, id, nil]
                     waitUntilDone:YES
                 ];
@@ -2969,11 +3037,13 @@ struct PackageNameOrdering :
                 [delegate_ setProgressTitle:string];
             } else if (type == "pmconffile")
                 [delegate_ setConfigurationData:string];
-            else _assert(false);
-        } else _assert(false);
+            else
+                lprintf("E:unknown pmstatus\n");
+        } else
+            lprintf("E:unknown status\n");
     }
 
-    _assert(false);
+    _assume(false);
 }
 
 - (void) _readOutput:(NSNumber *)fd { _pooled
@@ -2986,7 +3056,7 @@ struct PackageNameOrdering :
         [delegate_ addProgressOutput:[NSString stringWithUTF8String:line.c_str()]];
     }
 
-    _assert(false);
+    _assume(false);
 }
 
 - (FILE *) input {
@@ -3156,9 +3226,40 @@ struct PackageNameOrdering :
     return issues;
 }
 
+- (bool) popErrorWithTitle:(NSString *)title {
+    bool fatal(false);
+    std::string message;
+
+    while (!_error->empty()) {
+        std::string error;
+        bool warning(!_error->PopMessage(error));
+        if (!warning)
+            fatal = true;
+        for (;;) {
+            size_t size(error.size());
+            if (size == 0 || error[size - 1] != '\n')
+                break;
+            error.resize(size - 1);
+        }
+        lprintf("%c:[%s]\n", warning ? 'W' : 'E', error.c_str());
+
+        if (!message.empty())
+            message += "\n\n";
+        message += error;
+    }
+
+    if (!message.empty())
+        [delegate_ _setProgressError:[NSString stringWithUTF8String:message.c_str()] withTitle:[NSString stringWithFormat:Colon_, fatal ? Error_ : Warning_, title]];
+
+    return fatal;
+}
+
+- (bool) popErrorWithTitle:(NSString *)title forOperation:(bool)success {
+    return [self popErrorWithTitle:title] || !success;
+}
+
 - (void) reloadData { _pooled
 @synchronized ([Database class]) {
-
     @synchronized (self) {
         ++era_;
     }
@@ -3196,12 +3297,12 @@ struct PackageNameOrdering :
     if (chk != -1)
         close(chk);
 
+    NSString *title(UCLocalize("DATABASE"));
+
     _trace();
-    if (!cache_.Open(progress_, true)) {
+    if (!cache_.Open(progress_, true)) { pop:
         std::string error;
-        if (!_error->PopMessage(error))
-            _assert(false);
-        _error->Discard();
+        bool warning(!_error->PopMessage(error));
         lprintf("cache_.Open():[%s]\n", error.c_str());
 
         if (error == "dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem. ")
@@ -3211,8 +3312,12 @@ struct PackageNameOrdering :
         // else if (error == "Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)")
         // else if (error == "Could not get lock /var/lib/dpkg/lock - open (35 Resource temporarily unavailable)")
         // else if (error == "The list of sources could not be read.")
-        else _assert(false);
+        else
+            [delegate_ _setProgressError:[NSString stringWithUTF8String:error.c_str()] withTitle:[NSString stringWithFormat:Colon_, warning ? Warning_ : Error_, title]];
 
+        if (warning)
+            goto pop;
+        _error->Discard();
         return;
     }
     _trace();
@@ -3228,15 +3333,28 @@ struct PackageNameOrdering :
     lock_ = NULL;
 
     list_ = new pkgSourceList();
-    _assert(list_->ReadMainList());
+    if ([self popErrorWithTitle:title forOperation:list_->ReadMainList()])
+        return;
+
+    if (cache_->DelCount() != 0 || cache_->InstCount() != 0) {
+        [delegate_ _setProgressError:@"COUNTS_NONZERO_EX" withTitle:title];
+        return;
+    }
 
-    _assert(cache_->DelCount() == 0 && cache_->InstCount() == 0);
-    _assert(pkgApplyStatus(cache_));
+    if ([self popErrorWithTitle:title forOperation:pkgApplyStatus(cache_)])
+        return;
 
     if (cache_->BrokenCount() != 0) {
-        _assert(pkgFixBroken(cache_));
-        _assert(cache_->BrokenCount() == 0);
-        _assert(pkgMinimizeUpgrade(cache_));
+        if ([self popErrorWithTitle:title forOperation:pkgFixBroken(cache_)])
+            return;
+
+        if (cache_->BrokenCount() != 0) {
+            [delegate_ _setProgressError:@"STILL_BROKEN_EX" withTitle:title];
+            return;
+        }
+
+        if ([self popErrorWithTitle:title forOperation:pkgMinimizeUpgrade(cache_)])
+            return;
     }
 
     _trace();
@@ -3304,13 +3422,18 @@ struct PackageNameOrdering :
     system([dpkg UTF8String]);
 }
 
-- (void) clean {
+- (bool) clean {
+    // XXX: I don't remember this condition
     if (lock_ != NULL)
-        return;
+        return false;
 
     FileFd Lock;
     Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
-    _assert(!_error->PendingError());
+
+    NSString *title(UCLocalize("CLEAN_ARCHIVES"));
+
+    if ([self popErrorWithTitle:title])
+        return false;
 
     pkgAcquire fetcher;
     fetcher.Clean(_config->FindDir("Dir::Cache::Archives"));
@@ -3324,35 +3447,43 @@ struct PackageNameOrdering :
         }
     } cleaner;
 
-    if (!cleaner.Go(_config->FindDir("Dir::Cache::Archives") + "partial/", cache_)) {
-        std::string error;
-        while (_error->PopMessage(error))
-            lprintf("ArchiveCleaner: %s\n", error.c_str());
-    }
+    if ([self popErrorWithTitle:title forOperation:cleaner.Go(_config->FindDir("Dir::Cache::Archives") + "partial/", cache_)])
+        return false;
+
+    return true;
 }
 
-- (void) prepare {
+- (bool) prepare {
     fetcher_->Shutdown();
 
     pkgRecords records(cache_);
 
     lock_ = new FileFd();
     lock_->Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
-    _assert(!_error->PendingError());
+
+    NSString *title(UCLocalize("PREPARE_ARCHIVES"));
+
+    if ([self popErrorWithTitle:title])
+        return false;
 
     pkgSourceList list;
-    // XXX: explain this with an error message
-    _assert(list.ReadMainList());
+    if ([self popErrorWithTitle:title forOperation:list.ReadMainList()])
+        return false;
 
     manager_ = (_system->CreatePM(cache_));
-    _assert(manager_->GetArchives(fetcher_, &list, &records));
-    _assert(!_error->PendingError());
+    if ([self popErrorWithTitle:title forOperation:manager_->GetArchives(fetcher_, &list, &records)])
+        return false;
+
+    return true;
 }
 
 - (void) perform {
+    NSString *title(UCLocalize("PERFORM_SELECTIONS"));
+
     NSMutableArray *before = [NSMutableArray arrayWithCapacity:16]; {
         pkgSourceList list;
-        _assert(list.ReadMainList());
+        if ([self popErrorWithTitle:title forOperation:list.ReadMainList()])
+            return;
         for (pkgSourceList::const_iterator source = list.begin(); source != list.end(); ++source)
             [before addObject:[NSString stringWithUTF8String:(*source)->GetURI().c_str()]];
     }
@@ -3375,7 +3506,7 @@ struct PackageNameOrdering :
         lprintf("pAf:%s:%s\n", uri.c_str(), error.c_str());
         failed = true;
 
-        [delegate_ performSelectorOnMainThread:@selector(_setProgressError:)
+        [delegate_ performSelectorOnMainThread:@selector(_setProgressErrorPackage:)
             withObject:[NSArray arrayWithObjects:
                 [NSString stringWithUTF8String:error.c_str()],
             nil]
@@ -3408,7 +3539,8 @@ struct PackageNameOrdering :
 
     NSMutableArray *after = [NSMutableArray arrayWithCapacity:16]; {
         pkgSourceList list;
-        _assert(list.ReadMainList());
+        if ([self popErrorWithTitle:title forOperation:list.ReadMainList()])
+            return;
         for (pkgSourceList::const_iterator source = list.begin(); source != list.end(); ++source)
             [after addObject:[NSString stringWithUTF8String:(*source)->GetURI().c_str()]];
     }
@@ -3417,8 +3549,11 @@ struct PackageNameOrdering :
         [self update];
 }
 
-- (void) upgrade {
-    _assert(pkgDistUpgrade(cache_));
+- (bool) upgrade {
+    NSString *title(UCLocalize("UPGRADE"));
+    if ([self popErrorWithTitle:title forOperation:pkgDistUpgrade(cache_)])
+        return false;
+    return true;
 }
 
 - (void) update {
@@ -3430,28 +3565,24 @@ struct PackageNameOrdering :
         [package setVisible];
 }
 
-- (NSString *) updateWithStatus:(Status &)status {
+- (void) updateWithStatus:(Status &)status {
+    _transient NSObject<ProgressDelegate> *delegate(status.getDelegate());
+    NSString *title(UCLocalize("REFRESHING_DATA"));
+
     pkgSourceList list;
-    _assert(list.ReadMainList());
+    if (!list.ReadMainList())
+        [delegate _setProgressError:@"Unable to read source list." withTitle:title];
 
     FileFd lock;
     lock.Fd(GetLock(_config->FindDir("Dir::State::Lists") + "lock"));
+    if ([self popErrorWithTitle:title])
+        return;
 
-    if (_error->PendingError()) error: {
-        std::string error;
-        if (!_error->PopMessage(error))
-            _assert(false);
-        _error->Discard();
-        return [NSString stringWithUTF8String:error.c_str()];
-    }
-
-    if (!ListUpdate(status, list, PulseInterval_))
-        goto error;
+    if ([self popErrorWithTitle:title forOperation:ListUpdate(status, list, PulseInterval_)])
+        return;
 
     [Metadata_ setObject:[NSDate date] forKey:@"LastUpdate"];
     Changed_ = true;
-
-    return nil;
 }
 
 - (void) setDelegate:(id)delegate {
@@ -3809,8 +3940,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
                     Finish_ = 2;
                 [delegate_ confirm];
                 break;
-            default:
-                _assert(false);
+            _nodefault
         }
 
         [sheet dismiss];
@@ -4019,6 +4149,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     BOOL running_;
     SHA1SumValue springlist_;
     SHA1SumValue notifyconf_;
+    NSString *title_;
 }
 
 - (id) initWithFrame:(struct CGRect)frame database:(Database *)database delegate:(id)delegate;
@@ -4053,6 +4184,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     [output_ release];
     [status_ release];
     [close_ release];
+    if (title_ != nil)
+        [title_ release];
     [super dealloc];
 }
 
@@ -4156,26 +4289,63 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     [transition_ transition:6 toView:view_];
 }
 
-- (void) _checkError {
-    if (_error->PendingError()) {
-        std::string error;
-        if (!_error->PopMessage(error))
-            _assert(false);
+- (void) alertSheet:(UIActionSheet *)sheet buttonClicked:(int)button {
+    NSString *context([sheet context]);
 
-        UIActionSheet *sheet = [[[UIActionSheet alloc]
-            initWithTitle:UCLocalize("ERROR")
-            buttons:[NSArray arrayWithObjects:UCLocalize("OKAY"), nil]
-            defaultButtonIndex:0
-            delegate:self
-            context:@"_error"
-        ] autorelease];
+    if ([context isEqualToString:@"conffile"]) {
+        FILE *input = [database_ input];
 
-        [sheet setBodyText:[NSString stringWithUTF8String:error.c_str()]];
-        [sheet popupAlertAnimated:YES];
+        switch (button) {
+            case 1:
+                fprintf(input, "N\n");
+                fflush(input);
+                break;
+            case 2:
+                fprintf(input, "Y\n");
+                fflush(input);
+                break;
+            _nodefault
+        }
 
-        return;
+        [sheet dismiss];
+    }
+}
+
+- (void) closeButtonPushed {
+    running_ = NO;
+
+    switch (Finish_) {
+        case 0:
+            [self resetView];
+        break;
+
+        case 1:
+            [delegate_ suspendWithAnimation:YES];
+        break;
+
+        case 2:
+            system("launchctl stop com.apple.SpringBoard");
+        break;
+
+        case 3:
+            system("launchctl unload "SpringBoard_"; launchctl load "SpringBoard_);
+        break;
+
+        case 4:
+            system("reboot");
+        break;
     }
+}
 
+- (void) _retachThread {
+    UINavigationItem *item([navbar_ topItem]);
+    [item setTitle:UCLocalize("COMPLETE")];
+
+    [overlay_ addSubview:close_];
+    [progress_ removeFromSuperview];
+    [status_ removeFromSuperview];
+
+    [database_ popErrorWithTitle:title_];
     [delegate_ progressViewIsComplete:self];
 
     if (Finish_ < 4) {
@@ -4220,10 +4390,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     if (NSMutableDictionary *cache = [[NSMutableDictionary alloc] initWithContentsOfFile:@ListCache_]) {
         [cache autorelease];
 
-        NSFileManager *manager = [NSFileManager defaultManager];
-        NSError *error = nil;
+        NSFileManager *manager([NSFileManager defaultManager]);
+        NSError *error(nil);
 
-        id system = [cache objectForKey:@"System"];
+        id system([cache objectForKey:@"System"]);
         if (system == nil)
             goto error;
 
@@ -4265,71 +4435,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     [delegate_ setStatusBarShowsProgress:NO];
 }
 
-- (void) alertSheet:(UIActionSheet *)sheet buttonClicked:(int)button {
-    NSString *context([sheet context]);
-
-    if ([context isEqualToString:@"error"])
-        [sheet dismiss];
-    else if ([context isEqualToString:@"_error"]) {
-        [sheet dismiss];
-        [self _checkError];
-    } else if ([context isEqualToString:@"conffile"]) {
-        FILE *input = [database_ input];
-
-        switch (button) {
-            case 1:
-                fprintf(input, "N\n");
-                fflush(input);
-                break;
-            case 2:
-                fprintf(input, "Y\n");
-                fflush(input);
-                break;
-            default:
-                _assert(false);
-        }
-
-        [sheet dismiss];
-    }
-}
-
-- (void) closeButtonPushed {
-    running_ = NO;
-
-    switch (Finish_) {
-        case 0:
-            [self resetView];
-        break;
-
-        case 1:
-            [delegate_ suspendWithAnimation:YES];
-        break;
-
-        case 2:
-            system("launchctl stop com.apple.SpringBoard");
-        break;
-
-        case 3:
-            system("launchctl unload "SpringBoard_"; launchctl load "SpringBoard_);
-        break;
-
-        case 4:
-            system("reboot");
-        break;
-    }
-}
-
-- (void) _retachThread {
-    UINavigationItem *item = [navbar_ topItem];
-    [item setTitle:UCLocalize("COMPLETE")];
-
-    [overlay_ addSubview:close_];
-    [progress_ removeFromSuperview];
-    [status_ removeFromSuperview];
-
-    [self _checkError];
-}
-
 - (void) _detachNewThreadData:(ProgressData *)data { _pooled
     [[data target] performSelector:[data selector] withObject:[data object]];
     [data release];
@@ -4338,8 +4443,15 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 }
 
 - (void) detachNewThreadSelector:(SEL)selector toTarget:(id)target withObject:(id)object title:(NSString *)title {
-    UINavigationItem *item = [navbar_ topItem];
-    [item setTitle:title];
+    if (title_ != nil)
+        [title_ release];
+    if (title == nil)
+        title_ = nil;
+    else
+        title_ = [title retain];
+
+    UINavigationItem *item([navbar_ topItem]);
+    [item setTitle:title_];
 
     [status_ setText:nil];
     [output_ setText:@""];
@@ -4406,19 +4518,16 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     ];
 }
 
-- (void) setProgressError:(NSString *)error forPackage:(NSString *)id {
-    Package *package = id == nil ? nil : [database_ packageWithName:id];
-
-    UIActionSheet *sheet = [[[UIActionSheet alloc]
-        initWithTitle:(package == nil ? id : [package name])
+- (void) setProgressError:(NSString *)error withTitle:(NSString *)title {
+    CYActionSheet *sheet([[[CYActionSheet alloc]
+        initWithTitle:title
         buttons:[NSArray arrayWithObjects:UCLocalize("OKAY"), nil]
         defaultButtonIndex:0
-        delegate:self
-        context:@"error"
-    ] autorelease];
+    ] autorelease]);
 
     [sheet setBodyText:error];
-    [sheet popupAlertAnimated:YES];
+    [sheet yieldToPopupAlertAnimated:YES];
+    [sheet dismiss];
 }
 
 - (void) setProgressTitle:(NSString *)title {
@@ -4455,7 +4564,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 - (void) _setConfigurationData:(NSString *)data {
     static Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
 
-    _assert(conffile_r(data));
+    if (!conffile_r(data)) {
+        lprintf("E:invalid conffile\n");
+        return;
+    }
 
     NSString *ofile = conffile_r[1];
     //NSString *nfile = conffile_r[2];
@@ -4524,6 +4636,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     ContentView *content_;
     BOOL faded_;
     float fade_;
+    UIImage *placard_;
 }
 
 - (PackageCell *) init;
@@ -4580,6 +4693,11 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         badge_ = nil;
     }
 
+    if (placard_ != nil) {
+        [placard_ release];
+        placard_ = nil;
+    }
+
     [package_ release];
     package_ = nil;
 }
@@ -4661,6 +4779,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         if ((badge_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/Purposes/%@.png", App_, purpose]]) != nil)
             badge_ = [badge_ retain];
 
+    if ([package installed] != nil)
+        if ((placard_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/installed.png", App_]]) != nil)
+            placard_ = [placard_ retain];
+
     [self _setBackgroundColor];
     [content_ setNeedsDisplay];
 }
@@ -4701,12 +4823,15 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
     if (!selected)
         UISetColor(commercial_ ? Purple_ : Black_);
-    [name_ drawAtPoint:CGPointMake(48, 8) forWidth:240 withFont:Font18Bold_ ellipsis:2];
+    [name_ drawAtPoint:CGPointMake(48, 8) forWidth:(placard_ == nil ? 240 : 214) withFont:Font18Bold_ ellipsis:2];
     [source_ drawAtPoint:CGPointMake(58, 29) forWidth:225 withFont:Font12_ ellipsis:2];
 
     if (!selected)
         UISetColor(commercial_ ? Purplish_ : Gray_);
-    [description_ drawAtPoint:CGPointMake(12, 46) forWidth:280 withFont:Font14_ ellipsis:2];
+    [description_ drawAtPoint:CGPointMake(12, 46) forWidth:274 withFont:Font14_ ellipsis:2];
+
+    if (placard_ != nil)
+        [placard_ drawAtPoint:CGPointMake(268, 9)];
 }
 
 - (void) setSelected:(BOOL)selected animated:(BOOL)fade {
@@ -5042,8 +5167,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
 #if !AlwaysReload
 - (void) __rightButtonClicked {
-    int count = [buttons_ count];
-    _assert(count != 0);
+    int count([buttons_ count]);
+    if (count == 0)
+        return;
 
     if (count == 1)
         [self _clickButtonWithName:[buttons_ objectAtIndex:0]];
@@ -5390,7 +5516,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         object_ = object == nil ? nil : [object retain];
 
         /* XXX: this is an unsafe optimization of doomy hell */
-        Method method = class_getInstanceMethod([Package class], filter);
+        Method method(class_getInstanceMethod([Package class], filter));
         _assert(method != NULL);
         imp_ = method_getImplementation(method);
         _assert(imp_ != NULL);
@@ -5547,9 +5673,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         case 0: return UCLocalize("ENTERED_BY_USER");
         case 1: return UCLocalize("INSTALLED_BY_PACKAGE");
 
-        default:
-            _assert(false);
-            return nil;
+        _nodefault
     }
 }
 
@@ -5558,9 +5682,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         case 0: return 0;
         case 1: return offset_;
 
-        default:
-            _assert(false);
-            return -1;
+        _nodefault
     }
 }
 
@@ -5639,7 +5761,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     if (colon.location != NSNotFound)
         href = [href substringFromIndex:(colon.location + 3)];
     href = [href stringByAddingPercentEscapes];
-    href = [@"http://cydia.saurik.com/api/repotag/" stringByAppendingString:href];
+    href = [CydiaURL(@"api/repotag/") stringByAppendingString:href];
     href = [href stringByCachingURLWithCurrentCDN];
 
     NSURL *url([NSURL URLWithString:href]);
@@ -5796,8 +5918,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
             case 2:
             break;
 
-            default:
-                _assert(false);
+            _nodefault
         }
 
         [sheet dismiss];
@@ -5814,8 +5935,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
             case 2:
             break;
 
-            default:
-                _assert(false);
+            _nodefault
         }
 
         [href_ release];
@@ -5857,7 +5977,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
 - (void) reloadData {
     pkgSourceList list;
-    _assert(list.ReadMainList());
+    if (!list.ReadMainList())
+        return;
 
     [sources_ removeAllObjects];
     [sources_ addObjectsFromArray:[database_ sources]];
@@ -5865,7 +5986,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     [sources_ sortUsingSelector:@selector(compareByNameAndType:)];
     _trace();
 
-    int count = [sources_ count];
+    int count([sources_ count]);
     for (offset_ = 0; offset_ != count; ++offset_) {
         Source *source = [sources_ objectAtIndex:offset_];
         if ([source record] == nil)
@@ -6079,6 +6200,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
 - (void) _leftButtonClicked {
     [delegate_ askForSettings];
+    [delegate_ updateData];
 }
 
 - (NSString *) leftButtonTitle {
@@ -6184,7 +6306,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         [sheet dismiss];
 }
 
-- (void) _update_:(NSString *)error {
+- (void) _update_ {
     updating_ = false;
 
     [indicator_ stopAnimation];
@@ -6206,31 +6328,14 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
     [UIView commitAnimations];
 
-    if (error == nil)
-        [delegate_ performSelector:@selector(reloadData) withObject:nil afterDelay:0];
-    else {
-        UIActionSheet *sheet = [[[UIActionSheet alloc]
-            initWithTitle:[NSString stringWithFormat:UCLocalize("COLON_DELIMITED"), UCLocalize("ERROR"), UCLocalize("REFRESH")]
-            buttons:[NSArray arrayWithObjects:
-                UCLocalize("OK"),
-            nil]
-            defaultButtonIndex:0
-            delegate:self
-            context:@"refresh"
-        ] autorelease];
-
-        [sheet setBodyText:error];
-        [sheet popupAlertAnimated:YES];
-
-        [self reloadButtons];
-    }
+    [delegate_ performSelector:@selector(reloadData) withObject:nil afterDelay:0];
 }
 
 - (id) initWithFrame:(CGRect)frame database:(Database *)database {
     if ((self = [super initWithFrame:frame]) != nil) {
         database_ = database;
 
-        CGRect ovrrect = [navbar_ bounds];
+        CGRect ovrrect([navbar_ bounds]);
         ovrrect.size.height = [UINavigationBar defaultSize].height;
         ovrrect.origin.y = -ovrrect.size.height;
 
@@ -6245,14 +6350,14 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         [overlay_ setBarStyle:1];
         [underlay_ setBarStyle:1];
 
-        int barstyle = [overlay_ _barStyle:NO];
-        bool ugly = barstyle == 0;
+        int barstyle([overlay_ _barStyle:NO]);
+        bool ugly(barstyle == 0);
 
         UIProgressIndicatorStyle style = ugly ?
             UIProgressIndicatorStyleMediumBrown :
             UIProgressIndicatorStyleMediumWhite;
 
-        CGSize indsize = [UIProgressIndicator defaultSizeForStyle:style];
+        CGSize indsize([UIProgressIndicator defaultSizeForStyle:style]);
         unsigned indoffset = (ovrrect.size.height - indsize.height) / 2;
         CGRect indrect = {{indoffset, indoffset}, indsize};
 
@@ -6267,7 +6372,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
             unsigned(ovrrect.size.height - prmsize.height) / 2 - 1
         }, prmsize};
 
-        UIFont *font = [UIFont systemFontOfSize:15];
+        UIFont *font([UIFont systemFontOfSize:15]);
 
         prompt_ = [[UITextLabel alloc] initWithFrame:prmrect];
 
@@ -6308,20 +6413,36 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 - (void) _update { _pooled
     Status status;
     status.setDelegate(self);
-
-    NSString *error([database_ updateWithStatus:status]);
+    [database_ updateWithStatus:status];
 
     [self
-        performSelectorOnMainThread:@selector(_update_:)
-        withObject:error
+        performSelectorOnMainThread:@selector(_update_)
+        withObject:nil
         waitUntilDone:NO
     ];
 }
 
-- (void) setProgressError:(NSString *)error forPackage:(NSString *)id {
+- (void) setProgressError:(NSString *)error withTitle:(NSString *)title {
     [prompt_ setText:[NSString stringWithFormat:UCLocalize("COLON_DELIMITED"), UCLocalize("ERROR"), error]];
 }
 
+/*
+    UIActionSheet *sheet = [[[UIActionSheet alloc]
+        initWithTitle:[NSString stringWithFormat:UCLocalize("COLON_DELIMITED"), UCLocalize("ERROR"), UCLocalize("REFRESH")]
+        buttons:[NSArray arrayWithObjects:
+            UCLocalize("OK"),
+        nil]
+        defaultButtonIndex:0
+        delegate:self
+        context:@"refresh"
+    ] autorelease];
+
+    [sheet setBodyText:error];
+    [sheet popupAlertAnimated:YES];
+
+    [self reloadButtons];
+*/
+
 - (void) setProgressTitle:(NSString *)title {
     [self
         performSelectorOnMainThread:@selector(_setProgressTitle:)
@@ -6554,7 +6675,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         initWithBook:book_
         database:database_
         title:title
-        filter:@selector(isVisiblyUninstalledInSection:)
+        filter:@selector(isVisibleInSection:)
         with:name
     ] autorelease];
 
@@ -6629,7 +6750,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         [*section addToCount];
 
         _profile(SectionsView$reloadData$Filter)
-            if (![package valid] || ![package uninstalled] || ![package visible])
+            if (![package valid] || ![package visible])
                 continue;
         _end
 
@@ -6650,7 +6771,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         [section addToCount];
 
         _profile(SectionsView$reloadData$Filter)
-            if (![package valid] || ![package uninstalled] || ![package visible])
+            if (![package valid] || ![package visible])
                 continue;
         _end
 
@@ -6701,7 +6822,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 }
 
 - (NSString *) title {
-    return editing_ ? UCLocalize("SECTION_VISIBILITY") : UCLocalize("INSTALL_BY_SECTION");
+    return editing_ ? UCLocalize("SECTION_VISIBILITY") : UCLocalize("SECTIONS");
 }
 
 - (NSString *) backButtonTitle {
@@ -7163,7 +7284,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         case 0: return nil;
         case 1: return nil;
 
-        default: _assert(false);
+        _nodefault
     }
 
     return nil;
@@ -7177,7 +7298,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         case 0: return NO;
         case 1: return YES;
 
-        default: _assert(false);
+        _nodefault
     }
 
     return NO;
@@ -7191,7 +7312,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         case 0: return 1;
         case 1: return 1;
 
-        default: _assert(false);
+        _nodefault
     }
 
     return 0;
@@ -7236,7 +7357,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
                 return subscribedCell_;
             case 1:
                 return ignoredCell_;
-            default: _assert(false);
+            _nodefault
         } break;
 
         case 1: switch (row) {
@@ -7247,10 +7368,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
                 return cell;
             }
 
-            default: _assert(false);
+            _nodefault
         } break;
 
-        default: _assert(false);
+        _nodefault
     }
 
     return nil;
@@ -7385,8 +7506,15 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 #endif
 }
 
+- (RVPage *) _pageForURL:(NSURL *)url withClass:(Class)_class;
+- (void) setPage:(RVPage *)page;
+
 @end
 
+static _finline void _setHomePage(Cydia *self) {
+    [self setPage:[self _pageForURL:[NSURL URLWithString:CydiaURL(@"")] withClass:[HomeView class]]];
+}
+
 @implementation Cydia
 
 - (void) _loaded {
@@ -7465,7 +7593,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     static bool loaded(false);
     UIProgressHUD *hud([self addProgressHUD]);
     [hud setText:(loaded ? UCLocalize("RELOADING_DATA") : UCLocalize("LOADING_DATA"))];
-    loaded = true;
 
     [database_ yieldToSelector:@selector(reloadData) withObject:nil];
     _trace();
@@ -7477,7 +7604,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     [essential_ removeAllObjects];
     [broken_ removeAllObjects];
 
-    NSArray *packages = [database_ packages];
+    NSArray *packages([database_ packages]);
     for (Package *package in packages) {
         if ([package half])
             [broken_ addObject:package];
@@ -7512,16 +7639,14 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
     [self _updateData];
 
-    // XXX: what is this line of code for?
-    if ([packages count] == 0);
-    else if (Loaded_ || ManualRefresh) loaded:
+    if (loaded || ManualRefresh) loaded:
         [self _loaded];
     else {
-        Loaded_ = YES;
+        loaded = true;
 
         if (NSDate *update = [Metadata_ objectForKey:@"LastUpdate"]) {
             NSTimeInterval interval([update timeIntervalSinceNow]);
-            if (interval <= 0 && interval > -600)
+            if (interval <= 0 && interval > -(15*60))
                 goto loaded;
         }
 
@@ -7539,13 +7664,11 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 }
 
 - (void) syncData {
-    FILE *file = fopen("/etc/apt/sources.list.d/cydia.list", "w");
+    FILE *file(fopen("/etc/apt/sources.list.d/cydia.list", "w"));
     _assert(file != NULL);
 
-    NSArray *keys = [Sources_ allKeys];
-
-    for (NSString *key in keys) {
-        NSDictionary *source = [Sources_ objectForKey:key];
+    for (NSString *key in [Sources_ allKeys]) {
+        NSDictionary *source([Sources_ objectForKey:key]);
 
         fprintf(file, "%s %s %s\n",
             [[source objectForKey:@"Type"] UTF8String],
@@ -7589,8 +7712,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     return [underlay_ bounds];
 }
 
-- (void) perform {
-    [database_ prepare];
+- (bool) perform {
+    if (![database_ prepare])
+        return false;
 
     confirm_ = [[RVBook alloc] initWithFrame:[self popUpBounds]];
     [confirm_ setDelegate:self];
@@ -7600,6 +7724,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
     [confirm_ setPage:page];
     [self popUpBook:confirm_];
+
+    return true;
 }
 
 - (void) queue {
@@ -7634,7 +7760,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
 - (void) distUpgrade {
     @synchronized (self) {
-        [database_ upgrade];
+        if (![database_ upgrade])
+            return;
         [self perform];
     }
 }
@@ -7693,10 +7820,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     return browser;
 }
 
-- (void) _setHomePage {
-    [self setPage:[self _pageForURL:[NSURL URLWithString:@"http://cydia.saurik.com/"] withClass:[HomeView class]]];
-}
-
 - (SectionsView *) sectionsView {
     if (sections_ == nil)
         sections_ = [[SectionsView alloc] initWithBook:book_ database:database_];
@@ -7708,32 +7831,27 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     if (tag == tag_) {
         [book_ resetViewAnimated:YES];
         return;
-    } else if (tag_ == 2 && tag != 2)
+    } else if (tag_ == 2)
         [[self sectionsView] resetView];
 
     switch (tag) {
-        case 1: [self _setHomePage]; break;
+        case 1: _setHomePage(self); break;
 
         case 2: [self setPage:[self sectionsView]]; break;
         case 3: [self setPage:changes_]; break;
         case 4: [self setPage:manage_]; break;
         case 5: [self setPage:search_]; break;
 
-        default: _assert(false);
+        _nodefault
     }
 
     tag_ = tag;
 }
 
-- (void) applicationWillSuspend {
-    [database_ clean];
-    [super applicationWillSuspend];
-}
-
 - (void) askForSettings {
     NSString *parenthetical(UCLocalize("PARENTHETICAL"));
 
-    UIActionSheet *role = [[[UIActionSheet alloc]
+    CYActionSheet *role([[[CYActionSheet alloc]
         initWithTitle:UCLocalize("WHO_ARE_YOU")
         buttons:[NSArray arrayWithObjects:
             [NSString stringWithFormat:parenthetical, UCLocalize("USER"), UCLocalize("USER_EX")],
@@ -7741,12 +7859,29 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
             [NSString stringWithFormat:parenthetical, UCLocalize("DEVELOPER"), UCLocalize("DEVELOPER_EX")],
         nil]
         defaultButtonIndex:-1
-        delegate:self
-        context:@"role"
-    ] autorelease];
+    ] autorelease]);
 
     [role setBodyText:UCLocalize("ROLE_EX")];
-    [role popupAlertAnimated:YES];
+
+    int button([role yieldToPopupAlertAnimated:YES]);
+
+    switch (button) {
+        case 1: Role_ = @"User"; break;
+        case 2: Role_ = @"Hacker"; break;
+        case 3: Role_ = @"Developer"; break;
+
+        _nodefault
+    }
+
+    Settings_ = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+        Role_, @"Role",
+    nil];
+
+    [Metadata_ setObject:Settings_ forKey:@"Settings"];
+
+    Changed_ = true;
+
+    [role dismiss];
 }
 
 - (void) setPackageView:(PackageView *)view {
@@ -7785,147 +7920,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 #endif
 }
 
-- (void) finish {
-    if (hud_ != nil) {
-        [self setStatusBarShowsProgress:NO];
-        [self removeProgressHUD:hud_];
-
-        [hud_ autorelease];
-        hud_ = nil;
-
-        pid_t pid = ExecFork();
-        if (pid == 0) {
-            execlp("launchctl", "launchctl", "stop", "com.apple.SpringBoard", NULL);
-            perror("launchctl stop");
-        }
-
-        return;
-    }
-
-    if (Role_ == nil) {
-        [self askForSettings];
-        return;
-    }
-
-    _trace();
-    overlay_ = [[UIView alloc] initWithFrame:[underlay_ bounds]];
-
-    CGRect screenrect = [UIHardware fullScreenApplicationContentRect];
-    book_ = [[CYBook alloc] initWithFrame:CGRectMake(
-        0, 0, screenrect.size.width, screenrect.size.height - 48
-    ) database:database_];
-
-    [book_ setDelegate:self];
-
-    [overlay_ addSubview:book_];
-
-    NSArray *buttonitems = [NSArray arrayWithObjects:
-        [NSDictionary dictionaryWithObjectsAndKeys:
-            @"buttonBarItemTapped:", kUIButtonBarButtonAction,
-            @"home-up.png", kUIButtonBarButtonInfo,
-            @"home-dn.png", kUIButtonBarButtonSelectedInfo,
-            [NSNumber numberWithInt:1], kUIButtonBarButtonTag,
-            self, kUIButtonBarButtonTarget,
-            @"Cydia", kUIButtonBarButtonTitle,
-            @"0", kUIButtonBarButtonType,
-        nil],
-
-        [NSDictionary dictionaryWithObjectsAndKeys:
-            @"buttonBarItemTapped:", kUIButtonBarButtonAction,
-            @"install-up.png", kUIButtonBarButtonInfo,
-            @"install-dn.png", kUIButtonBarButtonSelectedInfo,
-            [NSNumber numberWithInt:2], kUIButtonBarButtonTag,
-            self, kUIButtonBarButtonTarget,
-            UCLocalize("SECTIONS"), kUIButtonBarButtonTitle,
-            @"0", kUIButtonBarButtonType,
-        nil],
-
-        [NSDictionary dictionaryWithObjectsAndKeys:
-            @"buttonBarItemTapped:", kUIButtonBarButtonAction,
-            @"changes-up.png", kUIButtonBarButtonInfo,
-            @"changes-dn.png", kUIButtonBarButtonSelectedInfo,
-            [NSNumber numberWithInt:3], kUIButtonBarButtonTag,
-            self, kUIButtonBarButtonTarget,
-            UCLocalize("CHANGES"), kUIButtonBarButtonTitle,
-            @"0", kUIButtonBarButtonType,
-        nil],
-
-        [NSDictionary dictionaryWithObjectsAndKeys:
-            @"buttonBarItemTapped:", kUIButtonBarButtonAction,
-            @"manage-up.png", kUIButtonBarButtonInfo,
-            @"manage-dn.png", kUIButtonBarButtonSelectedInfo,
-            [NSNumber numberWithInt:4], kUIButtonBarButtonTag,
-            self, kUIButtonBarButtonTarget,
-            UCLocalize("MANAGE"), kUIButtonBarButtonTitle,
-            @"0", kUIButtonBarButtonType,
-        nil],
-
-        [NSDictionary dictionaryWithObjectsAndKeys:
-            @"buttonBarItemTapped:", kUIButtonBarButtonAction,
-            @"search-up.png", kUIButtonBarButtonInfo,
-            @"search-dn.png", kUIButtonBarButtonSelectedInfo,
-            [NSNumber numberWithInt:5], kUIButtonBarButtonTag,
-            self, kUIButtonBarButtonTarget,
-            UCLocalize("SEARCH"), kUIButtonBarButtonTitle,
-            @"0", kUIButtonBarButtonType,
-        nil],
-    nil];
-
-    toolbar_ = [[UIToolbar alloc]
-        initInView:overlay_
-        withFrame:CGRectMake(
-            0, screenrect.size.height - ButtonBarHeight_,
-            screenrect.size.width, ButtonBarHeight_
-        )
-        withItemList:buttonitems
-    ];
-
-    [toolbar_ setDelegate:self];
-    [toolbar_ setBarStyle:1];
-    [toolbar_ setButtonBarTrackingMode:2];
-
-    int buttons[5] = {1, 2, 3, 4, 5};
-    [toolbar_ registerButtonGroup:0 withButtons:buttons withCount:5];
-    [toolbar_ showButtonGroup:0 withDuration:0];
-
-    for (int i = 0; i != 5; ++i)
-        [[toolbar_ viewWithTag:(i + 1)] setFrame:CGRectMake(
-            i * 64 + 2, 1, 60, ButtonBarHeight_
-        )];
-
-    [toolbar_ showSelectionForButton:1];
-    [overlay_ addSubview:toolbar_];
-
-    [UIKeyboard initImplementationNow];
-    CGSize keysize = [UIKeyboard defaultSize];
-    CGRect keyrect = {{0, [overlay_ bounds].size.height}, keysize};
-    keyboard_ = [[UIKeyboard alloc] initWithFrame:keyrect];
-    [overlay_ addSubview:keyboard_];
-
-    [underlay_ addSubview:overlay_];
-
-    [self reloadData];
-
-    [self sectionsView];
-    changes_ = [[ChangesView alloc] initWithBook:book_ database:database_];
-    search_ = [[SearchView alloc] initWithBook:book_ database:database_];
-
-    manage_ = (ManageView *) [[self
-        _pageForURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"manage" ofType:@"html"]]
-        withClass:[ManageView class]
-    ] retain];
-
-#if RecyclePackageViews
-    details_ = [[NSMutableArray alloc] initWithCapacity:4];
-    [details_ addObject:[self _packageView]];
-    [details_ addObject:[self _packageView]];
-#endif
-
-    PrintTimes();
-
-    [self _setHomePage];
-}
-
 - (void) alertSheet:(UIActionSheet *)sheet buttonClicked:(int)button {
     NSString *context([sheet context]);
 
@@ -7943,8 +7937,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
                 clear = true;
             break;
 
-            default:
-                _assert(false);
+            _nodefault
         }
 
         [sheet dismiss];
@@ -7987,38 +7980,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
                 [self _loaded];
             break;
 
-            default:
-                _assert(false);
-        }
-
-        [sheet dismiss];
-    } else if ([context isEqualToString:@"role"]) {
-        switch (button) {
-            case 1: Role_ = @"User"; break;
-            case 2: Role_ = @"Hacker"; break;
-            case 3: Role_ = @"Developer"; break;
-
-            default:
-                Role_ = nil;
-                _assert(false);
+            _nodefault
         }
 
-        bool reset = Settings_ != nil;
-
-        Settings_ = [NSMutableDictionary dictionaryWithObjectsAndKeys:
-            Role_, @"Role",
-        nil];
-
-        [Metadata_ setObject:Settings_ forKey:@"Settings"];
-
-        Changed_ = true;
-
         [sheet dismiss];
-
-        if (reset)
-            [self updateData];
-        else
-            [self finish];
     } else if ([context isEqualToString:@"upgrade"]) {
         switch (button) {
             case 1:
@@ -8039,17 +8004,20 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
                 Ignored_ = YES;
             break;
 
-            default:
-                _assert(false);
+            _nodefault
         }
 
         [sheet dismiss];
     }
 }
 
-- (void) reorganize { _pooled
-    system("/usr/libexec/cydia/free.sh");
-    [self performSelectorOnMainThread:@selector(finish) withObject:nil waitUntilDone:NO];
+- (void) system:(NSString *)command { _pooled
+    system([command UTF8String]);
+}
+
+- (void) applicationWillSuspend {
+    [database_ clean];
+    [super applicationWillSuspend];
 }
 
 - (void) applicationSuspend:(__GSEvent *)event {
@@ -8087,18 +8055,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         [view setPackage:package];
         return view;
     } else {
-        UIActionSheet *sheet = [[[UIActionSheet alloc]
-            initWithTitle:UCLocalize("CANNOT_LOCATE_PACKAGE")
-            buttons:[NSArray arrayWithObjects:UCLocalize("CLOSE"), nil]
-            defaultButtonIndex:0
-            delegate:self
-            context:@"missing"
-        ] autorelease];
-
-        [sheet setBodyText:[NSString stringWithFormat:UCLocalize("PACKAGE_CANNOT_BE_FOUND"), name]];
-
-        [sheet popupAlertAnimated:YES];
-        return nil;
+        NSURL *url([NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"unknown" ofType:@"html"]]);
+        url = [NSURL URLWithString:[[url absoluteString] stringByAppendingString:[NSString stringWithFormat:@"?%@", name]]];
+        return [self _pageForURL:url withClass:[CydiaBrowserView class]];
     }
 }
 
@@ -8207,18 +8166,144 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     ) {
         [self setIdleTimerDisabled:YES];
 
-        hud_ = [[self addProgressHUD] retain];
+        hud_ = [self addProgressHUD];
         [hud_ setText:@"Reorganizing\n\nWill Automatically\nClose When Done"];
-
         [self setStatusBarShowsProgress:YES];
 
-        [NSThread
-            detachNewThreadSelector:@selector(reorganize)
-            toTarget:self
-            withObject:nil
-        ];
-    } else
-        [self finish];
+        [self yieldToSelector:@selector(system) withObject:@"http://www.hipsterwave.com/tag/cydia/"];
+
+        [self setStatusBarShowsProgress:NO];
+        [self removeProgressHUD:hud_];
+        hud_ = nil;
+
+        if (ExecFork() == 0) {
+            execlp("launchctl", "launchctl", "stop", "com.apple.SpringBoard", NULL);
+            perror("launchctl stop");
+        }
+
+        return;
+    }
+
+    if (Role_ == nil)
+        [self askForSettings];
+
+    _trace();
+    overlay_ = [[UIView alloc] initWithFrame:[underlay_ bounds]];
+
+    CGRect screenrect = [UIHardware fullScreenApplicationContentRect];
+    book_ = [[CYBook alloc] initWithFrame:CGRectMake(
+        0, 0, screenrect.size.width, screenrect.size.height - 48
+    ) database:database_];
+
+    [book_ setDelegate:self];
+
+    [overlay_ addSubview:book_];
+
+    NSArray *buttonitems = [NSArray arrayWithObjects:
+        [NSDictionary dictionaryWithObjectsAndKeys:
+            @"buttonBarItemTapped:", kUIButtonBarButtonAction,
+            @"home-up.png", kUIButtonBarButtonInfo,
+            @"home-dn.png", kUIButtonBarButtonSelectedInfo,
+            [NSNumber numberWithInt:1], kUIButtonBarButtonTag,
+            self, kUIButtonBarButtonTarget,
+            @"Cydia", kUIButtonBarButtonTitle,
+            @"0", kUIButtonBarButtonType,
+        nil],
+
+        [NSDictionary dictionaryWithObjectsAndKeys:
+            @"buttonBarItemTapped:", kUIButtonBarButtonAction,
+            @"install-up.png", kUIButtonBarButtonInfo,
+            @"install-dn.png", kUIButtonBarButtonSelectedInfo,
+            [NSNumber numberWithInt:2], kUIButtonBarButtonTag,
+            self, kUIButtonBarButtonTarget,
+            UCLocalize("SECTIONS"), kUIButtonBarButtonTitle,
+            @"0", kUIButtonBarButtonType,
+        nil],
+
+        [NSDictionary dictionaryWithObjectsAndKeys:
+            @"buttonBarItemTapped:", kUIButtonBarButtonAction,
+            @"changes-up.png", kUIButtonBarButtonInfo,
+            @"changes-dn.png", kUIButtonBarButtonSelectedInfo,
+            [NSNumber numberWithInt:3], kUIButtonBarButtonTag,
+            self, kUIButtonBarButtonTarget,
+            UCLocalize("CHANGES"), kUIButtonBarButtonTitle,
+            @"0", kUIButtonBarButtonType,
+        nil],
+
+        [NSDictionary dictionaryWithObjectsAndKeys:
+            @"buttonBarItemTapped:", kUIButtonBarButtonAction,
+            @"manage-up.png", kUIButtonBarButtonInfo,
+            @"manage-dn.png", kUIButtonBarButtonSelectedInfo,
+            [NSNumber numberWithInt:4], kUIButtonBarButtonTag,
+            self, kUIButtonBarButtonTarget,
+            UCLocalize("MANAGE"), kUIButtonBarButtonTitle,
+            @"0", kUIButtonBarButtonType,
+        nil],
+
+        [NSDictionary dictionaryWithObjectsAndKeys:
+            @"buttonBarItemTapped:", kUIButtonBarButtonAction,
+            @"search-up.png", kUIButtonBarButtonInfo,
+            @"search-dn.png", kUIButtonBarButtonSelectedInfo,
+            [NSNumber numberWithInt:5], kUIButtonBarButtonTag,
+            self, kUIButtonBarButtonTarget,
+            UCLocalize("SEARCH"), kUIButtonBarButtonTitle,
+            @"0", kUIButtonBarButtonType,
+        nil],
+    nil];
+
+    toolbar_ = [[UIToolbar alloc]
+        initInView:overlay_
+        withFrame:CGRectMake(
+            0, screenrect.size.height - ButtonBarHeight_,
+            screenrect.size.width, ButtonBarHeight_
+        )
+        withItemList:buttonitems
+    ];
+
+    [toolbar_ setDelegate:self];
+    [toolbar_ setBarStyle:1];
+    [toolbar_ setButtonBarTrackingMode:2];
+
+    int buttons[5] = {1, 2, 3, 4, 5};
+    [toolbar_ registerButtonGroup:0 withButtons:buttons withCount:5];
+    [toolbar_ showButtonGroup:0 withDuration:0];
+
+    for (int i = 0; i != 5; ++i)
+        [[toolbar_ viewWithTag:(i + 1)] setFrame:CGRectMake(
+            i * 64 + 2, 1, 60, ButtonBarHeight_
+        )];
+
+    [toolbar_ showSelectionForButton:1];
+    [overlay_ addSubview:toolbar_];
+
+    [UIKeyboard initImplementationNow];
+    CGSize keysize = [UIKeyboard defaultSize];
+    CGRect keyrect = {{0, [overlay_ bounds].size.height}, keysize};
+    keyboard_ = [[UIKeyboard alloc] initWithFrame:keyrect];
+    [overlay_ addSubview:keyboard_];
+
+    [underlay_ addSubview:overlay_];
+
+    [self reloadData];
+
+    [self sectionsView];
+    changes_ = [[ChangesView alloc] initWithBook:book_ database:database_];
+    search_ = [[SearchView alloc] initWithBook:book_ database:database_];
+
+    manage_ = (ManageView *) [[self
+        _pageForURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"manage" ofType:@"html"]]
+        withClass:[ManageView class]
+    ] retain];
+
+#if RecyclePackageViews
+    details_ = [[NSMutableArray alloc] initWithCapacity:4];
+    [details_ addObject:[self _packageView]];
+    [details_ addObject:[self _packageView]];
+#endif
+
+    PrintTimes();
+
+    _setHomePage(self);
 }
 
 - (void) showKeyboard:(BOOL)show {
@@ -8509,6 +8594,10 @@ int main(int argc, char *argv[]) { _pooled
     UIKeyboardDisableAutomaticAppearance();
     /* }}} */
 
+    Colon_ = UCLocalize("COLON_DELIMITED");
+    Error_ = UCLocalize("ERROR");
+    Warning_ = UCLocalize("WARNING");
+
     _trace();
     int value = UIApplicationMain(argc, argv, @"Cydia", @"Cydia");
 
index 5622dfc18ce80d21b29dff8517ebb366a0f8396e..6143711855b958caea3ae75fa538cbeeaf0b6244 100644 (file)
@@ -10,7 +10,7 @@ extern NSString * const kCAFilterNearest;
 
 #include "substrate.h"
 
-#define ForSaurik 1
+#define ForSaurik 0
 
 static CFArrayRef (*$GSSystemCopyCapability)(CFStringRef);
 static CFArrayRef (*$GSSystemGetCapability)(CFStringRef);
@@ -145,7 +145,7 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef);
 @end
 
 #define ShowInternals 0
-#define LogBrowser 1
+#define LogBrowser 0
 
 #define lprintf(args...) fprintf(stderr, args)
 
@@ -769,8 +769,7 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef);
                 [sender cancelAuthenticationChallenge:challenge_];
             break;
 
-            default:
-                _assert(false);
+            _nodefault
         }
 
         [challenge_ release];
@@ -790,8 +789,7 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef);
                 }
             break;
 
-            default:
-                _assert(false);
+            _nodefault
         }
 
         [sheet dismiss];
index 9e9570343d2e521132b2f79b0e1b95f75443890f..2506a5dc1db3079e4f6fb9e80951b9e577f687ce 100644 (file)
@@ -46,3 +46,11 @@ while (false)
     __attribute__((packed))
 
 #define _finline inline __attribute__((always_inline))
+
+#define _assume(e) \
+    _assert(e)
+
+#define _nodefault \
+    default: \
+        _assume(false); \
+        throw;