Browse Source

Added Close Other Files to File menu, and fixed save_modified_dialog when choosing No

pipelines/353213535
eidheim 4 years ago
parent
commit
2035dba47e
  1. 2
      CMakeLists.txt
  2. 1
      src/config.cpp
  3. 4
      src/menu.cpp
  4. 11
      src/notebook.cpp
  5. 11
      src/window.cpp

2
CMakeLists.txt

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.1) cmake_minimum_required(VERSION 3.1)
project(juci) project(juci)
set(JUCI_VERSION "1.6.3.2") set(JUCI_VERSION "1.6.3.3")
set(CPACK_PACKAGE_NAME "jucipp") set(CPACK_PACKAGE_NAME "jucipp")
set(CPACK_PACKAGE_CONTACT "Ole Christian Eidheim <eidheim@gmail.com>") set(CPACK_PACKAGE_CONTACT "Ole Christian Eidheim <eidheim@gmail.com>")

1
src/config.cpp

@ -359,6 +359,7 @@ std::string Config::default_config() {
"file_close_file": "<primary>w", "file_close_file": "<primary>w",
"file_close_folder": "", "file_close_folder": "",
"file_close_project": "", "file_close_project": "",
"file_close_other_files": "",
"file_print": "", "file_print": "",
"edit_undo": "<primary>z", "edit_undo": "<primary>z",
"edit_redo": "<primary><shift>z", "edit_redo": "<primary><shift>z",

4
src/menu.cpp

@ -194,6 +194,10 @@ const Glib::ustring menu_xml = R"RAW(<interface>
<attribute name='label' translatable='yes'>_Close _Project</attribute> <attribute name='label' translatable='yes'>_Close _Project</attribute>
<attribute name='action'>app.file_close_project</attribute> <attribute name='action'>app.file_close_project</attribute>
</item> </item>
<item>
<attribute name='label' translatable='yes'>_Close _Other _Files</attribute>
<attribute name='action'>app.file_close_other_files</attribute>
</item>
</section> </section>
<section> <section>
<item> <item>

11
src/notebook.cpp

@ -943,14 +943,7 @@ bool Notebook::save_modified_dialog(size_t index) {
dialog.set_default_response(Gtk::RESPONSE_YES); 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.set_secondary_text("Do you want to save " + filesystem::get_short_path(get_view(index)->file_path).string() + "?");
dialog.show_all(); dialog.show_all();
int result = dialog.run(); if(dialog.run() == Gtk::RESPONSE_YES)
if(result == Gtk::RESPONSE_YES) {
return save(index); return save(index);
} return false;
else if(result == Gtk::RESPONSE_NO) {
return true;
}
else {
return false;
}
} }

11
src/window.cpp

@ -569,6 +569,17 @@ void Window::set_menu_actions() {
} }
Directories::get().close(project_path); 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<size_t>(-1); --c) {
if(Notebook::get().get_view(c) != current_view) {
if(!Notebook::get().close(c))
return;
}
}
});
menu.add_action("file_print", [this]() { menu.add_action("file_print", [this]() {
if(auto view = Notebook::get().get_current_view()) { if(auto view = Notebook::get().get_current_view()) {

Loading…
Cancel
Save