From 073584dd8b2faee16e73bbb7bdb5aeda1a49fee8 Mon Sep 17 00:00:00 2001 From: eidheim Date: Thu, 17 Mar 2016 19:41:36 +0100 Subject: [PATCH] Minor cleanup of directories --- src/directories.cc | 20 ++++++++++---------- src/directories.h | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/directories.cc b/src/directories.cc index eba9370..f703f21 100644 --- a/src/directories.cc +++ b/src/directories.cc @@ -25,7 +25,7 @@ namespace sigc { #endif } -bool Directories::TreeStore::row_drop_possible_vfunc(const Gtk::TreeModel::Path& path, const Gtk::SelectionData& selection_data) const { +bool Directories::TreeStore::row_drop_possible_vfunc(const Gtk::TreeModel::Path &path, const Gtk::SelectionData &selection_data) const { return true; } @@ -128,7 +128,7 @@ Directories::Directories() : Gtk::TreeView(), stop_update_thread(false) { set_enable_search(true); //TODO: why does this not work in OS X? set_search_column(column_record.name); - signal_row_activated().connect([this](const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column){ + signal_row_activated().connect([this](const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *column){ auto iter = tree_store->get_iter(path); if (iter) { auto filesystem_path=iter->get_value(column_record.path); @@ -143,7 +143,7 @@ Directories::Directories() : Gtk::TreeView(), stop_update_thread(false) { } }); - signal_test_expand_row().connect([this](const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path){ + signal_test_expand_row().connect([this](const Gtk::TreeModel::iterator &iter, const Gtk::TreeModel::Path &path){ if(iter->children().begin()->get_value(column_record.path)=="") { update_mutex.lock(); add_path(iter->get_value(column_record.path), *iter); @@ -151,7 +151,7 @@ Directories::Directories() : Gtk::TreeView(), stop_update_thread(false) { } return false; }); - signal_row_collapsed().connect([this](const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path){ + signal_row_collapsed().connect([this](const Gtk::TreeModel::iterator &iter, const Gtk::TreeModel::Path &path){ update_mutex.lock(); auto directory_str=iter->get_value(column_record.path).string(); for(auto it=last_write_times.begin();it!=last_write_times.end();) { @@ -216,7 +216,7 @@ Directories::Directories() : Gtk::TreeView(), stop_update_thread(false) { return; EntryBox::get().clear(); auto source_path=std::make_shared(menu_popup_row_path); - EntryBox::get().entries.emplace_back(menu_popup_row_path.filename().string(), [this, source_path](const std::string& content){ + EntryBox::get().entries.emplace_back(menu_popup_row_path.filename().string(), [this, source_path](const std::string &content){ bool is_directory=boost::filesystem::is_directory(*source_path); boost::system::error_code ec; @@ -311,7 +311,7 @@ Directories::~Directories() { dispatcher.disconnect(); } -void Directories::open(const boost::filesystem::path& dir_path) { +void Directories::open(const boost::filesystem::path &dir_path) { JDEBUG("start"); if(dir_path.empty()) return; @@ -372,7 +372,7 @@ void Directories::select(const boost::filesystem::path &select_path) { } for(auto &a_path: paths) { - tree_store->foreach_iter([this, &a_path](const Gtk::TreeModel::iterator& iter){ + tree_store->foreach_iter([this, &a_path](const Gtk::TreeModel::iterator &iter){ if(iter->get_value(column_record.path)==a_path) { update_mutex.lock(); add_path(a_path, *iter); @@ -383,7 +383,7 @@ void Directories::select(const boost::filesystem::path &select_path) { }); } - tree_store->foreach_iter([this, &select_path](const Gtk::TreeModel::iterator& iter){ + tree_store->foreach_iter([this, &select_path](const Gtk::TreeModel::iterator &iter){ if(iter->get_value(column_record.path)==select_path) { auto tree_path=Gtk::TreePath(iter); expand_to_path(tree_path); @@ -396,7 +396,7 @@ void Directories::select(const boost::filesystem::path &select_path) { } bool Directories::on_button_press_event(GdkEventButton* event) { - if(event->type==GDK_BUTTON_PRESS && event->button==3) { + if(event->type==GDK_BUTTON_PRESS && event->button==GDK_BUTTON_SECONDARY) { Gtk::TreeModel::Path path; if(get_path_at_pos(static_cast(event->x), static_cast(event->y), path)) { menu_popup_row_path=get_model()->get_iter(path)->get_value(column_record.path); @@ -408,7 +408,7 @@ bool Directories::on_button_press_event(GdkEventButton* event) { return Gtk::TreeView::on_button_press_event(event); } -void Directories::add_path(const boost::filesystem::path& dir_path, const Gtk::TreeModel::Row &parent) { +void Directories::add_path(const boost::filesystem::path &dir_path, const Gtk::TreeModel::Row &parent) { boost::system::error_code ec; auto last_write_time=boost::filesystem::last_write_time(dir_path, ec); if(ec) diff --git a/src/directories.h b/src/directories.h index dc4d947..fda3a9f 100644 --- a/src/directories.h +++ b/src/directories.h @@ -17,7 +17,7 @@ public: protected: TreeStore() {} - bool row_drop_possible_vfunc(const Gtk::TreeModel::Path& path, const Gtk::SelectionData& selection_data) const override; + bool row_drop_possible_vfunc(const Gtk::TreeModel::Path &path, const Gtk::SelectionData &selection_data) const override; bool drag_data_received_vfunc(const TreeModel::Path &path, const Gtk::SelectionData &selection_data) override; bool drag_data_delete_vfunc (const Gtk::TreeModel::Path &path) override; @@ -47,7 +47,7 @@ public: return singleton; } ~Directories(); - void open(const boost::filesystem::path& dir_path=""); + void open(const boost::filesystem::path &dir_path=""); void update(); void select(const boost::filesystem::path &path); @@ -55,10 +55,10 @@ public: boost::filesystem::path path; protected: - bool on_button_press_event(GdkEventButton* event) override; + bool on_button_press_event(GdkEventButton *event) override; private: - void add_path(const boost::filesystem::path& dir_path, const Gtk::TreeModel::Row &row); + void add_path(const boost::filesystem::path &dir_path, const Gtk::TreeModel::Row &row); Glib::RefPtr tree_store; TreeStore::ColumnRecord column_record;