From: Cheng Zhao Date: Wed, 12 Mar 2014 13:17:13 +0000 (+0800) Subject: gtk: Make synchronous message box work. X-Git-Tag: v0.11.0~9^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=676a48ae286b2ac01d61ae9d688746532a63be68;p=electron.git gtk: Make synchronous message box work. --- diff --git a/browser/ui/message_box_gtk.cc b/browser/ui/message_box_gtk.cc index f2988f6d..0fbb156f 100644 --- a/browser/ui/message_box_gtk.cc +++ b/browser/ui/message_box_gtk.cc @@ -78,6 +78,7 @@ class MessageBox { CHROMEGTK_CALLBACK_1(MessageBox, void, OnResponseDialog, int); GtkWidget* dialog() const { return dialog_; } + int cancel_id() const { return cancel_id_; } private: GtkWidget* dialog_; @@ -107,7 +108,13 @@ int ShowMessageBox(NativeWindow* parent_window, const std::string& title, const std::string& message, const std::string& detail) { - return 0; + MessageBox message_box(parent_window, type, buttons, title, message, detail); + gtk_widget_show_all(message_box.dialog()); + int response = gtk_dialog_run(GTK_DIALOG(message_box.dialog())); + if (response < 0) + return message_box.cancel_id(); + else + return response; } void ShowMessageBox(NativeWindow* parent_window,