diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-10-27 19:06:56 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-10-27 19:07:55 (GMT) |
commit | 6810a2896f27e7ee07aee847f5e8dbccd1f6ec89 (patch) | |
tree | f7ea87f030e57cb4494a4f897506fb18fc3d2241 /Slimber/Cocoa | |
parent | a7da393cfc807048d320ddba8a1c7d24ef23a46e (diff) | |
download | swift-contrib-6810a2896f27e7ee07aee847f5e8dbccd1f6ec89.zip swift-contrib-6810a2896f27e7ee07aee847f5e8dbccd1f6ec89.tar.bz2 |
Remove MainEventLoop singleton.
The event loop now needs to be explicitly passed to clients
using it.
Diffstat (limited to 'Slimber/Cocoa')
-rw-r--r-- | Slimber/Cocoa/CocoaController.mm | 3 | ||||
-rw-r--r-- | Slimber/Cocoa/main.h | 11 | ||||
-rw-r--r-- | Slimber/Cocoa/main.mm | 9 |
3 files changed, 20 insertions, 3 deletions
diff --git a/Slimber/Cocoa/CocoaController.mm b/Slimber/Cocoa/CocoaController.mm index 437d85a..a0c4ef4 100644 --- a/Slimber/Cocoa/CocoaController.mm +++ b/Slimber/Cocoa/CocoaController.mm @@ -2,6 +2,7 @@ #include "Slimber/MainController.h" #include "Slimber/Cocoa/CocoaMenulet.h" +#include "Slimber/Cocoa/main.h" @implementation CocoaController @@ -13,7 +14,7 @@ - (void) awakeFromNib { menulet = new CocoaMenulet(); - main = new MainController(menulet); + main = new MainController(menulet, eventLoop); } @end diff --git a/Slimber/Cocoa/main.h b/Slimber/Cocoa/main.h new file mode 100644 index 0000000..681139d --- /dev/null +++ b/Slimber/Cocoa/main.h @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include "Swiften/EventLoop/Cocoa/CocoaEventLoop.h" + +extern Swift::CocoaEventLoop* eventLoop; diff --git a/Slimber/Cocoa/main.mm b/Slimber/Cocoa/main.mm index e267477..fc051e0 100644 --- a/Slimber/Cocoa/main.mm +++ b/Slimber/Cocoa/main.mm @@ -1,8 +1,13 @@ #include <Cocoa/Cocoa.h> +#include "Slimber/Cocoa/main.h" #include "Swiften/EventLoop/Cocoa/CocoaEventLoop.h" +Swift::CocoaEventLoop* eventLoop; + int main(int argc, char *argv[]) { - Swift::CocoaEventLoop eventLoop; - return NSApplicationMain(argc, const_cast<const char **>(argv)); + eventLoop = new Swift::CocoaEventLoop(); + int result = NSApplicationMain(argc, const_cast<const char **>(argv)); + delete eventLoop; + return result; } |