OK, so except for AUTORELEASE(controller) it would work well. I
obviously have to RELEASE() the controller only when the dialog is
closing.

I've also found out how you maintain ABI compatibility when adding
ivars. The same way as it's typically done in C++.

But I also need to use Block_copy (and Block_release) when copying the
block to self, since beginWithCompletionHandler is asynchronous.

I haven't found a macro/solution for these calls. How to deal with that?

Luboš

On 06/20/2013 05:24 PM, Luboš Doležel wrote:
> Great, now I have a general question about NSSavePanel. I'd like
> to contribute so much, but I'm very far from proficient at AppKit
> :-(
> 
> - (void)beginWithCompletionHandler:(void (^)(NSInteger
> result))handler
> 
> starts a modeless window. My idea would be to save the handler into
> an instance variable and do this:
> 
> NSWindowController *controller = [[NSWindowController alloc] 
> initWithWindow: self]; self->completionHandler = handler; 
> [controller showWindow: self]; AUTORELEASE(controller);
> 
> Then, in -cancel and -ok check whether we were run modally or
> modelessly (by checking if we have a completion handler) and either
> call
> 
> [NSApp stopModalWithCode: code];
> 
> as it is now, or
> 
> CALL_BLOCK(completionHandler, code);
> 
> Another problem I need some help with is avoiding fragile ABI
> breakage.
> 
> Luboš
> 
> On Thu, 20 Jun 2013 16:10:55 +0100, David Chisnall wrote:
>> Yup, looks good to me,
>> 
>> David
>> 
> 

_______________________________________________
Gnustep-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to