Fix build issues

This commit is contained in:
Ben Gotow 2016-05-15 01:02:27 -05:00
parent 84cce6c2c1
commit 6217d497ed
2 changed files with 13 additions and 8 deletions

View file

@ -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);
}

View file

@ -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);