From da94aadda5f56a17d732f2b450eb8c3e18acd1ea Mon Sep 17 00:00:00 2001 From: Veluri Mithun Date: Sat, 4 Aug 2018 10:51:25 +0530 Subject: [PATCH] Close error window - When user clicks the 'close' button close the window and return from main() function. --- main.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index 50bb5d3..b1ad70e 100644 --- a/main.cpp +++ b/main.cpp @@ -14,10 +14,13 @@ int main(int argc, char *argv[]) { if (!check.canHandle()) { std::cerr << "Not all screens have open source drivers" << std::endl; //pop up error window here - Gtk::MessageDialog errorDialog = Gtk::MessageDialog("Closed source driver(s) detected!", - false, Gtk::MESSAGE_ERROR); - errorDialog.set_secondary_text("Currently adriconf cannot handle closed source drivers."); - return 0; + Gtk::MessageDialog *errorDialog = new Gtk::MessageDialog("Closed source driver(s) detected!", + false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE); + errorDialog->set_secondary_text("Currently adriconf cannot handle closed source drivers."); + if (errorDialog->run()) { + errorDialog->close(); + return 0; + } } GUI gui;