Fix build issues
This commit is contained in:
parent
84cce6c2c1
commit
6217d497ed
2 changed files with 13 additions and 8 deletions
|
@ -37,12 +37,16 @@ class FileChooserDialog {
|
||||||
FileChooserDialog(GtkFileChooserAction action,
|
FileChooserDialog(GtkFileChooserAction action,
|
||||||
atom::NativeWindow* parent_window,
|
atom::NativeWindow* parent_window,
|
||||||
const std::string& title,
|
const std::string& title,
|
||||||
|
const std::string& button_label,
|
||||||
const base::FilePath& default_path,
|
const base::FilePath& default_path,
|
||||||
const Filters& filters)
|
const Filters& filters)
|
||||||
: dialog_scope_(parent_window),
|
: dialog_scope_(parent_window),
|
||||||
filters_(filters) {
|
filters_(filters) {
|
||||||
const char* confirm_text = GTK_STOCK_OK;
|
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;
|
confirm_text = GTK_STOCK_SAVE;
|
||||||
else if (action == GTK_FILE_CHOOSER_ACTION_OPEN)
|
else if (action == GTK_FILE_CHOOSER_ACTION_OPEN)
|
||||||
confirm_text = GTK_STOCK_OPEN;
|
confirm_text = GTK_STOCK_OPEN;
|
||||||
|
@ -224,8 +228,8 @@ bool ShowOpenDialog(atom::NativeWindow* parent_window,
|
||||||
GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
|
GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
|
||||||
if (properties & FILE_DIALOG_OPEN_DIRECTORY)
|
if (properties & FILE_DIALOG_OPEN_DIRECTORY)
|
||||||
action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
|
action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
|
||||||
FileChooserDialog open_dialog(action, parent_window, title, default_path,
|
FileChooserDialog open_dialog(action, parent_window, title, button_label,
|
||||||
filters);
|
default_path, filters);
|
||||||
if (properties & FILE_DIALOG_MULTI_SELECTIONS)
|
if (properties & FILE_DIALOG_MULTI_SELECTIONS)
|
||||||
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(open_dialog.dialog()),
|
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(open_dialog.dialog()),
|
||||||
TRUE);
|
TRUE);
|
||||||
|
@ -251,7 +255,7 @@ void ShowOpenDialog(atom::NativeWindow* parent_window,
|
||||||
if (properties & FILE_DIALOG_OPEN_DIRECTORY)
|
if (properties & FILE_DIALOG_OPEN_DIRECTORY)
|
||||||
action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
|
action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
|
||||||
FileChooserDialog* open_dialog = new FileChooserDialog(
|
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)
|
if (properties & FILE_DIALOG_MULTI_SELECTIONS)
|
||||||
gtk_file_chooser_set_select_multiple(
|
gtk_file_chooser_set_select_multiple(
|
||||||
GTK_FILE_CHOOSER(open_dialog->dialog()), TRUE);
|
GTK_FILE_CHOOSER(open_dialog->dialog()), TRUE);
|
||||||
|
@ -266,7 +270,7 @@ bool ShowSaveDialog(atom::NativeWindow* parent_window,
|
||||||
const Filters& filters,
|
const Filters& filters,
|
||||||
base::FilePath* path) {
|
base::FilePath* path) {
|
||||||
FileChooserDialog save_dialog(GTK_FILE_CHOOSER_ACTION_SAVE, parent_window,
|
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());
|
gtk_widget_show_all(save_dialog.dialog());
|
||||||
int response = gtk_dialog_run(GTK_DIALOG(save_dialog.dialog()));
|
int response = gtk_dialog_run(GTK_DIALOG(save_dialog.dialog()));
|
||||||
if (response == GTK_RESPONSE_ACCEPT) {
|
if (response == GTK_RESPONSE_ACCEPT) {
|
||||||
|
@ -284,8 +288,8 @@ void ShowSaveDialog(atom::NativeWindow* parent_window,
|
||||||
const Filters& filters,
|
const Filters& filters,
|
||||||
const SaveDialogCallback& callback) {
|
const SaveDialogCallback& callback) {
|
||||||
FileChooserDialog* save_dialog = new FileChooserDialog(
|
FileChooserDialog* save_dialog = new FileChooserDialog(
|
||||||
GTK_FILE_CHOOSER_ACTION_SAVE, parent_window, title, default_path,
|
GTK_FILE_CHOOSER_ACTION_SAVE, parent_window, title, button_label,
|
||||||
filters);
|
default_path, filters);
|
||||||
save_dialog->RunSaveAsynchronous(callback);
|
save_dialog->RunSaveAsynchronous(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,8 @@ void RunSaveDialogInNewThread(const RunState& run_state,
|
||||||
const Filters& filters,
|
const Filters& filters,
|
||||||
const SaveDialogCallback& callback) {
|
const SaveDialogCallback& callback) {
|
||||||
base::FilePath path;
|
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,
|
run_state.ui_message_loop->PostTask(FROM_HERE,
|
||||||
base::Bind(callback, result, path));
|
base::Bind(callback, result, path));
|
||||||
run_state.ui_message_loop->DeleteSoon(FROM_HERE, run_state.dialog_thread);
|
run_state.ui_message_loop->DeleteSoon(FROM_HERE, run_state.dialog_thread);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue