26
26
#import < Carbon/Carbon.h>
27
27
#import < sys/resource.h>
28
28
#import < objc/Protocol.h>
29
- #import " Sparkle/Sparkle.h"
30
29
#import < tgmath.h>
31
30
32
31
// Models
73
72
static NSString *const PGRecentItemsDeprecatedKey = @" PGRecentDocuments" ; // Deprecated after 1.2.2.
74
73
static NSString *const PGFullscreenKey = @" PGFullscreen" ;
75
74
76
- static NSString *const PGCheckForUpdatesKey = @" PGCheckForUpdates" ;
77
- static NSString *const PGUpdateAvailableKey = @" PGUpdateAvailable" ;
78
- static NSString *const PGNextUpdateCheckDateKey = @" PGNextUpdateCheckDate" ;
79
-
80
75
static NSString *const PGPathFinderApplicationName = @" Path Finder" ;
81
76
82
77
static PGDocumentController *PGSharedDocumentController = nil ;
@@ -86,8 +81,6 @@ @interface PGDocumentController(Private)
86
81
- (void )_awakeAfterLocalizing ;
87
82
- (void )_setFullscreen : (BOOL )flag ;
88
83
- (PGDocument *)_openNew : (BOOL )flag document : (PGDocument *)document display : (BOOL )display ;
89
- - (void )_scheduleNextUpdateCheckWithDate : (NSDate *)date ;
90
- - (void )_checkForUpdates ;
91
84
92
85
@end
93
86
@@ -118,8 +111,6 @@ + (void)initialize
118
111
no, PGDimOtherScreensKey,
119
112
[NSNumber numberWithInteger: PGEndLocation], PGBackwardsInitialLocationKey,
120
113
[NSNumber numberWithUnsignedInteger: PGScaleFreely], PGImageScaleConstraintKey,
121
- yes, PGCheckForUpdatesKey,
122
- no, PGUpdateAvailableKey,
123
114
nil ]];
124
115
}
125
116
@@ -129,10 +120,6 @@ - (IBAction)orderFrontStandardAboutPanel:(id)sender
129
120
{
130
121
[[PGAboutBoxController sharedAboutBoxController ] showWindow: self ];
131
122
}
132
- - (IBAction )installUpdate : (id )sender
133
- {
134
- [[SUUpdater sharedUpdater ] checkForUpdates: sender]; // We validate this menu item specially but its behavior can just use the normal Sparkle mechanism.
135
- }
136
123
- (IBAction )showPreferences : (id )sender
137
124
{
138
125
[[PGPreferenceWindowController sharedPrefController ] showWindow: self ];
@@ -444,21 +431,6 @@ - (PGDocument *)_openNew:(BOOL)flag document:(PGDocument *)document display:(BOO
444
431
if (display) [document createUI ];
445
432
return document;
446
433
}
447
- - (void )_scheduleNextUpdateCheckWithDate : (NSDate *)date
448
- {
449
- if (![[NSUserDefaults standardUserDefaults ] boolForKey: PGCheckForUpdatesKey]) return ;
450
- NSDate *const d = date ? date : [NSDate dateWithTimeIntervalSinceNow: 604800 .0f ];
451
- [[NSUserDefaults standardUserDefaults ] setObject: d forKey: PGNextUpdateCheckDateKey];
452
- [_updateTimer invalidate ];
453
- [_updateTimer release ];
454
- _updateTimer = [[self PG_performSelector: @selector (_checkForUpdates ) withObject: nil fireDate: d interval: 0 .0f options: PGRetainTarget] retain ];
455
- }
456
- - (void )_checkForUpdates
457
- {
458
- if (![[NSUserDefaults standardUserDefaults ] boolForKey: PGCheckForUpdatesKey]) return ;
459
- [[SUUpdater sharedUpdater ] checkForUpdateInformation ];
460
- [self _scheduleNextUpdateCheckWithDate: nil ];
461
- }
462
434
463
435
#pragma mark -NSResponder
464
436
@@ -501,13 +473,6 @@ - (id)init
501
473
[[NSAppleEventManager sharedAppleEventManager ] setEventHandler: self andSelector: @selector (handleAppleEvent:withReplyEvent: ) forEventClass: kInternetEventClass andEventID: kAEGetURL ];
502
474
[self setNextResponder: [NSApp nextResponder ]];
503
475
[NSApp setNextResponder: self ];
504
-
505
- NSDate *updateDate = [[NSUserDefaults standardUserDefaults ] objectForKey: PGNextUpdateCheckDateKey];
506
- if (updateDate && [updateDate earlierDate: [NSDate date ]] == updateDate) {
507
- [self _checkForUpdates ];
508
- updateDate = nil ;
509
- }
510
- [self _scheduleNextUpdateCheckWithDate: updateDate];
511
476
}
512
477
}
513
478
return self;
@@ -518,8 +483,6 @@ - (void)dealloc
518
483
[self PG_removeObserver ];
519
484
[defaultPageMenu release ];
520
485
[windowsMenuSeparator release ];
521
- [_updateTimer invalidate ];
522
- [_updateTimer release ];
523
486
[_recentDocumentIdentifiers release ];
524
487
[_documents release ];
525
488
[_fullscreenController release ];
@@ -537,9 +500,6 @@ - (BOOL)validateMenuItem:(NSMenuItem *)anItem
537
500
SEL const action = [anItem action ];
538
501
539
502
// Sequential:
540
- if (@selector (installUpdate: ) == action) {
541
- [anItem setTitle: [[NSUserDefaults standardUserDefaults ] boolForKey: PGUpdateAvailableKey] ? NSLocalizedString(@" Install Update..." , @" Update menu item title. One of two states." ) : NSLocalizedString(@" Check for Updates..." , @" Update menu item title. One of two states." )];
542
- }
543
503
if (@selector (switchToFileManager: ) == action) [anItem setTitle: NSLocalizedString((self .pathFinderRunning ? @" Switch to Path Finder" : @" Switch to Finder" ), @" Switch to Finder or Path Finder (www.cocoatech.com). Two states of the same item." )];
544
504
545
505
// Window:
@@ -571,9 +531,9 @@ - (void)awakeFromNib
571
531
[scaleSlider setMinValue: log2 (PGScaleMin)];
572
532
[scaleSlider setMaxValue: log2 (PGScaleMax)];
573
533
574
- [selectPreviousDocument setKeyEquivalent: [NSString stringWithFormat: @" %d " , 0x21E1 ]];
534
+ [selectPreviousDocument setKeyEquivalent: [NSString stringWithFormat: @" %C " , ( unichar ) 0x21E1 ]];
575
535
[selectPreviousDocument setKeyEquivalentModifierMask: NSCommandKeyMask ];
576
- [selectNextDocument setKeyEquivalent: [NSString stringWithFormat: @" %d " , 0x21E3 ]];
536
+ [selectNextDocument setKeyEquivalent: [NSString stringWithFormat: @" %C " , ( unichar ) 0x21E3 ]];
577
537
[selectNextDocument setKeyEquivalentModifierMask: NSCommandKeyMask ];
578
538
579
539
[self _setFullscreen: _fullscreen];
@@ -582,21 +542,6 @@ - (void)awakeFromNib
582
542
[self performSelector: @selector (_awakeAfterLocalizing ) withObject: nil afterDelay: 0 .0f inModes: [NSArray arrayWithObject: (NSString *)kCFRunLoopCommonModes ]];
583
543
}
584
544
585
- #pragma mark -NSObject(SUUpdaterDelegateInformalProtocol)
586
-
587
- - (void )updater : (SUUpdater *)updater didFindValidUpdate : (SUAppcastItem *)update
588
- {
589
- [[NSUserDefaults standardUserDefaults ] setBool: YES forKey: PGUpdateAvailableKey];
590
- }
591
- - (void )updaterDidNotFindUpdate : (SUUpdater *)update
592
- {
593
- [[NSUserDefaults standardUserDefaults ] setBool: NO forKey: PGUpdateAvailableKey];
594
- }
595
- - (void )updater : (SUUpdater *)updater willInstallUpdate : (SUAppcastItem *)update
596
- {
597
- [[NSUserDefaults standardUserDefaults ] setBool: NO forKey: PGUpdateAvailableKey];
598
- }
599
-
600
545
#pragma mark -<NSApplicationDelegate>
601
546
602
547
- (BOOL )application : (NSApplication *)sender openFile : (NSString *)filename
0 commit comments