Commit f2ddc1ec authored by David Fuhrmann's avatar David Fuhrmann

macosx: minor additions in optical media scanning code

parent 15339133
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
id o_currentOpticalMediaView; id o_currentOpticalMediaView;
id o_currentOpticalMediaIconView; id o_currentOpticalMediaIconView;
NSMutableArray *o_allMediaDevices; NSMutableArray *o_allMediaDevices;
NSMutableArray *o_opticalDevices; NSArray *o_opticalDevices;
NSMutableArray *o_specialMediaFolders; NSMutableArray *o_specialMediaFolders;
NSString *o_file_path; NSString *o_file_path;
id o_currentCaptureView; id o_currentCaptureView;
......
...@@ -96,6 +96,7 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -96,6 +96,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
{ {
[o_allMediaDevices release]; [o_allMediaDevices release];
[o_specialMediaFolders release]; [o_specialMediaFolders release];
if (o_opticalDevices)
[o_opticalDevices release]; [o_opticalDevices release];
if( o_file_slave_path ) if( o_file_slave_path )
[o_file_slave_path release]; [o_file_slave_path release];
...@@ -321,7 +322,6 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -321,7 +322,6 @@ static VLCOpen *_o_sharedMainInstance = nil;
/* we want to be notified about removed or added media */ /* we want to be notified about removed or added media */
o_allMediaDevices = [[NSMutableArray alloc] init]; o_allMediaDevices = [[NSMutableArray alloc] init];
o_specialMediaFolders = [[NSMutableArray alloc] init]; o_specialMediaFolders = [[NSMutableArray alloc] init];
o_opticalDevices = [[NSMutableArray alloc] init];
o_displayInfos = [[NSMutableArray alloc] init]; o_displayInfos = [[NSMutableArray alloc] init];
NSWorkspace *sharedWorkspace = [NSWorkspace sharedWorkspace]; NSWorkspace *sharedWorkspace = [NSWorkspace sharedWorkspace];
...@@ -1078,21 +1078,27 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -1078,21 +1078,27 @@ static VLCOpen *_o_sharedMainInstance = nil;
- (void)scanDevicesWithPaths:(NSArray *)o_paths - (void)scanDevicesWithPaths:(NSArray *)o_paths
{ {
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
NSUInteger count = [o_paths count]; NSUInteger count = [o_paths count];
NSMutableArray *o_result = [NSMutableArray arrayWithCapacity:count]; NSMutableArray *o_result = [NSMutableArray arrayWithCapacity:count];
for (NSUInteger i = 0; i < count; i++) for (NSUInteger i = 0; i < count; i++)
[o_result addObject: [self scanPath:[o_paths objectAtIndex:i]]]; [o_result addObject: [self scanPath:[o_paths objectAtIndex:i]]];
@synchronized (self) { @synchronized (self) {
[o_opticalDevices removeAllObjects]; if (o_opticalDevices)
[o_opticalDevices addObjectsFromArray: o_result]; [o_opticalDevices release];
o_opticalDevices = [[NSArray alloc] initWithArray: o_result];
} }
[self performSelectorOnMainThread:@selector(updateMediaSelector:) withObject:nil waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(updateMediaSelector:) withObject:nil waitUntilDone:NO];
[o_pool release];
} }
- (void)scanSpecialPath:(NSString *)o_path - (void)scanSpecialPath:(NSString *)o_path
{ {
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
NSDictionary *o_dict = [self scanPath:o_path]; NSDictionary *o_dict = [self scanPath:o_path];
@synchronized (self) { @synchronized (self) {
...@@ -1100,6 +1106,7 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -1100,6 +1106,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
} }
[self performSelectorOnMainThread:@selector(updateMediaSelector:) withObject:[NSNumber numberWithBool:YES] waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(updateMediaSelector:) withObject:[NSNumber numberWithBool:YES] waitUntilDone:NO];
[o_pool release];
} }
- (void)scanOpticalMedia:(NSNotification *)o_notification - (void)scanOpticalMedia:(NSNotification *)o_notification
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment