#ifndef JUCI_DIRECTORIES_H_ #define JUCI_DIRECTORIES_H_ #include #include #include #include "boost/filesystem.hpp" #include "cmake.h" #include #include #include #include "dispatcher.h" class Directories : public Gtk::TreeView { public: class ColumnRecord : public Gtk::TreeModel::ColumnRecord { public: ColumnRecord() { add(id); add(name); add(path); add(color); } Gtk::TreeModelColumn id; Gtk::TreeModelColumn name; Gtk::TreeModelColumn path; Gtk::TreeModelColumn color; }; private: Directories(); public: static Directories &get() { static Directories singleton; return singleton; } ~Directories(); void open(const boost::filesystem::path& dir_path=""); void update(); void select(const boost::filesystem::path &path); std::function on_row_activated; std::unique_ptr cmake; boost::filesystem::path current_path; private: void add_path(const boost::filesystem::path& dir_path, const Gtk::TreeModel::Row &row); Glib::RefPtr tree_store; ColumnRecord column_record; std::unordered_map > last_write_times; std::mutex update_mutex; std::thread update_thread; std::atomic stop_update_thread; Dispatcher dispatcher; std::vector update_paths; }; #endif // JUCI_DIRECTORIES_H_