diff options
author | Damiano Galassi <[email protected]> | 2019-08-12 19:31:04 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2019-08-12 19:31:04 +0200 |
commit | d5cfa90ad9ac1f822ee2a7bf27416ca2ec44ff65 (patch) | |
tree | 1db4c5c6731ed7ed62505feaaae412fac298f60b | |
parent | 07283807608eb4af4385d3a02adf3c30be313d9e (diff) |
MacGui: fix some UI syncronization issues caused by moving things to another process.
-rw-r--r-- | macosx/HBController.m | 9 | ||||
-rw-r--r-- | macosx/HBPreferencesController.m | 10 | ||||
-rw-r--r-- | macosx/HBQueue.m | 3 | ||||
-rw-r--r-- | macosx/HBQueueController.m | 1 |
4 files changed, 14 insertions, 9 deletions
diff --git a/macosx/HBController.m b/macosx/HBController.m index 6fed7ebd9..dab3d55db 100644 --- a/macosx/HBController.m +++ b/macosx/HBController.m @@ -278,10 +278,6 @@ static void *HBControllerScanCoreContext = &HBControllerScanCoreContext; options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial context:HBControllerScanCoreContext]; - [NSNotificationCenter.defaultCenter addObserverForName:HBQueueDidChangeStateNotification object:_queue queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull note) { - [self updateQueueUI]; - }]; - [NSNotificationCenter.defaultCenter addObserverForName:HBQueueDidStartNotification object:_queue queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull note) { self.bottomConstrain.animator.constant = 0; self->fRipIndicator.hidden = NO; @@ -314,6 +310,11 @@ static void *HBControllerScanCoreContext = &HBControllerScanCoreContext; } }]; + [NSNotificationCenter.defaultCenter addObserverForName:HBQueueDidChangeStateNotification object:_queue queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull note) { + [self updateQueueUI]; + }]; + [self updateQueueUI]; + self.presetsMenuBuilder = [[HBPresetsMenuBuilder alloc] initWithMenu:self.presetsPopup.menu action:@selector(selectPresetFromMenu:) size:[NSFont smallSystemFontSize] diff --git a/macosx/HBPreferencesController.m b/macosx/HBPreferencesController.m index adecdbcf3..41b10c40c 100644 --- a/macosx/HBPreferencesController.m +++ b/macosx/HBPreferencesController.m @@ -74,15 +74,15 @@ NSString * const HBQueueAutoClearCompletedItems = @"HBQueueAutoClearCompletedIt */ + (void)registerUserDefaults { - NSString *desktopDirectory = [NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask, YES) firstObject]; - NSURL *desktopURL = [NSURL fileURLWithPath:desktopDirectory isDirectory:YES]; + NSString *moviesDirectory = [NSSearchPathForDirectoriesInDomains(NSMoviesDirectory, NSUserDomainMask, YES) firstObject]; + NSURL *moviesURL = [NSURL fileURLWithPath:moviesDirectory isDirectory:YES]; [[NSUserDefaults standardUserDefaults] registerDefaults:@{ HBShowOpenPanelAtLaunch: @YES, HBDefaultMpegExtension: @"Auto", HBUseDvdNav: @YES, - HBLastDestinationDirectoryURL: [NSKeyedArchiver archivedDataWithRootObject:desktopURL], - HBLastSourceDirectoryURL: [NSKeyedArchiver archivedDataWithRootObject:desktopURL], + HBLastDestinationDirectoryURL: [NSKeyedArchiver archivedDataWithRootObject:moviesURL], + HBLastSourceDirectoryURL: [NSKeyedArchiver archivedDataWithRootObject:moviesURL], HBDefaultAutoNaming: @NO, HBAutoNamingFormat: @[@"{Source}", @" ", @"{Title}"], HBAlertWhenDone: @(HBDoneActionNotification), @@ -102,7 +102,7 @@ NSString * const HBQueueAutoClearCompletedItems = @"HBQueueAutoClearCompletedIt // Overwrite the update check interval because previous versions // could be set to a daily check. NSUInteger week = 60 * 60 * 24 * 7; - [[NSUserDefaults standardUserDefaults] setObject:@(week) forKey:@"SUScheduledCheckInterval"]; + [NSUserDefaults.standardUserDefaults setObject:@(week) forKey:@"SUScheduledCheckInterval"]; } /** diff --git a/macosx/HBQueue.m b/macosx/HBQueue.m index 49fed88c1..9d2f32ba9 100644 --- a/macosx/HBQueue.m +++ b/macosx/HBQueue.m @@ -626,6 +626,9 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK [NSNotificationCenter.defaultCenter postNotificationName:HBQueueDidCompleteNotification object:self]; } } + + [NSNotificationCenter.defaultCenter postNotificationName:HBQueueDidChangeStateNotification object:self]; + [self.items commit]; } diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m index e49a53b11..3a5f5d4aa 100644 --- a/macosx/HBQueueController.m +++ b/macosx/HBQueueController.m @@ -155,6 +155,7 @@ [NSNotificationCenter.defaultCenter addObserverForName:HBQueueDidChangeStateNotification object:_queue queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull note) { [self updateUI]; }]; + [self updateUI]; [self tableViewDidSelectItemsAtIndexes:[NSIndexSet indexSet]]; } |