From 089d247d6d557c02089b94ff5e9bb60a6655df4c Mon Sep 17 00:00:00 2001 From: eidheim Date: Tue, 8 May 2018 08:01:26 +0200 Subject: [PATCH] Removed File Reload dialog that is no longer needed since one can undo the changes --- src/window.cc | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/window.cc b/src/window.cc index 1fb85bb..ed94901 100644 --- a/src/window.cc +++ b/src/window.cc @@ -312,29 +312,23 @@ void Window::set_menu_actions() { Directories::get().open(path); }); - menu.add_action("file_reload_file", [this]() { + menu.add_action("file_reload_file", []() { if(auto view=Notebook::get().get_current_view()) { - Gtk::MessageDialog dialog(*static_cast(get_toplevel()), "Reload file!", false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO); - dialog.set_default_response(Gtk::RESPONSE_YES); - dialog.set_secondary_text("Do you want to reload: " + view->file_path.string()+" ? The current buffer will be lost."); - int result = dialog.run(); - if(result==Gtk::RESPONSE_YES) { - if(boost::filesystem::exists(view->file_path)) { - std::ifstream can_read(view->file_path.string()); - if(!can_read) { - Terminal::get().print("Error: could not read "+view->file_path.string()+"\n", true); - return; - } - can_read.close(); - } - else { - Terminal::get().print("Error: "+view->file_path.string()+" does not exist\n", true); + if(boost::filesystem::exists(view->file_path)) { + std::ifstream can_read(view->file_path.string()); + if(!can_read) { + Terminal::get().print("Error: could not read "+view->file_path.string()+"\n", true); return; } - - if(view->load()) - view->full_reparse(); + can_read.close(); } + else { + Terminal::get().print("Error: "+view->file_path.string()+" does not exist\n", true); + return; + } + + if(view->load()) + view->full_reparse(); } });