Search
lxdream.org :: lxdream/src/cocoaui/cocoaui.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/cocoaui/cocoaui.c
changeset 693:b16608c4ad1e
prev691:ad3356543392
next718:047a244936d1
author nkeynes
date Fri Jun 20 05:43:34 2008 +0000 (15 years ago)
permissions -rw-r--r--
last change Cocoa: Don't try to display the error dialog if the gui isn't running
file annotate diff log raw
1.1 --- a/src/cocoaui/cocoaui.c Thu Jun 19 04:40:37 2008 +0000
1.2 +++ b/src/cocoaui/cocoaui.c Fri Jun 20 05:43:34 2008 +0000
1.3 @@ -47,6 +47,7 @@
1.4 static uint32_t cocoa_gui_ticks = 0;
1.5 static struct timeval cocoa_gui_lasttv;
1.6 static BOOL cocoa_gui_autorun = NO;
1.7 +static BOOL cocoa_gui_is_running = NO;
1.8
1.9 @interface NSApplication (PrivateAdditions)
1.10 - (void) setAppleMenu:(NSMenu *)aMenu;
1.11 @@ -238,10 +239,10 @@
1.12 {
1.13 if( run ) {
1.14 cocoa_gui_autorun = YES;
1.15 - /*
1.16 - */
1.17 }
1.18 + cocoa_gui_is_running = YES;
1.19 [NSApp run];
1.20 + cocoa_gui_is_running = NO;
1.21 }
1.22
1.23 void gui_update_state(void)
1.24 @@ -251,13 +252,18 @@
1.25
1.26 gboolean gui_error_dialog( const char *msg, ... )
1.27 {
1.28 - NSString *error_string;
1.29 -
1.30 - va_list args;
1.31 - va_start(args, msg);
1.32 - error_string = [[NSString alloc] initWithFormat: [NSString stringWithCString: msg] arguments: args];
1.33 - NSRunAlertPanel(@"Error in lxdream", error_string, nil, nil, nil);
1.34 - va_end(args);
1.35 + if( cocoa_gui_is_running ) {
1.36 + NSString *error_string;
1.37 +
1.38 + va_list args;
1.39 + va_start(args, msg);
1.40 + error_string = [[NSString alloc] initWithFormat: [NSString stringWithCString: msg] arguments: args];
1.41 + NSRunAlertPanel(@"Error in lxdream", error_string, nil, nil, nil);
1.42 + va_end(args);
1.43 + return TRUE;
1.44 + } else {
1.45 + return FALSE;
1.46 + }
1.47 }
1.48
1.49 void gui_update_io_activity( io_activity_type io, gboolean active )
.