Merge lp:~stolowski/unity-scope-scopes/api-0.4.0 into lp:unity-scope-scopes
- api-0.4.0
- Merge into trunk
Proposed by
Paweł Stołowski
Status: | Merged |
---|---|
Merged at revision: | 26 |
Proposed branch: | lp:~stolowski/unity-scope-scopes/api-0.4.0 |
Merge into: | lp:unity-scope-scopes |
Diff against target: |
341 lines (+55/-54) 7 files modified
CMakeLists.txt (+1/-1) debian/control (+1/-1) src/CMakeLists.txt (+2/-2) src/resultcollector.h (+2/-2) src/scopes-scope.cpp (+39/-39) src/scopes-scope.h (+9/-9) src/scopes.ini (+1/-0) |
To merge this branch: | bzr merge lp:~stolowski/unity-scope-scopes/api-0.4.0 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity Team | Pending | ||
Review via email: mp+209426@code.launchpad.net |
Commit message
Updated for unity-scopes-api 0.4.0.
Description of the change
Updated for unity-scopes-api 0.4.0.
To post a comment you must log in.
- 26. By Paweł Stołowski
-
Change install location.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2014-02-11 06:08:05 +0000 |
3 | +++ CMakeLists.txt 2014-03-06 13:09:30 +0000 |
4 | @@ -5,7 +5,7 @@ |
5 | find_package(Threads REQUIRED) |
6 | |
7 | pkg_check_modules(UNITY REQUIRED |
8 | - "libunity-scopes >= 0.3.1" |
9 | + "libunity-scopes >= 0.4.0" |
10 | ) |
11 | |
12 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wmissing-declarations -pedantic -std=c++11") |
13 | |
14 | === modified file 'debian/control' |
15 | --- debian/control 2014-02-13 16:32:07 +0000 |
16 | +++ debian/control 2014-03-06 13:09:30 +0000 |
17 | @@ -4,7 +4,7 @@ |
18 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
19 | Build-Depends: cmake (>= 2.8), |
20 | debhelper (>= 9), |
21 | - libunity-scopes-dev (>= 0.3.1), |
22 | + libunity-scopes-dev (>= 0.4.0), |
23 | pkg-config, |
24 | Standards-Version: 3.9.5 |
25 | Homepage: https://launchpad.net/unity-scope-scopes |
26 | |
27 | === modified file 'src/CMakeLists.txt' |
28 | --- src/CMakeLists.txt 2014-02-25 18:57:59 +0000 |
29 | +++ src/CMakeLists.txt 2014-03-06 13:09:30 +0000 |
30 | @@ -9,10 +9,10 @@ |
31 | |
32 | install( |
33 | TARGETS scopes |
34 | - LIBRARY DESTINATION "${CMAKE_INSTALL_DATADIR}/unity/scopes/scopes" |
35 | + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/unity-scopes/scopes" |
36 | ) |
37 | |
38 | install( |
39 | FILES scopes.ini |
40 | - DESTINATION "${CMAKE_INSTALL_DATADIR}/unity/scopes/scopes" |
41 | + DESTINATION "${CMAKE_INSTALL_LIBDIR}/unity-scopes/scopes" |
42 | ) |
43 | |
44 | === modified file 'src/resultcollector.h' |
45 | --- src/resultcollector.h 2014-02-25 18:57:59 +0000 |
46 | +++ src/resultcollector.h 2014-03-06 13:09:30 +0000 |
47 | @@ -20,7 +20,7 @@ |
48 | #ifndef RESULTCOLLECTOR_H_ |
49 | #define RESULTCOLLECTOR_H_ |
50 | |
51 | -#include <unity/scopes/SearchListener.h> |
52 | +#include <unity/scopes/SearchListenerBase.h> |
53 | #include <unity/scopes/ReplyProxyFwd.h> |
54 | #include <unity/scopes/ListenerBase.h> |
55 | #include <unity/scopes/CategorisedResult.h> |
56 | @@ -29,7 +29,7 @@ |
57 | #include <mutex> |
58 | #include <condition_variable> |
59 | |
60 | -class ResultCollector : public unity::scopes::SearchListener |
61 | +class ResultCollector : public unity::scopes::SearchListenerBase |
62 | { |
63 | public: |
64 | |
65 | |
66 | === modified file 'src/scopes-scope.cpp' |
67 | --- src/scopes-scope.cpp 2014-03-04 11:45:25 +0000 |
68 | +++ src/scopes-scope.cpp 2014-03-06 13:09:30 +0000 |
69 | @@ -69,29 +69,29 @@ |
70 | registry.reset(); |
71 | } |
72 | |
73 | -QueryBase::UPtr ScopesScope::create_query(Query const &q, |
74 | +SearchQueryBase::UPtr ScopesScope::search(CannedQuery const &q, |
75 | SearchMetadata const &hints) { |
76 | - QueryBase::UPtr query(new ScopesQuery(*this, q)); |
77 | + SearchQueryBase::UPtr query(new ScopesQuery(*this, q)); |
78 | return query; |
79 | } |
80 | |
81 | -QueryBase::UPtr ScopesScope::preview(Result const &result, |
82 | +PreviewQueryBase::UPtr ScopesScope::preview(Result const &result, |
83 | ActionMetadata const &hints) { |
84 | - QueryBase::UPtr previewer(new ScopesPreview(*this, result)); |
85 | + PreviewQueryBase::UPtr previewer(new ScopesPreview(*this, result)); |
86 | return previewer; |
87 | } |
88 | |
89 | -ActivationBase::UPtr ScopesScope::activate(Result const &result, ActionMetadata const& hints) { |
90 | - ActivationBase::UPtr activation(new ScopesActivation(result)); |
91 | - return activation; |
92 | -} |
93 | - |
94 | -ActivationBase::UPtr ScopesScope::perform_action(Result const &result, ActionMetadata const& hints, std::string const &widget_id, std::string const &action_id) { |
95 | - ActivationBase::UPtr activation(new ScopesActivation(result)); |
96 | - return activation; |
97 | -} |
98 | - |
99 | -ScopesQuery::ScopesQuery(ScopesScope &scope, Query const &query) |
100 | +ActivationQueryBase::UPtr ScopesScope::activate(Result const &result, ActionMetadata const& hints) { |
101 | + ActivationQueryBase::UPtr activation(new ScopesActivation(result)); |
102 | + return activation; |
103 | +} |
104 | + |
105 | +ActivationQueryBase::UPtr ScopesScope::perform_action(Result const &result, ActionMetadata const& hints, std::string const &widget_id, std::string const &action_id) { |
106 | + ActivationQueryBase::UPtr activation(new ScopesActivation(result)); |
107 | + return activation; |
108 | +} |
109 | + |
110 | +ScopesQuery::ScopesQuery(ScopesScope &scope, CannedQuery const &query) |
111 | : scope(scope), query(query) { |
112 | } |
113 | |
114 | @@ -132,12 +132,12 @@ |
115 | static bool compareMetadata(ScopeMetadata const &item1, ScopeMetadata const &item2) { |
116 | ScopeCategory cat1, cat2; |
117 | try { |
118 | - cat1 = category_mapping.at(item1.scope_name()); |
119 | + cat1 = category_mapping.at(item1.scope_id()); |
120 | } catch (std::out_of_range &e) { |
121 | cat1 = CAT_OTHER; |
122 | } |
123 | try { |
124 | - cat2 = category_mapping.at(item2.scope_name()); |
125 | + cat2 = category_mapping.at(item2.scope_id()); |
126 | } catch (std::out_of_range &e) { |
127 | cat2 = CAT_OTHER; |
128 | } |
129 | @@ -151,12 +151,12 @@ |
130 | try { |
131 | name1 = item1.display_name(); |
132 | } catch (NotFoundException &e) { |
133 | - name1 = item1.scope_name(); |
134 | + name1 = item1.scope_id(); |
135 | } |
136 | try { |
137 | name2 = item2.display_name(); |
138 | } catch (NotFoundException &e) { |
139 | - name2 = item2.scope_name(); |
140 | + name2 = item2.scope_id(); |
141 | } |
142 | |
143 | return name1 < name2; |
144 | @@ -180,7 +180,7 @@ |
145 | if (scope.online_scope && !query.query_string().empty()) { |
146 | online_query.reset(new ResultCollector); |
147 | try { |
148 | - create_subquery(scope.online_scope, query.query_string(), online_query); |
149 | + subsearch(scope.online_scope, query.query_string(), online_query); |
150 | // give the server a second before we display the results |
151 | bool finished = online_query->wait_until_finished(1000); |
152 | online_results = online_query->take_results(); |
153 | @@ -226,7 +226,7 @@ |
154 | } |
155 | if (display_name.find(term) != std::string::npos || |
156 | description.find(term) != std::string::npos || |
157 | - recommended_scopes.find(item.scope_name()) != recommended_scopes.end()) { |
158 | + recommended_scopes.find(item.scope_id()) != recommended_scopes.end()) { |
159 | scopes.push_back(item); |
160 | } |
161 | } |
162 | @@ -236,19 +236,19 @@ |
163 | |
164 | for (const auto &item : scopes) { |
165 | // don't display ourselves |
166 | - if (item.scope_name() == "scopes") continue; |
167 | + if (item.scope_id() == "scopes") continue; |
168 | |
169 | // TODO: categorisation of scopes should come from the |
170 | // metadata rather than being hard coded. |
171 | Category::SCPtr category; |
172 | try { |
173 | - ScopeCategory cat_id = category_mapping.at(item.scope_name()); |
174 | + ScopeCategory cat_id = category_mapping.at(item.scope_id()); |
175 | category = categories[cat_id]; |
176 | } catch (std::out_of_range &e) { |
177 | category = categories[CAT_OTHER]; |
178 | } |
179 | - auto it = recommended_scopes.find(item.scope_name()); |
180 | - pushed_scope_ids.insert(item.scope_name()); |
181 | + auto it = recommended_scopes.find(item.scope_id()); |
182 | + pushed_scope_ids.insert(item.scope_id()); |
183 | std::string search_string = it != recommended_scopes.end() ? it->second : ""; |
184 | push_scope_result(reply, item, category, search_string); |
185 | } |
186 | @@ -286,13 +286,13 @@ |
187 | // push more results |
188 | Category::SCPtr category; |
189 | try { |
190 | - ScopeCategory cat_id = category_mapping.at(item.scope_name()); |
191 | + ScopeCategory cat_id = category_mapping.at(item.scope_id()); |
192 | category = categories[cat_id]; |
193 | } catch (std::out_of_range &e) { |
194 | category = categories[CAT_OTHER]; |
195 | } |
196 | - auto it = recommended_scopes.find(item.scope_name()); |
197 | - pushed_scope_ids.insert(item.scope_name()); |
198 | + auto it = recommended_scopes.find(item.scope_id()); |
199 | + pushed_scope_ids.insert(item.scope_id()); |
200 | std::string search_string = it != recommended_scopes.end() ? it->second : ""; |
201 | push_scope_result(reply, item, category, search_string); |
202 | } |
203 | @@ -301,7 +301,7 @@ |
204 | |
205 | void ScopesQuery::push_scope_result(SearchReplyProxy const &reply, ScopeMetadata const& item, Category::SCPtr const& category, std::string const& search_string) |
206 | { |
207 | - std::string uri = "scope://" + item.scope_name(); |
208 | + std::string uri = "scope://" + item.scope_id(); |
209 | CategorisedResult result(category); |
210 | // Tell the shell to ask us to activate results. |
211 | result.set_intercept_activation(); |
212 | @@ -309,14 +309,14 @@ |
213 | try { |
214 | result.set_title(item.display_name()); |
215 | } catch (NotFoundException &e) { |
216 | - result.set_title(item.scope_name()); |
217 | + result.set_title(item.scope_id()); |
218 | } |
219 | try { |
220 | result.set_art(item.art()); |
221 | } catch (NotFoundException &e) { |
222 | } |
223 | result.set_dnd_uri(uri); |
224 | - result["scope_name"] = item.scope_name(); |
225 | + result["scope_name"] = item.scope_id(); |
226 | // FIXME: this should be provided by the scope metadata |
227 | result["author"] = "Canonical Ltd"; |
228 | result["description"] = item.description(); |
229 | @@ -332,7 +332,7 @@ |
230 | result["icon"] = icon; |
231 | } |
232 | try { |
233 | - result["background"] = background_mapping.at(item.scope_name()); |
234 | + result["background"] = background_mapping.at(item.scope_id()); |
235 | } catch (std::out_of_range &e) { |
236 | } |
237 | reply->push(result); |
238 | @@ -358,15 +358,15 @@ |
239 | reply->register_layout({layout1col, layout2col, layout3col}); |
240 | |
241 | PreviewWidget header("header", "header"); |
242 | - header.add_component("title", "title"); |
243 | - header.add_component("subtitle", "author"); |
244 | - header.add_component("mascot", "icon"); |
245 | + header.add_attribute_mapping("title", "title"); |
246 | + header.add_attribute_mapping("subtitle", "author"); |
247 | + header.add_attribute_mapping("mascot", "icon"); |
248 | |
249 | PreviewWidget art("art", "image"); |
250 | - art.add_component("source", "art"); |
251 | + art.add_attribute_mapping("source", "art"); |
252 | |
253 | PreviewWidget description("description", "text"); |
254 | - description.add_component("text", "description"); |
255 | + description.add_attribute_mapping("text", "description"); |
256 | |
257 | PreviewWidget actions("actions", "actions"); |
258 | { |
259 | @@ -375,7 +375,7 @@ |
260 | {"id", Variant("search")}, |
261 | {"label", Variant("Search")} |
262 | }); |
263 | - actions.add_attribute("actions", builder.end()); |
264 | + actions.add_attribute_value("actions", builder.end()); |
265 | } |
266 | |
267 | reply->push({art, header, actions, description}); |
268 | @@ -386,7 +386,7 @@ |
269 | } |
270 | |
271 | ActivationResponse ScopesActivation::activate() { |
272 | - Query query(result["scope_name"].get_string(), result["search_string"].get_string(), ""); |
273 | + CannedQuery query(result["scope_name"].get_string(), result["search_string"].get_string(), ""); |
274 | return ActivationResponse(query); |
275 | } |
276 | |
277 | |
278 | === modified file 'src/scopes-scope.h' |
279 | --- src/scopes-scope.h 2014-02-25 18:57:59 +0000 |
280 | +++ src/scopes-scope.h 2014-03-06 13:09:30 +0000 |
281 | @@ -31,11 +31,11 @@ |
282 | virtual int start(std::string const&, unity::scopes::RegistryProxy const&) override; |
283 | virtual void stop() override; |
284 | |
285 | - virtual unity::scopes::QueryBase::UPtr create_query(unity::scopes::Query const &q, unity::scopes::SearchMetadata const& hints) override; |
286 | - virtual unity::scopes::QueryBase::UPtr preview(unity::scopes::Result const& result, unity::scopes::ActionMetadata const& hints) override; |
287 | + virtual unity::scopes::SearchQueryBase::UPtr search(unity::scopes::CannedQuery const &q, unity::scopes::SearchMetadata const& hints) override; |
288 | + virtual unity::scopes::PreviewQueryBase::UPtr preview(unity::scopes::Result const& result, unity::scopes::ActionMetadata const& hints) override; |
289 | |
290 | - virtual unity::scopes::ActivationBase::UPtr activate(unity::scopes::Result const &result, unity::scopes::ActionMetadata const& hints) override; |
291 | - virtual unity::scopes::ActivationBase::UPtr perform_action(unity::scopes::Result const &result, unity::scopes::ActionMetadata const& hints, std::string const &widget_id, std::string const &action_id) override; |
292 | + virtual unity::scopes::ActivationQueryBase::UPtr activate(unity::scopes::Result const &result, unity::scopes::ActionMetadata const& hints) override; |
293 | + virtual unity::scopes::ActivationQueryBase::UPtr perform_action(unity::scopes::Result const &result, unity::scopes::ActionMetadata const& hints, std::string const &widget_id, std::string const &action_id) override; |
294 | |
295 | private: |
296 | unity::scopes::RegistryProxy registry; |
297 | @@ -43,10 +43,10 @@ |
298 | unity::scopes::ScopeProxy online_scope; |
299 | }; |
300 | |
301 | -class ScopesQuery : public unity::scopes::SearchQuery |
302 | +class ScopesQuery : public unity::scopes::SearchQueryBase |
303 | { |
304 | public: |
305 | - ScopesQuery(ScopesScope &scope, unity::scopes::Query const& query); |
306 | + ScopesQuery(ScopesScope &scope, unity::scopes::CannedQuery const& query); |
307 | virtual void cancelled() override; |
308 | virtual void run(unity::scopes::SearchReplyProxy const&reply) override; |
309 | |
310 | @@ -54,10 +54,10 @@ |
311 | void push_scope_result(unity::scopes::SearchReplyProxy const &reply, unity::scopes::ScopeMetadata const& item, unity::scopes::Category::SCPtr const& category, std::string const& search_string); |
312 | |
313 | const ScopesScope &scope; |
314 | - const unity::scopes::Query query; |
315 | + const unity::scopes::CannedQuery query; |
316 | }; |
317 | |
318 | -class ScopesPreview : public unity::scopes::PreviewQuery |
319 | +class ScopesPreview : public unity::scopes::PreviewQueryBase |
320 | { |
321 | public: |
322 | ScopesPreview(ScopesScope &scope, unity::scopes::Result const& result); |
323 | @@ -69,7 +69,7 @@ |
324 | const unity::scopes::Result result; |
325 | }; |
326 | |
327 | -class ScopesActivation : public unity::scopes::ActivationBase |
328 | +class ScopesActivation : public unity::scopes::ActivationQueryBase |
329 | { |
330 | public: |
331 | ScopesActivation(unity::scopes::Result const &result); |
332 | |
333 | === modified file 'src/scopes.ini' |
334 | --- src/scopes.ini 2014-03-04 11:45:17 +0000 |
335 | +++ src/scopes.ini 2014-03-06 13:09:30 +0000 |
336 | @@ -4,4 +4,5 @@ |
337 | Description = This is an Ubuntu search plugin that enables information from available search plugins to be searched and displayed in the Dash underneath the Dash plugins header. If you do not wish to search this content source, you can disable this search plugin. |
338 | SearchHint = Search for scopes |
339 | HotKey = |
340 | +Author = Canonical Ltd. |
341 | Invisible = true |