diff options
author | ritsuka <[email protected]> | 2015-02-20 12:15:41 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2015-02-20 12:15:41 +0000 |
commit | 1f5f8c44eb5adada531f7389334526497d1958f7 (patch) | |
tree | a724145e1d5df0a0a7a612ef822508bccac06362 | |
parent | 18d100c00bf3326db87668b35f236df335c56824 (diff) |
MacGui: remove the Queue directory in the Application Support folder, we don't use FSEvent anymore so it's not needed. Simplify the init of HBDistributedArray.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6931 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | macosx/HBDistributedArray.m | 21 | ||||
-rw-r--r-- | macosx/HBQueueController.m | 18 |
2 files changed, 16 insertions, 23 deletions
diff --git a/macosx/HBDistributedArray.m b/macosx/HBDistributedArray.m index 56505ab1d..aef8dc4be 100644 --- a/macosx/HBDistributedArray.m +++ b/macosx/HBDistributedArray.m @@ -78,16 +78,6 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk"; _fileURL = [fileURL copy]; _array = [[NSMutableArray alloc] init]; - NSFileManager *fileManager = [NSFileManager defaultManager]; - if (![fileManager fileExistsAtPath:_fileURL.path]) - { - if (![fileManager fileExistsAtPath:_fileURL.URLByDeletingLastPathComponent.path]) - { - [fileManager createDirectoryAtPath:_fileURL.URLByDeletingLastPathComponent.path withIntermediateDirectories:YES attributes:nil error:NULL]; - } - [fileManager createFileAtPath:_fileURL.path contents:nil attributes:nil]; - } - NSArray *runningInstances = [NSRunningApplication runningApplicationsWithBundleIdentifier:[[NSBundle mainBundle] bundleIdentifier]]; const char *name = [NSString stringWithFormat:@"/%@.hblock", _fileURL.lastPathComponent].UTF8String; @@ -109,10 +99,13 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk"; [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNotification:) name:HBDistributedArraWrittenToDisk object:nil]; - // Load the array from disk - [self lock]; - [self reload]; - [self unlock]; + if ([[NSFileManager defaultManager] fileExistsAtPath:_fileURL.path]) + { + // Load the array from disk + [self lock]; + [self reload]; + [self unlock]; + } } return self; diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m index aab0b0530..da63b5286 100644 --- a/macosx/HBQueueController.m +++ b/macosx/HBQueueController.m @@ -234,7 +234,7 @@ - (void)loadQueueFile { - NSURL *queueURL = [NSURL fileURLWithPath:[[HBUtilities appSupportPath] stringByAppendingPathComponent:@"Queue/Queue.hbqueue"]]; + NSURL *queueURL = [NSURL fileURLWithPath:[[HBUtilities appSupportPath] stringByAppendingPathComponent:@"Queue.hbqueue"]]; _jobs = [[HBDistributedArray alloc] initWithURL:queueURL]; [self reloadQueue]; @@ -490,8 +490,8 @@ if (self.currentJob.state != HBJobStateCanceled) { // Both the Growl Alert and Sending to tagger can be done as encodes roll off the queue - if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AlertWhenDone"] isEqualToString: @"Growl Notification"] || - [[[NSUserDefaults standardUserDefaults] stringForKey:@"AlertWhenDone"] isEqualToString: @"Alert Window And Growl"]) + if ([[NSUserDefaults standardUserDefaults] integerForKey:@"HBAlertWhenDone"] == 2 || + [[NSUserDefaults standardUserDefaults] integerForKey:@"HBAlertWhenDone"] == 3) { // If Play System Alert has been selected in Preferences if ([[NSUserDefaults standardUserDefaults] boolForKey:@"AlertWhenDoneSound"] == YES) @@ -802,8 +802,8 @@ } // If Alert Window or Window and Growl has been selected - if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AlertWhenDone"] isEqualToString: @"Alert Window"] || - [[[NSUserDefaults standardUserDefaults] stringForKey:@"AlertWhenDone"] isEqualToString: @"Alert Window And Growl"]) + if ([[NSUserDefaults standardUserDefaults] integerForKey:@"HBAlertWhenDone"] == 1 || + [[NSUserDefaults standardUserDefaults] integerForKey:@"HBAlertWhenDone"] == 3) { // On Screen Notification NSAlert *alert = [[NSAlert alloc] init]; @@ -815,7 +815,7 @@ } // If sleep has been selected - if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AlertWhenDone"] isEqualToString: @"Put Computer To Sleep"]) + if ([[NSUserDefaults standardUserDefaults] integerForKey:@"HBAlertWhenDone"] == 4) { // Sleep NSDictionary *errorDict; @@ -825,7 +825,7 @@ [scriptObject release]; } // If Shutdown has been selected - if( [[[NSUserDefaults standardUserDefaults] stringForKey:@"AlertWhenDone"] isEqualToString: @"Shut Down Computer"] ) + if ([[NSUserDefaults standardUserDefaults] integerForKey:@"HBAlertWhenDone"] == 5) { // Shut Down NSDictionary *errorDict; @@ -933,7 +933,7 @@ - (void)remindUserOfSleepOrShutdown { - if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AlertWhenDone"] isEqualToString:@"Put Computer To Sleep"]) + if ([[NSUserDefaults standardUserDefaults] integerForKey:@"HBAlertWhenDone"] == 4) { // Warn that computer will sleep after encoding NSBeep(); @@ -952,7 +952,7 @@ } [alert release]; } - else if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AlertWhenDone"] isEqualToString:@"Shut Down Computer"]) + else if ([[NSUserDefaults standardUserDefaults] integerForKey:@"HBAlertWhenDone"] == 5) { // Warn that computer will shut down after encoding NSBeep(); |