Browse Source

Fix indention and error message

merge-requests/365/head
Jørgen Lien Sellæg 10 years ago
parent
commit
140ae6a821
  1. 32
      src/window.cc

32
src/window.cc

@ -195,7 +195,7 @@ void Window::create_menu() {
else else
Singleton::terminal()->print("Error: "+path.string()+" already exists.\n"); Singleton::terminal()->print("Error: "+path.string()+" already exists.\n");
} else { } else {
Singleton::terminal()->print("Cancel \n"); Singleton::terminal()->print("Dialog was closed \n");
} }
Singleton::directories()->select(path); Singleton::directories()->select(path);
}); });
@ -237,24 +237,24 @@ void Window::create_menu() {
if (boost::filesystem::exists(path)) if (boost::filesystem::exists(path))
Singleton::directories()->open(path); Singleton::directories()->open(path);
else else
Singleton::terminal()->print("Cancel \n"); Singleton::terminal()->print("Dialog was closed \n");
}); });
menu.action_group->add(Gtk::Action::create("FileSaveAs", "Save As"), Gtk::AccelKey(menu.key_map["save_as"]), [this]() { menu.action_group->add(Gtk::Action::create("FileSaveAs", "Save As"), Gtk::AccelKey(menu.key_map["save_as"]), [this]() {
auto path = Dialog::save_file(); auto path = Dialog::save_file();
if(path.size()>0) { if(path.size()>0) {
std::ofstream file(path); std::ofstream file(path);
if(file) { if(file) {
file << notebook.get_current_view()->get_buffer()->get_text(); file << notebook.get_current_view()->get_buffer()->get_text();
file.close(); file.close();
if(Singleton::directories()->current_path!="") if(Singleton::directories()->current_path!="")
Singleton::directories()->update(); Singleton::directories()->update();
notebook.open(path); notebook.open(path);
Singleton::terminal()->print("File saved to: " + notebook.get_current_view()->file_path.string()+"\n"); Singleton::terminal()->print("File saved to: " + notebook.get_current_view()->file_path.string()+"\n");
}
else
Singleton::terminal()->print("Error saving file\n");
} }
}); else
Singleton::terminal()->print("Error saving file\n");
}
});
menu.action_group->add(Gtk::Action::create("Preferences", "Preferences..."), Gtk::AccelKey(menu.key_map["preferences"]), [this]() { menu.action_group->add(Gtk::Action::create("Preferences", "Preferences..."), Gtk::AccelKey(menu.key_map["preferences"]), [this]() {
notebook.open(Singleton::config_dir()+"config.json"); notebook.open(Singleton::config_dir()+"config.json");
}); });

Loading…
Cancel
Save