mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-27 05:04:27 +00:00
Use outlets instead of iterating through subviews
This commit is contained in:
1 parent
762d527463
commit
6e01dd272f
4 files changed
+17
-32
No files matched your search
Vendored
+7
-17
@@ -19,6 +19,8 @@
|
||||
@property (strong) SUHost *host;
|
||||
|
||||
@property (weak) IBOutlet NSButton *skipButton;
|
||||
@property (weak) IBOutlet NSButton *laterButton;
|
||||
@property (weak) IBOutlet NSButton *installButton;
|
||||
@property (strong) SUTouchBarProvider *touchBarProvider;
|
||||
@end
|
||||
|
||||
@@ -27,6 +29,8 @@
|
||||
@synthesize updateItem;
|
||||
@synthesize completionBlock;
|
||||
@synthesize skipButton;
|
||||
@synthesize laterButton;
|
||||
@synthesize installButton;
|
||||
@synthesize touchBarProvider;
|
||||
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost completionBlock:(void (^)(SUAutomaticInstallationChoice))block
|
||||
@@ -105,25 +109,11 @@
|
||||
|
||||
- (NSTouchBar *)makeTouchBar
|
||||
{
|
||||
NSButton *installButton, *laterButton, *cancelButton;
|
||||
for (NSView *control in self.window.contentView.subviews) {
|
||||
if ([control isKindOfClass:[NSButton class]]) {
|
||||
NSButton *button = (NSButton *)control;
|
||||
if (button.action == @selector(installNow:)) {
|
||||
installButton = button;
|
||||
} else if (button.action == @selector(installLater:)) {
|
||||
laterButton = button;
|
||||
} else if (button.action == @selector(doNotInstall:)) {
|
||||
cancelButton = button;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.touchBarProvider = [[SUTouchBarProvider alloc] initWithIdentifier:self.className];
|
||||
[self.touchBarProvider addButtonWithButton:cancelButton];
|
||||
[self.touchBarProvider addButtonWithButton:self.skipButton];
|
||||
[self.touchBarProvider addSpace];
|
||||
[self.touchBarProvider addButtonWithButton:laterButton];
|
||||
[self.touchBarProvider addButtonWithButton:installButton];
|
||||
[self.touchBarProvider addButtonWithButton:self.laterButton];
|
||||
[self.touchBarProvider addButtonWithButton:self.installButton];
|
||||
[self.touchBarProvider addSpace];
|
||||
[self.touchBarProvider addSpace];
|
||||
return self.touchBarProvider.touchBar;
|
||||
|
||||
Vendored
+6
-15
@@ -26,6 +26,8 @@
|
||||
@property (weak) IBOutlet NSView *moreInfoView;
|
||||
@property (weak) IBOutlet NSButton *moreInfoButton;
|
||||
@property (weak) IBOutlet NSTableView *profileTableView;
|
||||
@property (weak) IBOutlet NSButton *cancelButton;
|
||||
@property (weak) IBOutlet NSButton *checkButton;
|
||||
@property (strong) SUTouchBarProvider *touchBarProvider;
|
||||
|
||||
@property (nonatomic, readonly) void (^reply)(SUUpdatePermissionResponse *);
|
||||
@@ -43,6 +45,8 @@
|
||||
@synthesize moreInfoView;
|
||||
@synthesize moreInfoButton;
|
||||
@synthesize profileTableView;
|
||||
@synthesize cancelButton;
|
||||
@synthesize checkButton;
|
||||
@synthesize touchBarProvider;
|
||||
|
||||
- (BOOL)shouldAskAboutProfile
|
||||
@@ -165,22 +169,9 @@
|
||||
|
||||
- (NSTouchBar *)makeTouchBar
|
||||
{
|
||||
NSButton *checkButton, *cancelButton;
|
||||
for (NSView *control in self.window.contentView.subviews) {
|
||||
if ([control isKindOfClass:[NSButton class]]) {
|
||||
NSButton *button = (NSButton *)control;
|
||||
if (button.action == @selector(finishPrompt:)) {
|
||||
if (button.tag == 1) {
|
||||
checkButton = button;
|
||||
} else if (button.tag == 0) {
|
||||
cancelButton = button;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.touchBarProvider = [[SUTouchBarProvider alloc] initWithIdentifier:self.className];
|
||||
[self.touchBarProvider addButtonWithButton:cancelButton];
|
||||
[self.touchBarProvider addButtonWithButton:checkButton];
|
||||
[self.touchBarProvider addButtonWithButton:self.cancelButton];
|
||||
[self.touchBarProvider addButtonWithButton:self.checkButton];
|
||||
return self.touchBarProvider.touchBar;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -6,6 +6,8 @@
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="SUAutomaticUpdateAlert">
|
||||
<connections>
|
||||
<outlet property="installButton" destination="15" id="VHi-SZ-6td"/>
|
||||
<outlet property="laterButton" destination="16" id="AZg-1M-E8w"/>
|
||||
<outlet property="skipButton" destination="30" id="LpO-Ax-F1B"/>
|
||||
<outlet property="window" destination="5" id="22"/>
|
||||
</connections>
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="SUUpdatePermissionPrompt">
|
||||
<connections>
|
||||
<outlet property="cancelButton" destination="14" id="gmk-EB-rHf"/>
|
||||
<outlet property="checkButton" destination="13" id="JAM-bi-JDs"/>
|
||||
<outlet property="descriptionTextField" destination="33" id="133"/>
|
||||
<outlet property="moreInfoButton" destination="71" id="132"/>
|
||||
<outlet property="moreInfoView" destination="39" id="127"/>
|
||||
|
||||
Reference in new issue
Block a user