|
|
|
@ -3,6 +3,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
Directories::Controller::Controller(Directories::Config& cfg) : |
|
|
|
Directories::Controller::Controller(Directories::Config& cfg) : |
|
|
|
config_(cfg) { |
|
|
|
config_(cfg) { |
|
|
|
|
|
|
|
DEBUG("adding treeview to scrolledwindow"); |
|
|
|
m_ScrolledWindow.add(m_TreeView); |
|
|
|
m_ScrolledWindow.add(m_TreeView); |
|
|
|
m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); |
|
|
|
m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -13,16 +14,20 @@ open_folder(const boost::filesystem::path& dir_path) { |
|
|
|
m_refTreeModel = Gtk::TreeStore::create(view()); |
|
|
|
m_refTreeModel = Gtk::TreeStore::create(view()); |
|
|
|
m_TreeView.set_model(m_refTreeModel); |
|
|
|
m_TreeView.set_model(m_refTreeModel); |
|
|
|
m_TreeView.remove_all_columns(); |
|
|
|
m_TreeView.remove_all_columns(); |
|
|
|
|
|
|
|
DEBUG("Getting project name from CMakeLists.txt"); |
|
|
|
std::string project_name = GetCmakeVarValue(dir_path, "project"); |
|
|
|
std::string project_name = GetCmakeVarValue(dir_path, "project"); |
|
|
|
m_TreeView.append_column(project_name, view().m_col_name); |
|
|
|
m_TreeView.append_column(project_name, view().m_col_name); |
|
|
|
int row_id = 0; |
|
|
|
int row_id = 0; |
|
|
|
Gtk::TreeModel::Row row; |
|
|
|
Gtk::TreeModel::Row row; |
|
|
|
|
|
|
|
DEBUG("Listing directories"); |
|
|
|
list_dirs(dir_path, row, row_id); |
|
|
|
list_dirs(dir_path, row, row_id); |
|
|
|
|
|
|
|
DEBUG("Sorting directories"); |
|
|
|
m_refTreeModel->set_sort_column(0, Gtk::SortType::SORT_ASCENDING); |
|
|
|
m_refTreeModel->set_sort_column(0, Gtk::SortType::SORT_ASCENDING); |
|
|
|
INFO("Folder opened"); |
|
|
|
DEBUG("Folder opened"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool Directories::Controller::IsIgnored(std::string path) { |
|
|
|
bool Directories::Controller::IsIgnored(std::string path) { |
|
|
|
|
|
|
|
DEBUG("Checking if file-/directory is filtered"); |
|
|
|
std::transform(path.begin(), path.end(), path.begin(), ::tolower); |
|
|
|
std::transform(path.begin(), path.end(), path.begin(), ::tolower); |
|
|
|
// std::cout << "ignored?: " << path << std::endl;
|
|
|
|
// std::cout << "ignored?: " << path << std::endl;
|
|
|
|
if (config().IsException(path)) { |
|
|
|
if (config().IsException(path)) { |
|
|
|
@ -37,12 +42,13 @@ void Directories::Controller:: |
|
|
|
list_dirs(const boost::filesystem::path& dir_path, |
|
|
|
list_dirs(const boost::filesystem::path& dir_path, |
|
|
|
Gtk::TreeModel::Row &parent, |
|
|
|
Gtk::TreeModel::Row &parent, |
|
|
|
unsigned row_id) { |
|
|
|
unsigned row_id) { |
|
|
|
|
|
|
|
|
|
|
|
boost::filesystem::directory_iterator end_itr; |
|
|
|
boost::filesystem::directory_iterator end_itr; |
|
|
|
unsigned dir_counter = row_id; |
|
|
|
unsigned dir_counter = row_id; |
|
|
|
unsigned file_counter = 0; |
|
|
|
unsigned file_counter = 0; |
|
|
|
Gtk::TreeModel::Row child; |
|
|
|
Gtk::TreeModel::Row child; |
|
|
|
Gtk::TreeModel::Row row; |
|
|
|
Gtk::TreeModel::Row row; |
|
|
|
|
|
|
|
DEBUG_VAR(dir_path); |
|
|
|
// Fill the treeview
|
|
|
|
// Fill the treeview
|
|
|
|
for ( boost::filesystem::directory_iterator itr( dir_path ); |
|
|
|
for ( boost::filesystem::directory_iterator itr( dir_path ); |
|
|
|
itr != end_itr; |
|
|
|
itr != end_itr; |
|
|
|
|