]> git.tdb.fi Git - libs/gui.git/commitdiff
Fix the cocoa error dialog so that it actually compiles
authorMikko Rasa <tdb@tdb.fi>
Sun, 6 Oct 2013 16:50:30 +0000 (19:50 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 6 Oct 2013 16:50:30 +0000 (19:50 +0300)
source/graphics/cocoa/cocoaerrordialog.h [new file with mode: 0644]
source/graphics/cocoa/cocoaerrordialog.m [new file with mode: 0644]
source/graphics/cocoa/errordialog.cpp
source/graphics/cocoa/errordialog.m [deleted file]

diff --git a/source/graphics/cocoa/cocoaerrordialog.h b/source/graphics/cocoa/cocoaerrordialog.h
new file mode 100644 (file)
index 0000000..7a03018
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef MSP_GRAPHICS_COCOAERRORDIALOG_H_
+#define MSP_GRAPHICS_COCOAERRORDIALOG_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void run_alert(const char *, const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/source/graphics/cocoa/cocoaerrordialog.m b/source/graphics/cocoa/cocoaerrordialog.m
new file mode 100644 (file)
index 0000000..eb82d57
--- /dev/null
@@ -0,0 +1,13 @@
+#import <Foundation/NSString.h>
+#import <AppKit/NSAlert.h>
+#include "cocoaerrordialog.h"
+
+void run_alert(const char *type, const char *what)
+{
+       NSString *message = [[[NSString stringWithUTF8String:type] stringByAppendingString:@": "]
+               stringByAppendingString:[NSString stringWithUTF8String:what]];
+       NSAlert *alert = [NSAlert alertWithMessageText:@"Uncaught exception"
+               defaultButton:nil alternateButton:nil otherButton:nil
+               informativeTextWithFormat:@"%@", message];
+       [alert runModal];
+}
index ec44461113b675680c7d4e73a0ac2a743ce2aeb7..e923586cf2029270e5811c3ce41fa9f7a878f690 100644 (file)
@@ -1,14 +1,17 @@
+#include <typeinfo>
+#include <msp/core/application.h>
+#include <msp/debug/demangle.h>
+#include "cocoaerrordialog.h"
 #include "errordialog.h"
 
 using namespace std;
 
-extern "C" void run_alert(const char *, const char *);
-
 namespace Msp {
 namespace Graphics {
 
 bool ErrorDialog::report_uncaught_exception(const exception &e) const
 {
+       (void)display;
        if(Application::get_data())
        {
                string type = Debug::demangle(typeid(e).name());
diff --git a/source/graphics/cocoa/errordialog.m b/source/graphics/cocoa/errordialog.m
deleted file mode 100644 (file)
index 2b6b3c6..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#import <Foundation/NSString.h>
-#import <AppKit/NSAlert.h>
-
-// The function gets incorrect linkage without a prototype
-void run_alert(const char *, const char *);
-
-void run_alert(const char *type, const char *what)
-{
-       NSString *message = [[[NSString stringWithUTF8String:type] stringByAppendingString:@": "]
-               stringByAppendingString:[NSString stringWithUTF8String:what]];
-       NSAlert *alert = [NSAlert alertWithMessageText:@"Uncaught exception"
-               defaultButton:nil alternateButton:nil otherButton:nil
-               informativeTextWithFormat:@"%@", message];
-       [alert runModal];
-}
-