#import "intf.h"
#import "interaction.h"
+#import "misc.h"
/* for the icons in our custom error panel */
#import <ApplicationServices/ApplicationServices.h>
- (void)sheetDidEnd:(NSWindow *)o_sheet returnCode:(int)i_return
contextInfo:(void *)o_context
{
- vlc_mutex_lock( &p_dialog->p_interaction->object_lock );
+ vlc_object_lock( p_dialog->p_interaction );
if( i_return == NSAlertDefaultReturn )
{
p_dialog->i_return = DIALOG_OK_YES;
p_dialog->i_return = DIALOG_CANCELLED;
}
p_dialog->i_status = ANSWERED_DIALOG;
- vlc_mutex_unlock( &p_dialog->p_interaction->object_lock );
+ vlc_object_unlock( p_dialog->p_interaction );
}
-(void)updateDialog
msg_Dbg( p_intf, "hide event %p", self );
if( p_dialog->i_flags & DIALOG_USER_PROGRESS )
{
- if(![o_prog_win isVisible])
+ if([o_prog_win isVisible])
{
[NSApp endSheet: o_prog_win];
[o_prog_win close];
}
if( p_dialog->i_flags & DIALOG_LOGIN_PW_OK_CANCEL )
{
- if(![o_auth_win isVisible])
+ if([o_auth_win isVisible])
{
[NSApp endSheet: o_auth_win];
[o_auth_win close];
}
if( p_dialog->i_flags & DIALOG_PSZ_INPUT_OK_CANCEL )
{
- if(![o_input_win isVisible])
+ if([o_input_win isVisible])
{
[NSApp endSheet: o_input_win];
[o_input_win close];
- (IBAction)cancelAndClose:(id)sender
{
/* tell the core that the dialog was cancelled in a yes/no-style dialogue */
- vlc_mutex_lock( &p_dialog->p_interaction->object_lock );
+ vlc_object_lock( p_dialog->p_interaction );
p_dialog->i_return = DIALOG_CANCELLED;
p_dialog->i_status = ANSWERED_DIALOG;
- vlc_mutex_unlock( &p_dialog->p_interaction->object_lock );
+ vlc_object_unlock( p_dialog->p_interaction );
msg_Dbg( p_intf, "dialog cancelled" );
}
{
/* tell core that the user wishes to cancel the dialogue
* Use this function if cancelling is optionally like in the progress-dialogue */
- vlc_mutex_lock( &p_dialog->p_interaction->object_lock );
- p_dialog->b_cancelled = VLC_TRUE;
- vlc_mutex_unlock( &p_dialog->p_interaction->object_lock );
+ vlc_object_lock( p_dialog->p_interaction );
+ p_dialog->b_cancelled = true;
+ vlc_object_unlock( p_dialog->p_interaction );
msg_Dbg( p_intf, "cancelling dialog, will close it later on" );
}
- (IBAction)okayAndClose:(id)sender
{
msg_Dbg( p_intf, "running okayAndClose" );
- vlc_mutex_lock( &p_dialog->p_interaction->object_lock );
+ vlc_object_lock( p_dialog->p_interaction );
if( p_dialog->i_flags == DIALOG_LOGIN_PW_OK_CANCEL )
{
p_dialog->psz_returned[0] = strdup( [[o_auth_login_fld stringValue] UTF8String] );
p_dialog->psz_returned[0] = strdup( [[o_input_fld stringValue] UTF8String] );
p_dialog->i_return = DIALOG_OK_YES;
p_dialog->i_status = ANSWERED_DIALOG;
- vlc_mutex_unlock( &p_dialog->p_interaction->object_lock );
+ vlc_object_unlock( p_dialog->p_interaction );
msg_Dbg( p_intf, "dialog acknowledged" );
}
o_errors = [[NSMutableArray alloc] init];
o_icons = [[NSMutableArray alloc] init];
- /* ugly Carbon stuff following...
- * regrettably, you can't get the icons through clean Cocoa */
-
- /* retrieve our error icon */
- IconRef ourIconRef;
- int returnValue;
- returnValue = GetIconRef(kOnSystemDisk, 'macs', 'stop', &ourIconRef);
- errorIcon = [[NSImage alloc] initWithSize:NSMakeSize(32,32)];
- [errorIcon lockFocus];
- CGRect rect = CGRectMake(0,0,32,32);
- PlotIconRefInContext((CGContextRef)[[NSGraphicsContext currentContext]
- graphicsPort],
- &rect,
- kAlignNone,
- kTransformNone,
- NULL /*inLabelColor*/,
- kPlotIconRefNormalFlags,
- (IconRef)ourIconRef);
- [errorIcon unlockFocus];
- returnValue = ReleaseIconRef(ourIconRef);
-
- /* retrieve our caution icon */
- returnValue = GetIconRef(kOnSystemDisk, 'macs', 'caut', &ourIconRef);
- warnIcon = [[NSImage alloc] initWithSize:NSMakeSize(32,32)];
- [warnIcon lockFocus];
- PlotIconRefInContext((CGContextRef)[[NSGraphicsContext currentContext]
- graphicsPort],
- &rect,
- kAlignNone,
- kTransformNone,
- NULL /*inLabelColor*/,
- kPlotIconRefNormalFlags,
- (IconRef)ourIconRef);
- [warnIcon unlockFocus];
- returnValue = ReleaseIconRef(ourIconRef);
-
return self;
}
-(void)dealloc
{
- [errorIcon release];
- [warnIcon release];
[o_errors release];
[o_icons release];
[super dealloc];
[o_errors addObject: ourError];
[ourError release];
- [o_icons addObject: errorIcon];
+ [o_icons addObject: [NSImage imageWithErrorIcon]];
[o_error_table reloadData];
- [self showPanel];
}
-(void)addWarning: (NSString *)o_warning withMsg:(NSString *)o_msg
[o_errors addObject: ourWarning];
[ourWarning release];
- [o_icons addObject: warnIcon];
+ [o_icons addObject: [NSImage imageWithWarningIcon]];
[o_error_table reloadData];
-
- [self showPanel];
}
-(IBAction)cleanupTable:(id)sender