Merge lp:~donadigo/slingshot/search-keywords into lp:~elementary-pantheon/slingshot/trunk

Proposed by Adam Bieńkowski
Status: Merged
Approved by: Cody Garver
Approved revision: 658
Merged at revision: 661
Proposed branch: lp:~donadigo/slingshot/search-keywords
Merge into: lp:~elementary-pantheon/slingshot/trunk
Diff against target: 46 lines (+24/-1)
2 files modified
CMakeLists.txt (+1/-1)
lib/synapse-plugins/desktop-file-plugin.vala (+23/-0)
To merge this branch: bzr merge lp:~donadigo/slingshot/search-keywords
Reviewer Review Type Date Requested Status
elementary Pantheon team Pending
Review via email: mp+296001@code.launchpad.net

Commit message

Search .desktop keywords (lp:1581145)

Description of the change

Fixes bug #1581145: "Search doesn't use keywords".

This branch adds support for searching in the keywords. The keywords returned by desktop app info will be always localized.

* Note: you must have Vala version 0.32.1 in order to compile the branch, since there was an binding issue within the GIO vapi, that's now fixed upstream.

To post a comment you must log in.
658. By Adam Bieńkowski

Add support for searching keywords

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2015-11-25 05:52:20 +0000
+++ CMakeLists.txt 2016-05-31 12:33:20 +0000
@@ -84,7 +84,7 @@
8484
85find_package (Vala REQUIRED)85find_package (Vala REQUIRED)
86include (ValaVersion)86include (ValaVersion)
87ensure_vala_version ("0.26.2" MINIMUM)87ensure_vala_version ("0.32.1" MINIMUM)
8888
89# Include vala precompile89# Include vala precompile
90include (ValaPrecompile)90include (ValaPrecompile)
9191
=== modified file 'lib/synapse-plugins/desktop-file-plugin.vala'
--- lib/synapse-plugins/desktop-file-plugin.vala 2015-12-23 15:10:29 +0000
+++ lib/synapse-plugins/desktop-file-plugin.vala 2016-05-31 12:33:20 +0000
@@ -275,6 +275,29 @@
275 }275 }
276 }276 }
277277
278 foreach (unowned string keyword in desktop_app_info.get_keywords ()) {
279 string _keyword = keyword.down ();
280 foreach (var matcher in matchers)
281 {
282 MatchInfo action_info;
283 if (matcher.key.match (_keyword, 0, out action_info)
284 || _keyword.contains (q.query_string_folded)
285 || _keyword.has_prefix (q.query_string))
286 {
287 results.add (dfm, compute_relevancy (dfm, Match.Score.INCREMENT_SMALL));
288 matched = true;
289 break;
290 }
291
292 else if (action_info.is_partial_match ())
293 {
294 results.add (dfm, compute_relevancy (dfm, Match.Score.INCREMENT_SMALL));
295 matched = true;
296 break;
297 }
298 }
299 }
300
278 if (!matched && (comment.down ().contains (q.query_string_folded) 301 if (!matched && (comment.down ().contains (q.query_string_folded)
279 || generic_name.down ().contains (q.query_string_folded)))302 || generic_name.down ().contains (q.query_string_folded)))
280 {303 {

Subscribers

People subscribed via source and target branches