Revision: 28444
http://sourceforge.net/p/bibdesk/svn/28444
Author: hofman
Date: 2023-11-18 10:41:10 +0000 (Sat, 18 Nov 2023)
Log Message:
-----------
instantiate updater controller in MainMenu nib. Connect it to an outlet in the
preference controller. Use that to get to the updater from the General
Preferences pane.
Modified Paths:
--------------
trunk/bibdesk/BDSKAppController.m
trunk/bibdesk/BDSKPreferenceController.h
trunk/bibdesk/BDSKPreferenceController.m
trunk/bibdesk/Base.lproj/MainMenu.xib
trunk/bibdesk/BibPref_General.m
Modified: trunk/bibdesk/BDSKAppController.m
===================================================================
--- trunk/bibdesk/BDSKAppController.m 2023-11-18 10:28:37 UTC (rev 28443)
+++ trunk/bibdesk/BDSKAppController.m 2023-11-18 10:41:10 UTC (rev 28444)
@@ -461,7 +461,7 @@
#pragma mark Updater
-- (void)updaterWillRelaunchApplication:(SUUpdater *)updater {
+- (void)updaterWillRelaunchApplication:(SPUUpdater *)updater {
[[NSUserDefaults standardUserDefaults] setBool:YES
forKey:BDSKIsRelaunchKey];
}
Modified: trunk/bibdesk/BDSKPreferenceController.h
===================================================================
--- trunk/bibdesk/BDSKPreferenceController.h 2023-11-18 10:28:37 UTC (rev
28443)
+++ trunk/bibdesk/BDSKPreferenceController.h 2023-11-18 10:41:10 UTC (rev
28444)
@@ -38,6 +38,7 @@
#import <Cocoa/Cocoa.h>
+@class SPUStandardUpdaterController;
@interface BDSKPreferenceController : NSWindowController <NSToolbarDelegate,
NSWindowDelegate, NSTouchBarDelegate> {
NSView *controlView;
@@ -62,6 +63,7 @@
NSString *helpBookName;
NSMutableDictionary *identifierSearchTerms;
NSMutableDictionary *iconButtons;
+ SPUStandardUpdaterController *updaterController;
}
+ (id)sharedPreferenceController;
@@ -74,6 +76,7 @@
@property (nonatomic, assign) IBOutlet NSSegmentedControl *goLeftRightButton;
@property (nonatomic, assign) IBOutlet NSSearchField *searchField;
@property (nonatomic, assign) IBOutlet NSTextField *titleField;
+@property (nonatomic, retain) IBOutlet SPUStandardUpdaterController
*updaterController;
- (IBAction)revertPaneDefaults:(id)sender;
- (IBAction)revertAllDefaults:(id)sender;
Modified: trunk/bibdesk/BDSKPreferenceController.m
===================================================================
--- trunk/bibdesk/BDSKPreferenceController.m 2023-11-18 10:28:37 UTC (rev
28443)
+++ trunk/bibdesk/BDSKPreferenceController.m 2023-11-18 10:41:10 UTC (rev
28444)
@@ -119,7 +119,7 @@
@implementation BDSKPreferenceController
-@synthesize controlView, revertButton, revertAllButton, helpButton,
iconsButton, goLeftRightButton, searchField, titleField, categories,
selectedPaneIdentifier;
+@synthesize controlView, revertButton, revertAllButton, helpButton,
iconsButton, goLeftRightButton, searchField, titleField, categories,
selectedPaneIdentifier, updaterController;
@dynamic allPaneIdentifiers, selectedPane, iconView;
+ (void)initialize {
Modified: trunk/bibdesk/Base.lproj/MainMenu.xib
===================================================================
--- trunk/bibdesk/Base.lproj/MainMenu.xib 2023-11-18 10:28:37 UTC (rev
28443)
+++ trunk/bibdesk/Base.lproj/MainMenu.xib 2023-11-18 10:41:10 UTC (rev
28444)
@@ -1069,12 +1069,16 @@
</connections>
</customObject>
<customObject id="292" userLabel="Font Manager"
customClass="NSFontManager"/>
- <customObject id="956" userLabel="BDSKDocumentController"
customClass="BDSKDocumentController"/>
- <customObject id="1235" userLabel="Updater" customClass="SUUpdater">
+ <customObject id="956" userLabel="Document Controller"
customClass="BDSKDocumentController"/>
+ <customObject id="1235" userLabel="Updater Controller"
customClass="SPUStandardUpdaterController">
<connections>
- <outlet property="delegate" destination="214" id="1242"/>
+ <outlet property="updaterDelegate" destination="214"
id="TUz-yC-Aqr"/>
</connections>
</customObject>
- <customObject id="1248" userLabel="Preference Controller"
customClass="BDSKPreferenceController"/>
+ <customObject id="1248" userLabel="Preference Controller"
customClass="BDSKPreferenceController">
+ <connections>
+ <outlet property="updaterController" destination="1235"
id="Byj-Ml-W89"/>
+ </connections>
+ </customObject>
</objects>
</document>
Modified: trunk/bibdesk/BibPref_General.m
===================================================================
--- trunk/bibdesk/BibPref_General.m 2023-11-18 10:28:37 UTC (rev 28443)
+++ trunk/bibdesk/BibPref_General.m 2023-11-18 10:41:10 UTC (rev 28444)
@@ -40,12 +40,14 @@
#import "BDSKTemplate.h"
#import "NSURL_BDSKExtensions.h"
#import "BDSKStringConstants.h"
+#import "BDSKPreferenceController.h"
#import <Sparkle/Sparkle.h>
static char BDSKBibPrefGeneralUpdaterObservationContext;
-@interface BibPref_General (Private)
+@interface BibPref_General ()
+@property (nonatomic, readonly) SPUUpdater *updater;
- (void)updateUpdaterUI;
- (void)updateEmailTemplateUI;
- (void)updateDefaultBibFileUI;
@@ -56,13 +58,14 @@
@implementation BibPref_General
@synthesize emptyStartupRadioButton, nothingStartupRadioButton,
openStartupRadioButton, fileStartupRadioButton, savedStartupRadioButton,
emailTemplatePopup, editOnPasteButton, downloadImportedURLsButton,
downloadedTypesTextField, replaceDownloadedURLsButton, checkForUpdatesButton,
warnOnDeleteButton, warnOnRemovalFromGroupButton, warnOnRenameGroupButton,
warnOnGenerateCiteKeysButton, askToTrashFilesButton, defaultBibFileTextField,
defaultBibFileButton;
+@dynamic updater;
- (void)loadView {
[super loadView];
[self addObserverForUserDefaultsKey:BDSKStartupBehaviorKey];
- [[SUUpdater sharedUpdater] addObserver:self
forKeyPath:@"automaticallyChecksForUpdates" options:0
context:&BDSKBibPrefGeneralUpdaterObservationContext];
- [[SUUpdater sharedUpdater] addObserver:self
forKeyPath:@"updateCheckInterval" options:0
context:&BDSKBibPrefGeneralUpdaterObservationContext];
+ [[self updater] addObserver:self
forKeyPath:@"automaticallyChecksForUpdates" options:0
context:&BDSKBibPrefGeneralUpdaterObservationContext];
+ [[self updater] addObserver:self forKeyPath:@"updateCheckInterval"
options:0 context:&BDSKBibPrefGeneralUpdaterObservationContext];
[self updateEmailTemplateUI];
[self updateDefaultBibFileUI];
[self updateUpdaterUI];
@@ -69,6 +72,10 @@
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleExportTemplatesChanged:)
name:BDSKExportTemplatesChangedNotification object:nil];
}
+- (SPUUpdater *)updater {
+ return [[preferenceController updaterController] updater];
+}
+
- (NSString *)defaultBibFile {
NSURL *fileURL = [NSURL fileURLWithAliasData:[sud
objectForKey:BDSKDefaultBibFileAliasKey] bookmarkData:[sud
objectForKey:BDSKDefaultBibFileBookmarkKey]];
return [[fileURL path] stringByAbbreviatingWithTildeInPath] ?: @"";
@@ -80,8 +87,8 @@
- (void)updateUpdaterUI {
NSInteger interval = 0;
- if ([[SUUpdater sharedUpdater] automaticallyChecksForUpdates])
- interval = [[SUUpdater sharedUpdater] updateCheckInterval];
+ if ([[self updater] automaticallyChecksForUpdates])
+ interval = [[self updater] updateCheckInterval];
if (NO == [checkForUpdatesButton selectItemWithTag:interval]) {
NSInteger i, iMax = [checkForUpdatesButton numberOfItems];
for (i = 1; i < iMax; i++) {
@@ -98,8 +105,8 @@
- (void)defaultsDidRevert {
NSTimeInterval interval = [[[NSBundle mainBundle]
objectForInfoDictionaryKey:@"SUScheduledCheckInterval"] doubleValue];
- [[SUUpdater sharedUpdater] setUpdateCheckInterval:interval];
- [[SUUpdater sharedUpdater] setAutomaticallyChecksForUpdates:interval >
0.0];
+ [[self updater] setUpdateCheckInterval:interval];
+ [[self updater] setAutomaticallyChecksForUpdates:interval > 0.0];
[sud removeObjectForKey:BDSKDefaultBibFileBookmarkKey];
[sud removeObjectForKey:BDSKDefaultBibFileAliasKey];
if ([self isViewLoaded]) {
@@ -113,8 +120,8 @@
- (IBAction)changeUpdateInterval:(id)sender{
NSInteger interval = [[sender selectedItem] tag];
if (interval > 0)
- [[SUUpdater sharedUpdater] setUpdateCheckInterval:interval];
- [[SUUpdater sharedUpdater] setAutomaticallyChecksForUpdates:interval > 0];
+ [[self updater] setUpdateCheckInterval:interval];
+ [[self updater] setAutomaticallyChecksForUpdates:interval > 0];
}
- (IBAction)setAutoOpenFilePath:(id)sender{
@@ -158,8 +165,8 @@
- (void)dealloc{
@try {
- [[SUUpdater sharedUpdater] removeObserver:self
forKeyPath:@"automaticallyChecksForUpdates"
context:&BDSKBibPrefGeneralUpdaterObservationContext];
- [[SUUpdater sharedUpdater] removeObserver:self
forKeyPath:@"updateCheckInterval"
context:&BDSKBibPrefGeneralUpdaterObservationContext];
+ [[self updater] removeObserver:self
forKeyPath:@"automaticallyChecksForUpdates"
context:&BDSKBibPrefGeneralUpdaterObservationContext];
+ [[self updater] removeObserver:self forKeyPath:@"updateCheckInterval"
context:&BDSKBibPrefGeneralUpdaterObservationContext];
}
@catch (id e) {}
[[NSNotificationCenter defaultCenter] removeObserver:self];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit