summaryrefslogtreecommitdiffstats
path: root/macosx/HBRemoteCore.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2020-01-31 18:27:10 +0100
committerDamiano Galassi <[email protected]>2020-04-11 09:16:24 +0200
commitfe95d6526e2173f77b23d25102c603691889620f (patch)
tree69f4e38195cd9c573ff64190a2361ceeaf4c2927 /macosx/HBRemoteCore.m
parentc4202b8c37ac19f5fe6cc41a69212f82deec1dac (diff)
MacGui: lazy xpc service init.
Diffstat (limited to 'macosx/HBRemoteCore.m')
-rw-r--r--macosx/HBRemoteCore.m34
1 files changed, 20 insertions, 14 deletions
diff --git a/macosx/HBRemoteCore.m b/macosx/HBRemoteCore.m
index 7206310d6..39b400f0c 100644
--- a/macosx/HBRemoteCore.m
+++ b/macosx/HBRemoteCore.m
@@ -37,8 +37,19 @@
_stdoutRedirect = HBRedirect.stdoutRedirect;
_stderrRedirect = HBRedirect.stderrRedirect;
_assertionID = -1;
+ _level = 1;
+ _name = @"HandBrakeXPC";
+ }
+ return self;
+}
- [self connect];
+- (instancetype)initWithLogLevel:(NSInteger)level name:(NSString *)name
+{
+ self = [self init];
+ if (self)
+ {
+ _level = level;
+ _name = name;
}
return self;
}
@@ -73,6 +84,9 @@
}];
[_connection resume];
+
+ [_proxy setDVDNav:[NSUserDefaults.standardUserDefaults boolForKey:HBUseDvdNav]];
+ [_proxy setUpWithLogLevel:self.level name:self.name];
}
- (void)invalidate
@@ -103,19 +117,6 @@
[self forwardError:@"XPC: Service did crash\n"];
}
-- (instancetype)initWithLogLevel:(NSInteger)level name:(NSString *)name
-{
- self = [self init];
- if (self)
- {
- _level = level;
- _name = name;
- [_proxy setDVDNav:[NSUserDefaults.standardUserDefaults boolForKey:HBUseDvdNav]];
- [_proxy setUpWithLogLevel:level name:name];
- }
- return self;
-}
-
- (void)updateState:(HBState)state {
dispatch_sync(dispatch_get_main_queue(), ^{
self.state = state;
@@ -181,6 +182,11 @@
- (void)scanURL:(NSURL *)url titleIndex:(NSUInteger)index previews:(NSUInteger)previewsNum minDuration:(NSUInteger)seconds keepPreviews:(BOOL)keepPreviews progressHandler:(nonnull HBCoreProgressHandler)progressHandler completionHandler:(nonnull HBCoreCompletionHandler)completionHandler
{
+ if (!_connection)
+ {
+ [self connect];
+ }
+
[self preventAutoSleep];
#ifdef __SANDBOX_ENABLED__