From 0085b210db89c89e98eb83f04f1e50a60d1b7207 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 26 Feb 2008 11:54:54 -0500 Subject: [PATCH] Threading the print command with -[uploadAndPrint:] --- Source/AppController.m | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/AppController.m b/Source/AppController.m index 0a0aaf9..2d5f415 100644 --- a/Source/AppController.m +++ b/Source/AppController.m @@ -22,10 +22,10 @@ @interface AppController (Private) -//- (BOOL)uploadFile; - (void)setStatus:(NSString *)msg isError:(BOOL)error; - (void)readChannel:(LIBSSH2_CHANNEL *)channel; +- (void)uploadAndPrint:(id)sender; @end @@ -98,6 +98,17 @@ */ - (IBAction)print:(id)sender { + [NSThread detachNewThreadSelector:@selector(uploadAndPrint:) toTarget:self withObject:sender]; +} + +/** + * Opens an SSH session, creates a SCP channel to upload the file, followed by a shell channel + * to queue up LPR + */ +- (void)uploadAndPrint:(id)sender +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + [progress startAnimation:self]; [progress setHidden:NO]; [status setHidden:NO]; @@ -230,6 +241,8 @@ shutdown: close(sock); [progress stopAnimation:self]; + + [pool release]; } @end -- 2.22.5