Merge lp:~nick-dedekind/unity/duplicate.categories into lp:unity

Proposed by Nick Dedekind
Status: Merged
Approved by: Michal Hruby
Approved revision: no longer in the source branch.
Merged at revision: 3473
Proposed branch: lp:~nick-dedekind/unity/duplicate.categories
Merge into: lp:unity
Diff against target: 64 lines (+11/-19)
1 file modified
dash/ScopeView.cpp (+11/-19)
To merge this branch: bzr merge lp:~nick-dedekind/unity/duplicate.categories
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michal Hruby (community) Approve
Review via email: mp+180511@code.launchpad.net

Commit message

Fixed duplicate categories in scope caused by full resync on model change.

Description of the change

Fixed duplicate categories in scope caused by full resync on model change.
sigc::bind not working with sigc::hide

To post a comment you must log in.
Revision history for this message
Michal Hruby (mhr3) wrote :

Should fix the AP failures. +1

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/ScopeView.cpp'
2--- dash/ScopeView.cpp 2013-08-15 12:54:11 +0000
3+++ dash/ScopeView.cpp 2013-08-16 10:08:24 +0000
4@@ -293,18 +293,11 @@
5 conn = categories->category_removed.connect(sigc::mem_fun(this, &ScopeView::OnCategoryRemoved));
6 category_removed_connection_ = conn_manager_.Add(conn);
7
8- auto resync_categories = [this, categories] (bool add)
9- {
10- ClearCategories();
11- if (add)
12- {
13- for (unsigned int i = 0; i < categories->count(); ++i)
14- OnCategoryAdded(categories->RowAtIndex(i));
15- }
16- };
17+ categories->model.changed.connect(sigc::hide([this]() { ClearCategories(); }));
18
19- categories->model.changed.connect(sigc::bind(sigc::hide(resync_categories), false));
20- resync_categories(true);
21+ ClearCategories();
22+ for (unsigned int i = 0; i < categories->count(); ++i)
23+ OnCategoryAdded(categories->RowAtIndex(i));
24
25 scope_->category_order.changed.connect(sigc::mem_fun(this, &ScopeView::OnCategoryOrderChanged));
26 }
27@@ -393,23 +386,21 @@
28 conn = filters->filter_removed.connect(sigc::mem_fun(this, &ScopeView::OnFilterRemoved));
29 filter_removed_connection_ = conn_manager_.Add(conn);
30
31- auto resync_filters = [this, filters] (bool add)
32+ auto clear_filters = [this] ()
33 {
34 auto conn = conn_manager_.Get(filter_removed_connection_);
35 bool blocked = conn.block(true);
36
37 filter_bar_->ClearFilters();
38- if (add)
39- {
40- for (unsigned int i = 0; i < filters->count(); ++i)
41- OnFilterAdded(filters->FilterAtIndex(i));
42- }
43
44 conn.block(blocked);
45 };
46
47- filters->model.changed.connect(sigc::bind(sigc::hide(resync_filters), false));
48- resync_filters(true);
49+ filters->model.changed.connect(sigc::hide(clear_filters));
50+
51+ clear_filters();
52+ for (unsigned int i = 0; i < filters->count(); ++i)
53+ OnFilterAdded(filters->FilterAtIndex(i));
54 }
55
56 void ScopeView::OnCategoryAdded(Category const& category)
57@@ -425,6 +416,7 @@
58
59 LOG_DEBUG(logger) << "Category added '" << (scope_ ? scope_->name() : "unknown") << "': "
60 << name
61+ << "[" << category.id() << "] "
62 << "(" << icon_hint
63 << ", " << renderer_name
64 << ", " << index << ")";