Changeset 917
- Timestamp:
- 07/29/08 16:35:01 (4 months ago)
- Files:
-
- trunk/CPFPerianPrefPaneController.h (modified) (1 diff)
- trunk/CPFPerianPrefPaneController.m (modified) (4 diffs)
- trunk/PerianPrefPane.nib/classes.nib (modified) (2 diffs)
- trunk/PerianPrefPane.nib/info.nib (modified) (1 diff)
- trunk/PerianPrefPane.nib/keyedobjects.nib (modified) (previous)
- trunk/Update Checker Sources/UpdateCheckerAppDelegate.h (modified) (1 diff)
- trunk/Update Checker Sources/UpdateCheckerAppDelegate.m (modified) (4 diffs)
- trunk/Update Checker Sources/main.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/CPFPerianPrefPaneController.h
r792 r917 56 56 IBOutlet NSButton *button_install; 57 57 IBOutlet NSTextField *textField_installStatus; 58 IBOutlet NSProgressIndicator *progress_install;59 58 60 59 IBOutlet NSTextField *textField_currentVersion; 60 IBOutlet NSTextField *textField_updateStatus; 61 61 IBOutlet NSButton *button_updateCheck; 62 IBOutlet NSProgressIndicator *progress_updateCheck;63 62 IBOutlet NSButton *button_autoUpdateCheck; 64 63 trunk/CPFPerianPrefPaneController.m
r909 r917 401 401 402 402 - (void) dealloc { 403 [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:UPDATE_STATUS_NOTIFICATION object:nil]; 403 404 [perianForumURL release]; 404 405 [perianDonateURL release]; … … 654 655 auth = nil; 655 656 656 int tag = 0;657 657 componentPath = [[self quickTimeComponentDir:userInstalled] stringByAppendingPathComponent:@"Perian.component"]; 658 658 if(auth != nil && !userInstalled) … … 685 685 - (IBAction)installUninstall:(id)sender 686 686 { 687 [progress_install startAnimation:sender];688 687 if(installStatus == InstallStatusInstalled) 689 688 [NSThread detachNewThreadSelector:@selector(uninstall:) toTarget:self withObject:nil]; … … 694 693 - (void)installComplete:(id)sender 695 694 { 696 [progress_install stopAnimation:sender];697 695 [self checkForInstallation]; 698 696 } 699 697 700 698 #pragma mark Check Updates 699 - (void)updateCheckStatusChanged:(NSNotification*)notification 700 { 701 NSString *status = [notification object]; 702 703 //FIXME localize these 704 if ([status isEqualToString:@"Starting"]) { 705 [textField_updateStatus setStringValue:@"Checking..."]; 706 } else if ([status isEqualToString:@"Error"]) { 707 [textField_updateStatus setStringValue:@"Couldn't reach the update server."]; 708 } else if ([status isEqualToString:@"NoUpdates"]) { 709 [textField_updateStatus setStringValue:@"There are no updates."]; 710 } else if ([status isEqualToString:@"NoUpdates"]) { 711 [textField_updateStatus setStringValue:@"Updates found!"]; 712 } 713 } 714 701 715 - (IBAction)updateCheck:(id)sender 702 716 { 703 717 FSRef updateCheckRef; 704 718 719 [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:UPDATE_STATUS_NOTIFICATION object:nil]; 720 [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(updateCheckStatusChanged:) name:UPDATE_STATUS_NOTIFICATION object:nil]; 705 721 CFPreferencesSetAppValue((CFStringRef)NEXT_RUN_KEY, NULL, perianAppID); 706 722 CFPreferencesSetAppValue((CFStringRef)MANUAL_RUN_KEY, [NSNumber numberWithBool:YES], perianAppID); trunk/PerianPrefPane.nib/classes.nib
r792 r917 73 73 <key>popup_outputMode</key> 74 74 <string>NSPopUpButton</string> 75 <key>progress_install</key>76 <string>NSProgressIndicator</string>77 <key>progress_updateCheck</key>78 <string>NSProgressIndicator</string>79 75 <key>slider_ac3DynamicRangeSlider</key> 80 76 <string>NSSlider</string> … … 84 80 <string>NSTextField</string> 85 81 <key>textField_installStatus</key> 82 <string>NSTextField</string> 83 <key>textField_updateStatus</key> 86 84 <string>NSTextField</string> 87 85 <key>textView_about</key> trunk/PerianPrefPane.nib/info.nib
r889 r917 4 4 <dict> 5 5 <key>IBFramework Version</key> 6 <string>6 29</string>6 <string>670</string> 7 7 <key>IBLastKnownRelativeProjectPath</key> 8 <string> ../Perian.xcodeproj</string>8 <string>Perian.xcodeproj</string> 9 9 <key>IBOldestOS</key> 10 10 <integer>5</integer> 11 11 <key>IBOpenObjects</key> 12 12 <array> 13 <integer> 133</integer>13 <integer>32</integer> 14 14 </array> 15 15 <key>IBSystem Version</key> 16 <string>9 B18</string>16 <string>9E17</string> 17 17 <key>targetFramework</key> 18 18 <string>IBCocoaFramework</string> trunk/Update Checker Sources/UpdateCheckerAppDelegate.h
r624 r917 18 18 #define UPDATE_URL_KEY @"UpdateFeedURL" 19 19 #define SKIPPED_VERSION_KEY @"SkippedVersion" 20 #define UPDATE_STATUS_NOTIFICATION @"org.perian.UpdateCheckStatus" 20 21 #define TIME_INTERVAL_TIL_NEXT_RUN 7*24*60*60 21 22 trunk/Update Checker Sources/UpdateCheckerAppDelegate.m
r913 r917 35 35 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 36 36 lastRunDate = [[defaults objectForKey:NEXT_RUN_KEY] retain]; 37 if (lastRunDate == nil || [lastRunDate laterDate:[NSDate date]] != lastRunDate) { 38 //this means we should in fact run 39 [defaults setObject:[NSDate dateWithTimeIntervalSinceNow:TIME_INTERVAL_TIL_NEXT_RUN] forKey:NEXT_RUN_KEY]; 40 manualRun = [defaults boolForKey:MANUAL_RUN_KEY]; 41 [defaults removeObjectForKey:MANUAL_RUN_KEY]; 42 [self doUpdateCheck]; 43 } else { 44 //another instance was already started and therefore we don't need to do this again 45 [[NSApplication sharedApplication] terminate:self]; 46 } 37 38 [defaults setObject:[NSDate dateWithTimeIntervalSinceNow:TIME_INTERVAL_TIL_NEXT_RUN] forKey:NEXT_RUN_KEY]; 39 manualRun = [defaults boolForKey:MANUAL_RUN_KEY]; 40 [defaults removeObjectForKey:MANUAL_RUN_KEY]; 41 [defaults synchronize]; 42 [self doUpdateCheck]; 47 43 } 48 44 … … 56 52 updateUrlString = [[updateUrlString substringToIndex:[updateUrlString length]-4] stringByAppendingFormat:@"-%@.xml", betaAppcastUrl]; 57 53 #endif 54 if(manualRun) 55 [[NSDistributedNotificationCenter defaultCenter] postNotificationName:UPDATE_STATUS_NOTIFICATION object:@"Starting"]; 58 56 59 57 SUAppcast *appcast = [[SUAppcast alloc] init]; … … 81 79 NSString *panePath = [[[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] stringByDeletingLastPathComponent] stringByDeletingLastPathComponent]; 82 80 updateAvailable = (updateAvailable && (SUStandardVersionComparison([latest fileVersion], [[NSBundle bundleWithPath:panePath] objectForInfoDictionaryKey:@"CFBundleVersion"]) == NSOrderedAscending)); 81 82 if (![panePath isEqualToString:@"Perian.prefPane"]) { 83 NSLog(@"The update checker needs to be run from inside the preference pane, quitting..."); 84 updateAvailable = 0; 85 } 86 83 87 NSString *skippedVersion = [[NSUserDefaults standardUserDefaults] objectForKey:SKIPPED_VERSION_KEY]; 84 88 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 85 89 if (updateAvailable && (!skippedVersion || 86 90 (skippedVersion && ![skippedVersion isEqualToString:[latest versionString]]))) { 91 if(manualRun) 92 [[NSDistributedNotificationCenter defaultCenter] postNotificationName:UPDATE_STATUS_NOTIFICATION object:@"YesUpdates"]; 87 93 [self showUpdatePanelForItem:latest]; 88 94 } else { 89 95 if(manualRun) 90 NSRunAlertPanel(SULocalizedString(@"No Update Found!", nil), SULocalizedString(@"Your copy of Perian is up to date", nil), nil, nil, nil);96 [[NSDistributedNotificationCenter defaultCenter] postNotificationName:UPDATE_STATUS_NOTIFICATION object:@"NoUpdates"]; 91 97 [[NSApplication sharedApplication] terminate:self]; 92 98 } … … 99 105 [self updateFailed]; 100 106 if(manualRun) 101 [ self showUpdateErrorAlertWithInfo:SULocalizedString(@"An error occurred while trying to load Perian's version info. Please try again later.", nil)];107 [[NSDistributedNotificationCenter defaultCenter] postNotificationName:UPDATE_STATUS_NOTIFICATION object:@"Error"]; 102 108 [appcast release]; 103 109 [[NSApplication sharedApplication] terminate:self]; trunk/Update Checker Sources/main.m
r913 r917 13 13 #define lockPath "/tmp/PerianUpdateLock" 14 14 15 static int fp = -1; 16 17 static void deleteLock() 18 { 19 close(fp); 20 unlink(lockPath); 21 } 22 15 23 int main(int argc, char *argv[]) 16 24 { 17 intfp = open(lockPath, O_CREAT | O_EXCL);25 fp = open(lockPath, O_CREAT | O_EXCL); 18 26 if(fp == -1) 19 27 { … … 31 39 if(fp == -1) 32 40 return 0; 41 42 atexit(deleteLock); 33 43 34 44 int ret = NSApplicationMain(argc, (const char **) argv); 35 45 36 close(fp);37 unlink(lockPath);38 39 46 return ret; 40 47 }
