From 6217d497edfe9f691888db8b4fcc296882218800 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Sun, 15 May 2016 01:02:27 -0500 Subject: [PATCH] Fix build issues --- atom/browser/ui/file_dialog_gtk.cc | 18 +++++++++++------- atom/browser/ui/file_dialog_win.cc | 3 ++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/atom/browser/ui/file_dialog_gtk.cc b/atom/browser/ui/file_dialog_gtk.cc index d58d5b5025c4..713b7b3ddb72 100644 --- a/atom/browser/ui/file_dialog_gtk.cc +++ b/atom/browser/ui/file_dialog_gtk.cc @@ -37,12 +37,16 @@ class FileChooserDialog { FileChooserDialog(GtkFileChooserAction action, atom::NativeWindow* parent_window, const std::string& title, + const std::string& button_label, const base::FilePath& default_path, const Filters& filters) : dialog_scope_(parent_window), filters_(filters) { const char* confirm_text = GTK_STOCK_OK; - if (action == GTK_FILE_CHOOSER_ACTION_SAVE) + + if (button_label != NULL) + confirm_text = button_label.c_str(); + else if (action == GTK_FILE_CHOOSER_ACTION_SAVE) confirm_text = GTK_STOCK_SAVE; else if (action == GTK_FILE_CHOOSER_ACTION_OPEN) confirm_text = GTK_STOCK_OPEN; @@ -224,8 +228,8 @@ bool ShowOpenDialog(atom::NativeWindow* parent_window, GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN; if (properties & FILE_DIALOG_OPEN_DIRECTORY) action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; - FileChooserDialog open_dialog(action, parent_window, title, default_path, - filters); + FileChooserDialog open_dialog(action, parent_window, title, button_label, + default_path, filters); if (properties & FILE_DIALOG_MULTI_SELECTIONS) gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(open_dialog.dialog()), TRUE); @@ -251,7 +255,7 @@ void ShowOpenDialog(atom::NativeWindow* parent_window, if (properties & FILE_DIALOG_OPEN_DIRECTORY) action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; FileChooserDialog* open_dialog = new FileChooserDialog( - action, parent_window, title, default_path, filters); + action, parent_window, title, button_label, default_path, filters); if (properties & FILE_DIALOG_MULTI_SELECTIONS) gtk_file_chooser_set_select_multiple( GTK_FILE_CHOOSER(open_dialog->dialog()), TRUE); @@ -266,7 +270,7 @@ bool ShowSaveDialog(atom::NativeWindow* parent_window, const Filters& filters, base::FilePath* path) { FileChooserDialog save_dialog(GTK_FILE_CHOOSER_ACTION_SAVE, parent_window, - title, default_path, filters); + title, button_label, default_path, filters); gtk_widget_show_all(save_dialog.dialog()); int response = gtk_dialog_run(GTK_DIALOG(save_dialog.dialog())); if (response == GTK_RESPONSE_ACCEPT) { @@ -284,8 +288,8 @@ void ShowSaveDialog(atom::NativeWindow* parent_window, const Filters& filters, const SaveDialogCallback& callback) { FileChooserDialog* save_dialog = new FileChooserDialog( - GTK_FILE_CHOOSER_ACTION_SAVE, parent_window, title, default_path, - filters); + GTK_FILE_CHOOSER_ACTION_SAVE, parent_window, title, button_label, + default_path, filters); save_dialog->RunSaveAsynchronous(callback); } diff --git a/atom/browser/ui/file_dialog_win.cc b/atom/browser/ui/file_dialog_win.cc index c5d81c33100b..e99dcee35c50 100644 --- a/atom/browser/ui/file_dialog_win.cc +++ b/atom/browser/ui/file_dialog_win.cc @@ -180,7 +180,8 @@ void RunSaveDialogInNewThread(const RunState& run_state, const Filters& filters, const SaveDialogCallback& callback) { base::FilePath path; - bool result = ShowSaveDialog(parent, title, default_path, filters, &path); + bool result = ShowSaveDialog(parent, title, button_label, default_path, + filters, &path); run_state.ui_message_loop->PostTask(FROM_HERE, base::Bind(callback, result, path)); run_state.ui_message_loop->DeleteSoon(FROM_HERE, run_state.dialog_thread);