From 017d4480a7a2b379a8577670098f3535c49d538a Mon Sep 17 00:00:00 2001 From: eidheim Date: Tue, 4 Aug 2015 09:25:59 +0200 Subject: [PATCH] Now refreshes directories after running cmake for compilation_commands.json. --- src/notebook.cc | 5 +++-- src/notebook.h | 4 +++- src/window.cc | 2 +- src/window.h | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/notebook.cc b/src/notebook.cc index c113daa..4e18c1f 100644 --- a/src/notebook.cc +++ b/src/notebook.cc @@ -12,7 +12,7 @@ namespace sigc { SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE } -Notebook::Notebook() : Gtk::Notebook() { +Notebook::Notebook(Directories &directories) : Gtk::Notebook(), directories(directories) { Gsv::init(); } @@ -174,7 +174,8 @@ bool Notebook::make_compile_commands(const std::string &path) { Singleton::terminal()->print("Creating "+boost::filesystem::path(path+"/compile_commands.json").string()+"\n"); //TODO: Windows... if(Singleton::terminal()->execute(path, "cmake . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON 2>&1")) { - //TODO: refresh directories + if(project_path!="") + directories.open_folder(project_path); return true; } return false; diff --git a/src/notebook.h b/src/notebook.h index 2c9d980..ef95143 100644 --- a/src/notebook.h +++ b/src/notebook.h @@ -8,10 +8,11 @@ #include #include #include +#include "directories.h" class Notebook : public Gtk::Notebook { public: - Notebook(); + Notebook(Directories &directories); Source::View* get_view(int page); int size(); Source::View* get_current_view(); @@ -25,6 +26,7 @@ private: std::string find_project_path(const std::string &path); bool make_compile_commands(const std::string &path); bool save_modified_dialog(); + Directories &directories; std::vector source_views; //Is NOT freed in destructor, this is intended for quick program exit. std::vector > scrolled_windows; std::vector > hboxes; diff --git a/src/window.cc b/src/window.cc index b999717..1c00711 100644 --- a/src/window.cc +++ b/src/window.cc @@ -12,7 +12,7 @@ namespace sigc { SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE } -Window::Window() : box(Gtk::ORIENTATION_VERTICAL) { +Window::Window() : box(Gtk::ORIENTATION_VERTICAL), notebook(directories) { INFO("Create Window"); set_title("juCi++"); set_default_size(600, 400); diff --git a/src/window.h b/src/window.h index 44c6afb..7100de6 100644 --- a/src/window.h +++ b/src/window.h @@ -10,8 +10,8 @@ class Window : public Gtk::Window { public: Window(); - Notebook notebook; Directories directories; + Notebook notebook; protected: bool on_key_press_event(GdkEventKey *event); bool on_delete_event (GdkEventAny *event);