+- (IBAction)cancelDialog:(id)sender
+{
+ /* tell core that the user wishes to cancel the dialogue
+ * Use this function if cancelling is optionally like in the progress-dialogue */
+ 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_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[1] = strdup( [[o_auth_pw_fld stringValue] UTF8String] );
+ }
+ else if( p_dialog->i_flags == DIALOG_PSZ_INPUT_OK_CANCEL )
+ 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_object_unlock( p_dialog->p_interaction );
+ msg_Dbg( p_intf, "dialog acknowledged" );
+}
+
+@end
+
+/*****************************************************************************
+ * VLCErrorInteractionPanel implementation
+ *****************************************************************************/
+@implementation VLCErrorInteractionPanel
+-(id)init
+{
+ [super init];
+
+ /* load the nib */
+ nib_interact_errpanel_loaded = [NSBundle loadNibNamed:@"InteractionErrorPanel" owner:self];
+
+ /* init strings */
+ [o_window setTitle: _NS("Errors and Warnings")];
+ [o_cleanup_button setTitle: _NS("Clean up")];
+ [o_messages_btn setTitle: _NS("Show Details")];
+
+ /* init data sources */
+ o_errors = [[NSMutableArray alloc] init];
+ o_icons = [[NSMutableArray alloc] init];
+
+ return self;
+}
+
+-(void)dealloc
+{
+ [o_errors release];
+ [o_icons release];
+ [super dealloc];
+}
+
+-(void)showPanel
+{
+ [o_window makeKeyAndOrderFront: self];
+}
+
+-(void)addError: (NSString *)o_error withMsg:(NSString *)o_msg
+{
+ /* format our string as desired */
+ NSMutableAttributedString * ourError;
+ ourError = [[NSMutableAttributedString alloc] initWithString:
+ [NSString stringWithFormat:@"%@\n%@", o_error, o_msg]
+ attributes:
+ [NSDictionary dictionaryWithObject: [NSFont systemFontOfSize:11] forKey: NSFontAttributeName]];
+ [ourError
+ addAttribute: NSFontAttributeName
+ value: [NSFont boldSystemFontOfSize:11]
+ range: NSMakeRange( 0, [o_error length])];
+ [o_errors addObject: ourError];
+ [ourError release];
+
+ [o_icons addObject: [NSImage imageWithErrorIcon]];
+
+ [o_error_table reloadData];
+}
+
+-(void)addWarning: (NSString *)o_warning withMsg:(NSString *)o_msg
+{
+ /* format our string as desired */
+ NSMutableAttributedString * ourWarning;
+ ourWarning = [[NSMutableAttributedString alloc] initWithString:
+ [NSString stringWithFormat:@"%@\n%@", o_warning, o_msg]
+ attributes:
+ [NSDictionary dictionaryWithObject: [NSFont systemFontOfSize:11] forKey: NSFontAttributeName]];
+ [ourWarning
+ addAttribute: NSFontAttributeName
+ value: [NSFont boldSystemFontOfSize:11]
+ range: NSMakeRange( 0, [o_warning length])];
+ [o_errors addObject: ourWarning];
+ [ourWarning release];
+
+ [o_icons addObject: [NSImage imageWithWarningIcon]];
+
+ [o_error_table reloadData];
+}
+
+-(IBAction)cleanupTable:(id)sender
+{
+ [o_errors removeAllObjects];
+ [o_icons removeAllObjects];
+ [o_error_table reloadData];
+}
+
+-(IBAction)showMessages:(id)sender
+{
+ [[VLCMain sharedInstance] showMessagesPanel: sender];
+}
+
+/*----------------------------------------------------------------------------
+ * data source methods
+ *---------------------------------------------------------------------------*/
+- (int)numberOfRowsInTableView:(NSTableView *)theDataTable
+{
+ return [o_errors count];
+}
+
+- (id)tableView:(NSTableView *)theDataTable objectValueForTableColumn:
+ (NSTableColumn *)theTableColumn row: (int)row
+{
+ if( [[theTableColumn identifier] isEqualToString: @"error_msg"] )
+ return [o_errors objectAtIndex: row];
+
+ if( [[theTableColumn identifier] isEqualToString: @"icon"] )
+ return [o_icons objectAtIndex: row];
+
+ return @"unknown identifier";
+}
+