Browse Source

added rudimentary file_reload to menu

merge-requests/365/head
d3rrial 9 years ago
parent
commit
a1a0d9270f
  1. 6
      src/menu.cc
  2. 7
      src/window.cc

6
src/menu.cc

@ -61,6 +61,12 @@ Menu::Menu() {
<attribute name='action'>app.open_folder</attribute> <attribute name='action'>app.open_folder</attribute>
</item> </item>
</section> </section>
<section>
<item>
<attribute name='label' translatable='yes'>_Reload _File</attribute>
<attribute name='action'>app.reload_file</attribute>
</item>
</section>
<section> <section>
<item> <item>
<attribute name='label' translatable='yes'>_Save</attribute> <attribute name='label' translatable='yes'>_Save</attribute>

7
src/window.cc

@ -319,6 +319,13 @@ void Window::set_menu_actions() {
Directories::get().open(path); Directories::get().open(path);
}); });
menu.add_action("reload_file", [this]() {
auto path = Notebook::get().get_current_view()->file_path;
std::cout<<"Path: "<<path<<std::endl;
Notebook::get().close_current();
Notebook::get().open(path);
});
menu.add_action("save", [this]() { menu.add_action("save", [this]() {
if(auto view=Notebook::get().get_current_view()) { if(auto view=Notebook::get().get_current_view()) {
if(Notebook::get().save_current()) { if(Notebook::get().save_current()) {

Loading…
Cancel
Save