summaryrefslogtreecommitdiff
path: root/Cydia.mm
diff options
context:
space:
mode:
authorDustin L. Howett <dustin@howett.net>2010-10-04 10:15:46 -0400
committerDustin L. Howett <dustin@howett.net>2010-10-04 10:15:46 -0400
commita5938ea5e2ca223b9e969fe0424f63d7a4b31a4c (patch)
treef70eadb248c8ea23453c04316caecf70af9fac56 /Cydia.mm
parentfed0d010a6c7632fb69cbfa3c25303f3cd103c72 (diff)
Fix the custom button problem - applyRightButton was overriding BrowserView's support for custom buttons. We now just expose a default right button that is used in BrowserView's applyRightButton. Minor visual artifact: The 'Install' button flashes for non-commercial packages as it changes between loading/not-loading. Slightly better behaviour than before: AlwaysReload == 1 means the button is called 'Reload'.
Diffstat (limited to 'Cydia.mm')
-rw-r--r--Cydia.mm30
1 files changed, 15 insertions, 15 deletions
diff --git a/Cydia.mm b/Cydia.mm
index f561078..2638e42 100644
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -5227,9 +5227,12 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
}
+// We don't want to allow non-commercial packages to do custom things to the install button,
+// so it must call customButtonClicked with a custom commercial_ == 1 fallthrough.
- (void) customButtonClicked {
- // Wait until it's done loading.
- if (![self isLoading])
+ if (commercial_)
+ [super customButtonClicked];
+ else
[self _customButtonClicked];
}
@@ -5240,6 +5243,16 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
- (void) applyLoadingTitle {
// Don't show "Loading" as the title. Ever.
}
+
+- (UIBarButtonItem *) rightButton {
+ int count = [buttons_ count];
+ return [[[UIBarButtonItem alloc]
+ initWithTitle:count == 0 ? nil : count != 1 ? UCLocalize("MODIFY") : [buttons_ objectAtIndex:0]
+ style:UIBarButtonItemStylePlain
+ target:self
+ action:@selector(customButtonClicked)
+ ] autorelease];
+}
#endif
- (id) initWithDatabase:(Database *)database {
@@ -5307,19 +5320,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
}
-- (void) applyRightButton {
- int count = [buttons_ count];
- UIBarButtonItem *actionItem = [[UIBarButtonItem alloc]
- initWithTitle:count == 0 ? nil : count != 1 ? UCLocalize("MODIFY") : [buttons_ objectAtIndex:0]
- style:UIBarButtonItemStylePlain
- target:self
- action:@selector(customButtonClicked)
- ];
- if (![self isLoading]) [[self navigationItem] setRightBarButtonItem:actionItem];
- else [super applyRightButton];
- [actionItem release];
-}
-
- (bool) isLoading {
return commercial_ ? [super isLoading] : false;
}