diff --git a/Medianno/MAAddMediaSheet.h b/Medianno/MAAddMediaSheet.h
index 33ba3d8..7d4b147 100644
--- a/Medianno/MAAddMediaSheet.h
+++ b/Medianno/MAAddMediaSheet.h
@@ -13,8 +13,7 @@ typedef void (^MAAddMediaBlock)(NSURL * url, NSDate * date);
@interface MAAddMediaSheet : NSWindowController {
}
-@property (readonly) NSArray * urls;
-@property (readonly) NSArray * dates;
+@property (readonly) NSArray * media;
@property BOOL copyMedia;
- (void)runWithParentWindow:(NSWindow *)win media:(NSArray *)urls addMedia:(MAAddMediaBlock)block;
diff --git a/Medianno/MAAddMediaSheet.mm b/Medianno/MAAddMediaSheet.mm
index 6ca63b5..0f216ae 100644
--- a/Medianno/MAAddMediaSheet.mm
+++ b/Medianno/MAAddMediaSheet.mm
@@ -11,7 +11,7 @@
@implementation MAAddMediaSheet
-@synthesize urls, dates, copyMedia;
+@synthesize media, copyMedia;
- (id)init
{
@@ -24,12 +24,15 @@
- (void)runWithParentWindow:(NSWindow *)win media:(NSArray *)mediaUrls addMedia:(MAAddMediaBlock)block
{
- urls = [mediaUrls retain];
+ NSMutableArray * m = [[NSMutableArray alloc] initWithCapacity:[mediaUrls count]];
+ for (NSURL * url in mediaUrls)
+ [m addObject:[NSMutableDictionary dictionaryWithObject:url forKey:@"url"]];
+ media = m;
[self useModificationDates:self];
[NSApp beginSheet:[self window] modalForWindow:win didEndBlock:^(NSInteger returnCode) {
if (returnCode == NSAlertFirstButtonReturn) {
- [urls enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
- block(obj, [dates objectAtIndex:idx]);
+ [media enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
+ block([obj objectForKey:@"url"], [obj objectForKey:@"date"]);
}];
}
[[self window] orderOut:self];
@@ -39,20 +42,16 @@
- (void)dealloc
{
- [urls release];
- [dates release];
+ [media release];
}
- (IBAction)useModificationDates:(id)sender
{
- NSMutableArray * newDates = [[NSMutableArray alloc] initWithCapacity:[urls count]];
- for (NSURL * url in urls) {
+ for (NSMutableDictionary * m in media) {
NSDate * modificationDate;
- [url getResourceValue:&modificationDate forKey:NSURLContentModificationDateKey error:nil];
- [newDates addObject:(modificationDate ? modificationDate : [NSDate date])];
+ [[m objectForKey:@"url"] getResourceValue:&modificationDate forKey:NSURLContentModificationDateKey error:nil];
+ [m setObject:(modificationDate ? modificationDate : [NSDate date]) forKey:@"date"];
}
- [dates release];
- dates = newDates;
}
- (IBAction)endSheet:(id)sender
diff --git a/Medianno/en.lproj/MAAddMedia.xib b/Medianno/en.lproj/MAAddMedia.xib
index 4f8fd27..76700e6 100644
--- a/Medianno/en.lproj/MAAddMedia.xib
+++ b/Medianno/en.lproj/MAAddMedia.xib
@@ -68,7 +68,7 @@
256