[Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx: [389] trunk/fuse
Brought to you by:
fredm
|
From: <fr...@us...> - 2007-06-18 12:03:28
|
Revision: 389
http://svn.sourceforge.net/fuse-for-macosx/?rev=389&view=rev
Author: fredm
Date: 2007-06-18 05:03:30 -0700 (Mon, 18 Jun 2007)
Log Message:
-----------
Make sure error alert panels are invoked from the main thread.
Modified Paths:
--------------
trunk/fuse/fusepb/controllers/FuseController.h
trunk/fuse/fusepb/controllers/FuseController.m
trunk/fuse/ui/cocoa/cocoaerror.m
Modified: trunk/fuse/fusepb/controllers/FuseController.h
===================================================================
--- trunk/fuse/fusepb/controllers/FuseController.h 2007-06-17 14:04:21 UTC (rev 388)
+++ trunk/fuse/fusepb/controllers/FuseController.h 2007-06-18 12:03:30 UTC (rev 389)
@@ -191,6 +191,9 @@
- (void)setTapeState:(NSNumber*)state;
- (void)setMdrState:(NSNumber*)state;
+- (void)showAlertPanel:(NSString*)message;
+- (void)showCriticalAlertPanel:(NSString*)message;
+
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication;
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename;
Modified: trunk/fuse/fusepb/controllers/FuseController.m
===================================================================
--- trunk/fuse/fusepb/controllers/FuseController.m 2007-06-17 14:04:21 UTC (rev 388)
+++ trunk/fuse/fusepb/controllers/FuseController.m 2007-06-18 12:03:30 UTC (rev 389)
@@ -1436,6 +1436,16 @@
{
}
+- (void)showAlertPanel:(NSString*)message
+{
+ NSRunAlertPanel(@"Fuse - Info", message, nil, nil, nil);
+}
+
+- (void)showCriticalAlertPanel:(NSString*)message
+{
+ NSRunCriticalAlertPanel(@"Fuse - Error", message, nil, nil, nil);
+}
+
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
{
return YES;
Modified: trunk/fuse/ui/cocoa/cocoaerror.m
===================================================================
--- trunk/fuse/ui/cocoa/cocoaerror.m 2007-06-17 14:04:21 UTC (rev 388)
+++ trunk/fuse/ui/cocoa/cocoaerror.m 2007-06-18 12:03:30 UTC (rev 389)
@@ -34,6 +34,8 @@
#include <stdio.h>
#include <unistd.h>
+#import "FuseController.h"
+
#include "fuse.h"
#include "ui/ui.h"
#include "settings.h"
@@ -41,30 +43,21 @@
int
aqua_verror( ui_error_level severity, const char *message )
{
- NSString *title;
-
- /* Set the appropriate title */
- switch( severity ) {
- case UI_ERROR_INFO:
- title = @"Fuse - Info";
- break;
- case UI_ERROR_ERROR:
- title = @"Fuse - Error";
- break;
- default:
- title = @"Fuse - (Unknown error)";
- break;
- }
-
NSString *alertString = [NSString stringWithUTF8String:message];
switch( severity ) {
case UI_ERROR_INFO:
- NSRunAlertPanel(title, alertString, nil, nil, nil);
+ [[FuseController singleton]
+ performSelectorOnMainThread:@selector(showAlertPanel:)
+ withObject:alertString
+ waitUntilDone:YES];
break;
case UI_ERROR_ERROR:
default:
- NSRunCriticalAlertPanel(title, alertString, nil, nil, nil);
+ [[FuseController singleton]
+ performSelectorOnMainThread:@selector(showCriticalAlertPanel:)
+ withObject:alertString
+ waitUntilDone:YES];
break;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|