Browse Source

fixed bug with complie and run

merge-requests/365/head
oyvang 11 years ago
parent
commit
9087f660ca
  1. 8
      juci/notebook.cc
  2. 4
      juci/window.cc

8
juci/notebook.cc

@ -643,17 +643,23 @@ void Notebook::Controller:: OnSaveFile() {
std::string Notebook::Controller::OnSaveFileAs(){ std::string Notebook::Controller::OnSaveFileAs(){
INFO("Notebook save as"); INFO("Notebook save as");
Gtk::FileChooserDialog dialog("Please choose a file", Gtk::FileChooserDialog dialog("Please choose a file",
Gtk::FILE_CHOOSER_ACTION_SAVE); Gtk::FILE_CHOOSER_ACTION_SAVE);
DEBUG("SET TRANSISTEN FPR");
dialog.set_transient_for(*window_); dialog.set_transient_for(*window_);
dialog.set_position(Gtk::WindowPosition::WIN_POS_CENTER_ALWAYS); dialog.set_position(Gtk::WindowPosition::WIN_POS_CENTER_ALWAYS);
dialog.add_button("_Cancel", Gtk::RESPONSE_CANCEL); dialog.add_button("_Cancel", Gtk::RESPONSE_CANCEL);
dialog.add_button("_Save", Gtk::RESPONSE_OK); dialog.add_button("_Save", Gtk::RESPONSE_OK);
//dialog.set_current_name("Untitled");
DEBUG("RUN DIALOG");
int result = dialog.run(); int result = dialog.run();
DEBUG("DIALOG RUNNING");
switch (result) { switch (result) {
case(Gtk::RESPONSE_OK): { case(Gtk::RESPONSE_OK): {
DEBUG("get_filename()");
std::string path = dialog.get_filename(); std::string path = dialog.get_filename();
DEBUG_VAR(path);
unsigned pos = path.find_last_of("/\\"); unsigned pos = path.find_last_of("/\\");
std::cout << path<< std::endl; std::cout << path<< std::endl;
//notebook_.OnSaveFile(path); //notebook_.OnSaveFile(path);

4
juci/window.cc

@ -54,9 +54,9 @@ Window::Window() :
Gtk::AccelKey(keybindings_.config_ Gtk::AccelKey(keybindings_.config_
.key_map()["compile_and_run"]), .key_map()["compile_and_run"]),
[this]() { [this]() {
notebook_.OnSaveFile();
if (running.try_lock()) { if (running.try_lock()) {
std::thread execute([=]() { std::thread execute([=]() {
notebook_.OnSaveFile();
std::string path = notebook_.CurrentPagePath(); std::string path = notebook_.CurrentPagePath();
int pos = path.find_last_of("/\\"); int pos = path.find_last_of("/\\");
if(pos != std::string::npos){ if(pos != std::string::npos){
@ -80,9 +80,9 @@ Window::Window() :
Gtk::AccelKey(keybindings_.config_ Gtk::AccelKey(keybindings_.config_
.key_map()["compile"]), .key_map()["compile"]),
[this]() { [this]() {
notebook_.OnSaveFile();
if (running.try_lock()) { if (running.try_lock()) {
std::thread execute([=]() { std::thread execute([=]() {
notebook_.OnSaveFile();
std::string path = notebook_.CurrentPagePath(); std::string path = notebook_.CurrentPagePath();
int pos = path.find_last_of("/\\"); int pos = path.find_last_of("/\\");
if(pos != std::string::npos){ if(pos != std::string::npos){

Loading…
Cancel
Save