Merge lp:~3v1n0/unity/result-view-grid-signals-disconnect into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Stephen M. Webb
Approved revision: no longer in the source branch.
Merged at revision: 3991
Proposed branch: lp:~3v1n0/unity/result-view-grid-signals-disconnect
Merge into: lp:unity
Diff against target: 69 lines (+15/-11)
3 files modified
dash/PlacesGroup.cpp (+8/-5)
dash/PlacesGroup.h (+1/-0)
dash/ResultViewGrid.cpp (+6/-6)
To merge this branch: bzr merge lp:~3v1n0/unity/result-view-grid-signals-disconnect
Reviewer Review Type Date Requested Status
Stephen M. Webb (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+263453@code.launchpad.net

Commit message

PlacesGroup: connect to view changes using a function instead of a lambda

This prevents crashes as there's automatic disconnection.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Stephen M. Webb (bregma) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/PlacesGroup.cpp'
2--- dash/PlacesGroup.cpp 2014-07-10 16:39:12 +0000
3+++ dash/PlacesGroup.cpp 2015-07-01 02:03:22 +0000
4@@ -343,15 +343,18 @@
5 UpdateResultViewPadding();
6 _group_layout->AddLayout(_child_layout, 1);
7
8- view->results_per_row.changed.connect([this] (int results_per_row)
9- {
10- _n_visible_items_in_unexpand_mode = results_per_row;
11- RefreshLabel();
12- });
13+ UpdateVisibleItems(view->results_per_row());
14+ view->results_per_row.changed.connect(sigc::mem_fun(this, &PlacesGroup::UpdateVisibleItems));
15
16 QueueDraw();
17 }
18
19+void PlacesGroup::UpdateVisibleItems(int visible_items)
20+{
21+ _n_visible_items_in_unexpand_mode = visible_items;
22+ RefreshLabel();
23+}
24+
25 dash::ResultView*
26 PlacesGroup::GetChildView()
27 {
28
29=== modified file 'dash/PlacesGroup.h'
30--- dash/PlacesGroup.h 2014-03-20 04:05:39 +0000
31+++ dash/PlacesGroup.h 2015-07-01 02:03:22 +0000
32@@ -127,6 +127,7 @@
33 void UpdatePlacesGroupSize();
34 void UpdateResultViewPadding();
35 void UpdateScale(double scale);
36+ void UpdateVisibleItems(int visible_items);
37
38 private:
39 std::string _category_id;
40
41=== modified file 'dash/ResultViewGrid.cpp'
42--- dash/ResultViewGrid.cpp 2015-05-22 13:20:52 +0000
43+++ dash/ResultViewGrid.cpp 2015-07-01 02:03:22 +0000
44@@ -85,11 +85,11 @@
45 EnableDoubleClick(true);
46 SetAcceptKeyNavFocusOnMouseDown(false);
47
48- auto needredraw_lambda = [this](int value) { NeedRedraw(); };
49- horizontal_spacing.changed.connect(needredraw_lambda);
50- vertical_spacing.changed.connect(needredraw_lambda);
51- padding.changed.connect(needredraw_lambda);
52- selected_index_.changed.connect(needredraw_lambda);
53+ auto queue_draw_cb = sigc::hide(sigc::mem_fun(this, &ResultViewGrid::QueueDraw));
54+ horizontal_spacing.changed.connect(queue_draw_cb);
55+ vertical_spacing.changed.connect(queue_draw_cb);
56+ padding.changed.connect(queue_draw_cb);
57+ selected_index_.changed.connect(queue_draw_cb);
58 expanded.changed.connect([this](bool value) { if (value) all_results_preloaded_ = false; });
59 results_per_row.changed.connect([this](int value) { if (value > 0) all_results_preloaded_ = false; });
60 scale.changed.connect(sigc::mem_fun(this, &ResultViewGrid::UpdateScale));
61@@ -119,7 +119,7 @@
62 NeedRedraw();
63 });
64
65- WindowManager::Default().average_color.changed.connect(sigc::hide(sigc::mem_fun(this, &View::QueueDraw)));
66+ WindowManager::Default().average_color.changed.connect(queue_draw_cb);
67
68 ubus_.RegisterInterest(UBUS_DASH_SIZE_CHANGED, [this] (GVariant* data) {
69 // on dash size changed, we update our stored values, this sucks