summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordynaflash <[email protected]>2008-01-08 18:05:30 +0000
committerdynaflash <[email protected]>2008-01-08 18:05:30 +0000
commit5b9fd5c621abf4f8912d20dbc0f2703801f4c86b (patch)
tree184bd647a0b89e41d17547f07651109d037b8d7b /macosx
parent40d71aae36694353d60b074e0bcdc921d58321ab (diff)
MacGui: modify writeToActivityLog to use vargs
- thanks travistex - can now accept input like: [self writeToActivityLog: "trying to open a package at: %s", [path UTF8String]]; git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1176 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Controller.h2
-rw-r--r--macosx/Controller.mm21
2 files changed, 16 insertions, 7 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h
index fc0cdfc42..565f63b07 100644
--- a/macosx/Controller.h
+++ b/macosx/Controller.h
@@ -204,7 +204,7 @@
BOOL SuccessfulScan;
NSString * currentSource;
}
-- (void) writeToActivityLog:(char *) activityMessage;
+- (void) writeToActivityLog:(char *) format, ...;
- (IBAction) browseSources: (id) sender;
- (void) browseSourcesDone: (NSOpenPanel *) sheet
returnCode: (int) returnCode contextInfo: (void *) contextInfo;
diff --git a/macosx/Controller.mm b/macosx/Controller.mm
index 7a109eff3..7152a20fe 100644
--- a/macosx/Controller.mm
+++ b/macosx/Controller.mm
@@ -767,11 +767,20 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
}
/* We use this to write messages to stderr from the macgui which show up in the activity window and log*/
-- (void) writeToActivityLog:(char *) activityMessage
+- (void) writeToActivityLog:(char *) format, ...
{
- time_t _now = time( NULL );
- struct tm * now = localtime( &_now );
- fprintf(stderr, "[%02d:%02d:%02d] MacGui: %s\n", now->tm_hour, now->tm_min, now->tm_sec, activityMessage );
+ va_list args;
+ va_start(args, format);
+ if (format != nil)
+ {
+ char str[1024];
+ vsnprintf( str, 1024, format, args );
+
+ time_t _now = time( NULL );
+ struct tm * now = localtime( &_now );
+ fprintf(stderr, "[%02d:%02d:%02d] MacGui: %s\n", now->tm_hour, now->tm_min, now->tm_sec, str );
+ }
+ va_end(args);
}
#pragma mark -
@@ -1138,7 +1147,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
/* We check to see if the chosen file at path is a package */
if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:path])
{
- [self writeToActivityLog:"trying to open a package"];
+ [self writeToActivityLog: "trying to open a package at: %s", [path UTF8String]];
/* We check to see if this is an .eyetv package */
if ([[path pathExtension] isEqualToString: @"eyetv"])
{
@@ -1167,7 +1176,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
else
{
/* The package is not an eyetv package, so we do not call performScan */
- [self writeToActivityLog:"unable to open package"];
+ //[self writeToActivityLog:"unable to open package"];
}
}
else