diff options
Diffstat (limited to 'src/lib/ecore_cocoa/ecore_cocoa_app.m')
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa_app.m | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_app.m b/src/lib/ecore_cocoa/ecore_cocoa_app.m index 04391f61ff..8df1be1830 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa_app.m +++ b/src/lib/ecore_cocoa/ecore_cocoa_app.m | |||
@@ -112,6 +112,16 @@ _ecore_cocoa_run_loop_cb(void *data EINA_UNUSED) | |||
112 | ecore_timer_thaw(_timer); | 112 | ecore_timer_thaw(_timer); |
113 | } | 113 | } |
114 | 114 | ||
115 | - (void)setTerminateCb:(Ecore_Cocoa_Terminate_Cb)cb | ||
116 | { | ||
117 | _terminate_cb = cb; | ||
118 | } | ||
119 | |||
120 | - (Ecore_Cocoa_Terminate_Cb)terminateCb | ||
121 | { | ||
122 | return _terminate_cb; | ||
123 | } | ||
124 | |||
115 | @end | 125 | @end |
116 | 126 | ||
117 | 127 | ||
@@ -131,8 +141,19 @@ static Ecore_Cocoa_AppDelegate *_appDelegate = nil; | |||
131 | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *) EINA_UNUSED sender | 141 | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *) EINA_UNUSED sender |
132 | { | 142 | { |
133 | // XXX This should be alterable (by Elm_Window policy) | 143 | // XXX This should be alterable (by Elm_Window policy) |
134 | return YES; | 144 | return NO; |
135 | } | 145 | } |
136 | 146 | ||
137 | @end | 147 | - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender |
148 | { | ||
149 | NSApplicationTerminateReply status = NSTerminateNow; | ||
150 | const Ecore_Cocoa_Terminate_Cb cb = [(Ecore_Cocoa_Application *)sender terminateCb]; | ||
151 | if (cb) | ||
152 | { | ||
153 | const Eina_Bool ret = cb(sender); | ||
154 | if (!ret) status = NSTerminateCancel; | ||
155 | } | ||
156 | return status; | ||
157 | } | ||
138 | 158 | ||
159 | @end | ||