]> khamidou — GitHub mirrors - electron.git/commitdiff
linux: Use GTK+ for error reporting when GUI is ready
authorCheng Zhao <zcbenz@gmail.com>
Wed, 5 Nov 2014 11:27:43 +0000 (19:27 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 5 Nov 2014 11:27:43 +0000 (19:27 +0800)
atom/browser/ui/message_box_views.cc

index ff27373d1e3c2ea0ecf97cc9b7d36cd1f43681e0..959545c252d097e11cfb9c7ffc5efb95669283a4 100644 (file)
@@ -370,6 +370,14 @@ void ShowErrorBox(const base::string16& title, const base::string16& content) {
   ui::MessageBox(NULL, content, title, MB_OK | MB_ICONERROR | MB_TASKMODAL);
 #elif defined(USE_X11)
   if (Browser::Get()->is_ready()) {
+    GtkWidget* dialog = gtk_message_dialog_new(
+        NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+        "%s", base::UTF16ToUTF8(title).c_str());
+    gtk_message_dialog_format_secondary_text(
+        GTK_MESSAGE_DIALOG(dialog),
+        "%s", base::UTF16ToUTF8(content).c_str());
+    gtk_dialog_run(GTK_DIALOG(dialog));
+    gtk_widget_destroy(dialog);
   } else {
     fprintf(stderr,
             ANSI_TEXT_BOLD ANSI_BACKGROUND_GRAY