Merge lp:~mhr3/unity/fix-987781 into lp:unity

Proposed by Michal Hruby
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 2338
Proposed branch: lp:~mhr3/unity/fix-987781
Merge into: lp:unity
Diff against target: 111 lines (+12/-26)
3 files modified
plugins/unityshell/src/HudController.cpp (+5/-14)
plugins/unityshell/src/HudView.cpp (+6/-12)
plugins/unityshell/src/HudView.h (+1/-0)
To merge this branch: bzr merge lp:~mhr3/unity/fix-987781
Reviewer Review Type Date Requested Status
Gord Allott (community) Approve
Marco Trevisan (Treviño) Approve
Review via email: mp+103262@code.launchpad.net

Commit message

Make sure hud's spinner stops spinning after hud service returns reply

Description of the change

Hud's spinner keeps spinning even after the service returns reply.

Call SearchBar's SearchFinished() to signal it to stop spinning. Also get rid of some code from HudView that SearchBar handles internally. This makes it more consistent to the way it's used in DashView and therefore easier to maintain.

No new tests.

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

LGTM.

review: Approve
Revision history for this message
Gord Allott (gordallott) :
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/HudController.cpp'
2--- plugins/unityshell/src/HudController.cpp 2012-04-23 00:24:52 +0000
3+++ plugins/unityshell/src/HudController.cpp 2012-04-24 11:41:26 +0000
4@@ -467,22 +467,12 @@
5
6 void Controller::OnSearchChanged(std::string search_string)
7 {
8- //FIXME!! - when the service is smart enough to not fall over if you send many requests, this should be removed
9+ // we're using live_search_reached, so this is called 40ms after the text
10+ // is input in the search bar
11 LOG_DEBUG(logger) << "Search Changed";
12- auto on_search_changed_timeout_lambda = [] (gpointer data) -> gboolean {
13- Controller* self = static_cast<Controller*>(data);
14- self->hud_service_.RequestQuery(self->last_search_);
15- self->type_wait_handle_ = 0;
16- return FALSE;
17- };
18-
19+
20 last_search_ = search_string;
21-
22- if (type_wait_handle_)
23- {
24- g_source_remove(type_wait_handle_);
25- }
26- type_wait_handle_ = g_timeout_add(100, on_search_changed_timeout_lambda, this);
27+ hud_service_.RequestQuery(last_search_);
28 }
29
30 void Controller::OnSearchActivated(std::string search_string)
31@@ -520,6 +510,7 @@
32 }
33
34 SetIcon(icon_name);
35+ view_->SearchFinished();
36 }
37
38 // Introspectable
39
40=== modified file 'plugins/unityshell/src/HudView.cpp'
41--- plugins/unityshell/src/HudView.cpp 2012-04-23 02:03:25 +0000
42+++ plugins/unityshell/src/HudView.cpp 2012-04-24 11:41:26 +0000
43@@ -371,7 +371,7 @@
44 search_bar_->SetMinimumHeight(style.GetSearchBarHeight());
45 search_bar_->SetMaximumHeight(style.GetSearchBarHeight());
46 search_bar_->search_hint = _("Type your command");
47- search_bar_->search_changed.connect(sigc::mem_fun(this, &View::OnSearchChanged));
48+ search_bar_->live_search_reached.connect(sigc::mem_fun(this, &View::OnSearchChanged));
49 AddChild(search_bar_.GetPointer());
50 content_layout_->AddView(search_bar_.GetPointer(), 0, nux::MINOR_POSITION_LEFT);
51
52@@ -392,14 +392,6 @@
53 {
54 LOG_DEBUG(logger) << "got search change";
55 search_changed.emit(search_string);
56- if (search_string.empty())
57- {
58- search_bar_->search_hint = _("Type your command");
59- }
60- else
61- {
62- search_bar_->search_hint = "";
63- }
64
65 std::list<HudButton::Ptr>::iterator it;
66 for(it = buttons_.begin(); it != buttons_.end(); ++it)
67@@ -511,13 +503,17 @@
68 else
69 {
70 search_bar_->search_string = "";
71- search_bar_->search_hint = _("Type your command");
72 }
73 return true;
74 }
75 return false;
76 }
77
78+void View::SearchFinished()
79+{
80+ search_bar_->SearchFinished();
81+}
82+
83 void View::OnSearchbarActivated()
84 {
85 // The "Enter" key has been received and the text entry has the key focus.
86@@ -581,13 +577,11 @@
87
88 if (search_bar_->search_string == "")
89 {
90- search_bar_->search_hint = _("Type your command");
91 ubus.SendMessage(UBUS_HUD_CLOSE_REQUEST);
92 }
93 else
94 {
95 search_bar_->search_string = "";
96- search_bar_->search_hint = _("Type your command");
97 return search_bar_->text_entry();
98 }
99 return NULL;
100
101=== modified file 'plugins/unityshell/src/HudView.h'
102--- plugins/unityshell/src/HudView.h 2012-04-22 19:09:00 +0000
103+++ plugins/unityshell/src/HudView.h 2012-04-24 11:41:26 +0000
104@@ -55,6 +55,7 @@
105 void SetQueries(Hud::Queries queries);
106 void SetIcon(std::string icon_name, unsigned int tile_size, unsigned int size, unsigned int padding);
107 void ShowEmbeddedIcon(bool show);
108+ void SearchFinished();
109
110 void AboutToShow();
111 void AboutToHide();