diff options
| -rwxr-xr-x | dash/ScopeView.cpp | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/dash/ScopeView.cpp b/dash/ScopeView.cpp index ffce422ef..d087b1335 100755 --- a/dash/ScopeView.cpp +++ b/dash/ScopeView.cpp @@ -293,18 +293,11 @@ void ScopeView::SetupCategories(Categories::Ptr const& categories) conn = categories->category_removed.connect(sigc::mem_fun(this, &ScopeView::OnCategoryRemoved)); category_removed_connection_ = conn_manager_.Add(conn); - auto resync_categories = [this, categories] (bool add) - { - ClearCategories(); - if (add) - { - for (unsigned int i = 0; i < categories->count(); ++i) - OnCategoryAdded(categories->RowAtIndex(i)); - } - }; + categories->model.changed.connect(sigc::hide([this]() { ClearCategories(); })); - categories->model.changed.connect(sigc::bind(sigc::hide(resync_categories), false)); - resync_categories(true); + ClearCategories(); + for (unsigned int i = 0; i < categories->count(); ++i) + OnCategoryAdded(categories->RowAtIndex(i)); scope_->category_order.changed.connect(sigc::mem_fun(this, &ScopeView::OnCategoryOrderChanged)); } @@ -393,23 +386,21 @@ void ScopeView::SetupFilters(Filters::Ptr const& filters) conn = filters->filter_removed.connect(sigc::mem_fun(this, &ScopeView::OnFilterRemoved)); filter_removed_connection_ = conn_manager_.Add(conn); - auto resync_filters = [this, filters] (bool add) + auto clear_filters = [this] () { auto conn = conn_manager_.Get(filter_removed_connection_); bool blocked = conn.block(true); filter_bar_->ClearFilters(); - if (add) - { - for (unsigned int i = 0; i < filters->count(); ++i) - OnFilterAdded(filters->FilterAtIndex(i)); - } conn.block(blocked); }; - filters->model.changed.connect(sigc::bind(sigc::hide(resync_filters), false)); - resync_filters(true); + filters->model.changed.connect(sigc::hide(clear_filters)); + + clear_filters(); + for (unsigned int i = 0; i < filters->count(); ++i) + OnFilterAdded(filters->FilterAtIndex(i)); } void ScopeView::OnCategoryAdded(Category const& category) @@ -425,6 +416,7 @@ void ScopeView::OnCategoryAdded(Category const& category) LOG_DEBUG(logger) << "Category added '" << (scope_ ? scope_->name() : "unknown") << "': " << name + << "[" << category.id() << "] " << "(" << icon_hint << ", " << renderer_name << ", " << index << ")"; |
