Commit cd8a707f authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: don't use Carbon to retrieve icons from the OS

parent fca62c49
......@@ -48,10 +48,6 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
else
{
_o_sharedInstance = [super init];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(performDialogEvent:)
name: @"VLCNewCoreDialogEventNotification"
object:self];
o_error_panel = [[VLCErrorPanel alloc] init];
b_progress_cancelled = NO;
}
......@@ -220,11 +216,6 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
return o_error_panel;
}
-(void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
@end
/*****************************************************************************
......@@ -279,7 +270,7 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
[o_errors addObject: ourError];
[ourError release];
[o_icons addObject: [NSImage imageWithErrorIcon]];
[o_icons addObject: [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kAlertStopIcon)]];
[o_error_table reloadData];
}
......
......@@ -25,15 +25,6 @@
#import <Cocoa/Cocoa.h>
#import <ApplicationServices/ApplicationServices.h>
/*****************************************************************************
* NSImage (VLCAddition)
*****************************************************************************/
@interface NSImage (VLCAdditions)
+ (id)imageWithWarningIcon;
+ (id)imageWithErrorIcon;
@end
/*****************************************************************************
* NSAnimation (VLCAddition)
*****************************************************************************/
......
......@@ -32,59 +32,6 @@
#import "controls.h"
#import <vlc_url.h>
/*****************************************************************************
* NSImage (VLCAdditions)
*
* Addition to NSImage
*****************************************************************************/
@implementation NSImage (VLCAdditions)
+ (id)imageWithSystemName:(int)name
{
/* ugly Carbon stuff following...
* regrettably, you can't get the icons through clean Cocoa */
/* retrieve our error icon */
NSImage * icon;
IconRef ourIconRef;
int returnValue;
returnValue = GetIconRef(kOnSystemDisk, 'macs', name, &ourIconRef);
icon = [[[NSImage alloc] initWithSize:NSMakeSize(32,32)] autorelease];
[icon lockFocus];
CGRect rect = CGRectMake(0,0,32,32);
PlotIconRefInContext((CGContextRef)[[NSGraphicsContext currentContext]
graphicsPort],
&rect,
kAlignNone,
kTransformNone,
NULL /*inLabelColor*/,
kPlotIconRefNormalFlags,
(IconRef)ourIconRef);
[icon unlockFocus];
returnValue = ReleaseIconRef(ourIconRef);
return icon;
}
+ (id)imageWithWarningIcon
{
static NSImage * imageWithWarningIcon = nil;
if( !imageWithWarningIcon )
{
imageWithWarningIcon = [[[self class] imageWithSystemName:'caut'] retain];
}
return imageWithWarningIcon;
}
+ (id)imageWithErrorIcon
{
static NSImage * imageWithErrorIcon = nil;
if( !imageWithErrorIcon )
{
imageWithErrorIcon = [[[self class] imageWithSystemName:'stop'] retain];
}
return imageWithErrorIcon;
}
@end
/*****************************************************************************
* NSAnimation (VLCAdditions)
*
......
......@@ -324,7 +324,8 @@
{
if( input_item_HasErrorWhenReading( p_item->p_input ) )
{
o_value = [NSImage imageWithWarningIcon];
o_value = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kAlertCautionIcon)];
[o_value setSize: NSMakeSize(16,16)];
}
}
return o_value;
......
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