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

fix: message box missing an "OK" button in GTK #26917

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions shell/browser/ui/message_box_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ class GtkMessageBox : public NativeWindowObserver {

// Add buttons.
GtkDialog* dialog = GTK_DIALOG(dialog_);
for (size_t i = 0; i < settings.buttons.size(); ++i) {
gtk_dialog_add_button(dialog, TranslateToStock(i, settings.buttons[i]),
i);
if (settings.buttons.size() == 0) {
gtk_dialog_add_button(dialog, TranslateToStock(0, "OK"), 0);
} else {
for (size_t i = 0; i < settings.buttons.size(); ++i) {
gtk_dialog_add_button(dialog, TranslateToStock(i, settings.buttons[i]),
i);
}
}
gtk_dialog_set_default_response(dialog, settings.default_id);

Expand Down Expand Up @@ -220,7 +224,7 @@ void ShowErrorBox(const base::string16& title, const base::string16& content) {
if (Browser::Get()->is_ready()) {
electron::MessageBoxSettings settings;
settings.type = electron::MessageBoxType::kError;
settings.buttons = {"OK"};
settings.buttons = {};
settings.title = "Error";
settings.message = base::UTF16ToUTF8(title);
settings.detail = base::UTF16ToUTF8(content);
Expand Down