[vlc-commits] macosx: don't use Carbon to retrieve icons from the OS
Felix Paul Kühne
git at videolan.org
Sun Jul 24 15:58:52 CEST 2011
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sun Jul 24 15:58:43 2011 +0200| [cd8a707fa1e881f10f6f2b1ea90fee2c87f0bcf6] | committer: Felix Paul Kühne
macosx: don't use Carbon to retrieve icons from the OS
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cd8a707fa1e881f10f6f2b1ea90fee2c87f0bcf6
---
modules/gui/macosx/coredialogs.m | 11 +-------
modules/gui/macosx/misc.h | 9 ------
modules/gui/macosx/misc.m | 53 --------------------------------------
modules/gui/macosx/playlist.m | 3 +-
4 files changed, 3 insertions(+), 73 deletions(-)
diff --git a/modules/gui/macosx/coredialogs.m b/modules/gui/macosx/coredialogs.m
index b42d29d..7af5e69 100644
--- a/modules/gui/macosx/coredialogs.m
+++ b/modules/gui/macosx/coredialogs.m
@@ -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];
}
diff --git a/modules/gui/macosx/misc.h b/modules/gui/macosx/misc.h
index 570ec79..a6defe5 100644
--- a/modules/gui/macosx/misc.h
+++ b/modules/gui/macosx/misc.h
@@ -26,15 +26,6 @@
#import <ApplicationServices/ApplicationServices.h>
/*****************************************************************************
- * NSImage (VLCAddition)
- *****************************************************************************/
-
- at interface NSImage (VLCAdditions)
-+ (id)imageWithWarningIcon;
-+ (id)imageWithErrorIcon;
- at end
-
-/*****************************************************************************
* NSAnimation (VLCAddition)
*****************************************************************************/
diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m
index 899cf3f..38caa1e 100644
--- a/modules/gui/macosx/misc.m
+++ b/modules/gui/macosx/misc.m
@@ -33,59 +33,6 @@
#import <vlc_url.h>
/*****************************************************************************
- * NSImage (VLCAdditions)
- *
- * Addition to NSImage
- *****************************************************************************/
- at 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;
-}
-
- at end
-/*****************************************************************************
* NSAnimation (VLCAdditions)
*
* Missing extension to NSAnimation
diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m
index 15a4c64..3ec88e1 100644
--- a/modules/gui/macosx/playlist.m
+++ b/modules/gui/macosx/playlist.m
@@ -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;
More information about the vlc-commits
mailing list