Merge lp:~mhr3/unity/unity-4.0.fix-856205 into lp:unity/4.0

Proposed by Michal Hruby
Status: Merged
Approved by: Mikkel Kamstrup Erlandsen
Approved revision: no longer in the source branch.
Merged at revision: 1720
Proposed branch: lp:~mhr3/unity/unity-4.0.fix-856205
Merge into: lp:unity/4.0
Diff against target: 105 lines (+44/-1)
2 files modified
plugins/unityshell/src/DashView.cpp (+39/-1)
plugins/unityshell/src/DashView.h (+5/-0)
To merge this branch: bzr merge lp:~mhr3/unity/unity-4.0.fix-856205
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Approve
Review via email: mp+84600@code.launchpad.net

Description of the change

Fixes bug #856205. Already approved (and merged) for trunk.

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Double checked the code again - still looking good :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/DashView.cpp'
2--- plugins/unityshell/src/DashView.cpp 2011-10-11 17:05:24 +0000
3+++ plugins/unityshell/src/DashView.cpp 2011-12-06 11:47:51 +0000
4@@ -48,6 +48,9 @@
5 : nux::View(NUX_TRACKER_LOCATION)
6 , active_lens_view_(0)
7 , last_activated_uri_("")
8+ , searching_timeout_id_(0)
9+ , search_in_progress_(false)
10+ , activate_on_finish_(false)
11 , visible_(false)
12
13 {
14@@ -68,6 +71,8 @@
15
16 DashView::~DashView()
17 {
18+ if (searching_timeout_id_)
19+ g_source_remove (searching_timeout_id_);
20 delete bg_layer_;
21 delete bg_darken_layer_;
22 }
23@@ -648,9 +653,32 @@
24 QueueDraw();
25 }
26
27+gboolean DashView::ResetSearchStateCb(gpointer data)
28+{
29+ DashView *self = static_cast<DashView*>(data);
30+
31+ self->search_in_progress_ = false;
32+ self->activate_on_finish_ = false;
33+ self->searching_timeout_id_ = 0;
34+
35+ return FALSE;
36+}
37+
38 void DashView::OnSearchChanged(std::string const& search_string)
39 {
40 LOG_DEBUG(logger) << "Search changed: " << search_string;
41+ if (active_lens_view_)
42+ {
43+ search_in_progress_ = true;
44+ // it isn't guaranteed that we get a SearchFinished signal, so we need
45+ // to make sure this isn't set even though we aren't doing any search
46+ if (searching_timeout_id_)
47+ {
48+ g_source_remove (searching_timeout_id_);
49+ }
50+ // 250ms for the Search method call, rest for the actual search
51+ searching_timeout_id_ = g_timeout_add (500, &DashView::ResetSearchStateCb, this);
52+ }
53 }
54
55 void DashView::OnLiveSearchReached(std::string const& search_string)
56@@ -715,7 +743,12 @@
57 void DashView::OnSearchFinished(std::string const& search_string)
58 {
59 if (search_bar_->search_string == search_string)
60+ {
61 search_bar_->SearchFinished();
62+ search_in_progress_ = false;
63+ if (activate_on_finish_)
64+ this->OnEntryActivated();
65+ }
66 }
67
68 void DashView::OnGlobalSearchFinished(std::string const& search_string)
69@@ -824,7 +857,12 @@
70 }
71 void DashView::OnEntryActivated()
72 {
73- active_lens_view_->ActivateFirst();
74+ if (!search_in_progress_)
75+ {
76+ active_lens_view_->ActivateFirst();
77+ }
78+ // delay the activation until we get the SearchFinished signal
79+ activate_on_finish_ = search_in_progress_;
80 }
81
82 // Keyboard navigation
83
84=== modified file 'plugins/unityshell/src/DashView.h'
85--- plugins/unityshell/src/DashView.h 2011-09-29 11:41:09 +0000
86+++ plugins/unityshell/src/DashView.h 2011-12-06 11:47:51 +0000
87@@ -104,6 +104,8 @@
88
89 nux::Area* KeyNavIteration(nux::KeyNavDirection direction);
90
91+ static gboolean ResetSearchStateCb(gpointer data);
92+
93 private:
94 UBusManager ubus_manager_;
95 FilesystemLenses lenses_;
96@@ -131,6 +133,9 @@
97 nux::ObjectPtr <nux::IOpenGLBaseTexture> bg_shine_texture_;
98
99 std::string last_activated_uri_;
100+ guint searching_timeout_id_;
101+ bool search_in_progress_;
102+ bool activate_on_finish_;
103
104 bool visible_;
105 };

Subscribers

People subscribed via source and target branches

to all changes: