diff --git a/CMakeLists.txt b/CMakeLists.txt index 4031abf..7ad4190 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(juci) -set(JUCI_VERSION "1.6.3.2") +set(JUCI_VERSION "1.6.3.3") set(CPACK_PACKAGE_NAME "jucipp") set(CPACK_PACKAGE_CONTACT "Ole Christian Eidheim ") diff --git a/src/config.cpp b/src/config.cpp index dcb8a70..a6097fc 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -359,6 +359,7 @@ std::string Config::default_config() { "file_close_file": "w", "file_close_folder": "", "file_close_project": "", + "file_close_other_files": "", "file_print": "", "edit_undo": "z", "edit_redo": "z", diff --git a/src/menu.cpp b/src/menu.cpp index 6a412c5..ad65ca8 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -194,6 +194,10 @@ const Glib::ustring menu_xml = R"RAW( _Close _Project app.file_close_project + + _Close _Other _Files + app.file_close_other_files +
diff --git a/src/notebook.cpp b/src/notebook.cpp index 05dc91a..6b6c4fa 100644 --- a/src/notebook.cpp +++ b/src/notebook.cpp @@ -943,14 +943,7 @@ bool Notebook::save_modified_dialog(size_t index) { dialog.set_default_response(Gtk::RESPONSE_YES); dialog.set_secondary_text("Do you want to save " + filesystem::get_short_path(get_view(index)->file_path).string() + "?"); dialog.show_all(); - int result = dialog.run(); - if(result == Gtk::RESPONSE_YES) { + if(dialog.run() == Gtk::RESPONSE_YES) return save(index); - } - else if(result == Gtk::RESPONSE_NO) { - return true; - } - else { - return false; - } + return false; } diff --git a/src/window.cpp b/src/window.cpp index 3f37aa2..7f82c1e 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -569,6 +569,17 @@ void Window::set_menu_actions() { } Directories::get().close(project_path); }); + menu.add_action("file_close_other_files", []() { + auto current_view = Notebook::get().get_current_view(); + if(!current_view) + return; + for(size_t c = Notebook::get().size() - 1; c != static_cast(-1); --c) { + if(Notebook::get().get_view(c) != current_view) { + if(!Notebook::get().close(c)) + return; + } + } + }); menu.add_action("file_print", [this]() { if(auto view = Notebook::get().get_current_view()) {