Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[mac] Adopt new save/open API #1331

Merged
merged 2 commits into from
Oct 20, 2020
Merged

[mac] Adopt new save/open API #1331

merged 2 commits into from
Oct 20, 2020

Conversation

cmyr
Copy link
Member

@cmyr cmyr commented Oct 19, 2020

This implements the new save/open (#1068) API on macOS.

The implementation here is slightly different; Cocoa uses the idea
of 'blocks' (a c extension for callbacks) in most of their async API,
so we don't need to to manually defer the work.

This implements the new save/open (#1068) API on macOS.

The implementation here is slightly different; Cocoa uses the idea
of 'blocks' (a c extension for callbacks) in most of their async API,
so we don't need to to manually defer the work.
Copy link
Collaborator

@jneem jneem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I have no way of testing this, but at least it looks good.

let token = FileDialogToken::next();
let self_clone = self.clone();
unsafe {
let panel = dialog::build_panel(FileDialogType::Save, options);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like except for FileDialogType::Save this is identical to open_file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also different is the method we call on the handler inside the block. I could probably come up with some way to share this code more but I'm not sure it's worth the typing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(okay fine I rewrote it to share an implementation 😛)

@cmyr cmyr merged commit f666424 into master Oct 20, 2020
@cmyr cmyr deleted the mac-save-async branch October 20, 2020 22:14
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants