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

Proposed by Adam Bieńkowski on 2016-05-29
Status: Merged
Approved by: Cody Garver on 2016-06-20
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 2016-05-29 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 on 2016-05-31

Add support for searching keywords

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 2015-11-25 05:52:20 +0000
3+++ CMakeLists.txt 2016-05-31 12:33:20 +0000
4@@ -84,7 +84,7 @@
5
6 find_package (Vala REQUIRED)
7 include (ValaVersion)
8-ensure_vala_version ("0.26.2" MINIMUM)
9+ensure_vala_version ("0.32.1" MINIMUM)
10
11 # Include vala precompile
12 include (ValaPrecompile)
13
14=== modified file 'lib/synapse-plugins/desktop-file-plugin.vala'
15--- lib/synapse-plugins/desktop-file-plugin.vala 2015-12-23 15:10:29 +0000
16+++ lib/synapse-plugins/desktop-file-plugin.vala 2016-05-31 12:33:20 +0000
17@@ -275,6 +275,29 @@
18 }
19 }
20
21+ foreach (unowned string keyword in desktop_app_info.get_keywords ()) {
22+ string _keyword = keyword.down ();
23+ foreach (var matcher in matchers)
24+ {
25+ MatchInfo action_info;
26+ if (matcher.key.match (_keyword, 0, out action_info)
27+ || _keyword.contains (q.query_string_folded)
28+ || _keyword.has_prefix (q.query_string))
29+ {
30+ results.add (dfm, compute_relevancy (dfm, Match.Score.INCREMENT_SMALL));
31+ matched = true;
32+ break;
33+ }
34+
35+ else if (action_info.is_partial_match ())
36+ {
37+ results.add (dfm, compute_relevancy (dfm, Match.Score.INCREMENT_SMALL));
38+ matched = true;
39+ break;
40+ }
41+ }
42+ }
43+
44 if (!matched && (comment.down ().contains (q.query_string_folded)
45 || generic_name.down ().contains (q.query_string_folded)))
46 {

Subscribers

People subscribed via source and target branches