Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add buttonLabel param to showOpen/showSave dialogs #5509

Merged
merged 5 commits into from May 16, 2016

Conversation

Projects
None yet
2 participants
@bengotow
Copy link
Contributor

bengotow commented May 12, 2016

I still need to test this on a Win32 machine, but wanted to get feedback on this approach. The button_label parameter needed to be passed through more places than I would have liked, but I'm not sure if there's a better way!

@@ -75,6 +75,15 @@ module.exports = {
} else if (typeof options.title !== 'string') {
throw new TypeError('Title must be a string')
}
if (options.buttonLabel == null) {
if (options.properties.indexOf('openDirectory') !== -1) {
options.buttonLabel = 'Choose'

This comment has been minimized.

Copy link
@zcbenz

zcbenz May 13, 2016

Member

We should probably use an empty thing if it is not specified, so platform can show the default label, which is localized. Otherwise English label will always be used.

This comment has been minimized.

Copy link
@bengotow

bengotow May 15, 2016

Author Contributor

Sounds good. Willfix.

@@ -86,7 +95,7 @@ module.exports = {
wrappedCallback = typeof callback === 'function' ? function (success, result) {
return callback(success ? result : void 0)
} : null
return binding.showOpenDialog(String(options.title), String(options.defaultPath), options.filters, properties, window, wrappedCallback)
return binding.showOpenDialog(String(options.title), String(options.buttonLabel), String(options.defaultPath), options.filters, properties, window, wrappedCallback)

This comment has been minimized.

Copy link
@zcbenz

zcbenz May 13, 2016

Member

I think we can remove the String(...) conversion now, since the code is checking each parameter's type.

This comment has been minimized.

Copy link
@bengotow

bengotow May 15, 2016

Author Contributor

Nice! Will check and see—

@bengotow bengotow force-pushed the bengotow/dialog-titles branch from 67e8309 to 6217d49 May 15, 2016

bengotow and others added some commits May 15, 2016

@zcbenz

This comment has been minimized.

Copy link
Member

zcbenz commented May 16, 2016

Thanks!

@zcbenz zcbenz merged commit 57f0820 into master May 16, 2016

7 of 9 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
electron-linux-arm Build #3235755 succeeded in 40s
Details
electron-linux-ia32 Build #3235756 succeeded in 35s
Details
electron-linux-x64 Build #3235757 succeeded in 109s
Details
electron-mas-x64 Build #1183 succeeded in 5 min 9 sec
Details
electron-osx-x64 Build #1186 succeeded in 5 min 29 sec
Details
electron-win-ia32 Build #195 succeeded in 6 min 11 sec
Details
electron-win-x64 Build #190 succeeded in 5 min 58 sec
Details

@zcbenz zcbenz deleted the bengotow/dialog-titles branch May 16, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.