Kerberos: add kerberos_inject_longterm_key() helper function
[wireshark-sm.git] / ui / macosx / sparkle_bridge.m
blob7a6509ad8899aafa7b09e50f5a0e50ecb3d6a08d
1 /* sparkle_bridge.m
2  *
3  * C wrapper for the Sparkle API
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
12 #include <ui/macosx/sparkle_bridge.h>
14 #import <Cocoa/Cocoa.h>
16 #import <Sparkle.h>
18 // https://sparkle-project.org/documentation/customization/
19 // Sparkle stores its state in ~/Library/Preferences/org.wireshark.Wireshark.plist.
20 // You can check its log output via `log stream | grep -i sparkle`.
22 // The Sparkle 1 UI provided a sharedUpdater singleton, which is deprecated
23 // in Sparkle 2:
24 //   https://sparkle-project.org/documentation/upgrading/
25 // Create our own singleton which uses the updated API.
26 //   https://sparkle-project.org/documentation/programmatic-setup/
28 @interface SparkleBridge : NSObject
29 + (SPUStandardUpdaterController *)sharedStandardUpdaterController;
30 @end
32 @implementation SparkleBridge
34 + (SPUStandardUpdaterController *)sharedStandardUpdaterController {
35     static SPUStandardUpdaterController *sharedStandardUpdaterController_ = nil;
36     static dispatch_once_t onceToken;
37     dispatch_once(&onceToken, ^{
38         sharedStandardUpdaterController_ = [[SPUStandardUpdaterController alloc] initWithUpdaterDelegate: nil userDriverDelegate: nil];
39     });
40     return sharedStandardUpdaterController_;
43 @end
45 void sparkle_software_update_init(const char *url, bool enabled, int interval)
47     [[[SparkleBridge sharedStandardUpdaterController] updater] setAutomaticallyChecksForUpdates: enabled];
48     [[[SparkleBridge sharedStandardUpdaterController] updater] setUpdateCheckInterval: interval];
49     [[[SparkleBridge sharedStandardUpdaterController] updater] setFeedURL: [NSURL URLWithString: [[NSString alloc] initWithUTF8String: url] ]];
52 void sparkle_software_update_check(void)
54     [[SparkleBridge sharedStandardUpdaterController] checkForUpdates: [[NSApplication sharedApplication] delegate]];