Sparkle: Update API a bit

This updates the API interface calls a bit, and borrows about 20 lines
of code from WireShark.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
xcode15
Christopher Snowhill 2022-10-28 00:02:20 -07:00
parent 02a7fe84cb
commit 504ddcf82b
3 changed files with 25 additions and 7 deletions

View File

@ -7,7 +7,6 @@
@class PlaylistController;
@class PlaylistView;
@class PlaylistLoader;
@class SUUpdater;
@class PreferencesController;
@interface AppController : NSObject {
@ -47,8 +46,6 @@
IBOutlet NSWindowController *spotlightWindowController;
IBOutlet SUUpdater *updater;
IBOutlet FileTreeViewController *fileTreeViewController;
IBOutlet PreferencesController *preferencesController;
@ -110,6 +107,8 @@
- (void)showPathSuggester;
+ (void)globalShowPathSuggester;
- (IBAction)checkForUpdates:(id)sender;
@property NSWindow *mainWindow;
@property NSWindow *miniWindow;

View File

@ -40,6 +40,22 @@ BOOL kAppControllerShuttingDown = NO;
static AppController *kAppController = nil;
@interface SparkleBridge : NSObject
+ (SPUStandardUpdaterController *)sharedStandardUpdaterController;
@end
@implementation SparkleBridge
+ (SPUStandardUpdaterController *)sharedStandardUpdaterController {
static SPUStandardUpdaterController *sharedStandardUpdaterController_ = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedStandardUpdaterController_ = [[SPUStandardUpdaterController alloc] initWithUpdaterDelegate: nil userDriverDelegate: nil];
});
return sharedStandardUpdaterController_;
}
@end
@implementation AppController {
BOOL _isFullToolbarStyle;
}
@ -172,8 +188,9 @@ static AppController *kAppController = nil;
#ifdef DEBUG
// Prevent updates automatically in debug builds
[updater setAutomaticallyChecksForUpdates:NO];
[[[SparkleBridge sharedStandardUpdaterController] updater] setAutomaticallyChecksForUpdates:NO];
#endif
[[[SparkleBridge sharedStandardUpdaterController] updater] setUpdateCheckInterval:3600];
[[totalTimeField cell] setBackgroundStyle:NSBackgroundStyleRaised];
@ -785,4 +802,8 @@ static AppController *kAppController = nil;
[kAppController showPathSuggester];
}
- (IBAction)checkForUpdates:(id)sender {
[[SparkleBridge sharedStandardUpdaterController] checkForUpdates:[[NSApplication sharedApplication] delegate]];
}
@end

View File

@ -1382,7 +1382,7 @@
</menuItem>
<menuItem title="Check for Updates..." id="302">
<connections>
<action selector="checkForUpdates:" target="1303" id="1304"/>
<action selector="checkForUpdates:" target="226" id="jEY-i9-qwZ"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="1100">
@ -2201,7 +2201,6 @@ Gw
<outlet property="shuffleButton" destination="1637" id="Nzr-Mw-z9P"/>
<outlet property="spotlightWindowController" destination="1675" id="1677"/>
<outlet property="totalTimeField" destination="778" id="1659"/>
<outlet property="updater" destination="1303" id="gDn-jb-V0R"/>
</connections>
</customObject>
<menu title="Menu" autoenablesItems="NO" id="513" userLabel="DockMenu">
@ -2459,7 +2458,6 @@ Gw
<point key="canvasLocation" x="-117" y="-407"/>
</menu>
<customObject id="1217" userLabel="PreferencesController" customClass="PreferencesController"/>
<customObject id="1303" userLabel="SUUpdater" customClass="SUUpdater"/>
<customObject id="1319" userLabel="PlaylistLoader" customClass="PlaylistLoader">
<connections>
<outlet property="playbackController" destination="705" id="EBV-A8-3bM"/>