diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-09 16:00:11 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-09 16:00:11 -0800 |
commit | cb6b3a7b344155ce1aea701630b7cb754abf5cae (patch) | |
tree | ede9d442bd724994aabc2a6dace387f7f1b8eeb2 | |
parent | b3c8e69c20e49220c44b0d8bef0e9016a413ad52 (diff) |
Improve robustness of Changes button code.
-rw-r--r-- | MobileCydia.mm | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index 7b20df6..7f784db 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -7178,6 +7178,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (void) upgradeButtonClicked { [delegate_ distUpgrade]; + [[self navigationItem] setRightBarButtonItem:nil animated:YES]; } - (void) loadView { @@ -7317,21 +7318,19 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [list_ reloadData]; - if (upgrades_ > 0) - [[self navigationItem] setRightBarButtonItem:[[[UIBarButtonItem alloc] - initWithTitle:[NSString stringWithFormat:UCLocalize("PARENTHETICAL"), UCLocalize("UPGRADE"), [NSString stringWithFormat:@"%u", upgrades_]] - style:UIBarButtonItemStylePlain - target:self - action:@selector(upgradeButtonClicked) - ] autorelease]]; + [[self navigationItem] setRightBarButtonItem:(upgrades_ == 0 ? nil : [[[UIBarButtonItem alloc] + initWithTitle:[NSString stringWithFormat:UCLocalize("PARENTHETICAL"), UCLocalize("UPGRADE"), [NSString stringWithFormat:@"%u", upgrades_]] + style:UIBarButtonItemStylePlain + target:self + action:@selector(upgradeButtonClicked) + ] autorelease]) animated:YES]; - if (![delegate_ updating]) - [[self navigationItem] setLeftBarButtonItem:[[[UIBarButtonItem alloc] - initWithTitle:UCLocalize("REFRESH") - style:UIBarButtonItemStylePlain - target:self - action:@selector(refreshButtonClicked) - ] autorelease]]; + [[self navigationItem] setLeftBarButtonItem:([delegate_ updating] ? nil : [[[UIBarButtonItem alloc] + initWithTitle:UCLocalize("REFRESH") + style:UIBarButtonItemStylePlain + target:self + action:@selector(refreshButtonClicked) + ] autorelease]) animated:YES]; PrintTimes(); } } |