Reuse ShowMessageBox in ShowErrorBox

This commit is contained in:
Cheng Zhao 2015-07-07 16:57:19 +08:00
parent 3e6394a004
commit e627592eed

View file

@ -184,14 +184,12 @@ void ShowMessageBox(NativeWindow* parent,
void ShowErrorBox(const base::string16& title, const base::string16& content) { void ShowErrorBox(const base::string16& title, const base::string16& content) {
if (Browser::Get()->is_ready()) { if (Browser::Get()->is_ready()) {
GtkWidget* dialog = gtk_message_dialog_new( GtkMessageBox box(true, nullptr, MESSAGE_BOX_TYPE_ERROR, { "OK" }, "Error",
NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, base::UTF16ToUTF8(title).c_str(),
"%s", base::UTF16ToUTF8(title).c_str()); base::UTF16ToUTF8(content).c_str(),
gtk_message_dialog_format_secondary_text( gfx::ImageSkia());
GTK_MESSAGE_DIALOG(dialog), box.Show();
"%s", base::UTF16ToUTF8(content).c_str()); gtk_dialog_run(GTK_DIALOG(box.dialog()));
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
} else { } else {
fprintf(stderr, fprintf(stderr,
ANSI_TEXT_BOLD ANSI_BACKGROUND_GRAY ANSI_TEXT_BOLD ANSI_BACKGROUND_GRAY