[vlc-devel] commit: OSX: adapt to error dialog changes (untested) ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sat Jul 4 23:59:43 CEST 2009
vlc | branch: 1.0-bugfix | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 5 00:48:10 2009 +0300| [9ab2ddf32dbf7825613943edf35ee330811bfef4] | committer: Rémi Denis-Courmont
OSX: adapt to error dialog changes (untested)
The code (with or without this patch) looks quite fishy though.
Fortunately, I do not understand Objective-C, so I can blindly assume
it is correct.
(cherry picked from commit 23a91c0ea5344a0948342564c56f4950e9829394)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9ab2ddf32dbf7825613943edf35ee330811bfef4
---
modules/gui/macosx/coredialogs.h | 3 ++-
modules/gui/macosx/coredialogs.m | 30 ++++++++++++++++--------------
modules/gui/macosx/intf.m | 9 ++++++---
3 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/modules/gui/macosx/coredialogs.h b/modules/gui/macosx/coredialogs.h
index fe3a126..66b2f8b 100644
--- a/modules/gui/macosx/coredialogs.h
+++ b/modules/gui/macosx/coredialogs.h
@@ -81,6 +81,7 @@
-(void)performDialogEvent: (NSNotification *)o_notification;
-(void)showFatalDialog: (NSValue *)o_value;
+-(void)showFatalWaitDialog: (NSValue *)o_value;
-(void)showQuestionDialog: (NSValue *)o_value;
-(void)showLoginDialog: (NSValue *)o_value;
@@ -94,4 +95,4 @@
-(id)errorPanel;
- at end
\ No newline at end of file
+ at end
diff --git a/modules/gui/macosx/coredialogs.m b/modules/gui/macosx/coredialogs.m
index bccfe3e..078d4ba 100644
--- a/modules/gui/macosx/coredialogs.m
+++ b/modules/gui/macosx/coredialogs.m
@@ -75,8 +75,10 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
NSValue *o_value = [[o_notification userInfo] objectForKey:@"VLCDialogPointer"];
NSString *o_type = [[o_notification userInfo] objectForKey:@"VLCDialogType"];
- if( [o_type isEqualToString: @"dialog-fatal"] )
+ if( [o_type isEqualToString: @"dialog-error"] )
[self showFatalDialog: o_value];
+ else if( [o_type isEqualToString: @"dialog-critical"] )
+ [self showFatalWaitDialog: o_value];
else if( [o_type isEqualToString: @"dialog-question"] )
[self showQuestionDialog: o_value];
else if( [o_type isEqualToString: @"dialog-login"] )
@@ -90,19 +92,19 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
-(void)showFatalDialog: (NSValue *)o_value
{
dialog_fatal_t *p_dialog = [o_value pointerValue];
- /* do we need to block ? */
- if( p_dialog->modal == YES )
- {
- NSAlert *o_alert;
- o_alert = [NSAlert alertWithMessageText: [NSString stringWithUTF8String: p_dialog->title] defaultButton: _NS("OK") alternateButton: nil otherButton: nil informativeTextWithFormat: [NSString stringWithUTF8String: p_dialog->message]];
- [o_alert setAlertStyle: NSCriticalAlertStyle];
- [o_alert runModal];
- }
- else
- {
- [o_error_panel addError: [NSString stringWithUTF8String: p_dialog->title] withMsg: [NSString stringWithUTF8String: p_dialog->message]];
- [o_error_panel showPanel];
- }
+
+ [o_error_panel addError: [NSString stringWithUTF8String: p_dialog->title] withMsg: [NSString stringWithUTF8String: p_dialog->message]];
+ [o_error_panel showPanel];
+}
+
+-(void)showFatalWaitDialog: (NSValue *)o_value
+{
+ dialog_fatal_t *p_dialog = [o_value pointerValue];
+ NSAlert *o_alert;
+
+ o_alert = [NSAlert alertWithMessageText: [NSString stringWithUTF8String: p_dialog->title] defaultButton: _NS("OK") alternateButton: nil otherButton: nil informativeTextWithFormat: [NSString stringWithUTF8String: p_dialog->message]];
+ [o_alert setAlertStyle: NSCriticalAlertStyle];
+ [o_alert runModal];
}
-(void)showQuestionDialog: (NSValue *)o_value
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 969b0ce..2300863 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -509,8 +509,10 @@ static VLCMain *_o_sharedMainInstance = nil;
nib_coredialogs_loaded = [NSBundle loadNibNamed:@"CoreDialogs" owner: NSApp];
/* subscribe to various interactive dialogues */
- var_Create( p_intf, "dialog-fatal", VLC_VAR_ADDRESS );
- var_AddCallback( p_intf, "dialog-fatal", DialogCallback, self );
+ var_Create( p_intf, "dialog-error", VLC_VAR_ADDRESS );
+ var_AddCallback( p_intf, "dialog-error", DialogCallback, self );
+ var_Create( p_intf, "dialog-critical", VLC_VAR_ADDRESS );
+ var_AddCallback( p_intf, "dialog-critical", DialogCallback, self );
var_Create( p_intf, "dialog-login", VLC_VAR_ADDRESS );
var_AddCallback( p_intf, "dialog-login", DialogCallback, self );
var_Create( p_intf, "dialog-question", VLC_VAR_ADDRESS );
@@ -802,7 +804,8 @@ static VLCMain *_o_sharedMainInstance = nil;
/* unsubscribe from the interactive dialogues */
dialog_Unregister( p_intf );
- var_DelCallback( p_intf, "dialog-fatal", DialogCallback, self );
+ var_DelCallback( p_intf, "dialog-error", DialogCallback, self );
+ var_DelCallback( p_intf, "dialog-critical", DialogCallback, self );
var_DelCallback( p_intf, "dialog-login", DialogCallback, self );
var_DelCallback( p_intf, "dialog-question", DialogCallback, self );
var_DelCallback( p_intf, "dialog-progress-bar", DialogCallback, self );
More information about the vlc-devel
mailing list